@hatiolab/things-scene 10.0.0-beta.41 → 10.0.0-beta.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/things-scene.mjs CHANGED
@@ -47,5 +47,5 @@ import t from"dompurify";import*as e from"three";import{Scene as n,BoxGeometry a
47
47
  </button>`:T}
48
48
  ${n?P`<button class="closable" @click=${this.closeContainer}>close</button>`:T}
49
49
  </div>
50
- `,this.element)}catch(t){}}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}Np=new WeakMap,oc.memoize(Gp.prototype,"bounds",!0),oc.register("container",Gp);const Up=Math.sqrt(3),Wp=2;function Xp(t,e,n,r,i){const s=5+i,o=n.x,a=n.y,c=r.x,l=r.y;if(Math.abs(o-c)>s&&Math.abs(a-l)>s){const n=(l-a)/(c-o),r=a-n*o;if(Math.abs(e-(n*t+r))>s)return!1}let h,d,u,p;return o>c?(d=o,h=c):(d=c,h=o),a>l?(p=a,u=l):(p=l,u=a),!(d+5<t)&&(!(h-5>t)&&(!(p+5<e)&&!(u-5>e)))}function qp(t,e,n,r=2){for(let i=0;i<n.length-1;i++)if(Xp(t,e,n[i],n[i+1],r))return!0;return!1}function Kp(t,e,n,r){if("arrow"!=t.slice(-5))return n;const i=Math.atan2(r.y-n.y,r.x-n.x),s=1.5*e;return{x:n.x+Math.cos(i)*s,y:n.y+Math.sin(i)*s}}function $p(t,e,n){let{lineWidth:r=Wp,strokeStyle:i="#000000",lineCap:s=!1,alpha:o=1,begin:a="none",end:c="none",beginSize:l="size5",endSize:h="size5"}=n;if(("none"!=a||"none"!=c)&&(r=Number(r)||Wp,t.lineCap=s,t.lineWidth=r,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=o,"none"!=a&&Qp(t,e[0],e[1],r,a,Zp(l,r)),"none"!=c)){const n=e.length;Qp(t,e[n-1],e[n-2],r,c,Zp(h,r))}}function Qp(t,e,n,r,i,s){const{x:o,y:a}=e,c=Math.atan2(n.y-a,n.x-o);switch(t.beginPath(),t.translate(o,a),t.rotate(c),i){case"oval":t.ellipse(0,0,s.X,s.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-s.X,0),t.lineTo(0,-s.Y),t.lineTo(s.X,0),t.lineTo(0,s.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(Up*s.X,-s.Y),t.lineTo(Up*s.X,s.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Up*s.X,-s.Y),t.lineTo(-s.X/1.5+Up*s.X,0),t.lineTo(Up*s.X,s.Y),t.fill();break;case"open-arrow":t.moveTo(Up*s.X+r,-s.Y),t.lineTo(r,0),t.lineTo(Up*s.X+r,s.Y),t.stroke();break;case"cross":t.moveTo(-s.X,-s.Y),t.lineTo(s.X,s.Y),t.moveTo(s.X,-s.Y),t.lineTo(-s.X,s.Y),t.stroke()}t.rotate(-c),t.translate(-o,-a),t.closePath()}function Zp(t,e){const n={X:0,Y:0};switch(e*=1.2,t){case"size1":n.X=e,n.Y=e;break;case"size2":n.X=1.5*e,n.Y=e;break;case"size3":n.X=2*e,n.Y=e;break;case"size4":n.X=e,n.Y=1.5*e;break;case"size5":default:n.X=1.5*e,n.Y=1.5*e;break;case"size6":n.X=2*e,n.Y=1.5*e;break;case"size7":n.X=e,n.Y=2*e;break;case"size8":n.X=1.5*e,n.Y=2*e;break;case"size9":n.X=2*e,n.Y=2*e}return n}const Jp="N",tf="S",ef="E",nf="W";class rf{constructor({component:t,anchor:e,position:n,self:r}){this.component=t,this._anchorName=e,this._position=n,this.self=r}get position(){const t=this.anchor;if(t){const{position:e}=t,n=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(n.x,n.y)}return this._position}set position({x:t,y:e}){this._position={x:t,y:e}}get anchor(){return this.component?.findAnchor(this._anchorName)}get direction(){const t=this.component.bounds,e=this.anchor;if(!e)return ef;const n=e.position;return n.y<=t.top?Jp:n.y>=t.top+t.height?tf:n.x<=t.left?nf:ef}get boundaryPosition(){const t=this.anchor;if(t){let{position:e}=t,n=0,r=0;switch(this.direction){case tf:r=20;break;case Jp:r=-20;break;case nf:n=-20;break;default:n=20}e={x:e.x+n,y:e.y+r};const i=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(i.x,i.y)}}}class sf extends oc{isLine(){return!0}replaceRefids(t){["from","to"].forEach(e=>{const n=this.get(e);if(n?.component){const r=t.get(n.component)||n.component;this.set(e,{...n,component:r})}})}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:n}=this.getState("from")||{};if(!t)return;const r=this.root?.findByRefid?.(t);if(!r)return;this._fromEnd=new rf({component:r,fromto:"from",anchor:e,position:n,self:this})}return this._fromEnd}get from(){return this.getState("from")}set from(t){delete this._fromEnd,this.set("from",t)}get toEnd(){if(this.parent&&!this._toEnd){const{component:t,anchor:e,position:n}=this.getState("to")||{};if(!t)return;const r=this.root?.findByRefid?.(t);if(!r)return;this._toEnd=new rf({component:r,fromto:"to",anchor:e,position:n,self:this})}return this._toEnd}get to(){return this.getState("to")}set to(t){delete this._toEnd,this.set("to",t)}move({x:t,y:e},n){n&&(this.from={position:this._fromEnd?.position||this.getState("from")?.position||{x:0,y:0}},this.to={position:this._toEnd?.position||this.getState("to")?.position||{x:0,y:0}}),super.move({x:t,y:e})}render(t){const{begin:e="none",end:n="none",lineWidth:r,round:i=0}=this.state;let s=this.drawPath;$p(t,s,this.state),t.beginPath();const o=Kp(e,r,s[0],s[1]),a=Kp(n,r,s[s.length-1],s[s.length-2]);s=[o,...s.slice(1,-1),a];let c={x:o.x,y:o.y};t.moveTo(o.x,o.y);for(let e=1;e<s.length;e++){const n=c;c=s[e];const r=s[e+1];if(n.x===c.x&&n.y===c.y)continue;if(!r){t.lineTo(c.x,c.y);break}let o=Math.sqrt((n.x-c.x)*(n.x-c.x)+(n.y-c.y)*(n.y-c.y)),a=0!==o?Math.atan2(n.x-c.x,n.y-c.y):0,l=Math.sin(a)*Math.min(i,o/2)+c.x,h=Math.cos(a)*Math.min(i,o/2)+c.y;const d=i>0||0!==o?{x:l,y:h}:c;o=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y)),a=0!==o?Math.atan2(r.x-c.x,r.y-c.y):0,l=Math.sin(a)*Math.min(i,o/2)+c.x,h=Math.cos(a)*Math.min(i,o/2)+c.y;const u=i>0||0!==o?{x:l,y:h}:c;t.lineTo(d.x,d.y),i>0&&t.quadraticCurveTo(c.x,c.y,u.x,u.y)}this.drawStroke(t,void 0)}contains(t,e){const{lineWidth:n}=this.state;return qp(t,e,this.drawPath,n)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state,{x1:n,y1:r,x2:i,y2:s}=this.state;return[this.fromEnd?.position||t?.position||{x:n,y:r},this.toEnd?.position||e?.position||{x:i,y:s}]}set path(t){const[e,n]=t,{from:r,to:i}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...r,position:e},to:{...i,position:n}})}get textBounds(){const t=this.drawPath;let e,n,r=0;for(let i=1;i<t.length;i++){const s=t[i-1],o=t[i],a=(s.x-o.x)*(s.x-o.x)+(s.y-o.y)*(s.y-o.y);a>r&&(r=Math.ceil(a),e=s,n=o)}let{paddingTop:i,paddingLeft:s,paddingRight:o,paddingBottom:a}=this.state;return a||=0,i||=0,s||=0,o||=0,{left:Math.min(e.x,n.x)+s,top:Math.min(e.y,n.y)+i,width:Math.max(Math.abs(e.x-n.x)-s-o,0),height:Math.max(Math.abs(e.y-n.y)-i-a,0)}}get decorators(){return this.app.isEditMode?["decotag"]:[]}}sf.getTipNeckPos=Kp,sf.containedInPath=qp,sf.drawEndTips=$p,oc.register("line",sf);const of={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"angle",label:"start-angle",name:"startAngle",property:"startAngle"},{type:"angle",label:"end-angle",name:"endAngle",property:"endAngle"}],"value-property":"text"};class af extends(Id(ac)){is3dish(){return!0}render(t){const{cx:e,cy:n,rx:r,ry:i,startAngle:s,endAngle:o,anticlockwise:a}=this.state;t.beginPath(),t.ellipse(e,n,Math.abs(r),Math.abs(i),0,s||0,o||2*Math.PI,a),void 0!==s&&void 0!==o&&(t.lineTo(e,n),t.closePath())}get path(){const{cx:t,cy:e,rx:n,ry:r}=this.state;return[{x:t-n,y:e-r},{x:t+n,y:e-r},{x:t+n,y:e+r},{x:t-n,y:e+r}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2,rx:(n.x-e.x)/2,ry:(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:r,rx:i,ry:s}=this.state,o=(t-n)/(2*i-.5),a=(e-r)/(2*s-.5);return o*o+a*a<.25}outline(t){return function(t,e){const{cx:n,cy:r,rx:i,ry:s}=t.model,o=2*Math.PI*e,a=n+i*Math.cos(o),c=r+s*Math.sin(o);return t.toScene(a,c)}(this,t)}get anchors(){return function(t){const{left:e,top:n,width:r,height:i}=t.bounds,s=e+r/2,o=n+i/2;return[{name:"TOP",position:{x:s,y:n}},{name:"RIGHT",position:{x:e+r,y:o}},{name:"BOTTOM",position:{x:s,y:n+i}},{name:"LEFT",position:{x:e,y:o}}]}(this)}get nature(){return of}}oc.memoize(af.prototype,"path",!1),oc.register("ellipse",af);const cf={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e+1,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){n[e+1]=t})},ondragend:function(t,e,n){}},lf={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polygon"};class hf extends ac{is3dish(){return!0}get mutable(){return!0}get pathExtendable(){return!0}get path(){return this.state.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let r=!1;return n.forEach((i,s)=>{const o=(s+n.length+1)%n.length,a=i.x,c=i.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(r=!r)}),r}get controls(){const t=this.path;return t.map((e,n)=>{const r=t[n+1>=t.length?0:n+1];return{x:(e.x+r.x)/2,y:(e.y+r.y)/2,handler:cf}})}get nature(){return lf}}oc.memoize(hf.prototype,"controls",!1),oc.register("polygon",hf);const df={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){n[e]=t})},ondragend:function(t,e,n){}},uf={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polyline"};class pf extends sf{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:n}=this.state;return[this.fromEnd?.position||t?.position||n[0],...n.slice(1,-1),this.toEnd?.position||e?.position||n[n.length-1]]}set path(t){const{from:e,to:n}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...n,position:t[t.length-1]},path:t})}get controls(){const t=this.path,e=[];for(let n=0;n<t.length-1;n++){const r=t[n],i=t[n+1];0==n&&e.push({x:r.x,y:r.y,handler:df}),e.push({x:(r.x+i.x)/2,y:(r.y+i.y)/2,handler:df}),n==t.length-2&&e.push({x:i.x,y:i.y,handler:df})}return e}get nature(){return uf}}oc.register("polyline",pf);const ff={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/ortholine"};class gf extends sf{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:n,direction:r,boundaryPosition:i=t}=this.fromEnd||{},{component:s,direction:o,boundaryPosition:a=e}=this.toEnd||{},c=[i,a],l=[];i&&l.push(i);let h,d=n?.bounds;d&&(h=n.toScene(d.left,d.top),h=this.transcoordT2P(h.x,h.y),d={...d,left:h.x,top:h.y});const u=d?{left:d.left-20,top:d.top-20,width:d.width+40,height:d.height+40}:{left:i.x,top:i.y,width:0,height:0};d=d||u;let p=s?.bounds;p&&(h=s.toScene(p.left,p.top),h=this.transcoordT2P(h.x,h.y),p={...p,left:h.x,top:h.y});const f=p?{left:p.left-20,top:p.top-20,width:p.width+40,height:p.height+40}:{left:a.x,top:a.y,width:0,height:0};p=p||f;const g=[u,f],m=u.left>f.left?f.left:u.left,y=u.top>f.top?f.top:u.top,b={left:m,top:y,width:u.left+u.width>f.left+f.width?u.left+u.width-m:f.left+f.width-m,height:u.top+u.height>f.top+f.height?u.top+u.height-y:f.top+f.height-y};let v,_,x,w,M,S,k,A,E,C,T=0,P=0;d.left+d.width<p.left?(w=0,M=1,E=r,C=o,v=(d.left+d.width+p.left)/2,T=p.left-v):p.left+p.width<d.left&&(w=1,M=0,E=o,C=r,v=(d.left+p.width+p.left)/2,T=d.left-v),d.top+d.height<p.top?(x=0,S=1,k=r,A=o,_=(d.top+d.height+p.top)/2,P=p.top-_):p.top+p.height<d.top&&(x=1,S=0,k=o,A=r,_=(d.top+p.height+p.top)/2,P=d.top-_);const D=[];if(v&&T>P){let t,e,n;switch(C){case nf:switch(E){case ef:D.push({x:v,y:c[w].y}),D.push({x:v,y:c[M].y});break;case nf:t=g[w].top+g[w].height/2,e=t>c[M].y?Math.min(g[w].top,c[M].y):Math.max(g[w].top+g[w].height,c[M].y),D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:c[M].y});break;case Jp:case tf:e=E===tf?Math.max(c[w].y,c[M].y):Math.min(c[w].y,c[M].y),D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:c[M].y});break;default:return this.path}break;case ef:switch(E){case ef:e=c[w].y<c[M].y?Math.min(g[M].top,c[w].y):Math.max(g[M].top+g[M].height,c[w].y),n=e;break;case nf:e=void 0!==_?_:c[w].y<c[M].y?b.top-.5*T:b.top+b.height+.5*T,n=e;break;case tf:e=void 0!==_?Math.max(_,c[w].y):b.top+b.height,n=e;break;case Jp:e=_?Math.min(_,g[w].top):b.top,n=e;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:n}),D.push({x:c[M].x,y:n});break;case tf:switch(E){case ef:e=c[w].y,n=c[w].y>c[M].y?c[w].y:g[M].top+g[M].height;break;case nf:e=_?Math.max(_,g[M].top+g[M].height):b.top+b.height,n=e;break;case tf:e=b.top+b.height,n=e;break;case Jp:e=_?Math.min(_,g[w].top):g[w].top,n=_?Math.max(_,g[M].top+g[M].height):g[M].top+g[M].height;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:n}),D.push({x:c[M].x,y:n});break;case Jp:switch(E){case ef:e=c[w].y,n=c[w].y<c[M].y?c[w].y:g[M].top;break;case nf:e=_?Math.min(_,g[M].top):b.top,n=e;break;case tf:e=void 0!==_?Math.max(_,c[w].y):c[w].y,n=void 0!==_?Math.min(_,c[M].y):c[M].y;break;case Jp:e=b.top,n=e;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:n}),D.push({x:c[M].x,y:n});break;default:return this.path}l.push(...0===w?D:D.reverse())}else if(_){let t,e,n;switch(A){case Jp:switch(k){case tf:D.push({x:c[x].x,y:_}),D.push({x:c[S].x,y:_});break;case Jp:t=g[x].left+g[x].width/2,e=t>c[S].x?Math.min(g[x].left,c[S].x):Math.max(g[x].left+g[x].width,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:c[S].x,y:_});break;case nf:e=Math.min(c[x].x,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:c[S].x,y:_});break;case ef:e=Math.max(c[x].x,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:c[S].x,y:_});break;default:return this.path}break;case tf:switch(k){case nf:e=b.left,n=e;break;case ef:e=void 0!==v?Math.max(v,c[x].x):b.left+b.width,n=e;break;case Jp:e=void 0!==v?v:c[x].x<c[S].x?b.left-.5*P:b.left+b.width+.5*P,n=e;break;case tf:e=c[x].x,n=c[x].x<c[S].x?Math.min(g[S].left,c[x].x):Math.max(g[S].left+g[S].width,c[x].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:n,y:_}),D.push({x:n,y:c[S].y});break;case ef:switch(k){case nf:e=void 0!==v?Math.min(v,c[x].x):c[x].x,n=void 0!==v?Math.max(v,c[S].x):c[S].x;break;case ef:e=b.left+b.width,n=e;break;case Jp:e=void 0!==v?Math.max(v,c[S].x):b.left+b.width,n=e;break;case tf:e=c[x].x,n=Math.max(g[S].left+g[S].width,c[x].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:n,y:_}),D.push({x:n,y:c[S].y});break;case nf:switch(k){case nf:e=b.left,n=e;break;case ef:e=void 0!==v?Math.max(v,c[x].x):c[x].x,n=void 0!==v?Math.min(v,c[S].x):c[S].x;break;case Jp:e=b.left,n=e;break;case tf:e=c[x].x<c[S].x?Math.min(g[S].left,c[x].x):c[x].x,n=Math.min(e,c[S].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:n,y:_}),D.push({x:n,y:c[S].y});break;default:return this.path}l.push(...0===x?D:D.reverse())}else{let t,e;switch(r){case Jp:switch(o){case Jp:e=b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case tf:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top+b.height}),l.push({x:c[1].x,y:b.top+b.height});break;case ef:t=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;case nf:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case tf:switch(o){case Jp:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top}),l.push({x:c[1].x,y:b.top});break;case tf:case ef:case nf:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;case nf:switch(o){case Jp:t=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:b.left,e=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(b.top,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case tf:t=b.left,e=Math.max(b.top+b.height,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case ef:t=b.left+b.width,l.push({x:c[0].x,y:b.top}),l.push({x:t,y:b.top}),l.push({x:t,y:c[1].y});break;case nf:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case ef:switch(o){case Jp:e=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case tf:e=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case ef:case nf:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;default:return this.path}}return a&&l.push(a),[t,...l,e].filter((t,e,n)=>{if(0===e)return!0;const r=n[e-1];return t.x!==r.x||t.y!==r.y}).filter((t,e,n)=>{if(0===e||e>=n.length-1)return!0;const r=n[e-1],i=n[e+1];return!(t.x===r.x&&t.x===i.x||t.y===r.y&&t.y===i.y)})}get nature(){return ff}}oc.register("ortholine",gf);const mf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"image-src",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"scene-image",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0}},{type:"select",label:"cross-origin",name:"crossOrigin",property:{options:["","anonymous","use-credentials"]}}],"value-property":"src",help:"scene/component/image-view"};class yf extends(lc(ac)){static get noimage(){return yf.NOIMAGE||(yf.NOIMAGE=new Image,yf.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),yf.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){const{left:e,top:n,width:r,height:i,isGray:s=!1,alpha:o=1,src:a}=this.state;if(this.prepareIf(!this._image&&a),t.beginPath(),t.globalAlpha*=o,this._image&&this._image.complete)if(s&&this._offcanvas)t.drawImage(this._offcanvas,e,n,r,i);else try{t.drawImage(this._image,e,n,r,i)}catch(s){t.drawImage(yf.noimage,e,n,r,i)}else!this.app.isViewMode&&t.drawImage(yf.noimage,e,n,r,i)}get nature(){return mf}get hasTextProperty(){return!1}async ready(){await super.ready();const{src:t}=this.state;if(!this._image&&t){const e=this.root?.app?.loadTracker;if(e){const n=new Promise((t,e)=>{this.prepare(()=>t(),t=>e(t))});e.track(`image:${t}`,"image",t,n)}else this.prepareIf(!0)}}prepare(t,e){const{src:n,crossOrigin:r}=this.state;if(n){this._image=new Image;try{r&&(this._image.crossOrigin=r),this._image.src=this.app.url(n)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){const t=this._image.width,e=this._image.height;this._offcanvas=oc.createCanvas(t,e);const n=this._offcanvas.getContext("2d");n.drawImage(this._image,0,0);const r=function(t,e,n){let r;try{r=t.getImageData(0,0,e,n)}catch(t){return Xr("Get Image Data Error: "+(t instanceof Error?t.message:String(t))),null}const i=r.data;for(let t=0;t<e*n*4;t+=4){const e=i[t],n=i[t+1],s=i[t+2],o=Math.floor((e+n+s)/3);r.data[t]=o,r.data[t+1]=o,r.data[t+2]=o}return r}(n,t,e);n.putImageData(r,0,0)}t(this)},this._image.onerror=t=>{this._image&&!this._image.currentSrc&&(this._image=null),e(t)}}else t(this)}get src(){return this.get("src")}set src(t){this.set("src",t)}onchange(t,e){(t.hasOwnProperty("src")||t.hasOwnProperty("isGray"))&&(this._offcanvas=null,this._image=null,this.prepareIf(t.src))}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("image/"))return void(this.src=e[n])}}oc.register("image-view",yf);class bf extends(Bp(lc(oc))){is3dish(){return!0}prerender(){}}var vf,_f,xf={},wf={},Mf={};function Sf(){if(_f)return wf;_f=1,Object.defineProperty(wf,"__esModule",{value:!0});var t=function(){if(vf)return Mf;vf=1,Object.defineProperty(Mf,"__esModule",{value:!0});var t=function(){function t(){}return t.bitsToNum=function(t){return t.reduce(function(t,e){return 2*t+e},0)},t.byteToBitArr=function(t){for(var e=[],n=7;n>=0;n--)e.push(!!(t&1<<n));return e},t.lzwDecode=function(t,e){for(var n,r,i=0,s=function(t){for(var n=0,r=0;r<t;r++)e.charCodeAt(i>>3)&1<<(7&i)&&(n|=1<<r),i++;return n},o=[],a=1<<t,c=a+1,l=t+1,h=[],d=function(){h=[],l=t+1;for(var e=0;e<a;e++)h[e]=[e];h[a]=[],h[c]=null};;)if(r=n,(n=s(l))!==a){if(n===c)break;if(n<h.length)r!==a&&h.push(h[r].concat(h[n][0]));else{if(n!==h.length)throw new Error("Invalid LZW code.");h.push(h[r].concat(h[r][0]))}o.push.apply(o,h[n]),h.length===1<<l&&l<12&&l++}else d();return o},t}();return Mf.SuperGifUtils=t,Mf}(),e=function(){function e(t,e){this.stream=t,this.handler=e}return e.prototype.parseCT=function(t){for(var e=[],n=0;n<t;n++)e.push(this.stream.readBytes(3));return e},e.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},e.prototype.parseHeader=function(){var e={};if(e.sig=this.stream.read(3),e.ver=this.stream.read(3),"GIF"!==e.sig)throw new Error("Not a GIF file.");e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.gctFlag=n.shift(),e.colorRes=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.sorted=n.shift(),e.gctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.bgColor=this.stream.readByte(),e.pixelAspectRatio=this.stream.readByte(),e.gctFlag&&(e.gct=this.parseCT(1<<e.gctSize+1)),this.handler.hdr&&this.handler.hdr(e)},e.prototype.parseExt=function(e){var n=this;switch(e.label=this.stream.readByte(),e.label){case 249:e.extType="gce",function(e){n.stream.readByte();var r=t.SuperGifUtils.byteToBitArr(n.stream.readByte());e.reserved=r.splice(0,3),e.disposalMethod=t.SuperGifUtils.bitsToNum(r.splice(0,3)),e.userInput=r.shift(),e.transparencyGiven=r.shift(),e.delayTime=n.stream.readUnsigned(),e.transparencyIndex=n.stream.readByte(),e.terminator=n.stream.readByte(),n.handler.gce&&n.handler.gce(e)}(e);break;case 254:e.extType="com",function(t){t.comment=n.readSubBlocks(),n.handler.com&&n.handler.com(t)}(e);break;case 1:e.extType="pte",function(t){n.stream.readByte(),t.ptHeader=n.stream.readBytes(12),t.ptData=n.readSubBlocks(),n.handler.pte&&n.handler.pte(t)}(e);break;case 255:e.extType="app",function(t){n.stream.readByte(),t.identifier=n.stream.read(8),t.authCode=n.stream.read(3),"NETSCAPE"===t.identifier?function(t){n.stream.readByte(),t.unknown=n.stream.readByte(),t.iterations=n.stream.readUnsigned(),t.terminator=n.stream.readByte(),n.handler.app&&n.handler.app.NETSCAPE&&n.handler.app.NETSCAPE(t)}(t):function(t){t.appData=n.readSubBlocks(),n.handler.app&&n.handler.app[t.identifier]&&n.handler.app[t.identifier](t)}(t)}(e);break;default:e.extType="unknown",function(t){t.data=n.readSubBlocks(),n.handler.unknown&&n.handler.unknown(t)}(e)}},e.prototype.parseImg=function(e){e.leftPos=this.stream.readUnsigned(),e.topPos=this.stream.readUnsigned(),e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.lctFlag=n.shift(),e.interlaced=n.shift(),e.sorted=n.shift(),e.reserved=n.splice(0,2),e.lctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.lctFlag&&(e.lct=this.parseCT(1<<e.lctSize+1)),e.lzwMinCodeSize=this.stream.readByte();var r=this.readSubBlocks();e.pixels=t.SuperGifUtils.lzwDecode(e.lzwMinCodeSize,r),e.interlaced&&(e.pixels=function(t,e){for(var n=new Array(t.length),r=t.length/e,i=function(r,i){var s=t.slice(i*e,(i+1)*e);n.splice.apply(n,[r*e,e].concat(s))},s=[0,4,2,1],o=[8,8,4,2],a=0,c=0;c<4;c++)for(var l=s[c];l<r;l+=o[c])i(l,a),a++;return n}(e.pixels,e.width)),this.handler.img&&this.handler.img(e)},e.prototype.parseBlock=function(){var t={};switch(t.sentinel=this.stream.readByte(),String.fromCharCode(t.sentinel)){case"!":t.type="ext",this.parseExt(t);break;case",":t.type="img",this.parseImg(t);break;case";":t.type="eof",this.handler.eof&&this.handler.eof(t);break;default:throw new Error("Unknown block: 0x"+t.sentinel.toString(16))}"eof"!==t.type&&setTimeout(this.parseBlock.bind(this),0)},e.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},e}();return wf.SuperGifParser=e,wf}var kf,Af,Ef={};var Cf=function(){if(Af)return xf;Af=1,Object.defineProperty(xf,"__esModule",{value:!0});var t=Sf(),e=function(){if(kf)return Ef;kf=1,Object.defineProperty(Ef,"__esModule",{value:!0});var t=function(){function t(t){this.data=t,this.position=0}return t.prototype.readByte=function(){if(this.position>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.position++]:255&this.data.charCodeAt(this.position++)},t.prototype.readBytes=function(t){for(var e=[],n=0;n<t;n++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",n=0;n<t;n++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();return Ef.SuperGifStream=t,Ef}(),n=function(){function n(t,e){var n=this;for(var r in this.gifImgElement=t,this.options={autoPlay:!0},this.loading=!1,this.ready=!1,this.transparency=null,this.delay=null,this.disposalMethod=null,this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,this.playing=!0,this.forward=!0,this.ctxScaled=!1,this.frames=[],this.frameOffsets=[],this.initialized=!1,this.currentFrameIndex=-1,this.iterationCount=0,this.stepping=!1,this.handler={hdr:this.withProgress(this.doHdr.bind(this)),gce:this.withProgress(this.doGCE.bind(this)),com:this.withProgress(this.doNothing.bind(this)),app:{NETSCAPE:this.withProgress(this.doNothing.bind(this))},img:this.withProgress(this.doImg.bind(this)),eof:function(){n.pushFrame(),n.canvas.width=n.hdr.width*n.getCanvasScale(),n.canvas.height=n.hdr.height*n.getCanvasScale(),n.playerInit(),n.loading=!1,n.ready=!0,n.loadCallback&&n.loadCallback(n.gifImgElement)}},e)this.options[r]=e[r];this.onEndListener=e.onEnd,this.loopDelay=e.loopDelay||0,this.overrideLoopMode=null!=e.loopMode?e.loopMode:"auto",this.drawWhileLoading=null==e.drawWhileLoading||e.drawWhileLoading}return n.prototype.init=function(){var t=this.gifImgElement.parentNode,e=document.createElement("div");this.canvas=document.createElement("canvas"),this.canvasContext=this.canvas.getContext("2d"),this.tmpCanvas=document.createElement("canvas"),e.className=this.options.enclosingClass||"super-gif",e.appendChild(this.canvas),t&&(t.insertBefore(e,this.gifImgElement),t.removeChild(this.gifImgElement)),this.initialized=!0},n.prototype.loadSetup=function(t){return!this.loading&&(t&&(this.loadCallback=t),this.loading=!0,this.frames=[],this.clear(),this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,!0)},n.prototype.completeLoop=function(){this.onEndListener&&this.onEndListener(this.gifImgElement),this.iterationCount++,!1!==this.overrideLoopMode||this.iterationCount<0?this.doStep():(this.stepping=!1,this.playing=!1)},n.prototype.doStep=function(){if(this.stepping=this.playing,this.stepping){this.stepFrame(1);var t=10*this.frames[this.currentFrameIndex].delay;t||(t=100),0===this.getNextFrameNo()?(t+=this.loopDelay,setTimeout(this.completeLoop.bind(this),t)):setTimeout(this.doStep.bind(this),t)}},n.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},n.prototype.putFrame=function(){var t;this.currentFrameIndex=parseInt(this.currentFrameIndex.toString(),10),this.currentFrameIndex>this.frames.length-1&&(this.currentFrameIndex=0),this.currentFrameIndex<0&&(this.currentFrameIndex=0),t=this.frameOffsets[this.currentFrameIndex],this.tmpCanvas.getContext("2d").putImageData(this.frames[this.currentFrameIndex].data,t.x,t.y),this.canvasContext.globalCompositeOperation="copy",this.canvasContext.drawImage(this.tmpCanvas,0,0)},n.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},n.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},n.prototype.parseStream=function(e){try{new t.SuperGifParser(e,this.handler).parse()}catch(t){this.handleError("parse")}},n.prototype.setSizes=function(t,e){this.canvas.width=t*this.getCanvasScale(),this.canvas.height=e*this.getCanvasScale(),this.tmpCanvas.width=t,this.tmpCanvas.height=e,this.tmpCanvas.style.width=t+"px",this.tmpCanvas.style.height=e+"px",this.tmpCanvas.getContext("2d").setTransform(1,0,0,1,0,0)},n.prototype.drawError=function(){this.canvasContext.fillStyle="black",this.canvasContext.fillRect(0,0,this.hdr.width,this.hdr.height),this.canvasContext.strokeStyle="red",this.canvasContext.lineWidth=3,this.canvasContext.moveTo(0,0),this.canvasContext.lineTo(this.hdr.width,this.hdr.height),this.canvasContext.moveTo(0,this.hdr.height),this.canvasContext.lineTo(this.hdr.width,0),this.canvasContext.stroke()},n.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},n.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},n.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},n.prototype.pushFrame=function(){this.frame&&(this.frames.push({data:this.frame.getImageData(0,0,this.hdr.width,this.hdr.height),delay:this.delay}),this.frameOffsets.push({x:0,y:0}))},n.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var n=this.frames.length,r=t.lctFlag?t.lct:this.hdr.gct;n>0&&(3===this.lastDisposalMethod?null!==this.disposalRestoreFromIdx?this.frame.putImageData(frames[this.disposalRestoreFromIdx].data,0,0):this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height):this.disposalRestoreFromIdx=n-1,2===this.lastDisposalMethod&&this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height));var i=this.frame.getImageData(t.leftPos,t.topPos,t.width,t.height);t.pixels.forEach(function(t,n){t!==e.transparency&&(i.data[4*n+0]=r[t][0],i.data[4*n+1]=r[t][1],i.data[4*n+2]=r[t][2],i.data[4*n+3]=255)}),this.frame.putImageData(i,t.leftPos,t.topPos),this.ctxScaled||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.ctxScaled=!0),this.drawWhileLoading&&(this.canvasContext.drawImage(this.tmpCanvas,0,0),this.drawWhileLoading=this.options.autoPlay),this.lastImg=t},n.prototype.doNothing=function(){},n.prototype.withProgress=function(t){return function(e){t(e)}},n.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},n.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},n.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},n.prototype.play=function(){this.playing=!0,this.step()},n.prototype.pause=function(){this.playing=!1},n.prototype.isPlaying=function(){return this.playing},n.prototype.getCanvas=function(){return this.canvas},n.prototype.isLoading=function(){return this.loading},n.prototype.isReady=function(){return this.ready},n.prototype.isAutoPlay=function(){return this.options.autoPlay},n.prototype.getLength=function(){return this.frames.length},n.prototype.getCurrentFrame=function(){return this.currentFrameIndex},n.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},n.prototype.loadURL=function(t,n){var r=this;if(this.loadSetup(n)){var i=new XMLHttpRequest;i.open("GET",t,!0),"overrideMimeType"in i?i.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in i?i.responseType="arraybuffer":i.setRequestHeader("Accept-Charset","x-user-defined"),i.onloadstart=function(){r.initialized||r.init()},i.onload=function(){if(200===i.status){var t=i.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var n=new e.SuperGifStream(t);setTimeout(function(){r.parseStream(n)},0)}else r.handleError("xhr - response")},i.onerror=function(){r.handleError("xhr")},i.send()}},n.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},n}();return xf.SuperGif=n,xf}();const Tf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"src",name:"src"},{type:"checkbox",label:"play",name:"play"}],"value-property":"src",help:"scene/component/gif-view"};class Pf extends bf{async oncreate_element(t){const{src:e,play:n}=this.state;this.onchangesrc(e),this.onchangeplay(n)}buildImg(){const t=this.element;if(!t)return document.createElement("img");t.replaceChildren();const e=document.createElement("img");return e.style.width="100%",e.style.height="100%",t.appendChild(e),e}onchange(t,e){super.onchange(t,e),"src"in t&&this.onchangesrc(t.src),"play"in t&&this.onchangeplay(t.play)}setElementProperties(t){}onchangeplay(t){const e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){const e=this.buildImg();t||(t="data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw=="),e.src=t,e.setAttribute("rel:animated_src",t),e.setAttribute("rel:auto_play",String(0)),this._superGif=new Cf.SuperGif(e,{autoPlay:!1}),this._superGif.init(),this.element&&Array.from(this.element.children).forEach(t=>{t.style.width="100%",t.style.height="100%"});const n=this._superGif.getCanvas();n.style.width="100%",n.style.height="100%",this._superGif.load(()=>{setTimeout(()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()},100)})}ondropfile(t,e){for(let n=0;n<t.length;n++)if(/\.gif$/.test(t[n].name))return void(this.src=e[n])}get src(){return this.getState("src")}set src(t){this.set("src",t)}get play(){return this.getState("play")}set play(t){this.setState("play",t)}get nature(){return Tf}get tagName(){return"div"}}oc.register("gif-view",Pf);const Df={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"attachment-selector",label:"src",name:"src",property:{category:"audio"}},{type:"checkbox",label:"started",name:"started"},{type:"checkbox",label:"loop",name:"loop"}],"value-property":"src",help:"scene/component/audio"};class Of extends(lc(ac)){static get image(){return Of.IMAGE||(Of.IMAGE=new Image,Of.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5ZzAwBurHDk3WGeRY0bvYrGa1+rqNI22f7dS32ZnUK1GMr0eSK3mEc9dhKMxp+ZTo8kT2emOXS5LQ1kCxbJBocSd2k5PaIjMVzjWcdJPk9ooBnmzx1t5XbIxqBKpJ4NGTgzwKiGpK4do72gb+Z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J++VPJfTu5UwBpv4Pp9DJSi6MJx0bvUwiw4ewgT8zNR0LHUL+OccOpY/3ElzyGKD5pBlMJpDlsOkMythRoNbXh95PJsdA67MrMtAEYbjeDqNo+7oKqWUUkoppZRSSimllFJKFfMXp4vmSjB8n6sAAAAASUVORK5CYII="),Of.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}async ready(){super.ready(),this._audio=new Audio;const{src:t="",loop:e=!1,started:n=!1}=this.state;if(t){const e=this.root?.app?.loadTracker;if(e){const n=new Promise((e,n)=>{this._audio.addEventListener("canplay",()=>e(),{once:!0}),this._audio.addEventListener("error",()=>n(new Error(`Audio load failed: ${t}`)),{once:!0})});e.track(`audio:${t}`,"audio",t,n)}}this._audio.addEventListener("canplay",()=>{this.started&&this._audio.play()}),this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(n)}render(t){const{left:e,top:n,width:r,height:i}=this.state;t.beginPath(),this.drawImage(t,Of.image,e,n,r,i)}get nature(){return Df}get hasTextProperty(){return!1}get src(){return this.get("src")}set src(t){this.set("src",t)}get started(){return!!this.get("started")}set started(t){this.set("started",t)}start(){this._audio&&(this._audio.classList.add("active"),this._audio.play())}pause(){this._audio&&(this._audio.classList.remove("active"),this._audio.pause())}onchangeSrc(t){try{"data"!==String(t).substring(0,4)?this._audio.crossOrigin="use-credentials":this._audio.crossOrigin=null,this._audio.src="string"==typeof t?this.app.url(t):t}catch(t){return void Xr(t)}}onchangeStarted(t){const e=this._audio;t?4==e.readyState&&e.play():e.pause()}onchangeLoop(t){this._audio.loop=t}onchange(t,e){"src"in t&&this.onchangeSrc(t.src),"started"in t&&this.onchangeStarted(t.started),"loop"in t&&this.onchangeLoop(t.loop)}ondblclick(t){this.started=!this.started}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("audio/"))return void(this.src=e[n])}}oc.register("audio",Of);class zf extends(lc(oc)){is3dish(){return!0}}oc.register("text",zf);const If=["refid","left","top","width","height","rotation","animation"];class Lf extends Gp{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});const n=If.reduce((e,n)=>(t.hasOwnProperty(n)&&(e[n]=t[n]),e),{});return super.set(n,void 0)}capture(t,e,n){const r=super.capture(t,e,n);if(r!==this)return r}set bounds(t){if(this.__MUTATING__)return void(super.bounds=t);const e=this.bounds,n=t.width/e.width,r=t.height/e.height;this.path=this.path.map(i=>({x:t.left+(i.x-e.left)*n,y:t.top+(i.y-e.top)*r})),this.components&&this.components.forEach(t=>{if(t.mutable)t.mutatePath(null,function(t){return t.map(function(t){return{x:t.x*n,y:t.y*r}})});else{const e=t.bounds,i=t.center,s={x:i.x*(1-n),y:i.y*(1-r)},o=e.width*(1-n),a=e.height*(1-r),c=-(s.x-o/2),l=-(s.y-a/2);t.bounds={left:e.left+c,top:e.top+l,width:e.width*n,height:e.height*r}}})}get focusible(){return!1}get bounds(){return super.bounds}get hasTextProperty(){return!1}isIdentifiable(){return!1}calculateBounds(){this.clearCache(),this.__MUTATING__=!0,this.mutateBounds(function(t){const e=oc.union(this.components.map(t=>t.bounds));return this.components.forEach(t=>{const n=t.bounds;t.bounds={left:n.left-e.left,top:n.top-e.top,width:n.width,height:n.height}}),{left:t.left+e.left,top:t.top+e.top,width:e.width,height:e.height}},this),this.__MUTATING__=!1,this.parent.isGroup()&&this.parent.calculateBounds?.()}render(t){}postrender(t){const{top:e,left:n}=this.state;t.translate(n,e),this.layout.drawables(this).forEach(e=>{e.draw(t)}),t.translate(-n,-e)}}oc.memoize(Lf.prototype,"bounds",!0),oc.register("group",Lf);const jf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"id-input",label:"ref",name:"ref"},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio"]}}],"value-property":"ref",help:"scene/component/local-ref"};class Rf extends(lc(ac)){get ref(){const t=this.getState("ref");return t&&"string"==typeof t?this.root.findById?.(t):null}set ref(t){this.setState("ref",t)}get refScale(){const t=this.ref;if(!t)return{x:1,y:1};const e=t.bounds,n=this.bounds,r=n.width/e.width,i=n.height/e.height;return"both"===this.model.fit?{x:r,y:i}:{x:Math.min(r,i),y:Math.min(r,i)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){const e=this.ref.center,n=this.center,r=this.refScale;t.translate(n.x,n.y),t.scale(r.x,r.y),t.translate(-e.x,-e.y)}}postrender(t){if(this.ref)return this.ref.postrender(t);super.postrender(t)}render(t){if(this.ref)return this.ref.render(t);const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),t.rect(e,n,r,i)}get nature(){return jf}get hasTextProperty(){return!1}}oc.memoize(Rf.prototype,"ref",!1),oc.memoize(Rf.prototype,"refScale",!1),oc.register("local-ref",Rf);class Ff extends(Bp(jc)){render(t){}is3dish(){return!0}get layout(){return gc.get(this.get("layout"))||mc}}const Bf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"scene-number",name:"ref",placeholder:"SCENE-1"},{type:"number",label:"round",name:"round",property:{min:0}},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio","width","height","none"]}},{type:"select",label:"mode",name:"mode",property:{options:["view","interaction"]}}],"value-property":"ref",help:"scene/component/global-ref"};class Nf extends Ff{dispose(){this._releaseRef(),super.dispose()}get nature(){return Bf}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){const{mode:e="view",round:n=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=n+"px"}async ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();const t=this._element_bounds,{offsetWidth:e,offsetHeight:n}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:n},(!t||t.offsetWidth!=e||t.offsetHeight!=n)&&this.ref&&this.root.target_element){const{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();const{ref:t,fit:e="ratio"}=this.state;if(!t)return;const n=this.app.refProvider;if(n&&t){const r=(async()=>{this.__ref=await n.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data})();this.root?.app?.loadTracker?.track(`ref:${t}`,"ref-board",t,r);try{await r}catch(t){Xr(t)}}}get ref(){return this.__ref}set ref(t){this.setState("ref",t)}_releaseRef(){this.__ref&&this.__ref.release&&this.__ref.release(),delete this.__ref}onchange(t,e,n){super.onchange(t,e),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame(()=>{const{fit:t}=this.state;this.ref.fit(t)}),"data"in t&&this.ref&&requestAnimationFrame(()=>{this.ref.data=t.data})}}oc.register("global-ref",Nf);const Hf="center-middle",Vf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"board",name:"board"},{type:"checkbox",label:"modal",name:"modal"},{type:"checkbox",label:"closable",name:"closable"},{type:"checkbox",label:"draggable",name:"draggable"},{type:"checkbox",label:"minimizable",name:"minimizable"},{type:"checkbox",label:"show",name:"show"},{type:"select",label:"popup-position",name:"popupPosition",property:{options:["static","absolute"]}},{type:"select",label:"popup-origin",name:"origin",property:{options:["left-top","center-top","right-top","left-middle",Hf,"right-middle","left-bottom","center-bottom","right-bottom","auto"]}},{type:"string",label:"title",name:"text"},{type:"data",label:"value",name:"value"}],help:"scene/component/popup"};class Yf extends(lc(ac)){static get image(){return Yf._image||(Yf._image=new Image,Yf._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJ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MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzOguTm2AAAATHRSTlMARhB73r9B7YLrsqdE+0cq9Avzeg31eQx4aQ+Ks6aUd5DsYKixEX1w8vyT2VjoZ3YezY/cCEDvl+QTvRwJ0ifwK/5T/aw6+IuFuCImAcS6MQAAAeJJREFUWMPt2FlX2zAQhuHJYmOSFhIggbC0QNn3rS1dKXSH9///Hi58CJLxKIpEWi6YO8c5z4lG/nxGEXmu/1OVLGnhrFaSVQYg1SZetTTvUibqeFZ9QlfmvRWoV1VmCaCRzroXPpsuAjTV7gLUfPahBqD1OQMW/fazAWTKvQRI/ZgUSJR7U8CM/dHZ+/2VcatWdvdEZAaYUhiAwkerJXt0rnzXwdRKmHfDM0fHD5kxjTFyVLzVfvvirn7+cDJWjhy7c7XlYuwc6Urvu2tRhRypyhwAf1sKY+TIxfQA+H39q5wxc+RgVrcBduTmZTlj5khnDgH4IzKpMGaOVCbvyyvRGTNHGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Yf._image}async ready(){await super.ready(),this.show&&this.onchangeShow(!0)}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,Yf.image,e,n,r,i)}onchange(t,e){"value"in t?this.show?this.onchangeShow(!0):this.show=!0:"show"in t&&this.onchangeShow(this.show)}onchangeShow(t){!this.app.isEditMode&&this.getState("board")&&(t?this.openPopup(this.value):this.hidePopup())}openPopup(t,e){this.app.isEditMode||Oc.show(this,this.getState("board"),{origin:this.getState("origin")||Hf,modal:this.getState("modal"),closable:this.getState("closable")||!1,draggable:this.getState("draggable")||!1,minimizable:this.getState("minimizable")||!1,popupPosition:this.getState("popupPosition"),title:this.text,data:t||this.value,...e})}hidePopup(){Oc.hide(this)}get board(){return this.getState("board")}set board(t){this.set("board",t)}get show(){return this.getState("show")}set show(t){this.setState("show",t)}get started(){return this.getState("show")}set started(t){this.setState("show",t)}get value(){return this.getState("value")}set value(t){this.setState("value",t)}get hasTextProperty(){return!1}get nature(){return Vf}}oc.register("popup",Yf);class Gf extends oc{render(t){const{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),this.drawStroke(t,void 0)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let r=!1;return n.forEach((i,s)=>{const o=(s+n.length+1)%n.length,a=i.x,c=i.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(r=!r)}),r}}oc.register("path",Gf);const Uf={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/triangle"};class Wf extends ac{is3dish(){return!0}contains(t,e){const{x1:n,y1:r,x2:i,y2:s,x3:o,y3:a}=this.state,c=[n,r,i,s,o,a];let l=!1;for(let n=0;n<c.length;n+=2){const r=(n+2)%c.length,i=c[n],s=c[n+1],o=c[r+1];s>e!=o>e&&t<(c[r]-i)*(e-s)/(o-s)+i&&(l=!l)}return l}get mutable(){return!0}get path(){const{x1:t,y1:e,x2:n,y2:r,x3:i,y3:s}=this.state;return[{x:t,y:e},{x:n,y:r},{x:i,y:s}]}set path(t){this.set({x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y,x3:t[2].x,y3:t[2].y})}get nature(){return Uf}}oc.memoize(Wf.prototype,"path",!1),oc.register("triangle",Wf);const Xf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"},qf={ondragmove:function(t,e,n){let{cx:r,rx:i}=n.model;i=Math.abs(i);let s=(n.fromParent(t.x,t.y).x-r)/i*100;s=s>=100||s<=-100?100:Math.abs(s),n.set({ratio:s})}};class Kf extends af{is3dish(){return!0}render(t){let{ratio:e=50,cx:n,cy:r,rx:i,ry:s,startAngle:o,endAngle:a,anticlockwise:c}=this.state;i=Math.abs(i),s=Math.abs(s),t.beginPath(),t.ellipse(n,r,i,s,0,o||0,a||2*Math.PI,c),t.moveTo(n+i/100*e,r),t.ellipse(n,r,i/100*e,s/100*e,0,o||0,a||2*Math.PI,!0)}contains(t,e){let{cx:n,cy:r,rx:i,ry:s,ratio:o}=this.state;i=Math.abs(i),s=Math.abs(s);const a=(t-n)/(2*i-.5),c=(e-r)/(2*s-.5),l=(t-n)/(i/100*o*2-.5),h=(e-r)/(s/100*o*2-.5);let d=!1;return a*a+c*c<.25&&l*l+h*h>.25&&(d=!d),d}get controls(){let{cx:t,cy:e,rx:n,ratio:r}=this.state;return n=Math.abs(n),[{x:t+n/100*r,y:e,handler:qf}]}get nature(){return Xf}}oc.memoize(Kf.prototype,"controls",!1),oc.register("donut",Kf);const $f={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"},{type:"number",label:"wing",name:"wing",property:"wing"}],help:"scene/component/star"},Qf={ondragmove:function(t,e,n){const{cy:r,ry:i}=n.model;let s=(n.fromParent(t.x,t.y).y-r)/i*100+100;s>=100?s=100:s<=0&&(s=0),n.set({ratio:s})}};class Zf extends af{is3dish(){return!0}render(t){const{ratio:e=30,wing:n=5,cx:r,cy:i,rx:s,ry:o}=this.state;if(n<3)return;const a=1.5707963267948966,c=2*Math.PI/n,l=s-e/100*s,h=o-e/100*o;t.save(),t.beginPath(),t.translate(r,i),t.moveTo(s*Math.cos(-a),o*Math.sin(-a)),t.lineTo((s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let e=1;e<n;e++)t.lineTo(s*Math.cos(c*e-a),o*Math.sin(c*e-a)),t.lineTo((s-l)*(Math.cos(c*(e+1)-a)+Math.cos(c*e-a))/2,(o-h)*(Math.sin(c*(e+1)-a)+Math.sin(c*e-a))/2);t.closePath(),t.restore()}get controls(){const{cx:t,cy:e,ry:n,ratio:r}=this.state;return[{x:t,y:e-n+n*(r/100),handler:Qf}]}get nature(){return $f}}oc.memoize(Zf.prototype,"controls",!1),oc.register("star",Zf);const Jf={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class tg extends(Id(ac)){is3dish(){return!1}isDescendible(){return!1}render(t){const{cx:e,cy:n,anticlockwise:r}=this.state,i=this.app?.scale||1;t.beginPath(),t.scale(1/i,1/i),t.ellipse(e,n,Math.abs(tg.RADIUS),Math.abs(tg.RADIUS),0,0,2*Math.PI,r),t.scale(i,i),t.closePath()}get path(){const{cx:t,cy:e}=this.state;return[{x:t-tg.RADIUS,y:e-tg.RADIUS},{x:t+tg.RADIUS,y:e-tg.RADIUS},{x:t+tg.RADIUS,y:e+tg.RADIUS},{x:t-tg.RADIUS,y:e+tg.RADIUS}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:r}=this.state,i=(t-n)/(2*tg.RADIUS-.5),s=(e-r)/(2*tg.RADIUS-.5);return i*i+s*s<.25}outline(t){const{cx:e,cy:n}=this.state;return this.toScene(e,n)}get nature(){return Jf}}tg.RADIUS=5,oc.memoize(tg.prototype,"path",!1),oc.register("node",tg);class eg extends Yh{getObject3dInstance(){return new e.Mesh}build(){super.build();const{width:t,height:n}=this.component.bounds,r=this.component.state.depth||.5*Math.min(t,n),i=.15*Math.min(t,n,r),s=new D(1,1,1,4,i/Math.min(t,n,r));s.scale(t,r,n),this.object3d.geometry=s,this.object3d.material=new e.MeshStandardMaterial({color:"#5090d0",transparent:!0,opacity:.35,roughness:.6,metalness:.1,side:e.FrontSide,depthWrite:!1}),this.object3d.visible=!!this.component.app?.isEditMode}updateAlpha(){const t=this.object3d.material;t&&(t.opacity=this.component.app?.isEditMode?.35:0)}updateHidden(){this.object3d.visible=!!this.component.app?.isEditMode&&!this.component.state.hidden}updateDimension(){const{width:t,height:e}=this.component.bounds,n=this.component.state.depth||.5*Math.min(t,e);this.object3d.geometry.computeBoundingBox();const r=this.object3d.geometry.boundingBox;if(r){const i=r.max.x-r.min.x,s=r.max.y-r.min.y,o=r.max.z-r.min.z;this.object3d.scale.set(t/i,n/s,e/o)}}updateFillStyle(){}updateStrokeStyle(){}updateText(){}clear(){return Bh(this.object3d),super.clear()}}const ng="data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="#5090d0">\n <path d="M32 20a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm0 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12z"/>\n <path d="M55.4 27.2l-3.6-.6c-.4-1.2-.8-2.4-1.4-3.4l2.2-3c.6-.8.4-2-.2-2.6l-3-3c-.8-.6-1.8-.8-2.6-.2l-3 2.2c-1.2-.6-2.2-1-3.4-1.4l-.6-3.6c-.2-1-1-1.6-2-1.6h-4.2c-1 0-1.8.6-2 1.6l-.6 3.6c-1.2.4-2.4.8-3.4 1.4l-3-2.2c-.8-.6-2-.4-2.6.2l-3 3c-.6.8-.8 1.8-.2 2.6l2.2 3c-.6 1.2-1 2.2-1.4 3.4l-3.6.6c-1 .2-1.6 1-1.6 2v4.2c0 1 .6 1.8 1.6 2l3.6.6c.4 1.2.8 2.4 1.4 3.4l-2.2 3c-.6.8-.4 2 .2 2.6l3 3c.8.6 1.8.8 2.6.2l3-2.2c1.2.6 2.2 1 3.4 1.4l.6 3.6c.2 1 1 1.6 2 1.6h4.2c1 0 1.8-.6 2-1.6l.6-3.6c1.2-.4 2.4-.8 3.4-1.4l3 2.2c.8.6 2 .4 2.6-.2l3-3c.6-.8.8-1.8.2-2.6l-2.2-3c.6-1.2 1-2.2 1.4-3.4l3.6-.6c1-.2 1.6-1 1.6-2v-4.2c0-1-.6-1.8-1.6-2z"/>\n</svg>');class rg extends(lc(oc)){static get icon(){return rg._defaultIcon||(rg._defaultIcon=new Image,rg._defaultIcon.src=ng),rg._defaultIcon}get serviceName(){}get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new eg(this)}render(t){if(this.app?.isViewMode)return;const{left:e,top:n,width:r,height:i}=this.bounds,s=this.constructor.icon;t.beginPath(),t.globalAlpha=.6,this.drawImage(t,s,e,n,r,i),t.globalAlpha=1}added(t){super.added(t);const e=this.serviceName;e&&(this._registeredRoot=this.root,this._registeredRoot?.registerService?.(e,this))}removed(t){const e=this.serviceName;e&&this._registeredRoot&&(this._registeredRoot.unregisterService?.(e),this._registeredRoot=void 0),super.removed(t)}get controls(){return[]}}function ig(t){return class extends t{animOnValueChange(t,e=!1,n){if(t==this._lastValue)return;let r;r=e?t-(Number(n)||0):t-(this._lastValue||0),this._lastValue=t,this._anim_alpha=-r,this.animate({step:t=>{this._anim_alpha=r*(t-1),this.invalidate()},duration:1e3,delta:"circ",options:{x:1},ease:"out"}).start()}dispose(){super.dispose(),delete this._value_substitutor}onchange(t,e){t.hasOwnProperty("value")&&delete this._value_substitutor}get animAlpha(){return this._anim_alpha||0}get animValue(){return(this._lastValue||0)+(this._anim_alpha||0)}defaultValueSubstitutor(){return this.getState("value")}get valueSubstitutor(){return this._value_substitutor||(this._value_substitutor=Ls(this.getState("value"),this,void 0)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(yr(t)))}}}function sg(t){return class extends t{_convertDataFormat(t,e){let n;if("json"===e)n=JSON.parse(t);else n=t;return n}isDataSource(){return!0}}}function og(t){return function(e){return Array.isArray(t)?t.forEach(t=>{oc.register(t,e)}):oc.register(t,e),e}}let ag=0;const cg=new FinalizationRegistry(()=>{ag--});class lg{static get residents(){return ag}static get residentsCount(){return ag}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,ag++,cg.register(this,ag)}dispose(){if(this.disposer)for(const t in this.references)this.disposer(t,this.references[t]);this.references={},this.counters={}}get ids(){return Object.keys(this.references)}create(t){return new Promise((e,n)=>{this.creator?this.creator(t,n=>{n.release=()=>{this.disposer?.(t,n),delete n.release,Kr("RELEASED",t)},e(n)},n):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))})}add(t,e){const n=new Promise((n,r)=>{const i=this.references[t];if(i)i===e?r(Error("Reference ID and target duplicate")):e?r(Error("Reference ID duplicate")):n(i);else{const i=e=>{e.release=()=>{this.release(e)},this.references[t]=e,this.counters[t]=1,n(e)};if(e)i(e);else{if(!this.creator)return void r(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));this.creator(t,i,r)}}});return this.references[t]||(this.references[t]=n),n}async get(t,e=!1){let n=this.references[t];if(n){if(!(n instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,n}if(e)return n=await n,this.counters[t]++,n}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(const e in this.references){if(this.references[e]===t)return e}}release(t){const e=this._id(t);if(!e)return void Xr("No Referenced ID");const n=this.references[e];n&&(this.counters[e]--,0==this.counters[e]&&(this.disposer?.(e,n),delete this.references[e],delete this.counters[e],delete t.release,Kr("RELEASED",e)))}}const hg={},dg={};let ug=[];function pg(t){const e=t.target,n="SCRIPT"===e.tagName?hg:dg,r=e.src||e.href;n[r]=!0,ug.forEach((t,e)=>{if(!t)return;const{resolve:i,scripts:s,styles:o}=t;if(n===hg){const t=s.indexOf(r);t>-1&&t<s.length-1&&gg(s[t+1])}s.some(t=>!hg[t])||o?.some(t=>!dg[t])||(i(),ug[e]=null)}),ug=ug.filter(Boolean)}function fg(t){if("string"==typeof t)return;const e=t.target,n=e.src,r="SCRIPT"===e.tagName?hg:dg;ug.forEach((e,i)=>{if(!e)return;const{reject:s,scripts:o,styles:a}=e;(r===hg&&o.includes(n)||r===dg&&!!a?.includes(n))&&(s(t),ug[i]=null)}),ug=ug.filter(Boolean),delete r[n],document.head.removeChild(e)}function gg(t){hg[t]=!1;const e=document.createElement("script");e.onload=pg,e.onerror=fg,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class mg{static load(t,e){const n="string"==typeof t?[t]:t,r="string"==typeof e?[e]:e;return new Promise(function(t,e){if(n&&!Array.isArray(n)||r&&!Array.isArray(r))return void e(new Error("invalid sources for load"));let i,s=!0;if(r?.forEach(t=>{t in dg||function(t){dg[t]=!1;const e=document.createElement("link");e.onload=pg,e.onerror=fg,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),dg[t]||(s=!1)}),n&&n.length>0)for(const t of n)t in hg?hg[t]||(s=!1):i??=t;if(i)gg(i);else if(s)return void t();ug.push({resolve:t,reject:e,scripts:n,styles:r})})}}const yg="0.0.0";class bg extends Yh{getObject3dInstance(){return new e.Sprite}build(){super.build(),this.buildMaterial()}get cz(){const{zPos:t=0}=this.component.state,{height:e}=this.component.bounds,{tz:n=0}=this.component.delta();return t+n+e/2}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Ah(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=Yh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(Eh(t)):e.opacity=0)}}function vg(t){if(!(t>0))return 1;let e=0;if(!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function _g(t){const{lineWidth:n=0}=t.state;let{width:r,height:i}=t.bounds;r+=n,i+=n;const s=vg(2*r),o=vg(2*i),a=vh(s,o),c=new e.CanvasTexture(a);return xg(a,t,2),c.needsUpdate=!0,c.wrapS=e.RepeatWrapping,c.wrapT=e.RepeatWrapping,c.offset.set(0,1-2*i/o),c.repeat.set(2*r/s,2*i/o),c.magFilter=e.NearestFilter,c.minFilter=e.LinearFilter,c.colorSpace=e.SRGBColorSpace,c}function xg(t,e,n){const{lineWidth:r=0}=e.state;let{left:i,top:s}=e.bounds;i-=r/2,s-=r/2;const o=t.getContext("2d");o.scale(n,n),o.translate(-i,-s),e.render(o),e.postrender(o)}class wg extends bg{buildMaterial(){const t=this.object3d.material;t&&t.dispose(),this.object3d.material=new e.SpriteMaterial({map:_g(this.component),alphaTest:.01,sizeAttenuation:!1})}get scale(){const{width:t,height:e}=this.component.bounds,n=this.threeContainer,{width:r=1,height:i=1}=n?.bounds??{},{scale:s=1}=this.component.state;return{x:s*t/r,y:s*e/i,z:s}}update(){this.build(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateAlpha(){this.update()}updateText(){this.update()}}class Mg extends Yh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const t=zh(this.component.state.material3d),n=new e.PlaneGeometry(1,1);n.rotateX(-Math.PI/2),this.object3d.geometry=n;const r=_g(this.component);this.object3d.material=new e.MeshStandardMaterial({map:r,transparent:!0,alphaTest:.01,side:e.DoubleSide,metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity}),this.object3d.castShadow=t.castShadow,this.object3d.receiveShadow=t.receiveShadow}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Ah(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}update(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateText(){this.update()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=zh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return Bh(this.object3d),super.clear()}}class Sg extends Yh{getObject3dInstance(){return new e.Mesh}build(){super.build(),this.buildGeometry(),this.buildMaterial()}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Ah(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=Yh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(Eh(t)):e.opacity=0)}updateStrokeStyle(){const t=this.object3d.getObjectByName("__edgeLines__");t&&(this.object3d.remove(t),Bh(t));const{strokeStyle:n}=this.component.state;if(!n||"transparent"===n||"none"===n)return;const r=this.object3d.geometry;if(!r?.getAttribute("position"))return;const i=new e.EdgesGeometry(r),s=new e.LineBasicMaterial({color:n}),o=new e.LineSegments(i,s);o.name="__edgeLines__",this.object3d.add(o)}updateDimension(){const{width:t,height:e}=this.component.bounds,{depth:n=1}=this.component.state;if(!this.object3d)return;this.object3d.geometry.computeBoundingBox();const r=this.object3d.geometry.boundingBox;if(r){const i=r.max.x-r.min.x,s=r.max.y-r.min.y,o=r.max.z-r.min.z;this.object3d.scale.set(t/i,n/s,e/o)}}buildMaterial(){const t=zh(this.component.state.material3d),n=new e.MeshStandardMaterial({transparent:!0});jh(n,t),this.object3d.material=n}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;t&&jh(t,zh(this.component.state.material3d))}clear(){return Bh(this.object3d),super.clear()}}function kg(t,e,n,r){return[["bold",t],["italic",e],[n+"px",!0],[r,!0]].filter(t=>t[1]).map(t=>t[0]).join(" ")}function Ag(t){let e=0;if(!((t=Math.abs(t)||1)&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function Eg(t,e,n){const{bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",textAlign:c="center",textBaseline:l="middle",width:h=t.width,height:d=t.height}=n||{},u=t.getContext("2d");let p,f;u.imageSmoothingEnabled=!1,u.fillStyle=a,u.strokeStyle=a,u.font=kg(r,i,o,s),"left"===c||"start"===c?(u.textAlign="left",p=0):"right"===c||"end"===c?(u.textAlign="right",p=h):(u.textAlign="center",p=h/2);const g=1.2*o,m=String(e).split("\n"),y=g*m.length;f="top"===l||"hanging"===l?.1*o:"bottom"===l||"alphabetic"===l?d-y+.1*o:(d-y)/2+.1*o,u.textBaseline="top";for(const t of m)u.fillText(t,p,f),f+=g}function Cg(t,n,r,i){const s=Ag(2*n),o=Ag(2*r),a=vh(s,o),c=a.getContext("2d"),{fillStyle:l}=i||{};if(l&&"object"==typeof l&&l.colorStops?.length){const t=Nh(l,2*n,2*r);t&&c.drawImage(t,0,0)}c.scale(2,2),"string"==typeof l&&""!==l&&"transparent"!==l&&(c.fillStyle=l,c.fillRect(0,0,n,r)),Eg(a,t,i);const h=new e.CanvasTexture(a);return h.needsUpdate=!0,h.wrapS=e.RepeatWrapping,h.wrapT=e.RepeatWrapping,h.offset.set(0,1-2*r/o),h.repeat.set(2*n/s,2*r/o),h.minFilter=e.LinearFilter,h.colorSpace=e.SRGBColorSpace,h}function Tg(t,n,r,i,s,o,a){const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{const t=2*r,l=2*i,h=Ag(t),d=Ag(l),u=vh(h,d),p=u.getContext("2d");if(o.color&&(p.fillStyle=o.color,p.fillRect(0,0,t,l)),o.fitPattern)p.drawImage(c,0,0,t,l);else{const e=2*(o.width||c.naturalWidth),n=2*(o.height||c.naturalHeight),r=2*(o.offsetX||0),i=2*(o.offsetY||0);let s=0,a=0;switch(o.align){case"center":s=(t-e)/2,a=(l-n)/2;break;case"left-top":break;case"left-bottom":a=l-n;break;case"right-top":s=t-e;break;case"right-bottom":s=t-e,a=l-n;break;case"left":a=(l-n)/2;break;case"right":s=t-e,a=(l-n)/2;break;case"top":s=(t-e)/2;break;case"bottom":s=(t-e)/2,a=l-n}const h=r+s,d=i+a;if(o.noRepeat)p.drawImage(c,0,0,c.naturalWidth,c.naturalHeight,h,d,e,n);else{p.save(),p.rect(0,0,t,l),p.clip();const r=h>0?h-Math.ceil(h/e)*e:h;for(let i=d>0?d-Math.ceil(d/n)*n:d;i<l;i+=n)for(let s=r;s<t;s+=e)p.drawImage(c,0,0,c.naturalWidth,c.naturalHeight,s,i,e,n);p.restore()}}n&&(p.scale(2,2),Eg(u,n,s));const f=new e.CanvasTexture(u);f.needsUpdate=!0,f.wrapS=e.RepeatWrapping,f.wrapT=e.RepeatWrapping,f.offset.set(0,1-l/d),f.repeat.set(t/h,l/d),f.minFilter=e.LinearFilter,f.colorSpace=e.SRGBColorSpace,a(f)},c.onerror=()=>{const t=Cg(n,r,i,s);a(t)},c.src=t}function Pg(t,e){let{bold:n=!1,italic:r=!1,fontFamily:i="Serif",fontSize:s=10,lineHeight:o="normal"}=e||{};t=void 0===t||""==t?" ":String(t);const a=document.createElement("span");a.style.font=kg(n,r,s,i),a.style.lineHeight=String(o),a.style.whiteSpace="pre",a.style.position="absolute",a.textContent=t,document.body.appendChild(a);const c=a.getBoundingClientRect();return document.body.removeChild(a),{width:c.width,height:c.height}}class Dg extends Sg{get syncZPosOffset(){return this.effectiveDepth}buildGeometry(){this.updateDimension()}updateStrokeStyle(){}updateFillStyle(){this.updateText()}updateDimension(){const{width:t,height:n}=this.component.state,r=Math.abs(t)||1,i=Math.abs(n)||1;this.object3d.geometry&&this.object3d.geometry.dispose();const s=new e.PlaneGeometry(r,i);s.rotateX(-Math.PI/2),this.object3d.geometry=s}updateText(){const t=this.object3d.material;if(!t)return;const{width:e,height:n,bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",textAlign:c="center",textBaseline:l="middle",fillStyle:h}=this.component.state,d=Math.abs(e)||1,u=Math.abs(n)||1,p=this.component.text,f=h&&"none"!==h?h:"transparent",g={bold:r,italic:i,fontFamily:s,fontSize:o,fontColor:a,textAlign:c,textBaseline:l,width:d,height:u,fillStyle:f};if("object"==typeof f&&"pattern"===f?.type&&f.image){return void Tg(this.component.app.url(h.image),p,d,u,g,h,e=>{t.map&&t.map.dispose(),t.map=e,t.color.set(16777215),t.needsUpdate=!0})}const m=Cg(p,d,u,g);m?(t.map&&t.map.dispose(),t.map=m,t.color.set(16777215),m.needsUpdate=!0):"string"==typeof h&&(""!==h&&"transparent"!==h?t.color.set(Eh(h)):t.opacity=0)}updateAlpha(){const{alpha:t=1}=this.component.state,e=this.object3d.material;e.opacity=t,e.transparent=!0}}Xh("text",t=>new Dg(t));class Og extends Yh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const{width:t,height:n}=this.component.bounds;if(!t||!n)return;const r=zh(this.component.state.material3d),i=new e.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const s=_g(this.component);this.object3d.material=new e.MeshStandardMaterial({map:s,transparent:!0,side:e.DoubleSide,metalness:r.metalness,roughness:r.roughness,emissive:new e.Color(r.emissive),emissiveIntensity:r.emissiveIntensity}),this.object3d.castShadow=r.castShadow,this.object3d.receiveShadow=r.receiveShadow}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Ah(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}_debouncedRebuild(){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=void 0,this._rebuildTexture()},100)}_rebuildTexture(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}updateFillStyle(){this._debouncedRebuild()}updateStrokeStyle(){this._debouncedRebuild()}updateText(){this._debouncedRebuild()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=zh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),Bh(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),super.dispose()}}const zg={input:"css3d",select:"css3d",textarea:"css3d",button:"css3d",iframe:"css3d",video:"css3d",label:"texture",table:"texture",progress:"texture"};function Ig(t){const e=function(t){const e=t.state?.material3d?.renderMode;if("css3d"===e||"texture"===e)return e;const n=t.model?.type??"";return zg[n]??"css3d"}(t);return"texture"===e?new Og(t):new Gh(t)}Xh("html-overlay-element",Ig),Xh("html-overlay-container",Ig);class Lg{setShape({extrudedShape:t,extrudedOptions:n}){this.extrudedShape=t,this.bb=new e.Box2,this.bb.setFromPoints(this.extrudedShape?.extractPoints(0).shape),this.extrudedOptions=n}generateTopUV(t,n,r,i,s){const o=n[3*r],a=n[3*r+1],c=n[3*i],l=n[3*i+1],h=n[3*s],d=n[3*s+1],u=this.bb,p=u.max.x-u.min.x,f=u.max.y-u.min.y;return[new e.Vector2((o-u.min.x)/p,1-(a-u.min.y)/f),new e.Vector2((c-u.min.x)/p,1-(l-u.min.y)/f),new e.Vector2((h-u.min.x)/p,1-(d-u.min.y)/f)]}generateSideWallUV(t,n,r,i,s,o){const a=n[3*r],c=n[3*r+1],l=n[3*r+2],h=n[3*i],d=n[3*i+1],u=n[3*i+2],p=n[3*s],f=n[3*s+1],g=n[3*s+2],m=n[3*o],y=n[3*o+1],b=n[3*o+2],v=this.extrudedOptions?.depth||100,_=this.bb,x=_.max.x-_.min.x,w=_.max.y-_.min.y;return Math.abs(c-d)<.01?[new e.Vector2(a/x,1-l/v),new e.Vector2(h/x,1-u/v),new e.Vector2(p/x,1-g/v),new e.Vector2(m/x,1-b/v)]:[new e.Vector2(c/w,1-l/v),new e.Vector2(d/w,1-u/v),new e.Vector2(f/w,1-g/v),new e.Vector2(y/w,1-b/v)]}}class jg extends Yh{clear(){return this._mesh=void 0,super.clear()}get shape(){return null}get boundUVGenerator(){return this._boundUVGenerator||(this._boundUVGenerator=new Lg),this._boundUVGenerator}build(){super.build();const t=this.effectiveDepth,n=this.shape;if(!n)return;const r=this.boundUVGenerator;r&&r.setShape({extrudedShape:n,extrudedOptions:{depth:t}});const i=this.createGeometry(n),s=this.createMaterials();this._mesh=new e.Mesh(i,s),this._mesh.rotation.x=-Math.PI/2,this._mesh.rotation.y=-Math.PI,this._mesh.rotation.z=-Math.PI,this._mesh.castShadow=!0,this.object3d.add(this._mesh),this.updateFillStyle(),this.updateStrokeStyle()}createGeometry(t){const n=this.effectiveDepth,{lineWidth:r=0}=this.component.state,i={steps:1,depth:n,bevelEnabled:r>0,bevelThickness:0,bevelSize:r,bevelSegments:1,UVGenerator:this.boundUVGenerator},s=new e.ExtrudeGeometry(t,i);return s.center(),s}createMaterials(){const t=zh(this.component.state.material3d),n=new e.MeshStandardMaterial;jh(n,t);const r=new e.MeshStandardMaterial;return jh(r,t),[n,r]}createTexture(){const{width:t,height:n}=this.component.bounds,r=Ag(t),i=Ag(n),s=vh(r,i);this.component.render(s.getContext("2d"));const o=new e.CanvasTexture(s);return o.needsUpdate=!0,o.wrapS=e.RepeatWrapping,o.wrapT=e.RepeatWrapping,o.offset.set(0,1-n/i),o.repeat.set(t/r,n/i),o.minFilter=e.LinearFilter,o}getMaterials(){if(!this._mesh)return;const t=this._mesh.material;return Array.isArray(t)?t:void 0}updateMaterial3d(){super.updateMaterial3d();const t=this.getMaterials();if(!t)return;const e=zh(this.component.state.material3d);for(const n of t)jh(n,e)}updateAlpha(){const{alpha:t=1,fillStyle:e,strokeStyle:n}=this.component.state,r=this.getMaterials();r&&(Ah(r[0],t,e),Ah(r[1],t,n))}updateStrokeStyle(){const t=this.getMaterials();if(!t)return;const{strokeStyle:e}=this.component.state;t[1].color.set(Eh(e))}updateFillStyle(){this._applyCapTexture()}updateText(){this._applyCapTexture()}_applyCapTexture(){const t=this.getMaterials();if(!t)return;const e=t[0],{fillStyle:n}=this.component.state,r=this.component.hasTextProperty?this.component.text:"";if(!r){const t=Yh.buildFillStyleTexture(this.component);return t?(e.map&&e.map.dispose(),e.map=t,e.color.set(16777215)):(e.map&&(e.map.dispose(),e.map=null),e.color.set(Eh(n))),void(e.needsUpdate=!0)}const{width:i,height:s,bold:o=!1,italic:a=!1,fontFamily:c="Serif",fontSize:l=10,fontColor:h="black",textAlign:d="center",textBaseline:u="middle"}=this.component.state,p=Math.abs(i)||1,f=Math.abs(s)||1,g={bold:o,italic:a,fontFamily:c,fontSize:l,fontColor:h,textAlign:d,textBaseline:u,width:p,height:f,fillStyle:n};if("object"==typeof n&&"pattern"===n?.type&&n.image){return void Tg(this.component.app.url(n.image),r,p,f,g,n,t=>{e.map&&e.map.dispose(),e.map=t,e.color.set(16777215),e.needsUpdate=!0})}e.map&&e.map.dispose();const m=Cg(r,p,f,g);e.map=m,e.color.set(16777215),e.needsUpdate=!0}updateDimension(){super.updateDimension()}}class Rg extends jg{get shape(){const{cx:t=0,cy:n=0,rx:r=1,ry:i=1,startAngle:s=0,endAngle:o=2*Math.PI,anticlockwise:a=!1}=this.component.state,c=new e.EllipseCurve(t,n,Math.abs(r),Math.abs(i),s,o,a,0);return new e.Shape(c.getPoints(50))}}Xh("ellipse",t=>new Rg(t));class Fg extends jg{get shape(){const{width:t,height:n,round:r}=this.component.state,i=new e.Shape;if(r>0){const e=r/100*(t/2);i.moveTo(e,0),i.lineTo(t-e,0),i.quadraticCurveTo(t,0,t,e),i.lineTo(t,n-e),i.quadraticCurveTo(t,n,t-e,n),i.lineTo(e,n),i.quadraticCurveTo(0,n,0,n-e),i.lineTo(0,e),i.quadraticCurveTo(0,0,e,0)}else i.moveTo(0,0),i.lineTo(t,0),i.lineTo(t,n),i.lineTo(0,n),i.lineTo(0,0);return i}}Xh("rect",t=>new Fg(t));class Bg extends jg{get shape(){const{path:t=[],round:n=0}=this.component.state,r=new e.Shape;for(let e=0;e<t.length;e++){const i=t[(e-1+t.length)%t.length],s=t[(e+t.length)%t.length],o=t[(e+1)%t.length];if(i.x===s.x&&i.y===s.y)continue;let a=Math.sqrt((i.x-s.x)*(i.x-s.x)+(i.y-s.y)*(i.y-s.y)),c=0!==a?Math.atan2(i.x-s.x,i.y-s.y):0,l=Math.sin(c)*Math.min(n,a/2)+s.x,h=Math.cos(c)*Math.min(n,a/2)+s.y;const d=n>0||0!==a?{x:l,y:h}:s;a=Math.sqrt((o.x-s.x)*(o.x-s.x)+(o.y-s.y)*(o.y-s.y)),c=0!==a?Math.atan2(o.x-s.x,o.y-s.y):0,l=Math.sin(c)*Math.min(n,a/2)+s.x,h=Math.cos(c)*Math.min(n,a/2)+s.y;const u=n>0||0!==a?{x:l,y:h}:s;0==e?r.moveTo(d.x,d.y):r.lineTo(d.x,d.y),n>0&&r.quadraticCurveTo(s.x,s.y,u.x,u.y)}return r}get minMax(){if(!this._minMax){const{path:t}=this.component.state;let e,n,r,i;t.forEach((t,s)=>{if(0==s)return e=r=t.x,void(n=i=t.y);e=Math.min(e,t.x),r=Math.max(r,t.x),n=Math.min(n,t.y),i=Math.max(i,t.y)}),this._minMax={minX:e,minY:n,maxX:r,maxY:i}}return this._minMax}}Xh("polygon",t=>new Bg(t));class Ng extends jg{get shape(){const{cx:t=0,cy:n=0,rx:r=1,ry:i=1,ratio:s=50,startAngle:o=0,endAngle:a=2*Math.PI,anticlockwise:c=!1}=this.component.state,l=Math.abs(r),h=Math.abs(i),d=new e.EllipseCurve(t,n,l,h,o,a,c,0),u=new e.Shape(d.getPoints(50)),p=l/100*s,f=h/100*s;if(p>0&&f>0){const r=new e.EllipseCurve(t,n,p,f,o,a,c,0),i=new e.Path(r.getPoints(50));u.holes.push(i)}return u}}Xh("donut",t=>new Ng(t));class Hg extends jg{get shape(){const{x1:t=0,y1:n=0,x2:r=0,y2:i=0,x3:s=0,y3:o=0}=this.component.state,a=new e.Shape;return a.moveTo(t,n),a.lineTo(r,i),a.lineTo(s,o),a.closePath(),a}}Xh("triangle",t=>new Hg(t));class Vg extends jg{get shape(){const{ratio:t=30,wing:n=5,cx:r=0,cy:i=0,rx:s=1,ry:o=1}=this.component.state;if(n<3)return null;const a=Math.PI/2,c=2*Math.PI/n,l=s-t/100*s,h=o-t/100*o,d=new e.Shape;d.moveTo(r+s*Math.cos(-a),i+o*Math.sin(-a)),d.lineTo(r+(s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,i+(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let t=1;t<n;t++)d.lineTo(r+s*Math.cos(c*t-a),i+o*Math.sin(c*t-a)),d.lineTo(r+(s-l)*(Math.cos(c*(t+1)-a)+Math.cos(c*t-a))/2,i+(o-h)*(Math.sin(c*(t+1)-a)+Math.sin(c*t-a))/2);return d.closePath(),d}}Xh("star",t=>new Vg(t));const Yg={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/sphere"};class Gg extends Sg{buildGeometry(){const{rx:t=0,ry:n=0,rz:r}=this.component.state,i=r??t,s=new e.SphereGeometry(1,32,16);s.scale(t,i,n),this.object3d.geometry=s}updateDimension(){this.buildGeometry()}}let Ug=class extends af{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Gg(this)}get nature(){return Yg}};Ug=Lp([og("sphere")],Ug);const Wg={mutable:!1,resizable:!0,rotatable:!0,properties:[]};let Xg=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new wg(this)}get nature(){return Wg}};Xg=Lp([og("sprite")],Xg);const qg={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cube"};class Kg extends Sg{buildGeometry(){const{width:t=0,height:n=0,depth:r=0}=this.component.state,i=new e.BoxGeometry(1,1,1);i.scale(t,r,n),this.object3d.geometry=i}}let $g=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Kg(this)}get nature(){return qg}};$g=Lp([og("cube")],$g);const Qg={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cylinder"};class Zg extends Sg{buildGeometry(){const{rx:t=0,ry:n=0}=this.component.state,r=this.component.state.depth??1,i=new e.CylinderGeometry(1,1,1,25);i.scale(t||1,r||1,n||1),this.object3d.geometry=i}updateDimension(){this.buildGeometry()}}let Jg=class extends af{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Zg(this)}get nature(){return Qg}};Jg=Lp([og("cylinder")],Jg);const tm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"color",label:"box-color",name:"boxColor",property:"boxColor"}],help:"scene/component/banner"};class em extends Yh{build(){super.build();const{width:t=1,height:e=1,depth:n=1}=this.component.state;this.object3d.add(this.createCube(t,e,n));const r=this.createTextureBoard(t,n);r.position.set(0,0,.5*e+1),this.object3d.add(r)}createCube(t,n,r){const{boxColor:i="#ccaa76"}=this.component.state,s=zh(this.component.state.material3d),o=new e.BoxGeometry(t,r,n),a=new e.MeshStandardMaterial({color:i,side:e.FrontSide});jh(a,s);const c=new e.Mesh(o,a);return c.castShadow=s.castShadow,c.receiveShadow=s.receiveShadow,c}createTextureBoard(t,n){const r=zh(this.component.state.material3d),{fillStyle:i="#ccaa76"}=this.component.state,s=Yh.buildFillStyleTexture(this.component),o=new e.MeshStandardMaterial(s?{map:s}:{color:i||"#ccaa76",side:e.FrontSide});jh(o,r);const a=new e.PlaneGeometry(t,n,1,1),c=new e.Mesh(a,o);return c.castShadow=r.castShadow,c.receiveShadow=r.receiveShadow,c}updateMaterial3d(){super.updateMaterial3d();const t=zh(this.component.state.material3d);this.object3d.traverse(e=>{if(e.isMesh){const n=e.material;n&&jh(n,t),e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow}})}}let nm=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}get nature(){return tm}buildRealObject(){return new em(this)}};var rm;nm=Lp([og("banner")],nm);const im={far:1e5,fov:80,near:1,zoom:1},sm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"near",name:"near"},{type:"number",label:"far",name:"far"},{type:"number",label:"fov",name:"fov"},{type:"number",label:"zoom",name:"zoom"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/camera"};class om extends Yh{getObject3dInstance(){return new e.Mesh}updateCamera(){const{near:t=im.near,far:n=im.far,fov:r=im.fov,zoom:i=im.zoom,showHelper:s}=this.component.state;this.camera.far=n,this.camera.fov=r,this.camera.near=t,this.camera.zoom=i,s?this.helper||(this.helper=new e.CameraHelper(this.camera),this.object3d.add(this.helper)):this.helper&&(this.object3d.remove(this.helper),delete this.helper)}build(){super.build();const{width:t=0,height:n=0,depth:r=0,fillStyle:i="lightgray"}=this.component.state;this.object3d.geometry=new e.BoxGeometry(t,r,n),this.object3d.material=new e.MeshStandardMaterial({color:i,side:e.FrontSide}),this.camera=new e.PerspectiveCamera,this.camera.position.set(0,0,0),this.object3d.add(this.camera),this.object3d.lookAt(0,0,0),this.updateCamera()}}let am=rm=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}static get image(){return rm._image||(rm._image=new Image,rm._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1IAAANSAQMAAABV6G1EAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEX6+voBAQGV71ZvAAAFO0lEQVR42u3dMZLkNBiGYakUKFRIqKOISxDvETiCTBEQcgQOQE7clyAi8REm7KDXIhgYoMa/7fbIX+2K9w022MCP/25Z28GW5RwRERERERERERERERERERERERERERERERERERERERERERERERHRl9mv7fdPn7879sf8Mcq3J3r5EJXaUy3Wddrcd6qNybx9F2/lZ63H+nVCa9Oe9elZa5ksa/dDbE+3fsm4v27C89bd+i6W3l+XdcnSWtuxyvPW+hqorbWb0Jr7Pl3m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rnP9XPHKue7OeMDsuWInyx+Y67T1Yv0gs+cKvay6P5fvZZULrdnYFBbbcr2sdKF1MxbZFdZkLLItq3aay6/vJ102eusD2rJKl633nw/o3n+uxbrpLSv1svL6M95hQ3xYNz33t16sC21Zoc+28Xahm+u+Ic7WhbYs1+dRfrvQ5LpvHOaFNq3SZ8n/faEt6twDtli7wrJpxT6P1183/di0Ti36u3XT903Ld1qGrzf9smmdWhyTddNzf8t8UqdtK/dZGq8P2DZ1ZnHcrQ/osWO5PkvDuby7NE58Yctk7Qq3PSv3+bpc3F0aJ56wF+uLX9xu6eOb4es9z/vWc0vR3oZuByjnf2t/fP/54B/2WvvWEREREREREREREREREREREREREREREREREREREREREREREREREX2J/QlrTpqHD8xO1gAAAABJRU5ErkJggg=="),rm._image}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,rm.image,e,n,r,i)}buildRealObject(){return new om(this)}get nature(){return sm}};am=rm=Lp([og("camera")],am);const cm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"gltf-selector",label:"url",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"3d-model",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0,category:"application"},observe:function(t){this.parentNode.querySelector("[name=gltfInfo]").src=t;const e=this.parentNode.querySelector("[name=fillStyleTargets]");e&&(e.src=t);const n=this.parentNode.querySelector("[name=playTargets]");n&&(n.src=t)}},{type:"gltf-info",label:"",name:"gltfInfo",readonly:!0,property:{action:(t,e)=>{t._ratioLocking=!0;try{t.set(e)}finally{t._ratioLocking=!1}}},editor:{fullwidth:!0}},{type:"gltf-fill-targets",label:"fill-targets",name:"fillStyleTargets",editor:{fullwidth:!0}},{type:"gltf-play-targets",label:"play-targets",name:"playTargets",editor:{fullwidth:!0}}],"value-property":"source",help:"scene/component/gltf-object"};let lm=class extends(lc(ac)){constructor(){super(...arguments),this._ratioLocking=!1}get hasTextProperty(){return!1}is3dish(){return!0}get controls(){return[]}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath();const s=this._topViewSnapshot;if(s)t.drawImage(s,e,n,r,i);else{t.rect(e,n,r,i),t.fillStyle="#f0f0f0",t.fill(),t.strokeStyle="#999",t.lineWidth=1,t.stroke();const s=this.getState("src"),o=s&&s.split("/").pop()?.replace(/\.[^.]+$/,"")||"GLTF",a=Math.max(10,.12*Math.min(r,i));t.fillStyle="#666",t.font=`${a}px sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillText(o,e+r/2,n+i/2,.9*r)}}async ready(){await super.ready(),this._ensureTopViewSnapshot()}onchange(t,e){super.onchange(t,e),"src"in t&&(this._topViewSnapshot=void 0,this._ensureTopViewSnapshot())}_ensureTopViewSnapshot(){const t=this.getState("src");if(!t)return;const e=kp.getTopViewCache(t);if(e)return this._topViewSnapshot=e,void this.invalidate();const n=this.app.url(t);kp.loadGLTF(n).then(e=>{if(this.getState("src")!==t)return;const n=kp.getTopViewCache(t);if(n)return this._topViewSnapshot=n,void this.invalidate();const r=kp.renderTopView(e.scene);kp.setTopViewCache(t,r),this._topViewSnapshot=r,this.invalidate()})}buildRealObject(){return new kp(this)}get nature(){return cm}get source(){return this.getState("src")}set source(t){this.setState("src",t)}set dimension(t){const{width:e=1,height:n=1,depth:r=1}=t;this.setState({width:e,height:n,depth:r}),this.realObject?.updateDimension()}_applyRatioLock(t){if(!("width"in t||"height"in t||"depth"in t))return t;const e=this.state.width||1,n=this.state.height||1,r=this.state.depth||1,i=hd([(t.width??e)/e,(t.height??n)/n,(t.depth??r)/r]);return i?{...t,width:Math.round(e*i),height:Math.round(n*i),depth:Math.round(r*i)}:t}set(t,e){"string"==typeof t&&(t={[t]:e}),this.state.ratioLock&&!this._ratioLocking&&(this._ratioLocking=!0,t=this._applyRatioLock(t));try{return super.set(t)}finally{this._ratioLocking=!1}}setState(t,e){"string"==typeof t&&(t={[t]:e}),this.state.ratioLock&&!this._ratioLocking&&(this._ratioLocking=!0,t=this._applyRatioLock(t));try{return super.setState(t)}finally{this._ratioLocking=!1}}get play(){return!1!==this.getState("play")}set play(t){this.setState("play",t)}get nodes(){return this.getState("nodes")}set nodes(t){this.setState("nodes",t)}get animations(){return this.getState("animations")}set animations(t){this.setState("animations",t)}get playTargets(){return this.getState("playTargets")}set playTargets(t){this.setState("playTargets",t)}get fillStyleTargets(){return this.getState("fillStyleTargets")}set fillStyleTargets(t){this.setState("fillStyleTargets",t)}get nodeNames(){const t=this.realObject;return t?.nodeNames??[]}get animationNames(){const t=this.realObject;return t?.animationNames??[]}};lm=Lp([og("gltf-object")],lm);const hm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"light-type",name:"lightType",property:{options:["","point","directional"]}},{type:"number",label:"intensity",name:"intensity"},{type:"number",label:"distance",name:"distance"},{type:"number",label:"decay",name:"decay"},{type:"checkbox",label:"cast-shadow",name:"castShadow"},{type:"number",label:"near",name:"near",placeholder:"0.5"},{type:"number",label:"far",name:"far",placeholder:"1000"},{type:"number",label:"fov",name:"fov",placeholder:"90"},{type:"number",label:"zoom",name:"zoom",placeholder:"1"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/light"};class dm extends Yh{updatePointLight(){const{lightType:t="point",distance:n=0,intensity:r=10,decay:i=1,fillStyle:s="white",castShadow:o,near:a=.5,far:c=1e3,fov:l=90,zoom:h=1,showHelper:d}=this.component.state;if(this.object3d.color=new e.Color(s),"point"==t&&(this.object3d.distance=n,this.object3d.decay=i),this.object3d.intensity=r,this.object3d.castShadow=o,o){const t=this.object3d.shadow?.camera;t.far=c,t.near=a,t.fov=l,t.zoom=h}if(d){const t=this.object3d.shadow?.camera;this.helper||(this.helper=new e.CameraHelper(t),this.object3d.add(this.helper))}else this.helper&&(this.object3d.remove(this.helper),delete this.helper)}getObject3dInstance(){const{lightType:t="point"}=this.component.state;return"point"==t?new e.PointLight:new e.DirectionalLight}update(){this.clear(),this.build(),this.updateDimension(),this.updateHidden(),this.updatePointLight()}}let um=class extends af{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new dm(this)}get anchors(){return[]}get nature(){return hm}};um=Lp([og("light")],um);const pm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"}],help:"scene/component/wall"};class fm extends Sg{buildGeometry(){const{width:t=0,height:n=0,depth:r=0}=this.component.state,i=new e.BoxGeometry(1,1,1);i.scale(t,r,n),this.object3d.geometry=i}}let gm=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new fm(this)}get nature(){return pm}};function mm(t,e){return"none"===t?0:t.endsWith("arrow")?1.5*e:0}function ym(t,n,r,i){const s=[];for(let o=1;o<=i;o++){const a=o/i,c=1-a;s.push(new e.Vector3(c*c*t.x+2*c*a*n.x+a*a*r.x,c*c*t.y+2*c*a*n.y+a*a*r.y,c*c*t.z+2*c*a*n.z+a*a*r.z))}return s}gm=Lp([og("wall")],gm);class bm extends Yh{getObject3dInstance(){return new e.Group}get gizmoTransformable(){return!0}get syncZPosOffset(){return 0}syncFromObject3D(){}applyDimensionFromGizmo(t){}build(){super.build(),this._buildLine()}get smoothedPath(){const t=this.worldPath;if(t.length<2)return t;const{round:n=0}=this.component.state;if(n<=0||t.length<3)return t;const r=[];r.push(t[0]);for(let i=1;i<t.length;i++){const s=t[i-1],o=t[i],a=t[i+1];if(!a){r.push(o);break}const c=s.x-o.x,l=s.y-o.y,h=s.z-o.z,d=Math.sqrt(c*c+l*l+h*h),u=Math.min(n,d/2),p=a.x-o.x,f=a.y-o.y,g=a.z-o.z,m=Math.sqrt(p*p+f*f+g*g),y=Math.min(n,m/2),b=d>0?new e.Vector3(o.x+c/d*u,o.y+l/d*u,o.z+h/d*u):o.clone(),v=m>0?new e.Vector3(o.x+p/m*y,o.y+f/m*y,o.z+g/m*y):o.clone();r.push(b),r.push(...ym(b,o,v,8))}return r}_buildLine(){const t=this.smoothedPath;if(t.length<2)return;const{strokeStyle:n,lineWidth:r=2,alpha:i=1,lineDash:s,begin:o="none",beginSize:a="size5",end:c="none",endSize:l="size5"}=this.component.state,h=Math.max(r,1),d="string"==typeof n&&"transparent"!==n?Eh(n):"#000000",g=new e.Color(d),m=this._getResolution(),y=o,b=c,v=mm(y,h),_=mm(b,h),x=t[0],w=t[t.length-1],M=(new e.Vector3).subVectors(t[1],x).normalize(),S=(new e.Vector3).subVectors(t[t.length-2],w).normalize(),k=[...t];v>0&&(k[0]=x.clone().add(M.clone().multiplyScalar(v))),_>0&&(k[k.length-1]=w.clone().add(S.clone().multiplyScalar(_)));const A=new f;A.setPositions(k.flatMap(t=>[t.x,t.y,t.z]));const E=function(t,e){switch(t){case"round-dot":return{dashSize:e,gapSize:e};case"square-dot":return{dashSize:2*e,gapSize:e};case"dash":return{dashSize:4*e,gapSize:1.5*e};case"dash-dot":return{dashSize:4*e,gapSize:2*e};case"long-dash":return{dashSize:6*e,gapSize:3*e};case"long-dash-dot":return{dashSize:6*e,gapSize:2*e};case"long-dash-dot-dot":return{dashSize:6*e,gapSize:e};default:return null}}(s,h),C=new p({color:g.getHex(),linewidth:h,worldUnits:!0,transparent:i<1,opacity:i,resolution:m,dashed:!!E,dashSize:E?.dashSize??1,gapSize:E?.gapSize??1,dashScale:1});if(this._line2=new u(A,C),this._line2.computeLineDistances(),this.object3d.add(this._line2),"none"!==y){const t=wh(y,xh(a,h));if(t){const n=(new e.Quaternion).setFromUnitVectors(new e.Vector3(1,0,0),M.clone().negate());this._placeTip(t,x,n,g,i,m)}}if("none"!==b){const t=wh(b,xh(l,h));if(t){const n=(new e.Quaternion).setFromUnitVectors(new e.Vector3(1,0,0),S.clone().negate());this._placeTip(t,w,n,g,i,m)}}}_placeTip(t,e,n,r,i,s){const o=t.mesh||t.line2||t.group;if(o){if(o.position.copy(e),o.setRotationFromQuaternion(n),t.mesh){const e=t.mesh.material;e.color.copy(r),e.transparent=i<1,e.opacity=i}else if(t.line2){const e=t.line2.material;e.color.copy(r),e.transparent=i<1,e.opacity=i,e.resolution.copy(s)}else t.group&&t.group.traverse(t=>{if(t.material){const e=t.material;e.color&&e.color.copy(r),e.transparent=i<1,e.opacity=i,e.resolution&&e.resolution.copy(s)}});this.object3d.add(o)}}_getResolution(){const t=this.threeContainer?.renderer3d;if(t){return t.getSize(new e.Vector2)}return new e.Vector2(window.innerWidth,window.innerHeight)}onGizmoDragEnd(t){const e=this._component,n=e.path;if(!n||n.length<2)return;const r=this.object3d,{width:i=0,height:s=0}=e.parent?.bounds??{},{x:o,y:a}=e.center,c=r.position,l=r.rotation,h=r.scale,d=this.position;if(Math.abs(c.x-d.x)<.001&&Math.abs(c.y-d.y)<.001&&Math.abs(c.z-d.z)<.001&&Math.abs(l.x)<.001&&Math.abs(l.y)<.001&&Math.abs(l.z)<.001&&Math.abs(h.x-1)<.001&&Math.abs(h.y-1)<.001&&Math.abs(h.z-1)<.001)return;const u=bm.computeBakedPath(n,{x:o,y:a},{width:i,height:s},r);this._suppressOnchange=!0,e.set({rotation:0,rotationX:0,rotationY:0,zPos:0}),e.mutatePath(null,()=>u),this._suppressOnchange=!1,this.update()}static computeBakedPath(t,n,r,i){const s=r.width,o=r.height,a=n.x,c=n.y;return i.updateMatrixWorld(!0),t.map(t=>{const n=new e.Vector3(t.x-a,t.z||0,t.y-c).applyMatrix4(i.matrixWorld),r={x:n.x+s/2,y:n.z+o/2};return Math.abs(n.y)>.001&&(r.z=n.y),r})}updateStrokeStyle(){this.updateDimension()}updateAlpha(){this.updateDimension()}updateDimension(){this.clear(),this.build()}onchange(t,e){("path"in t||"from"in t||"to"in t)&&(this.updateDimension(),this.updatePosition()),("round"in t||"lineDash"in t||"lineWidth"in t||"begin"in t||"end"in t||"beginSize"in t||"endSize"in t)&&this.updateDimension(),super.onchange(t,e)}clear(){for(;this.object3d.children.length>0;){const t=this.object3d.children[0];this.object3d.remove(t),Bh(t)}return this._line2=void 0,super.clear()}}class vm extends bm{get worldPath(){const t=this.component.path;if(!t||t.length<2)return[];const{x:n,y:r}=this.component.center;return t.map(t=>new e.Vector3(t.x-n,t.z||0,t.y-r))}}Xh("line",t=>new vm(t));class _m extends bm{get worldPath(){const t=this.component.path;if(!t||t.length<2)return[];const{x:n,y:r}=this.component.center;return t.map(t=>new e.Vector3(t.x-n,t.z||0,t.y-r))}}Xh("polyline",t=>new _m(t));class xm extends Yh{build(){super.build()}update(){}}const wm={far:1e5,fov:80,near:1,zoom:1};class Mm extends Yh{build(){super.build()}update(){super.update(),this.updateCamera()}getObject3dInstance(){return new e.PerspectiveCamera}updateCamera(){const{near:t=wm.near,far:e=wm.far,fov:n=wm.fov,zoom:r=wm.zoom}=this.component.state;this.object3d.far=e,this.object3d.fov=n,this.object3d.near=t,this.object3d.zoom=r}}class Sm extends Yh{getObject3dInstance(){return new e.Group}}class km extends Sg{buildGeometry(){const{width:t,height:n}=this.component.state.dimension;this.object3d.geometry=new e.PlaneGeometry(t,n)}buildMaterial(){this.object3d.material=new e.MeshStandardMaterial({opacity:0,side:e.DoubleSide,blending:e.NoBlending})}}class Am extends Yh{getObject3dInstance(){return new e.Scene}dispose(){for(const t of this.object3d.children)Bh(t);this._animationMixer&&(this._animationMixer.stopAllAction(),this._animationMixer.uncacheRoot(this.object3d),this._animationMixer=void 0),super.dispose()}clear(){return this._floor&&(this.object3d.remove(this._floor),this._floor.material instanceof Array?this._floor.material.forEach(t=>t.dispose()):this._floor.material.dispose(),this._floor.geometry.dispose(),delete this._floor),super.clear()}get floor(){return this._floor}set floor(t){this._floor&&(this.object3d.remove(this._floor),this._floor.clear(),delete this._floor),t&&(this._floor=t,this.object3d.add(t)),this.component.invalidate()}build(){super.build(),this.floor=Jh(this.component)}updateTransform(){}updateDimension(){}updatePosition(){}updateRotate(){}updateScale(){}updateAlpha(){}updateHidden(){}get animationMixer(){return this._animationMixer||(this._animationMixer=new e.AnimationMixer(this.object3d)),this._animationMixer}}const Em={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"precision",name:"precision",property:{options:[{display:"High",value:"highp"},{display:"Medium",value:"mediump"},{display:"Low",value:"lowp"}]}},{type:"checkbox",label:"anti-alias",name:"antialias",property:"antialias"},{type:"checkbox",label:"3dmode",name:"threed",property:"threed"},{type:"checkbox",label:"auto-rotate",name:"autoRotate",property:"autoRotate"},{type:"checkbox",label:"debug",name:"debug",property:"debug"}],help:"scene/component/three-container"};let Cm=class extends Gp{constructor(){super(...arguments),this._capability=new xd}get sceneManager(){return this._capability.sceneManager}get cameraManager(){return this._capability.cameraManager}get rendererManager(){return this._capability.rendererManager}get lightManager(){return this._capability.lightManager}get controlsManager(){return this._capability.controlsManager}get eventManager(){return this._capability.eventManager}containable(t){return!0}is3dContainer(){return!0}getLightingConfig(){return{hemisphere:{skyColor:16777215,groundColor:14540253,intensity:1},directional:{color:16777215,intensity:1.2,attachToCamera:!0,castShadow:!1}}}getCss3DSceneAttribute(){return"three-container:css3d-renderer"}init_scene3d(){this._capability.isInitialized&&this._capability.destroy(),this._capability.init(this,{lightingConfig:this.getLightingConfig(),css3DSceneAttribute:this.getCss3DSceneAttribute(),skipEnvironment:!0,skipPostprocessing:!0,skipShadowMap:!0}),this._capability.buildOverlays(),this._capability.resize(),this.onchangeData&&this.onchangeData(this.data,this.data)}destroy_scene3d(){this.stop(),this._capability.destroy()}stop(){}resize(){this._capability.resize()}get scene3d(){return this._capability.isInitialized||this.init_scene3d(),this._capability.scene3d}get renderer3d(){return this._capability.renderer3d}get mixer(){return this._capability.mixer}get css3DScene(){return this._capability.css3DScene}get css3DRenderer(){return this._capability.css3DRenderer}render_threed(){this._capability.renderThreeD()}get _parentIs3dMode(){return!!this.rootModel?.is3dMode}render(t){this._parentIs3dMode||(this.app.isViewMode&&this.setState("threed",!0),!this.state.threed||this._capability.noSupportWebgl?super.render(t):this._capability.camera&&this._capability.renderCSS3D())}postrender(t){if(this._parentIs3dMode)return;const{left:e,top:n,debug:r,threed:i}=this.state;let{width:s,height:o}=this.bounds;if(s=Math.floor(s),o=Math.floor(o),i){if(this._capability.isInitialized||this.init_scene3d(),this._capability.noSupportWebgl)return void this._capability.showWebglNoSupportText(t,this.state.width,this.state.height);if(!this._capability.renderer3d)return;this._capability.renderThreeD();const i=this._capability.domElement;if(!i||!i.width||!i.height)return;t.drawImage(i,0,0,i.width,i.height,e,n,s,o),r&&this._capability.showDebugFPS(t)}else super.postrender(t)}dispose(){this._capability.dispose(),super.dispose()}get layout(){return gc.get("three")}get nature(){return Em}getObjectByRaycast(){return this._capability.getObjectByRaycast()}getObjectsByRaycast(){return this._capability.getObjectsByRaycast()}onchange(t,e){(t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&this._capability.destroy(),this._capability.onchange(t)}onmousedown(t){this._capability.onMouseDown(t)}onmouseup(t){this._capability.onMouseUp(t)}onmousemove(t){this._capability.onMouseMove(t)}onmouseleave(t){this._capability.onMouseLeave(t)}onwheel(t){this._capability.onWheel(t)&&this.invalidate()}ondblclick(t){this._capability.onDblClick(t)&&this.invalidate()}ondragstart(t){this._capability.onDragStart(t)}ondragmove(t){this._capability.onDragMove(t)&&this.invalidate()}ondragend(t){this._capability.onDragEnd(t)&&this.invalidate()}ontouchstart(t){this._capability.onTouchStart(t)}onpan(t){this._capability.onPan(t)&&this.invalidate()}ontouchend(t){this._capability.onTouchEnd(t)}onkeydown(t){this._capability.onKeyDown(t)}onpinch(t){this._capability.onPinch(t)&&this.invalidate()}ondoubletap(){this._capability.onDoubleTap(),this.invalidate()}};var Tm;Cm=Lp([og("3d-container")],Cm),qh(t=>{const e=t.state.material3d?.spriteMode;return"plane"===e?new Mg(t):new wg(t)}),function(t){t.compile=vl,t.duplicate=_l,t.select=za,t.match=Pa}(Tm||(Tm={})),Or.registerResidents(()=>({componentResidentsCount:oc.residentsCount,sceneResidentsCount:Op.residentsCount,referenceMapResidentsCount:lg.residentsCount,sceneResidents:oc.residents}));var Pm=Object.freeze({__proto__:null,AbsoluteLayout:yc,Animation:ra,AudioPlayer:Of,get Banner(){return nm},Banner3D:em,BoxSelectionManager:yd,get Camera(){return am},Camera3D:om,CameraBookmarkManager:md,CameraManager:nd,CardLayout:vc,Component:oc,Connectable:Id,Container:Gp,ContainerAbstract:jc,ControlsManager:od,get Cube(){return $g},Cube3D:Kg,get Cylinder(){return Jg},Cylinder3D:Zg,DEFAULT:Vi,DPPX:Bi,DataLagTracker:rp,DataSource:sg,Donut:Kf,DonutExtrude:Ng,Ellipse:af,EllipseExtrude:Rg,EventManager3D:ad,EventMap:Lu,FPS:yh,GESTURES:Ni,get GLTFObject(){return lm},GifView:Pf,GizmoManager:cd,GizmoOperationManager:dd,GlobalRef:Nf,Group:Lf,HTMLAbsoluteLayout:mc,HTMLOverlayContainer:Ff,HTMLOverlayElement:bf,ImageView:yf,InfoWindow:pc,InteractionManager:ud,KEYEVENTS:Hi,Layer:Rc,Layout:gc,LightManager:id,LightObject:dm,Line:sf,Line3D:vm,LinearHorizontalLayout:xc,LinearVerticalLayout:Mc,LoadTracker:sp,LoadingOverlay:xp,LocalRef:Rf,MATERIAL_PRESETS:Oh,MAX_UNDO_SIZE:30,MODE_ADD:3,MODE_EDIT:1,MODE_PASTE_DATABIND:5,MODE_PASTE_STYLE:4,MODE_SHIFT:2,MODE_VIEW:0,get Model(){return Tm},MoveHandle:Ic,NOTHING:Pi,Node:tg,OrthoLine:gf,PIXEL_RATIO:bh,Path:Gf,PlacementManager:pd,get PointLight(){return um},Polygon:hf,PolygonExtrude:Bg,Polyline:pf,Polyline3D:_m,Popup:Yf,RealObject:Yh,RealObjectCamera:Mm,RealObjectDomElement:Gh,RealObjectDomTexture:Og,RealObjectDummy:xm,RealObjectExtrude:jg,RealObjectGLTF:kp,RealObjectGroup:Sm,RealObjectLine:bm,RealObjectMesh:Sg,RealObjectPlane:km,RealObjectPlane2D:Mg,RealObjectScene:Am,RealObjectService:eg,RealObjectSprite:bg,RealObjectSprite2D:wg,RealObjectText:Dg,Rect:Rd,RectExtrude:Fg,RectPath:lc,ReferenceMap:lg,RendererManager:rd,RootContainer:ep,Ruler:Bd,SCALE_MIN:kh,SCENE_MODE:Ri,Scene:Op,SceneManager:ed,ScenePopup:Oc,SceneSearchEngine:Ep,ScriptLoader:mg,SearchOverlay:Tp,ServiceComponent:rg,Shape:ac,get Sphere(){return Ug},Sphere3D:Gg,get Sprite(){return Xg},Star:Zf,StarExtrude:Vg,TableLayout:Sc,Text:zf,ThreeCapability:xd,get ThreeContainer(){return Cm},TransitionEffect:Zu,Triangle:Wf,TriangleExtrude:Hg,UNIT_DIMENSION:Ch,UNIT_ROTATE:Dh,UNIT_SCALE:Th,UNIT_TRANSLATE:Ph,ValueHolder:ig,VertexGizmoManager:_d,get Wall(){return gm},Wall3D:fm,animate:na,applyAlpha:Ah,applyMaterial3dProps:jh,buildArrow3D:Sh,compile:sa,create:Ip,createCanvas:vh,createCanvasTexture:_g,createFloor:Jh,createRealObjectFor:Kh,debug:Kr,delta:ta,disposeObject3D:Bh,drawTextTexture:Eg,error:Xr,fontStyle:kg,initFontFamilyWatcher:Gi,inspector:yp,metrics:Or,opaqueColor:Eh,projectToScreen:Gc,registerDefaultRealObjectFactory:qh,registerRealObjectFactory:Xh,renderCanvasTexture:xg,resolveMaterial3d:zh,sceneComponent:og,stopFPSMeasure:mh,textBounds:Pg,textTexture:Cg,toThreeSide:Lh,updateDefaultFontFamily:Yi,version:yg,warn:qr});const Dm=globalThis;"undefined"==typeof globalThis||Dm.scene||(Dm.scene=Pm);export{yc as AbsoluteLayout,ra as Animation,Of as AudioPlayer,nm as Banner,em as Banner3D,yd as BoxSelectionManager,am as Camera,om as Camera3D,md as CameraBookmarkManager,nd as CameraManager,vc as CardLayout,oc as Component,Id as Connectable,Gp as Container,jc as ContainerAbstract,od as ControlsManager,$g as Cube,Kg as Cube3D,Jg as Cylinder,Zg as Cylinder3D,Vi as DEFAULT,Bi as DPPX,rp as DataLagTracker,sg as DataSource,Kf as Donut,Ng as DonutExtrude,af as Ellipse,Rg as EllipseExtrude,ad as EventManager3D,Lu as EventMap,yh as FPS,Ni as GESTURES,lm as GLTFObject,Pf as GifView,cd as GizmoManager,dd as GizmoOperationManager,Nf as GlobalRef,Lf as Group,mc as HTMLAbsoluteLayout,Ff as HTMLOverlayContainer,bf as HTMLOverlayElement,yf as ImageView,pc as InfoWindow,ud as InteractionManager,Hi as KEYEVENTS,Rc as Layer,gc as Layout,id as LightManager,dm as LightObject,sf as Line,vm as Line3D,xc as LinearHorizontalLayout,Mc as LinearVerticalLayout,sp as LoadTracker,xp as LoadingOverlay,Rf as LocalRef,Oh as MATERIAL_PRESETS,Fi as MAX_UNDO_SIZE,Ii as MODE_ADD,Oi as MODE_EDIT,ji as MODE_PASTE_DATABIND,Li as MODE_PASTE_STYLE,zi as MODE_SHIFT,Di as MODE_VIEW,Tm as Model,Ic as MoveHandle,Pi as NOTHING,tg as Node,gf as OrthoLine,bh as PIXEL_RATIO,Gf as Path,pd as PlacementManager,um as PointLight,hf as Polygon,Bg as PolygonExtrude,pf as Polyline,_m as Polyline3D,Yf as Popup,Yh as RealObject,Mm as RealObjectCamera,Gh as RealObjectDomElement,Og as RealObjectDomTexture,xm as RealObjectDummy,jg as RealObjectExtrude,kp as RealObjectGLTF,Sm as RealObjectGroup,bm as RealObjectLine,Sg as RealObjectMesh,km as RealObjectPlane,Mg as RealObjectPlane2D,Am as RealObjectScene,eg as RealObjectService,bg as RealObjectSprite,wg as RealObjectSprite2D,Dg as RealObjectText,Rd as Rect,Fg as RectExtrude,lc as RectPath,lg as ReferenceMap,rd as RendererManager,ep as RootContainer,Bd as Ruler,kh as SCALE_MIN,Ri as SCENE_MODE,Op as Scene,ed as SceneManager,Oc as ScenePopup,Ep as SceneSearchEngine,mg as ScriptLoader,Tp as SearchOverlay,rg as ServiceComponent,ac as Shape,Ug as Sphere,Gg as Sphere3D,Xg as Sprite,Zf as Star,Vg as StarExtrude,Sc as TableLayout,zf as Text,xd as ThreeCapability,Cm as ThreeContainer,Zu as TransitionEffect,Wf as Triangle,Hg as TriangleExtrude,Ch as UNIT_DIMENSION,Dh as UNIT_ROTATE,Th as UNIT_SCALE,Ph as UNIT_TRANSLATE,ig as ValueHolder,_d as VertexGizmoManager,gm as Wall,fm as Wall3D,na as animate,Ah as applyAlpha,jh as applyMaterial3dProps,Sh as buildArrow3D,sa as compile,Ip as create,vh as createCanvas,_g as createCanvasTexture,Jh as createFloor,Kh as createRealObjectFor,Kr as debug,ta as delta,Bh as disposeObject3D,Eg as drawTextTexture,Xr as error,kg as fontStyle,Gi as initFontFamilyWatcher,yp as inspector,Or as metrics,Eh as opaqueColor,Gc as projectToScreen,qh as registerDefaultRealObjectFactory,Xh as registerRealObjectFactory,xg as renderCanvasTexture,zh as resolveMaterial3d,og as sceneComponent,mh as stopFPSMeasure,Pg as textBounds,Cg as textTexture,Lh as toThreeSide,Yi as updateDefaultFontFamily,yg as version,qr as warn};
50
+ `,this.element)}catch(t){}}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}Np=new WeakMap,oc.memoize(Gp.prototype,"bounds",!0),oc.register("container",Gp);const Up=Math.sqrt(3),Wp=2;function Xp(t,e,n,r,i){const s=5+i,o=n.x,a=n.y,c=r.x,l=r.y;if(Math.abs(o-c)>s&&Math.abs(a-l)>s){const n=(l-a)/(c-o),r=a-n*o;if(Math.abs(e-(n*t+r))>s)return!1}let h,d,u,p;return o>c?(d=o,h=c):(d=c,h=o),a>l?(p=a,u=l):(p=l,u=a),!(d+5<t)&&(!(h-5>t)&&(!(p+5<e)&&!(u-5>e)))}function qp(t,e,n,r=2){for(let i=0;i<n.length-1;i++)if(Xp(t,e,n[i],n[i+1],r))return!0;return!1}function Kp(t,e,n,r){if("arrow"!=t.slice(-5))return n;const i=Math.atan2(r.y-n.y,r.x-n.x),s=1.5*e;return{x:n.x+Math.cos(i)*s,y:n.y+Math.sin(i)*s}}function $p(t,e,n){let{lineWidth:r=Wp,strokeStyle:i="#000000",lineCap:s=!1,alpha:o=1,begin:a="none",end:c="none",beginSize:l="size5",endSize:h="size5"}=n;if(("none"!=a||"none"!=c)&&(r=Number(r)||Wp,t.lineCap=s,t.lineWidth=r,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=o,"none"!=a&&Qp(t,e[0],e[1],r,a,Zp(l,r)),"none"!=c)){const n=e.length;Qp(t,e[n-1],e[n-2],r,c,Zp(h,r))}}function Qp(t,e,n,r,i,s){const{x:o,y:a}=e,c=Math.atan2(n.y-a,n.x-o);switch(t.beginPath(),t.translate(o,a),t.rotate(c),i){case"oval":t.ellipse(0,0,s.X,s.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-s.X,0),t.lineTo(0,-s.Y),t.lineTo(s.X,0),t.lineTo(0,s.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(Up*s.X,-s.Y),t.lineTo(Up*s.X,s.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Up*s.X,-s.Y),t.lineTo(-s.X/1.5+Up*s.X,0),t.lineTo(Up*s.X,s.Y),t.fill();break;case"open-arrow":t.moveTo(Up*s.X+r,-s.Y),t.lineTo(r,0),t.lineTo(Up*s.X+r,s.Y),t.stroke();break;case"cross":t.moveTo(-s.X,-s.Y),t.lineTo(s.X,s.Y),t.moveTo(s.X,-s.Y),t.lineTo(-s.X,s.Y),t.stroke()}t.rotate(-c),t.translate(-o,-a),t.closePath()}function Zp(t,e){const n={X:0,Y:0};switch(e*=1.2,t){case"size1":n.X=e,n.Y=e;break;case"size2":n.X=1.5*e,n.Y=e;break;case"size3":n.X=2*e,n.Y=e;break;case"size4":n.X=e,n.Y=1.5*e;break;case"size5":default:n.X=1.5*e,n.Y=1.5*e;break;case"size6":n.X=2*e,n.Y=1.5*e;break;case"size7":n.X=e,n.Y=2*e;break;case"size8":n.X=1.5*e,n.Y=2*e;break;case"size9":n.X=2*e,n.Y=2*e}return n}const Jp="N",tf="S",ef="E",nf="W";class rf{constructor({component:t,anchor:e,position:n,self:r}){this.component=t,this._anchorName=e,this._position=n,this.self=r}get position(){const t=this.anchor;if(t){const{position:e}=t,n=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(n.x,n.y)}return this._position}set position({x:t,y:e}){this._position={x:t,y:e}}get anchor(){return this.component?.findAnchor(this._anchorName)}get direction(){const t=this.component.bounds,e=this.anchor;if(!e)return ef;const n=e.position;return n.y<=t.top?Jp:n.y>=t.top+t.height?tf:n.x<=t.left?nf:ef}get boundaryPosition(){const t=this.anchor;if(t){let{position:e}=t,n=0,r=0;switch(this.direction){case tf:r=20;break;case Jp:r=-20;break;case nf:n=-20;break;default:n=20}e={x:e.x+n,y:e.y+r};const i=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(i.x,i.y)}}}class sf extends oc{isLine(){return!0}replaceRefids(t){["from","to"].forEach(e=>{const n=this.get(e);if(n?.component){const r=t.get(n.component)||n.component;this.set(e,{...n,component:r})}})}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:n}=this.getState("from")||{};if(!t)return;const r=this.root?.findByRefid?.(t);if(!r)return;this._fromEnd=new rf({component:r,fromto:"from",anchor:e,position:n,self:this})}return this._fromEnd}get from(){return this.getState("from")}set from(t){delete this._fromEnd,this.set("from",t)}get toEnd(){if(this.parent&&!this._toEnd){const{component:t,anchor:e,position:n}=this.getState("to")||{};if(!t)return;const r=this.root?.findByRefid?.(t);if(!r)return;this._toEnd=new rf({component:r,fromto:"to",anchor:e,position:n,self:this})}return this._toEnd}get to(){return this.getState("to")}set to(t){delete this._toEnd,this.set("to",t)}move({x:t,y:e},n){n&&(this.from={position:this._fromEnd?.position||this.getState("from")?.position||{x:0,y:0}},this.to={position:this._toEnd?.position||this.getState("to")?.position||{x:0,y:0}}),super.move({x:t,y:e})}render(t){const{begin:e="none",end:n="none",lineWidth:r,round:i=0}=this.state;let s=this.drawPath;$p(t,s,this.state),t.beginPath();const o=Kp(e,r,s[0],s[1]),a=Kp(n,r,s[s.length-1],s[s.length-2]);s=[o,...s.slice(1,-1),a];let c={x:o.x,y:o.y};t.moveTo(o.x,o.y);for(let e=1;e<s.length;e++){const n=c;c=s[e];const r=s[e+1];if(n.x===c.x&&n.y===c.y)continue;if(!r){t.lineTo(c.x,c.y);break}let o=Math.sqrt((n.x-c.x)*(n.x-c.x)+(n.y-c.y)*(n.y-c.y)),a=0!==o?Math.atan2(n.x-c.x,n.y-c.y):0,l=Math.sin(a)*Math.min(i,o/2)+c.x,h=Math.cos(a)*Math.min(i,o/2)+c.y;const d=i>0||0!==o?{x:l,y:h}:c;o=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y)),a=0!==o?Math.atan2(r.x-c.x,r.y-c.y):0,l=Math.sin(a)*Math.min(i,o/2)+c.x,h=Math.cos(a)*Math.min(i,o/2)+c.y;const u=i>0||0!==o?{x:l,y:h}:c;t.lineTo(d.x,d.y),i>0&&t.quadraticCurveTo(c.x,c.y,u.x,u.y)}this.drawStroke(t,void 0)}contains(t,e){const{lineWidth:n}=this.state;return qp(t,e,this.drawPath,n)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state,{x1:n,y1:r,x2:i,y2:s}=this.state;return[this.fromEnd?.position||t?.position||{x:n,y:r},this.toEnd?.position||e?.position||{x:i,y:s}]}set path(t){const[e,n]=t,{from:r,to:i}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...r,position:e},to:{...i,position:n}})}get textBounds(){const t=this.drawPath;let e,n,r=0;for(let i=1;i<t.length;i++){const s=t[i-1],o=t[i],a=(s.x-o.x)*(s.x-o.x)+(s.y-o.y)*(s.y-o.y);a>r&&(r=Math.ceil(a),e=s,n=o)}let{paddingTop:i,paddingLeft:s,paddingRight:o,paddingBottom:a}=this.state;return a||=0,i||=0,s||=0,o||=0,{left:Math.min(e.x,n.x)+s,top:Math.min(e.y,n.y)+i,width:Math.max(Math.abs(e.x-n.x)-s-o,0),height:Math.max(Math.abs(e.y-n.y)-i-a,0)}}get decorators(){return this.app.isEditMode?["decotag"]:[]}}sf.getTipNeckPos=Kp,sf.containedInPath=qp,sf.drawEndTips=$p,oc.register("line",sf);const of={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"angle",label:"start-angle",name:"startAngle",property:"startAngle"},{type:"angle",label:"end-angle",name:"endAngle",property:"endAngle"}],"value-property":"text"};class af extends(Id(ac)){is3dish(){return!0}render(t){const{cx:e,cy:n,rx:r,ry:i,startAngle:s,endAngle:o,anticlockwise:a}=this.state;t.beginPath(),t.ellipse(e,n,Math.abs(r),Math.abs(i),0,s||0,o||2*Math.PI,a),void 0!==s&&void 0!==o&&(t.lineTo(e,n),t.closePath())}get path(){const{cx:t,cy:e,rx:n,ry:r}=this.state;return[{x:t-n,y:e-r},{x:t+n,y:e-r},{x:t+n,y:e+r},{x:t-n,y:e+r}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2,rx:(n.x-e.x)/2,ry:(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:r,rx:i,ry:s}=this.state,o=(t-n)/(2*i-.5),a=(e-r)/(2*s-.5);return o*o+a*a<.25}outline(t){return function(t,e){const{cx:n,cy:r,rx:i,ry:s}=t.model,o=2*Math.PI*e,a=n+i*Math.cos(o),c=r+s*Math.sin(o);return t.toScene(a,c)}(this,t)}get anchors(){return function(t){const{left:e,top:n,width:r,height:i}=t.bounds,s=e+r/2,o=n+i/2;return[{name:"TOP",position:{x:s,y:n}},{name:"RIGHT",position:{x:e+r,y:o}},{name:"BOTTOM",position:{x:s,y:n+i}},{name:"LEFT",position:{x:e,y:o}}]}(this)}get nature(){return of}}oc.memoize(af.prototype,"path",!1),oc.register("ellipse",af);const cf={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e+1,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){n[e+1]=t})},ondragend:function(t,e,n){}},lf={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polygon"};class hf extends ac{is3dish(){return!0}get mutable(){return!0}get pathExtendable(){return!0}get path(){return this.state.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let r=!1;return n.forEach((i,s)=>{const o=(s+n.length+1)%n.length,a=i.x,c=i.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(r=!r)}),r}get controls(){const t=this.path;return t.map((e,n)=>{const r=t[n+1>=t.length?0:n+1];return{x:(e.x+r.x)/2,y:(e.y+r.y)/2,handler:cf}})}get nature(){return lf}}oc.memoize(hf.prototype,"controls",!1),oc.register("polygon",hf);const df={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){n[e]=t})},ondragend:function(t,e,n){}},uf={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polyline"};class pf extends sf{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:n}=this.state;return[this.fromEnd?.position||t?.position||n[0],...n.slice(1,-1),this.toEnd?.position||e?.position||n[n.length-1]]}set path(t){const{from:e,to:n}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...n,position:t[t.length-1]},path:t})}get controls(){const t=this.path,e=[];for(let n=0;n<t.length-1;n++){const r=t[n],i=t[n+1];0==n&&e.push({x:r.x,y:r.y,handler:df}),e.push({x:(r.x+i.x)/2,y:(r.y+i.y)/2,handler:df}),n==t.length-2&&e.push({x:i.x,y:i.y,handler:df})}return e}get nature(){return uf}}oc.register("polyline",pf);const ff={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/ortholine"};class gf extends sf{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:n,direction:r,boundaryPosition:i=t}=this.fromEnd||{},{component:s,direction:o,boundaryPosition:a=e}=this.toEnd||{},c=[i,a],l=[];i&&l.push(i);let h,d=n?.bounds;d&&(h=n.toScene(d.left,d.top),h=this.transcoordT2P(h.x,h.y),d={...d,left:h.x,top:h.y});const u=d?{left:d.left-20,top:d.top-20,width:d.width+40,height:d.height+40}:{left:i.x,top:i.y,width:0,height:0};d=d||u;let p=s?.bounds;p&&(h=s.toScene(p.left,p.top),h=this.transcoordT2P(h.x,h.y),p={...p,left:h.x,top:h.y});const f=p?{left:p.left-20,top:p.top-20,width:p.width+40,height:p.height+40}:{left:a.x,top:a.y,width:0,height:0};p=p||f;const g=[u,f],m=u.left>f.left?f.left:u.left,y=u.top>f.top?f.top:u.top,b={left:m,top:y,width:u.left+u.width>f.left+f.width?u.left+u.width-m:f.left+f.width-m,height:u.top+u.height>f.top+f.height?u.top+u.height-y:f.top+f.height-y};let v,_,x,w,M,S,k,A,E,C,T=0,P=0;d.left+d.width<p.left?(w=0,M=1,E=r,C=o,v=(d.left+d.width+p.left)/2,T=p.left-v):p.left+p.width<d.left&&(w=1,M=0,E=o,C=r,v=(d.left+p.width+p.left)/2,T=d.left-v),d.top+d.height<p.top?(x=0,S=1,k=r,A=o,_=(d.top+d.height+p.top)/2,P=p.top-_):p.top+p.height<d.top&&(x=1,S=0,k=o,A=r,_=(d.top+p.height+p.top)/2,P=d.top-_);const D=[];if(v&&T>P){let t,e,n;switch(C){case nf:switch(E){case ef:D.push({x:v,y:c[w].y}),D.push({x:v,y:c[M].y});break;case nf:t=g[w].top+g[w].height/2,e=t>c[M].y?Math.min(g[w].top,c[M].y):Math.max(g[w].top+g[w].height,c[M].y),D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:c[M].y});break;case Jp:case tf:e=E===tf?Math.max(c[w].y,c[M].y):Math.min(c[w].y,c[M].y),D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:c[M].y});break;default:return this.path}break;case ef:switch(E){case ef:e=c[w].y<c[M].y?Math.min(g[M].top,c[w].y):Math.max(g[M].top+g[M].height,c[w].y),n=e;break;case nf:e=void 0!==_?_:c[w].y<c[M].y?b.top-.5*T:b.top+b.height+.5*T,n=e;break;case tf:e=void 0!==_?Math.max(_,c[w].y):b.top+b.height,n=e;break;case Jp:e=_?Math.min(_,g[w].top):b.top,n=e;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:n}),D.push({x:c[M].x,y:n});break;case tf:switch(E){case ef:e=c[w].y,n=c[w].y>c[M].y?c[w].y:g[M].top+g[M].height;break;case nf:e=_?Math.max(_,g[M].top+g[M].height):b.top+b.height,n=e;break;case tf:e=b.top+b.height,n=e;break;case Jp:e=_?Math.min(_,g[w].top):g[w].top,n=_?Math.max(_,g[M].top+g[M].height):g[M].top+g[M].height;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:n}),D.push({x:c[M].x,y:n});break;case Jp:switch(E){case ef:e=c[w].y,n=c[w].y<c[M].y?c[w].y:g[M].top;break;case nf:e=_?Math.min(_,g[M].top):b.top,n=e;break;case tf:e=void 0!==_?Math.max(_,c[w].y):c[w].y,n=void 0!==_?Math.min(_,c[M].y):c[M].y;break;case Jp:e=b.top,n=e;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:v,y:e}),D.push({x:v,y:n}),D.push({x:c[M].x,y:n});break;default:return this.path}l.push(...0===w?D:D.reverse())}else if(_){let t,e,n;switch(A){case Jp:switch(k){case tf:D.push({x:c[x].x,y:_}),D.push({x:c[S].x,y:_});break;case Jp:t=g[x].left+g[x].width/2,e=t>c[S].x?Math.min(g[x].left,c[S].x):Math.max(g[x].left+g[x].width,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:c[S].x,y:_});break;case nf:e=Math.min(c[x].x,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:c[S].x,y:_});break;case ef:e=Math.max(c[x].x,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:c[S].x,y:_});break;default:return this.path}break;case tf:switch(k){case nf:e=b.left,n=e;break;case ef:e=void 0!==v?Math.max(v,c[x].x):b.left+b.width,n=e;break;case Jp:e=void 0!==v?v:c[x].x<c[S].x?b.left-.5*P:b.left+b.width+.5*P,n=e;break;case tf:e=c[x].x,n=c[x].x<c[S].x?Math.min(g[S].left,c[x].x):Math.max(g[S].left+g[S].width,c[x].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:n,y:_}),D.push({x:n,y:c[S].y});break;case ef:switch(k){case nf:e=void 0!==v?Math.min(v,c[x].x):c[x].x,n=void 0!==v?Math.max(v,c[S].x):c[S].x;break;case ef:e=b.left+b.width,n=e;break;case Jp:e=void 0!==v?Math.max(v,c[S].x):b.left+b.width,n=e;break;case tf:e=c[x].x,n=Math.max(g[S].left+g[S].width,c[x].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:n,y:_}),D.push({x:n,y:c[S].y});break;case nf:switch(k){case nf:e=b.left,n=e;break;case ef:e=void 0!==v?Math.max(v,c[x].x):c[x].x,n=void 0!==v?Math.min(v,c[S].x):c[S].x;break;case Jp:e=b.left,n=e;break;case tf:e=c[x].x<c[S].x?Math.min(g[S].left,c[x].x):c[x].x,n=Math.min(e,c[S].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:_}),D.push({x:n,y:_}),D.push({x:n,y:c[S].y});break;default:return this.path}l.push(...0===x?D:D.reverse())}else{let t,e;switch(r){case Jp:switch(o){case Jp:e=b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case tf:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top+b.height}),l.push({x:c[1].x,y:b.top+b.height});break;case ef:t=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;case nf:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case tf:switch(o){case Jp:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top}),l.push({x:c[1].x,y:b.top});break;case tf:case ef:case nf:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;case nf:switch(o){case Jp:t=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:b.left,e=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(b.top,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case tf:t=b.left,e=Math.max(b.top+b.height,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case ef:t=b.left+b.width,l.push({x:c[0].x,y:b.top}),l.push({x:t,y:b.top}),l.push({x:t,y:c[1].y});break;case nf:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case ef:switch(o){case Jp:e=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case tf:e=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case ef:case nf:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;default:return this.path}}return a&&l.push(a),[t,...l,e].filter((t,e,n)=>{if(0===e)return!0;const r=n[e-1];return t.x!==r.x||t.y!==r.y}).filter((t,e,n)=>{if(0===e||e>=n.length-1)return!0;const r=n[e-1],i=n[e+1];return!(t.x===r.x&&t.x===i.x||t.y===r.y&&t.y===i.y)})}get nature(){return ff}}oc.register("ortholine",gf);const mf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"image-src",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"scene-image",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0}},{type:"select",label:"cross-origin",name:"crossOrigin",property:{options:["","anonymous","use-credentials"]}}],"value-property":"src",help:"scene/component/image-view"};class yf extends(lc(ac)){static get noimage(){return yf.NOIMAGE||(yf.NOIMAGE=new Image,yf.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),yf.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){const{left:e,top:n,width:r,height:i,isGray:s=!1,alpha:o=1,src:a}=this.state;if(this.prepareIf(!this._image&&a),t.beginPath(),t.globalAlpha*=o,this._image&&this._image.complete)if(s&&this._offcanvas)t.drawImage(this._offcanvas,e,n,r,i);else try{t.drawImage(this._image,e,n,r,i)}catch(s){t.drawImage(yf.noimage,e,n,r,i)}else!this.app.isViewMode&&t.drawImage(yf.noimage,e,n,r,i)}get nature(){return mf}get hasTextProperty(){return!1}async ready(){await super.ready();const{src:t}=this.state;if(!this._image&&t){const e=this.root?.app?.loadTracker;if(e){const n=new Promise((t,e)=>{this.prepare(()=>t(),t=>e(t))});e.track(`image:${t}`,"image",t,n)}else this.prepareIf(!0)}}prepare(t,e){const{src:n,crossOrigin:r}=this.state;if(n){this._image=new Image;try{r&&(this._image.crossOrigin=r),this._image.src=this.app.url(n)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){const t=this._image.width,e=this._image.height;this._offcanvas=oc.createCanvas(t,e);const n=this._offcanvas.getContext("2d");n.drawImage(this._image,0,0);const r=function(t,e,n){let r;try{r=t.getImageData(0,0,e,n)}catch(t){return Xr("Get Image Data Error: "+(t instanceof Error?t.message:String(t))),null}const i=r.data;for(let t=0;t<e*n*4;t+=4){const e=i[t],n=i[t+1],s=i[t+2],o=Math.floor((e+n+s)/3);r.data[t]=o,r.data[t+1]=o,r.data[t+2]=o}return r}(n,t,e);n.putImageData(r,0,0)}t(this)},this._image.onerror=t=>{this._image&&!this._image.currentSrc&&(this._image=null),e(t)}}else t(this)}get src(){return this.get("src")}set src(t){this.set("src",t)}onchange(t,e){(t.hasOwnProperty("src")||t.hasOwnProperty("isGray"))&&(this._offcanvas=null,this._image=null,this.prepareIf(t.src))}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("image/"))return void(this.src=e[n])}}oc.register("image-view",yf);class bf extends(Bp(lc(oc))){is3dish(){return!0}prerender(){}}var vf,_f,xf={},wf={},Mf={};function Sf(){if(_f)return wf;_f=1,Object.defineProperty(wf,"__esModule",{value:!0});var t=function(){if(vf)return Mf;vf=1,Object.defineProperty(Mf,"__esModule",{value:!0});var t=function(){function t(){}return t.bitsToNum=function(t){return t.reduce(function(t,e){return 2*t+e},0)},t.byteToBitArr=function(t){for(var e=[],n=7;n>=0;n--)e.push(!!(t&1<<n));return e},t.lzwDecode=function(t,e){for(var n,r,i=0,s=function(t){for(var n=0,r=0;r<t;r++)e.charCodeAt(i>>3)&1<<(7&i)&&(n|=1<<r),i++;return n},o=[],a=1<<t,c=a+1,l=t+1,h=[],d=function(){h=[],l=t+1;for(var e=0;e<a;e++)h[e]=[e];h[a]=[],h[c]=null};;)if(r=n,(n=s(l))!==a){if(n===c)break;if(n<h.length)r!==a&&h.push(h[r].concat(h[n][0]));else{if(n!==h.length)throw new Error("Invalid LZW code.");h.push(h[r].concat(h[r][0]))}o.push.apply(o,h[n]),h.length===1<<l&&l<12&&l++}else d();return o},t}();return Mf.SuperGifUtils=t,Mf}(),e=function(){function e(t,e){this.stream=t,this.handler=e}return e.prototype.parseCT=function(t){for(var e=[],n=0;n<t;n++)e.push(this.stream.readBytes(3));return e},e.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},e.prototype.parseHeader=function(){var e={};if(e.sig=this.stream.read(3),e.ver=this.stream.read(3),"GIF"!==e.sig)throw new Error("Not a GIF file.");e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.gctFlag=n.shift(),e.colorRes=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.sorted=n.shift(),e.gctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.bgColor=this.stream.readByte(),e.pixelAspectRatio=this.stream.readByte(),e.gctFlag&&(e.gct=this.parseCT(1<<e.gctSize+1)),this.handler.hdr&&this.handler.hdr(e)},e.prototype.parseExt=function(e){var n=this;switch(e.label=this.stream.readByte(),e.label){case 249:e.extType="gce",function(e){n.stream.readByte();var r=t.SuperGifUtils.byteToBitArr(n.stream.readByte());e.reserved=r.splice(0,3),e.disposalMethod=t.SuperGifUtils.bitsToNum(r.splice(0,3)),e.userInput=r.shift(),e.transparencyGiven=r.shift(),e.delayTime=n.stream.readUnsigned(),e.transparencyIndex=n.stream.readByte(),e.terminator=n.stream.readByte(),n.handler.gce&&n.handler.gce(e)}(e);break;case 254:e.extType="com",function(t){t.comment=n.readSubBlocks(),n.handler.com&&n.handler.com(t)}(e);break;case 1:e.extType="pte",function(t){n.stream.readByte(),t.ptHeader=n.stream.readBytes(12),t.ptData=n.readSubBlocks(),n.handler.pte&&n.handler.pte(t)}(e);break;case 255:e.extType="app",function(t){n.stream.readByte(),t.identifier=n.stream.read(8),t.authCode=n.stream.read(3),"NETSCAPE"===t.identifier?function(t){n.stream.readByte(),t.unknown=n.stream.readByte(),t.iterations=n.stream.readUnsigned(),t.terminator=n.stream.readByte(),n.handler.app&&n.handler.app.NETSCAPE&&n.handler.app.NETSCAPE(t)}(t):function(t){t.appData=n.readSubBlocks(),n.handler.app&&n.handler.app[t.identifier]&&n.handler.app[t.identifier](t)}(t)}(e);break;default:e.extType="unknown",function(t){t.data=n.readSubBlocks(),n.handler.unknown&&n.handler.unknown(t)}(e)}},e.prototype.parseImg=function(e){e.leftPos=this.stream.readUnsigned(),e.topPos=this.stream.readUnsigned(),e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.lctFlag=n.shift(),e.interlaced=n.shift(),e.sorted=n.shift(),e.reserved=n.splice(0,2),e.lctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.lctFlag&&(e.lct=this.parseCT(1<<e.lctSize+1)),e.lzwMinCodeSize=this.stream.readByte();var r=this.readSubBlocks();e.pixels=t.SuperGifUtils.lzwDecode(e.lzwMinCodeSize,r),e.interlaced&&(e.pixels=function(t,e){for(var n=new Array(t.length),r=t.length/e,i=function(r,i){var s=t.slice(i*e,(i+1)*e);n.splice.apply(n,[r*e,e].concat(s))},s=[0,4,2,1],o=[8,8,4,2],a=0,c=0;c<4;c++)for(var l=s[c];l<r;l+=o[c])i(l,a),a++;return n}(e.pixels,e.width)),this.handler.img&&this.handler.img(e)},e.prototype.parseBlock=function(){var t={};switch(t.sentinel=this.stream.readByte(),String.fromCharCode(t.sentinel)){case"!":t.type="ext",this.parseExt(t);break;case",":t.type="img",this.parseImg(t);break;case";":t.type="eof",this.handler.eof&&this.handler.eof(t);break;default:throw new Error("Unknown block: 0x"+t.sentinel.toString(16))}"eof"!==t.type&&setTimeout(this.parseBlock.bind(this),0)},e.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},e}();return wf.SuperGifParser=e,wf}var kf,Af,Ef={};var Cf=function(){if(Af)return xf;Af=1,Object.defineProperty(xf,"__esModule",{value:!0});var t=Sf(),e=function(){if(kf)return Ef;kf=1,Object.defineProperty(Ef,"__esModule",{value:!0});var t=function(){function t(t){this.data=t,this.position=0}return t.prototype.readByte=function(){if(this.position>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.position++]:255&this.data.charCodeAt(this.position++)},t.prototype.readBytes=function(t){for(var e=[],n=0;n<t;n++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",n=0;n<t;n++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();return Ef.SuperGifStream=t,Ef}(),n=function(){function n(t,e){var n=this;for(var r in this.gifImgElement=t,this.options={autoPlay:!0},this.loading=!1,this.ready=!1,this.transparency=null,this.delay=null,this.disposalMethod=null,this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,this.playing=!0,this.forward=!0,this.ctxScaled=!1,this.frames=[],this.frameOffsets=[],this.initialized=!1,this.currentFrameIndex=-1,this.iterationCount=0,this.stepping=!1,this.handler={hdr:this.withProgress(this.doHdr.bind(this)),gce:this.withProgress(this.doGCE.bind(this)),com:this.withProgress(this.doNothing.bind(this)),app:{NETSCAPE:this.withProgress(this.doNothing.bind(this))},img:this.withProgress(this.doImg.bind(this)),eof:function(){n.pushFrame(),n.canvas.width=n.hdr.width*n.getCanvasScale(),n.canvas.height=n.hdr.height*n.getCanvasScale(),n.playerInit(),n.loading=!1,n.ready=!0,n.loadCallback&&n.loadCallback(n.gifImgElement)}},e)this.options[r]=e[r];this.onEndListener=e.onEnd,this.loopDelay=e.loopDelay||0,this.overrideLoopMode=null!=e.loopMode?e.loopMode:"auto",this.drawWhileLoading=null==e.drawWhileLoading||e.drawWhileLoading}return n.prototype.init=function(){var t=this.gifImgElement.parentNode,e=document.createElement("div");this.canvas=document.createElement("canvas"),this.canvasContext=this.canvas.getContext("2d"),this.tmpCanvas=document.createElement("canvas"),e.className=this.options.enclosingClass||"super-gif",e.appendChild(this.canvas),t&&(t.insertBefore(e,this.gifImgElement),t.removeChild(this.gifImgElement)),this.initialized=!0},n.prototype.loadSetup=function(t){return!this.loading&&(t&&(this.loadCallback=t),this.loading=!0,this.frames=[],this.clear(),this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,!0)},n.prototype.completeLoop=function(){this.onEndListener&&this.onEndListener(this.gifImgElement),this.iterationCount++,!1!==this.overrideLoopMode||this.iterationCount<0?this.doStep():(this.stepping=!1,this.playing=!1)},n.prototype.doStep=function(){if(this.stepping=this.playing,this.stepping){this.stepFrame(1);var t=10*this.frames[this.currentFrameIndex].delay;t||(t=100),0===this.getNextFrameNo()?(t+=this.loopDelay,setTimeout(this.completeLoop.bind(this),t)):setTimeout(this.doStep.bind(this),t)}},n.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},n.prototype.putFrame=function(){var t;this.currentFrameIndex=parseInt(this.currentFrameIndex.toString(),10),this.currentFrameIndex>this.frames.length-1&&(this.currentFrameIndex=0),this.currentFrameIndex<0&&(this.currentFrameIndex=0),t=this.frameOffsets[this.currentFrameIndex],this.tmpCanvas.getContext("2d").putImageData(this.frames[this.currentFrameIndex].data,t.x,t.y),this.canvasContext.globalCompositeOperation="copy",this.canvasContext.drawImage(this.tmpCanvas,0,0)},n.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},n.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},n.prototype.parseStream=function(e){try{new t.SuperGifParser(e,this.handler).parse()}catch(t){this.handleError("parse")}},n.prototype.setSizes=function(t,e){this.canvas.width=t*this.getCanvasScale(),this.canvas.height=e*this.getCanvasScale(),this.tmpCanvas.width=t,this.tmpCanvas.height=e,this.tmpCanvas.style.width=t+"px",this.tmpCanvas.style.height=e+"px",this.tmpCanvas.getContext("2d").setTransform(1,0,0,1,0,0)},n.prototype.drawError=function(){this.canvasContext.fillStyle="black",this.canvasContext.fillRect(0,0,this.hdr.width,this.hdr.height),this.canvasContext.strokeStyle="red",this.canvasContext.lineWidth=3,this.canvasContext.moveTo(0,0),this.canvasContext.lineTo(this.hdr.width,this.hdr.height),this.canvasContext.moveTo(0,this.hdr.height),this.canvasContext.lineTo(this.hdr.width,0),this.canvasContext.stroke()},n.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},n.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},n.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},n.prototype.pushFrame=function(){this.frame&&(this.frames.push({data:this.frame.getImageData(0,0,this.hdr.width,this.hdr.height),delay:this.delay}),this.frameOffsets.push({x:0,y:0}))},n.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var n=this.frames.length,r=t.lctFlag?t.lct:this.hdr.gct;n>0&&(3===this.lastDisposalMethod?null!==this.disposalRestoreFromIdx?this.frame.putImageData(frames[this.disposalRestoreFromIdx].data,0,0):this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height):this.disposalRestoreFromIdx=n-1,2===this.lastDisposalMethod&&this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height));var i=this.frame.getImageData(t.leftPos,t.topPos,t.width,t.height);t.pixels.forEach(function(t,n){t!==e.transparency&&(i.data[4*n+0]=r[t][0],i.data[4*n+1]=r[t][1],i.data[4*n+2]=r[t][2],i.data[4*n+3]=255)}),this.frame.putImageData(i,t.leftPos,t.topPos),this.ctxScaled||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.ctxScaled=!0),this.drawWhileLoading&&(this.canvasContext.drawImage(this.tmpCanvas,0,0),this.drawWhileLoading=this.options.autoPlay),this.lastImg=t},n.prototype.doNothing=function(){},n.prototype.withProgress=function(t){return function(e){t(e)}},n.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},n.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},n.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},n.prototype.play=function(){this.playing=!0,this.step()},n.prototype.pause=function(){this.playing=!1},n.prototype.isPlaying=function(){return this.playing},n.prototype.getCanvas=function(){return this.canvas},n.prototype.isLoading=function(){return this.loading},n.prototype.isReady=function(){return this.ready},n.prototype.isAutoPlay=function(){return this.options.autoPlay},n.prototype.getLength=function(){return this.frames.length},n.prototype.getCurrentFrame=function(){return this.currentFrameIndex},n.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},n.prototype.loadURL=function(t,n){var r=this;if(this.loadSetup(n)){var i=new XMLHttpRequest;i.open("GET",t,!0),"overrideMimeType"in i?i.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in i?i.responseType="arraybuffer":i.setRequestHeader("Accept-Charset","x-user-defined"),i.onloadstart=function(){r.initialized||r.init()},i.onload=function(){if(200===i.status){var t=i.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var n=new e.SuperGifStream(t);setTimeout(function(){r.parseStream(n)},0)}else r.handleError("xhr - response")},i.onerror=function(){r.handleError("xhr")},i.send()}},n.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},n}();return xf.SuperGif=n,xf}();const Tf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"src",name:"src"},{type:"checkbox",label:"play",name:"play"}],"value-property":"src",help:"scene/component/gif-view"};class Pf extends bf{async oncreate_element(t){const{src:e,play:n}=this.state;this.onchangesrc(e),this.onchangeplay(n)}buildImg(){const t=this.element;if(!t)return document.createElement("img");t.replaceChildren();const e=document.createElement("img");return e.style.width="100%",e.style.height="100%",t.appendChild(e),e}onchange(t,e){super.onchange(t,e),"src"in t&&this.onchangesrc(t.src),"play"in t&&this.onchangeplay(t.play)}setElementProperties(t){}onchangeplay(t){const e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){const e=this.buildImg();t||(t="data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw=="),e.src=t,e.setAttribute("rel:animated_src",t),e.setAttribute("rel:auto_play",String(0)),this._superGif=new Cf.SuperGif(e,{autoPlay:!1}),this._superGif.init(),this.element&&Array.from(this.element.children).forEach(t=>{t.style.width="100%",t.style.height="100%"});const n=this._superGif.getCanvas();n.style.width="100%",n.style.height="100%",this._superGif.load(()=>{setTimeout(()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()},100)})}ondropfile(t,e){for(let n=0;n<t.length;n++)if(/\.gif$/.test(t[n].name))return void(this.src=e[n])}get src(){return this.getState("src")}set src(t){this.set("src",t)}get play(){return this.getState("play")}set play(t){this.setState("play",t)}get nature(){return Tf}get tagName(){return"div"}}oc.register("gif-view",Pf);const Df={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"attachment-selector",label:"src",name:"src",property:{category:"audio"}},{type:"checkbox",label:"started",name:"started"},{type:"checkbox",label:"loop",name:"loop"}],"value-property":"src",help:"scene/component/audio"};class Of extends(lc(ac)){static get image(){return Of.IMAGE||(Of.IMAGE=new Image,Of.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMg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cSPGtIPX3M08wn6I4qYQ94cM/Yw9Xxhmw+X/59wHrtMlX1AmIkzdyaaAnLg1Nnw8WGYSk40X/BOh4+El6LMSBnN2Cd0tPq4w/LJXGrMbCX06PZ2dcM65yzlNertShSHf3SzRAyPM332IcSAHUKPi8EHmXU0l8Uglmni0yipDoi16s+jJKejhywLooz68yiMEcHr2qM4h81CJ++VPJfTu5UwBpv4Pp9DJSi6MJx0bvUwiw4ewgT8zNR0LHUL+OccOpY/3ElzyGKD5pBlMJpDlsOkMythRoNbXh95PJsdA67MrMtAEYbjeDqNo+7oKqWUUkoppZRSSimllFJKFfMXp4vmSjB8n6sAAAAASUVORK5CYII="),Of.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}async ready(){super.ready(),this._audio=new Audio;const{src:t="",loop:e=!1,started:n=!1}=this.state;if(t){const e=this.root?.app?.loadTracker;if(e){const n=new Promise((e,n)=>{this._audio.addEventListener("canplay",()=>e(),{once:!0}),this._audio.addEventListener("error",()=>n(new Error(`Audio load failed: ${t}`)),{once:!0})});e.track(`audio:${t}`,"audio",t,n)}}this._audio.addEventListener("canplay",()=>{this.started&&this._audio.play()}),this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(n)}render(t){const{left:e,top:n,width:r,height:i}=this.state;t.beginPath(),this.drawImage(t,Of.image,e,n,r,i)}get nature(){return Df}get hasTextProperty(){return!1}get src(){return this.get("src")}set src(t){this.set("src",t)}get started(){return!!this.get("started")}set started(t){this.set("started",t)}start(){this._audio&&(this._audio.classList.add("active"),this._audio.play())}pause(){this._audio&&(this._audio.classList.remove("active"),this._audio.pause())}onchangeSrc(t){try{"data"!==String(t).substring(0,4)?this._audio.crossOrigin="use-credentials":this._audio.crossOrigin=null,this._audio.src="string"==typeof t?this.app.url(t):t}catch(t){return void Xr(t)}}onchangeStarted(t){const e=this._audio;t?4==e.readyState&&e.play():e.pause()}onchangeLoop(t){this._audio.loop=t}onchange(t,e){"src"in t&&this.onchangeSrc(t.src),"started"in t&&this.onchangeStarted(t.started),"loop"in t&&this.onchangeLoop(t.loop)}ondblclick(t){this.started=!this.started}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("audio/"))return void(this.src=e[n])}}oc.register("audio",Of);class zf extends(lc(oc)){is3dish(){return!0}}oc.register("text",zf);const If=["refid","left","top","width","height","rotation","animation"];class Lf extends Gp{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});const n=If.reduce((e,n)=>(t.hasOwnProperty(n)&&(e[n]=t[n]),e),{});return super.set(n,void 0)}capture(t,e,n){const r=super.capture(t,e,n);if(r!==this)return r}set bounds(t){if(this.__MUTATING__)return void(super.bounds=t);const e=this.bounds,n=t.width/e.width,r=t.height/e.height;this.path=this.path.map(i=>({x:t.left+(i.x-e.left)*n,y:t.top+(i.y-e.top)*r})),this.components&&this.components.forEach(t=>{if(t.mutable)t.mutatePath(null,function(t){return t.map(function(t){return{x:t.x*n,y:t.y*r}})});else{const e=t.bounds,i=t.center,s={x:i.x*(1-n),y:i.y*(1-r)},o=e.width*(1-n),a=e.height*(1-r),c=-(s.x-o/2),l=-(s.y-a/2);t.bounds={left:e.left+c,top:e.top+l,width:e.width*n,height:e.height*r}}})}get focusible(){return!1}get bounds(){return super.bounds}get hasTextProperty(){return!1}isIdentifiable(){return!1}calculateBounds(){this.clearCache(),this.__MUTATING__=!0,this.mutateBounds(function(t){const e=oc.union(this.components.map(t=>t.bounds));return this.components.forEach(t=>{const n=t.bounds;t.bounds={left:n.left-e.left,top:n.top-e.top,width:n.width,height:n.height}}),{left:t.left+e.left,top:t.top+e.top,width:e.width,height:e.height}},this),this.__MUTATING__=!1,this.parent.isGroup()&&this.parent.calculateBounds?.()}render(t){}postrender(t){const{top:e,left:n}=this.state;t.translate(n,e),this.layout.drawables(this).forEach(e=>{e.draw(t)}),t.translate(-n,-e)}}oc.memoize(Lf.prototype,"bounds",!0),oc.register("group",Lf);const jf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"id-input",label:"ref",name:"ref"},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio"]}}],"value-property":"ref",help:"scene/component/local-ref"};class Rf extends(lc(ac)){get ref(){const t=this.getState("ref");return t&&"string"==typeof t?this.root.findById?.(t):null}set ref(t){this.setState("ref",t)}get refScale(){const t=this.ref;if(!t)return{x:1,y:1};const e=t.bounds,n=this.bounds,r=n.width/e.width,i=n.height/e.height;return"both"===this.model.fit?{x:r,y:i}:{x:Math.min(r,i),y:Math.min(r,i)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){const e=this.ref.center,n=this.center,r=this.refScale;t.translate(n.x,n.y),t.scale(r.x,r.y),t.translate(-e.x,-e.y)}}postrender(t){if(this.ref)return this.ref.postrender(t);super.postrender(t)}render(t){if(this.ref)return this.ref.render(t);const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),t.rect(e,n,r,i)}get nature(){return jf}get hasTextProperty(){return!1}}oc.memoize(Rf.prototype,"ref",!1),oc.memoize(Rf.prototype,"refScale",!1),oc.register("local-ref",Rf);class Ff extends(Bp(jc)){render(t){}is3dish(){return!0}get layout(){return gc.get(this.get("layout"))||mc}}const Bf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"scene-number",name:"ref",placeholder:"SCENE-1"},{type:"number",label:"round",name:"round",property:{min:0}},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio","width","height","none"]}},{type:"select",label:"mode",name:"mode",property:{options:["view","interaction"]}}],"value-property":"ref",help:"scene/component/global-ref"};class Nf extends Ff{dispose(){this._releaseRef(),super.dispose()}get nature(){return Bf}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){const{mode:e="view",round:n=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=n+"px"}async ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();const t=this._element_bounds,{offsetWidth:e,offsetHeight:n}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:n},(!t||t.offsetWidth!=e||t.offsetHeight!=n)&&this.ref&&this.root.target_element){const{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();const{ref:t,fit:e="ratio"}=this.state;if(!t)return;const n=this.app.refProvider;if(n&&t){const r=(async()=>{this.__ref=await n.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data})();this.root?.app?.loadTracker?.track(`ref:${t}`,"ref-board",t,r);try{await r}catch(t){Xr(t)}}}get ref(){return this.__ref}set ref(t){this.setState("ref",t)}_releaseRef(){this.__ref&&this.__ref.release&&this.__ref.release(),delete this.__ref}onchange(t,e,n){super.onchange(t,e),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame(()=>{const{fit:t}=this.state;this.ref.fit(t)}),"data"in t&&this.ref&&requestAnimationFrame(()=>{this.ref.data=t.data})}}oc.register("global-ref",Nf);const Hf="center-middle",Vf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"board",name:"board"},{type:"checkbox",label:"modal",name:"modal"},{type:"checkbox",label:"closable",name:"closable"},{type:"checkbox",label:"draggable",name:"draggable"},{type:"checkbox",label:"minimizable",name:"minimizable"},{type:"checkbox",label:"show",name:"show"},{type:"select",label:"popup-position",name:"popupPosition",property:{options:["static","absolute"]}},{type:"select",label:"popup-origin",name:"origin",property:{options:["left-top","center-top","right-top","left-middle",Hf,"right-middle","left-bottom","center-bottom","right-bottom","auto"]}},{type:"string",label:"title",name:"text"},{type:"data",label:"value",name:"value"}],help:"scene/component/popup"};class Yf extends(lc(ac)){static get image(){return Yf._image||(Yf._image=new Image,Yf._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhp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Ix2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Yf._image}async ready(){await super.ready(),this.show&&this.onchangeShow(!0)}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,Yf.image,e,n,r,i)}onchange(t,e){"value"in t?this.show?this.onchangeShow(!0):this.show=!0:"show"in t&&this.onchangeShow(this.show)}onchangeShow(t){!this.app.isEditMode&&this.getState("board")&&(t?this.openPopup(this.value):this.hidePopup())}openPopup(t,e){this.app.isEditMode||Oc.show(this,this.getState("board"),{origin:this.getState("origin")||Hf,modal:this.getState("modal"),closable:this.getState("closable")||!1,draggable:this.getState("draggable")||!1,minimizable:this.getState("minimizable")||!1,popupPosition:this.getState("popupPosition"),title:this.text,data:t||this.value,...e})}hidePopup(){Oc.hide(this)}get board(){return this.getState("board")}set board(t){this.set("board",t)}get show(){return this.getState("show")}set show(t){this.setState("show",t)}get started(){return this.getState("show")}set started(t){this.setState("show",t)}get value(){return this.getState("value")}set value(t){this.setState("value",t)}get hasTextProperty(){return!1}get nature(){return Vf}}oc.register("popup",Yf);class Gf extends oc{render(t){const{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),this.drawStroke(t,void 0)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let r=!1;return n.forEach((i,s)=>{const o=(s+n.length+1)%n.length,a=i.x,c=i.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(r=!r)}),r}}oc.register("path",Gf);const Uf={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/triangle"};class Wf extends ac{is3dish(){return!0}contains(t,e){const{x1:n,y1:r,x2:i,y2:s,x3:o,y3:a}=this.state,c=[n,r,i,s,o,a];let l=!1;for(let n=0;n<c.length;n+=2){const r=(n+2)%c.length,i=c[n],s=c[n+1],o=c[r+1];s>e!=o>e&&t<(c[r]-i)*(e-s)/(o-s)+i&&(l=!l)}return l}get mutable(){return!0}get path(){const{x1:t,y1:e,x2:n,y2:r,x3:i,y3:s}=this.state;return[{x:t,y:e},{x:n,y:r},{x:i,y:s}]}set path(t){this.set({x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y,x3:t[2].x,y3:t[2].y})}get nature(){return Uf}}oc.memoize(Wf.prototype,"path",!1),oc.register("triangle",Wf);const Xf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"},qf={ondragmove:function(t,e,n){let{cx:r,rx:i}=n.model;i=Math.abs(i);let s=(n.fromParent(t.x,t.y).x-r)/i*100;s=s>=100||s<=-100?100:Math.abs(s),n.set({ratio:s})}};class Kf extends af{is3dish(){return!0}render(t){let{ratio:e=50,cx:n,cy:r,rx:i,ry:s,startAngle:o,endAngle:a,anticlockwise:c}=this.state;i=Math.abs(i),s=Math.abs(s),t.beginPath(),t.ellipse(n,r,i,s,0,o||0,a||2*Math.PI,c),t.moveTo(n+i/100*e,r),t.ellipse(n,r,i/100*e,s/100*e,0,o||0,a||2*Math.PI,!0)}contains(t,e){let{cx:n,cy:r,rx:i,ry:s,ratio:o}=this.state;i=Math.abs(i),s=Math.abs(s);const a=(t-n)/(2*i-.5),c=(e-r)/(2*s-.5),l=(t-n)/(i/100*o*2-.5),h=(e-r)/(s/100*o*2-.5);let d=!1;return a*a+c*c<.25&&l*l+h*h>.25&&(d=!d),d}get controls(){let{cx:t,cy:e,rx:n,ratio:r}=this.state;return n=Math.abs(n),[{x:t+n/100*r,y:e,handler:qf}]}get nature(){return Xf}}oc.memoize(Kf.prototype,"controls",!1),oc.register("donut",Kf);const $f={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"},{type:"number",label:"wing",name:"wing",property:"wing"}],help:"scene/component/star"},Qf={ondragmove:function(t,e,n){const{cy:r,ry:i}=n.model;let s=(n.fromParent(t.x,t.y).y-r)/i*100+100;s>=100?s=100:s<=0&&(s=0),n.set({ratio:s})}};class Zf extends af{is3dish(){return!0}render(t){const{ratio:e=30,wing:n=5,cx:r,cy:i,rx:s,ry:o}=this.state;if(n<3)return;const a=1.5707963267948966,c=2*Math.PI/n,l=s-e/100*s,h=o-e/100*o;t.save(),t.beginPath(),t.translate(r,i),t.moveTo(s*Math.cos(-a),o*Math.sin(-a)),t.lineTo((s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let e=1;e<n;e++)t.lineTo(s*Math.cos(c*e-a),o*Math.sin(c*e-a)),t.lineTo((s-l)*(Math.cos(c*(e+1)-a)+Math.cos(c*e-a))/2,(o-h)*(Math.sin(c*(e+1)-a)+Math.sin(c*e-a))/2);t.closePath(),t.restore()}get controls(){const{cx:t,cy:e,ry:n,ratio:r}=this.state;return[{x:t,y:e-n+n*(r/100),handler:Qf}]}get nature(){return $f}}oc.memoize(Zf.prototype,"controls",!1),oc.register("star",Zf);const Jf={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class tg extends(Id(ac)){is3dish(){return!1}isDescendible(){return!1}render(t){const{cx:e,cy:n,anticlockwise:r}=this.state,i=this.app?.scale||1;t.beginPath(),t.scale(1/i,1/i),t.ellipse(e,n,Math.abs(tg.RADIUS),Math.abs(tg.RADIUS),0,0,2*Math.PI,r),t.scale(i,i),t.closePath()}get path(){const{cx:t,cy:e}=this.state;return[{x:t-tg.RADIUS,y:e-tg.RADIUS},{x:t+tg.RADIUS,y:e-tg.RADIUS},{x:t+tg.RADIUS,y:e+tg.RADIUS},{x:t-tg.RADIUS,y:e+tg.RADIUS}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:r}=this.state,i=(t-n)/(2*tg.RADIUS-.5),s=(e-r)/(2*tg.RADIUS-.5);return i*i+s*s<.25}outline(t){const{cx:e,cy:n}=this.state;return this.toScene(e,n)}get nature(){return Jf}}tg.RADIUS=5,oc.memoize(tg.prototype,"path",!1),oc.register("node",tg);class eg extends Yh{getObject3dInstance(){return new e.Mesh}build(){super.build();const{width:t,height:n}=this.component.bounds,r=this.component.state.depth||.5*Math.min(t,n),i=.15*Math.min(t,n,r),s=new D(1,1,1,4,i/Math.min(t,n,r));s.scale(t,r,n),this.object3d.geometry=s,this.object3d.material=new e.MeshStandardMaterial({color:"#5090d0",transparent:!0,opacity:.35,roughness:.6,metalness:.1,side:e.FrontSide,depthWrite:!1}),this.object3d.visible=!!this.component.app?.isEditMode}updateAlpha(){const t=this.object3d.material;t&&(t.opacity=this.component.app?.isEditMode?.35:0)}updateHidden(){this.object3d.visible=!!this.component.app?.isEditMode&&!this.component.state.hidden}updateDimension(){const{width:t,height:e}=this.component.bounds,n=this.component.state.depth||.5*Math.min(t,e);this.object3d.geometry.computeBoundingBox();const r=this.object3d.geometry.boundingBox;if(r){const i=r.max.x-r.min.x,s=r.max.y-r.min.y,o=r.max.z-r.min.z;this.object3d.scale.set(t/i,n/s,e/o)}}updateFillStyle(){}updateStrokeStyle(){}updateText(){}clear(){return Bh(this.object3d),super.clear()}}const ng="data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="#5090d0">\n <path d="M32 20a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm0 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12z"/>\n <path d="M55.4 27.2l-3.6-.6c-.4-1.2-.8-2.4-1.4-3.4l2.2-3c.6-.8.4-2-.2-2.6l-3-3c-.8-.6-1.8-.8-2.6-.2l-3 2.2c-1.2-.6-2.2-1-3.4-1.4l-.6-3.6c-.2-1-1-1.6-2-1.6h-4.2c-1 0-1.8.6-2 1.6l-.6 3.6c-1.2.4-2.4.8-3.4 1.4l-3-2.2c-.8-.6-2-.4-2.6.2l-3 3c-.6.8-.8 1.8-.2 2.6l2.2 3c-.6 1.2-1 2.2-1.4 3.4l-3.6.6c-1 .2-1.6 1-1.6 2v4.2c0 1 .6 1.8 1.6 2l3.6.6c.4 1.2.8 2.4 1.4 3.4l-2.2 3c-.6.8-.4 2 .2 2.6l3 3c.8.6 1.8.8 2.6.2l3-2.2c1.2.6 2.2 1 3.4 1.4l.6 3.6c.2 1 1 1.6 2 1.6h4.2c1 0 1.8-.6 2-1.6l.6-3.6c1.2-.4 2.4-.8 3.4-1.4l3 2.2c.8.6 2 .4 2.6-.2l3-3c.6-.8.8-1.8.2-2.6l-2.2-3c.6-1.2 1-2.2 1.4-3.4l3.6-.6c1-.2 1.6-1 1.6-2v-4.2c0-1-.6-1.8-1.6-2z"/>\n</svg>');class rg extends(lc(oc)){static get icon(){return rg._defaultIcon||(rg._defaultIcon=new Image,rg._defaultIcon.src=ng),rg._defaultIcon}get serviceName(){}get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new eg(this)}render(t){if(this.app?.isViewMode)return;const{left:e,top:n,width:r,height:i}=this.bounds,s=this.constructor.icon;t.beginPath(),t.globalAlpha=.6,this.drawImage(t,s,e,n,r,i),t.globalAlpha=1}added(t){super.added(t);const e=this.serviceName;e&&(this._registeredRoot=this.root,this._registeredRoot?.registerService?.(e,this))}removed(t){const e=this.serviceName;e&&this._registeredRoot&&(this._registeredRoot.unregisterService?.(e),this._registeredRoot=void 0),super.removed(t)}get controls(){return[]}}function ig(t){return class extends t{animOnValueChange(t,e=!1,n){if(t==this._lastValue)return;let r;r=e?t-(Number(n)||0):t-(this._lastValue||0),this._lastValue=t,this._anim_alpha=-r,this.animate({step:t=>{this._anim_alpha=r*(t-1),this.invalidate()},duration:1e3,delta:"circ",options:{x:1},ease:"out"}).start()}dispose(){super.dispose(),delete this._value_substitutor}onchange(t,e){t.hasOwnProperty("value")&&delete this._value_substitutor}get animAlpha(){return this._anim_alpha||0}get animValue(){return(this._lastValue||0)+(this._anim_alpha||0)}defaultValueSubstitutor(){return this.getState("value")}get valueSubstitutor(){return this._value_substitutor||(this._value_substitutor=Ls(this.getState("value"),this,void 0)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(yr(t)))}}}function sg(t){return class extends t{_convertDataFormat(t,e){let n;if("json"===e)n=JSON.parse(t);else n=t;return n}isDataSource(){return!0}}}function og(t){return function(e){return Array.isArray(t)?t.forEach(t=>{oc.register(t,e)}):oc.register(t,e),e}}let ag=0;const cg=new FinalizationRegistry(()=>{ag--});class lg{static get residents(){return ag}static get residentsCount(){return ag}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,ag++,cg.register(this,ag)}dispose(){if(this.disposer)for(const t in this.references)this.disposer(t,this.references[t]);this.references={},this.counters={}}get ids(){return Object.keys(this.references)}create(t){return new Promise((e,n)=>{this.creator?this.creator(t,n=>{n.release=()=>{this.disposer?.(t,n),delete n.release,Kr("RELEASED",t)},e(n)},n):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))})}add(t,e){const n=new Promise((n,r)=>{const i=this.references[t];if(i)i===e?r(Error("Reference ID and target duplicate")):e?r(Error("Reference ID duplicate")):n(i);else{const i=e=>{e.release=()=>{this.release(e)},this.references[t]=e,this.counters[t]=1,n(e)};if(e)i(e);else{if(!this.creator)return void r(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));this.creator(t,i,r)}}});return this.references[t]||(this.references[t]=n),n}async get(t,e=!1){let n=this.references[t];if(n){if(!(n instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,n}if(e)return n=await n,this.counters[t]++,n}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(const e in this.references){if(this.references[e]===t)return e}}release(t){const e=this._id(t);if(!e)return void Xr("No Referenced ID");const n=this.references[e];n&&(this.counters[e]--,0==this.counters[e]&&(this.disposer?.(e,n),delete this.references[e],delete this.counters[e],delete t.release,Kr("RELEASED",e)))}}const hg={},dg={};let ug=[];function pg(t){const e=t.target,n="SCRIPT"===e.tagName?hg:dg,r=e.src||e.href;n[r]=!0,ug.forEach((t,e)=>{if(!t)return;const{resolve:i,scripts:s,styles:o}=t;if(n===hg){const t=s.indexOf(r);t>-1&&t<s.length-1&&gg(s[t+1])}s.some(t=>!hg[t])||o?.some(t=>!dg[t])||(i(),ug[e]=null)}),ug=ug.filter(Boolean)}function fg(t){if("string"==typeof t)return;const e=t.target,n=e.src,r="SCRIPT"===e.tagName?hg:dg;ug.forEach((e,i)=>{if(!e)return;const{reject:s,scripts:o,styles:a}=e;(r===hg&&o.includes(n)||r===dg&&!!a?.includes(n))&&(s(t),ug[i]=null)}),ug=ug.filter(Boolean),delete r[n],document.head.removeChild(e)}function gg(t){hg[t]=!1;const e=document.createElement("script");e.onload=pg,e.onerror=fg,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class mg{static load(t,e){const n="string"==typeof t?[t]:t,r="string"==typeof e?[e]:e;return new Promise(function(t,e){if(n&&!Array.isArray(n)||r&&!Array.isArray(r))return void e(new Error("invalid sources for load"));let i,s=!0;if(r?.forEach(t=>{t in dg||function(t){dg[t]=!1;const e=document.createElement("link");e.onload=pg,e.onerror=fg,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),dg[t]||(s=!1)}),n&&n.length>0)for(const t of n)t in hg?hg[t]||(s=!1):i??=t;if(i)gg(i);else if(s)return void t();ug.push({resolve:t,reject:e,scripts:n,styles:r})})}}const yg="0.0.0";class bg extends Yh{getObject3dInstance(){return new e.Sprite}build(){super.build(),this.buildMaterial()}get cz(){const{zPos:t=0}=this.component.state,{height:e}=this.component.bounds,{tz:n=0}=this.component.delta();return t+n+e/2}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Ah(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=Yh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(Eh(t)):e.opacity=0)}}function vg(t){if(!(t>0))return 1;let e=0;if(!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function _g(t){const{lineWidth:n=0}=t.state;let{width:r,height:i}=t.bounds;r+=n,i+=n;const s=vg(2*r),o=vg(2*i),a=vh(s,o),c=new e.CanvasTexture(a);return xg(a,t,2),c.needsUpdate=!0,c.wrapS=e.RepeatWrapping,c.wrapT=e.RepeatWrapping,c.offset.set(0,1-2*i/o),c.repeat.set(2*r/s,2*i/o),c.magFilter=e.NearestFilter,c.minFilter=e.LinearFilter,c.colorSpace=e.SRGBColorSpace,c}function xg(t,e,n){const{lineWidth:r=0}=e.state;let{left:i,top:s}=e.bounds;i-=r/2,s-=r/2;const o=t.getContext("2d");o.scale(n,n),o.translate(-i,-s),e.render(o),e.postrender(o)}class wg extends bg{buildMaterial(){const t=this.object3d.material;t&&t.dispose(),this.object3d.material=new e.SpriteMaterial({map:_g(this.component),alphaTest:.01,sizeAttenuation:!1})}get scale(){const{width:t,height:e}=this.component.bounds,n=this.threeContainer,{width:r=1,height:i=1}=n?.bounds??{},{scale:s=1}=this.component.state;return{x:s*t/r,y:s*e/i,z:s}}update(){this.build(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateAlpha(){this.update()}updateText(){this.update()}}class Mg extends Yh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const t=zh(this.component.state.material3d),n=new e.PlaneGeometry(1,1);n.rotateX(-Math.PI/2),this.object3d.geometry=n;const r=_g(this.component);this.object3d.material=new e.MeshStandardMaterial({map:r,transparent:!0,alphaTest:.01,side:e.DoubleSide,metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity}),this.object3d.castShadow=t.castShadow,this.object3d.receiveShadow=t.receiveShadow}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Ah(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}update(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateText(){this.update()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=zh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return Bh(this.object3d),super.clear()}}class Sg extends Yh{getObject3dInstance(){return new e.Mesh}build(){super.build(),this.buildGeometry(),this.buildMaterial()}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Ah(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=Yh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(Eh(t)):e.opacity=0)}updateStrokeStyle(){const t=this.object3d.getObjectByName("__edgeLines__");t&&(this.object3d.remove(t),Bh(t));const{strokeStyle:n}=this.component.state;if(!n||"transparent"===n||"none"===n)return;const r=this.object3d.geometry;if(!r?.getAttribute("position"))return;const i=new e.EdgesGeometry(r),s=new e.LineBasicMaterial({color:n}),o=new e.LineSegments(i,s);o.name="__edgeLines__",this.object3d.add(o)}updateDimension(){const{width:t,height:e}=this.component.bounds,{depth:n=1}=this.component.state;if(!this.object3d)return;this.object3d.geometry.computeBoundingBox();const r=this.object3d.geometry.boundingBox;if(r){const i=r.max.x-r.min.x,s=r.max.y-r.min.y,o=r.max.z-r.min.z;this.object3d.scale.set(t/i,n/s,e/o)}}buildMaterial(){const t=zh(this.component.state.material3d),n=new e.MeshStandardMaterial({transparent:!0});jh(n,t),this.object3d.material=n}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;t&&jh(t,zh(this.component.state.material3d))}clear(){return Bh(this.object3d),super.clear()}}function kg(t,e,n,r){return[["bold",t],["italic",e],[n+"px",!0],[r,!0]].filter(t=>t[1]).map(t=>t[0]).join(" ")}function Ag(t){let e=0;if(!((t=Math.abs(t)||1)&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function Eg(t,e,n){const{bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",textAlign:c="center",textBaseline:l="middle",width:h=t.width,height:d=t.height}=n||{},u=t.getContext("2d");let p,f;u.imageSmoothingEnabled=!1,u.fillStyle=a,u.strokeStyle=a,u.font=kg(r,i,o,s),"left"===c||"start"===c?(u.textAlign="left",p=0):"right"===c||"end"===c?(u.textAlign="right",p=h):(u.textAlign="center",p=h/2);const g=1.2*o,m=String(e).split("\n"),y=g*m.length;f="top"===l||"hanging"===l?.1*o:"bottom"===l||"alphabetic"===l?d-y+.1*o:(d-y)/2+.1*o,u.textBaseline="top";for(const t of m)u.fillText(t,p,f),f+=g}function Cg(t,n,r,i){const s=Ag(2*n),o=Ag(2*r),a=vh(s,o),c=a.getContext("2d"),{fillStyle:l}=i||{};if(l&&"object"==typeof l&&l.colorStops?.length){const t=Nh(l,2*n,2*r);t&&c.drawImage(t,0,0)}c.scale(2,2),"string"==typeof l&&""!==l&&"transparent"!==l&&(c.fillStyle=l,c.fillRect(0,0,n,r)),Eg(a,t,i);const h=new e.CanvasTexture(a);return h.needsUpdate=!0,h.wrapS=e.RepeatWrapping,h.wrapT=e.RepeatWrapping,h.offset.set(0,1-2*r/o),h.repeat.set(2*n/s,2*r/o),h.minFilter=e.LinearFilter,h.colorSpace=e.SRGBColorSpace,h}function Tg(t,n,r,i,s,o,a){const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{const t=2*r,l=2*i,h=Ag(t),d=Ag(l),u=vh(h,d),p=u.getContext("2d");if(o.color&&(p.fillStyle=o.color,p.fillRect(0,0,t,l)),o.fitPattern)p.drawImage(c,0,0,t,l);else{const e=2*(o.width||c.naturalWidth),n=2*(o.height||c.naturalHeight),r=2*(o.offsetX||0),i=2*(o.offsetY||0);let s=0,a=0;switch(o.align){case"center":s=(t-e)/2,a=(l-n)/2;break;case"left-top":break;case"left-bottom":a=l-n;break;case"right-top":s=t-e;break;case"right-bottom":s=t-e,a=l-n;break;case"left":a=(l-n)/2;break;case"right":s=t-e,a=(l-n)/2;break;case"top":s=(t-e)/2;break;case"bottom":s=(t-e)/2,a=l-n}const h=r+s,d=i+a;if(o.noRepeat)p.drawImage(c,0,0,c.naturalWidth,c.naturalHeight,h,d,e,n);else{p.save(),p.rect(0,0,t,l),p.clip();const r=h>0?h-Math.ceil(h/e)*e:h;for(let i=d>0?d-Math.ceil(d/n)*n:d;i<l;i+=n)for(let s=r;s<t;s+=e)p.drawImage(c,0,0,c.naturalWidth,c.naturalHeight,s,i,e,n);p.restore()}}n&&(p.scale(2,2),Eg(u,n,s));const f=new e.CanvasTexture(u);f.needsUpdate=!0,f.wrapS=e.RepeatWrapping,f.wrapT=e.RepeatWrapping,f.offset.set(0,1-l/d),f.repeat.set(t/h,l/d),f.minFilter=e.LinearFilter,f.colorSpace=e.SRGBColorSpace,a(f)},c.onerror=()=>{const t=Cg(n,r,i,s);a(t)},c.src=t}function Pg(t,e){let{bold:n=!1,italic:r=!1,fontFamily:i="Serif",fontSize:s=10,lineHeight:o="normal"}=e||{};t=void 0===t||""==t?" ":String(t);const a=document.createElement("span");a.style.font=kg(n,r,s,i),a.style.lineHeight=String(o),a.style.whiteSpace="pre",a.style.position="absolute",a.textContent=t,document.body.appendChild(a);const c=a.getBoundingClientRect();return document.body.removeChild(a),{width:c.width,height:c.height}}class Dg extends Sg{get syncZPosOffset(){return this.effectiveDepth}buildGeometry(){this.updateDimension()}updateStrokeStyle(){}updateFillStyle(){this.updateText()}updateDimension(){const{width:t,height:n}=this.component.state,r=Math.abs(t)||1,i=Math.abs(n)||1;this.object3d.geometry&&this.object3d.geometry.dispose();const s=new e.PlaneGeometry(r,i);s.rotateX(-Math.PI/2),this.object3d.geometry=s}updateText(){const t=this.object3d.material;if(!t)return;const{width:e,height:n,bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",textAlign:c="center",textBaseline:l="middle",fillStyle:h}=this.component.state,d=Math.abs(e)||1,u=Math.abs(n)||1,p=this.component.text,f=h&&"none"!==h?h:"transparent",g={bold:r,italic:i,fontFamily:s,fontSize:o,fontColor:a,textAlign:c,textBaseline:l,width:d,height:u,fillStyle:f};if("object"==typeof f&&"pattern"===f?.type&&f.image){return void Tg(this.component.app.url(h.image),p,d,u,g,h,e=>{t.map&&t.map.dispose(),t.map=e,t.color.set(16777215),t.needsUpdate=!0})}const m=Cg(p,d,u,g);m?(t.map&&t.map.dispose(),t.map=m,t.color.set(16777215),m.needsUpdate=!0):"string"==typeof h&&(""!==h&&"transparent"!==h?t.color.set(Eh(h)):t.opacity=0)}updateAlpha(){const{alpha:t=1}=this.component.state,e=this.object3d.material;e.opacity=t,e.transparent=!0}}Xh("text",t=>new Dg(t));class Og extends Yh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const{width:t,height:n}=this.component.bounds;if(!t||!n)return;const r=zh(this.component.state.material3d),i=new e.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const s=_g(this.component);this.object3d.material=new e.MeshStandardMaterial({map:s,transparent:!0,side:e.DoubleSide,metalness:r.metalness,roughness:r.roughness,emissive:new e.Color(r.emissive),emissiveIntensity:r.emissiveIntensity}),this.object3d.castShadow=r.castShadow,this.object3d.receiveShadow=r.receiveShadow}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Ah(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}_debouncedRebuild(){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=void 0,this._rebuildTexture()},100)}_rebuildTexture(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}updateFillStyle(){this._debouncedRebuild()}updateStrokeStyle(){this._debouncedRebuild()}updateText(){this._debouncedRebuild()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=zh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),Bh(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),super.dispose()}}const zg={input:"css3d",select:"css3d",textarea:"css3d",button:"css3d",iframe:"css3d",video:"css3d",label:"texture",table:"texture",progress:"texture"};function Ig(t){const e=function(t){const e=t.state?.material3d?.renderMode;if("css3d"===e||"texture"===e)return e;const n=t.model?.type??"";return zg[n]??"css3d"}(t);return"texture"===e?new Og(t):new Gh(t)}Xh("html-overlay-element",Ig),Xh("html-overlay-container",Ig);class Lg{setShape({extrudedShape:t,extrudedOptions:n}){this.extrudedShape=t,this.bb=new e.Box2,this.bb.setFromPoints(this.extrudedShape?.extractPoints(0).shape),this.extrudedOptions=n}generateTopUV(t,n,r,i,s){const o=n[3*r],a=n[3*r+1],c=n[3*i],l=n[3*i+1],h=n[3*s],d=n[3*s+1],u=this.bb,p=u.max.x-u.min.x,f=u.max.y-u.min.y;return[new e.Vector2((o-u.min.x)/p,1-(a-u.min.y)/f),new e.Vector2((c-u.min.x)/p,1-(l-u.min.y)/f),new e.Vector2((h-u.min.x)/p,1-(d-u.min.y)/f)]}generateSideWallUV(t,n,r,i,s,o){const a=n[3*r],c=n[3*r+1],l=n[3*r+2],h=n[3*i],d=n[3*i+1],u=n[3*i+2],p=n[3*s],f=n[3*s+1],g=n[3*s+2],m=n[3*o],y=n[3*o+1],b=n[3*o+2],v=this.extrudedOptions?.depth||100,_=this.bb,x=_.max.x-_.min.x,w=_.max.y-_.min.y;return Math.abs(c-d)<.01?[new e.Vector2(a/x,1-l/v),new e.Vector2(h/x,1-u/v),new e.Vector2(p/x,1-g/v),new e.Vector2(m/x,1-b/v)]:[new e.Vector2(c/w,1-l/v),new e.Vector2(d/w,1-u/v),new e.Vector2(f/w,1-g/v),new e.Vector2(y/w,1-b/v)]}}class jg extends Yh{clear(){return this._mesh=void 0,super.clear()}get shape(){return null}get boundUVGenerator(){return this._boundUVGenerator||(this._boundUVGenerator=new Lg),this._boundUVGenerator}build(){super.build();const t=this.effectiveDepth,n=this.shape;if(!n)return;const r=this.boundUVGenerator;r&&r.setShape({extrudedShape:n,extrudedOptions:{depth:t}});const i=this.createGeometry(n),s=this.createMaterials();this._mesh=new e.Mesh(i,s),this._mesh.rotation.x=-Math.PI/2,this._mesh.rotation.y=-Math.PI,this._mesh.rotation.z=-Math.PI,this._mesh.castShadow=!0,this.object3d.add(this._mesh),this.updateFillStyle(),this.updateStrokeStyle()}createGeometry(t){const n=this.effectiveDepth,{lineWidth:r=0}=this.component.state,i={steps:1,depth:n,bevelEnabled:r>0,bevelThickness:0,bevelSize:r,bevelSegments:1,UVGenerator:this.boundUVGenerator},s=new e.ExtrudeGeometry(t,i);return s.center(),s}createMaterials(){const t=zh(this.component.state.material3d),n=new e.MeshStandardMaterial;jh(n,t);const r=new e.MeshStandardMaterial;return jh(r,t),[n,r]}createTexture(){const{width:t,height:n}=this.component.bounds,r=Ag(t),i=Ag(n),s=vh(r,i);this.component.render(s.getContext("2d"));const o=new e.CanvasTexture(s);return o.needsUpdate=!0,o.wrapS=e.RepeatWrapping,o.wrapT=e.RepeatWrapping,o.offset.set(0,1-n/i),o.repeat.set(t/r,n/i),o.minFilter=e.LinearFilter,o}getMaterials(){if(!this._mesh)return;const t=this._mesh.material;return Array.isArray(t)?t:void 0}updateMaterial3d(){super.updateMaterial3d();const t=this.getMaterials();if(!t)return;const e=zh(this.component.state.material3d);for(const n of t)jh(n,e)}updateAlpha(){const{alpha:t=1,fillStyle:e,strokeStyle:n}=this.component.state,r=this.getMaterials();r&&(Ah(r[0],t,e),Ah(r[1],t,n))}updateStrokeStyle(){const t=this.getMaterials();if(!t)return;const{strokeStyle:e}=this.component.state;t[1].color.set(Eh(e))}updateFillStyle(){this._applyCapTexture()}updateText(){this._applyCapTexture()}_applyCapTexture(){const t=this.getMaterials();if(!t)return;const e=t[0],{fillStyle:n}=this.component.state,r=this.component.hasTextProperty?this.component.text:"";if(!r){const t=Yh.buildFillStyleTexture(this.component);return t?(e.map&&e.map.dispose(),e.map=t,e.color.set(16777215)):(e.map&&(e.map.dispose(),e.map=null),e.color.set(Eh(n))),void(e.needsUpdate=!0)}const{width:i,height:s,bold:o=!1,italic:a=!1,fontFamily:c="Serif",fontSize:l=10,fontColor:h="black",textAlign:d="center",textBaseline:u="middle"}=this.component.state,p=Math.abs(i)||1,f=Math.abs(s)||1,g={bold:o,italic:a,fontFamily:c,fontSize:l,fontColor:h,textAlign:d,textBaseline:u,width:p,height:f,fillStyle:n};if("object"==typeof n&&"pattern"===n?.type&&n.image){return void Tg(this.component.app.url(n.image),r,p,f,g,n,t=>{e.map&&e.map.dispose(),e.map=t,e.color.set(16777215),e.needsUpdate=!0})}e.map&&e.map.dispose();const m=Cg(r,p,f,g);e.map=m,e.color.set(16777215),e.needsUpdate=!0}updateDimension(){super.updateDimension()}}class Rg extends jg{get shape(){const{cx:t=0,cy:n=0,rx:r=1,ry:i=1,startAngle:s=0,endAngle:o=2*Math.PI,anticlockwise:a=!1}=this.component.state,c=new e.EllipseCurve(t,n,Math.abs(r),Math.abs(i),s,o,a,0);return new e.Shape(c.getPoints(50))}}Xh("ellipse",t=>new Rg(t));class Fg extends jg{get shape(){const{width:t,height:n,round:r}=this.component.state,i=new e.Shape;if(r>0){const e=r/100*(t/2);i.moveTo(e,0),i.lineTo(t-e,0),i.quadraticCurveTo(t,0,t,e),i.lineTo(t,n-e),i.quadraticCurveTo(t,n,t-e,n),i.lineTo(e,n),i.quadraticCurveTo(0,n,0,n-e),i.lineTo(0,e),i.quadraticCurveTo(0,0,e,0)}else i.moveTo(0,0),i.lineTo(t,0),i.lineTo(t,n),i.lineTo(0,n),i.lineTo(0,0);return i}}Xh("rect",t=>new Fg(t));class Bg extends jg{get shape(){const{path:t=[],round:n=0}=this.component.state,r=new e.Shape;for(let e=0;e<t.length;e++){const i=t[(e-1+t.length)%t.length],s=t[(e+t.length)%t.length],o=t[(e+1)%t.length];if(i.x===s.x&&i.y===s.y)continue;let a=Math.sqrt((i.x-s.x)*(i.x-s.x)+(i.y-s.y)*(i.y-s.y)),c=0!==a?Math.atan2(i.x-s.x,i.y-s.y):0,l=Math.sin(c)*Math.min(n,a/2)+s.x,h=Math.cos(c)*Math.min(n,a/2)+s.y;const d=n>0||0!==a?{x:l,y:h}:s;a=Math.sqrt((o.x-s.x)*(o.x-s.x)+(o.y-s.y)*(o.y-s.y)),c=0!==a?Math.atan2(o.x-s.x,o.y-s.y):0,l=Math.sin(c)*Math.min(n,a/2)+s.x,h=Math.cos(c)*Math.min(n,a/2)+s.y;const u=n>0||0!==a?{x:l,y:h}:s;0==e?r.moveTo(d.x,d.y):r.lineTo(d.x,d.y),n>0&&r.quadraticCurveTo(s.x,s.y,u.x,u.y)}return r}get minMax(){if(!this._minMax){const{path:t}=this.component.state;let e,n,r,i;t.forEach((t,s)=>{if(0==s)return e=r=t.x,void(n=i=t.y);e=Math.min(e,t.x),r=Math.max(r,t.x),n=Math.min(n,t.y),i=Math.max(i,t.y)}),this._minMax={minX:e,minY:n,maxX:r,maxY:i}}return this._minMax}}Xh("polygon",t=>new Bg(t));class Ng extends jg{get shape(){const{cx:t=0,cy:n=0,rx:r=1,ry:i=1,ratio:s=50,startAngle:o=0,endAngle:a=2*Math.PI,anticlockwise:c=!1}=this.component.state,l=Math.abs(r),h=Math.abs(i),d=new e.EllipseCurve(t,n,l,h,o,a,c,0),u=new e.Shape(d.getPoints(50)),p=l/100*s,f=h/100*s;if(p>0&&f>0){const r=new e.EllipseCurve(t,n,p,f,o,a,c,0),i=new e.Path(r.getPoints(50));u.holes.push(i)}return u}}Xh("donut",t=>new Ng(t));class Hg extends jg{get shape(){const{x1:t=0,y1:n=0,x2:r=0,y2:i=0,x3:s=0,y3:o=0}=this.component.state,a=new e.Shape;return a.moveTo(t,n),a.lineTo(r,i),a.lineTo(s,o),a.closePath(),a}}Xh("triangle",t=>new Hg(t));class Vg extends jg{get shape(){const{ratio:t=30,wing:n=5,cx:r=0,cy:i=0,rx:s=1,ry:o=1}=this.component.state;if(n<3)return null;const a=Math.PI/2,c=2*Math.PI/n,l=s-t/100*s,h=o-t/100*o,d=new e.Shape;d.moveTo(r+s*Math.cos(-a),i+o*Math.sin(-a)),d.lineTo(r+(s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,i+(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let t=1;t<n;t++)d.lineTo(r+s*Math.cos(c*t-a),i+o*Math.sin(c*t-a)),d.lineTo(r+(s-l)*(Math.cos(c*(t+1)-a)+Math.cos(c*t-a))/2,i+(o-h)*(Math.sin(c*(t+1)-a)+Math.sin(c*t-a))/2);return d.closePath(),d}}Xh("star",t=>new Vg(t));const Yg={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/sphere"};class Gg extends Sg{buildGeometry(){const{rx:t=0,ry:n=0,rz:r}=this.component.state,i=r??t,s=new e.SphereGeometry(1,32,16);s.scale(t,i,n),this.object3d.geometry=s}updateDimension(){this.buildGeometry()}}let Ug=class extends af{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Gg(this)}get nature(){return Yg}};Ug=Lp([og("sphere")],Ug);const Wg={mutable:!1,resizable:!0,rotatable:!0,properties:[]};let Xg=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new wg(this)}get nature(){return Wg}};Xg=Lp([og("sprite")],Xg);const qg={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cube"};class Kg extends Sg{buildGeometry(){const{width:t=0,height:n=0,depth:r=0}=this.component.state,i=new e.BoxGeometry(1,1,1);i.scale(t,r,n),this.object3d.geometry=i}}let $g=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Kg(this)}get nature(){return qg}};$g=Lp([og("cube")],$g);const Qg={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cylinder"};class Zg extends Sg{buildGeometry(){const{rx:t=0,ry:n=0}=this.component.state,r=this.component.state.depth??1,i=new e.CylinderGeometry(1,1,1,25);i.scale(t||1,r||1,n||1),this.object3d.geometry=i}updateDimension(){this.buildGeometry()}}let Jg=class extends af{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Zg(this)}get nature(){return Qg}};Jg=Lp([og("cylinder")],Jg);const tm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"color",label:"box-color",name:"boxColor",property:"boxColor"}],help:"scene/component/banner"};class em extends Yh{build(){super.build();const{width:t=1,height:e=1,depth:n=1}=this.component.state;this.object3d.add(this.createCube(t,e,n));const r=this.createTextureBoard(t,n);r.position.set(0,0,.5*e+1),this.object3d.add(r)}createCube(t,n,r){const{boxColor:i="#ccaa76"}=this.component.state,s=zh(this.component.state.material3d),o=new e.BoxGeometry(t,r,n),a=new e.MeshStandardMaterial({color:i,side:e.FrontSide});jh(a,s);const c=new e.Mesh(o,a);return c.castShadow=s.castShadow,c.receiveShadow=s.receiveShadow,c}createTextureBoard(t,n){const r=zh(this.component.state.material3d),{fillStyle:i="#ccaa76"}=this.component.state,s=Yh.buildFillStyleTexture(this.component),o=new e.MeshStandardMaterial(s?{map:s}:{color:i||"#ccaa76",side:e.FrontSide});jh(o,r);const a=new e.PlaneGeometry(t,n,1,1),c=new e.Mesh(a,o);return c.castShadow=r.castShadow,c.receiveShadow=r.receiveShadow,c}updateMaterial3d(){super.updateMaterial3d();const t=zh(this.component.state.material3d);this.object3d.traverse(e=>{if(e.isMesh){const n=e.material;n&&jh(n,t),e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow}})}}let nm=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}get nature(){return tm}buildRealObject(){return new em(this)}};var rm;nm=Lp([og("banner")],nm);const im={far:1e5,fov:80,near:1,zoom:1},sm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"near",name:"near"},{type:"number",label:"far",name:"far"},{type:"number",label:"fov",name:"fov"},{type:"number",label:"zoom",name:"zoom"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/camera"};class om extends Yh{getObject3dInstance(){return new e.Mesh}updateCamera(){const{near:t=im.near,far:n=im.far,fov:r=im.fov,zoom:i=im.zoom,showHelper:s}=this.component.state;this.camera.far=n,this.camera.fov=r,this.camera.near=t,this.camera.zoom=i,s?this.helper||(this.helper=new e.CameraHelper(this.camera),this.object3d.add(this.helper)):this.helper&&(this.object3d.remove(this.helper),delete this.helper)}build(){super.build();const{width:t=0,height:n=0,depth:r=0,fillStyle:i="lightgray"}=this.component.state;this.object3d.geometry=new e.BoxGeometry(t,r,n),this.object3d.material=new e.MeshStandardMaterial({color:i,side:e.FrontSide}),this.camera=new e.PerspectiveCamera,this.camera.position.set(0,0,0),this.object3d.add(this.camera),this.object3d.lookAt(0,0,0),this.updateCamera()}}let am=rm=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}static get image(){return rm._image||(rm._image=new Image,rm._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1IAAANSAQMAAABV6G1EAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEX6+voBAQGV71ZvAAAFO0lEQVR42u3dMZLkNBiGYakUKFRIqKOISxDvETiCTBEQcgQOQE7cl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qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqxyyahcrH7JKFysJ54rCuYJwLi+cywnn+vdlLp+rCOfKwrnStXP95zLxiJX7WEFoeaHljO/xEqsaf9/FWqz1bM+VzloP655df2uxrnP9XPHKue7OeMDsuWInyx+Y67T1Yv0gs+cKvay6P5fvZZULrdnYFBbbcr2sdKF1MxbZFdZkLLItq3aay6/vJ102eusD2rJKl633nw/o3n+uxbrpLSv1svL6M95hQ3xYNz33t16sC21Zoc+28Xahm+u+Ic7WhbYs1+dRfrvQ5LpvHOaFNq3SZ8n/faEt6twDtli7wrJpxT6P1183/di0Ti36u3XT903Ld1qGrzf9smmdWhyTddNzf8t8UqdtK/dZGq8P2DZ1ZnHcrQ/osWO5PkvDuby7NE58Yctk7Qq3PSv3+bpc3F0aJ56wF+uLX9xu6eOb4es9z/vWc0vR3oZuByjnf2t/fP/54B/2WvvWEREREREREREREREREREREREREREREREREREREREREREREREREX2J/QlrTpqHD8xO1gAAAABJRU5ErkJggg=="),rm._image}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,rm.image,e,n,r,i)}buildRealObject(){return new om(this)}get nature(){return sm}};am=rm=Lp([og("camera")],am);const cm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"gltf-selector",label:"url",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"3d-model",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0,category:"application"},observe:function(t){this.parentNode.querySelector("[name=gltfInfo]").src=t;const e=this.parentNode.querySelector("[name=fillStyleTargets]");e&&(e.src=t);const n=this.parentNode.querySelector("[name=playTargets]");n&&(n.src=t)}},{type:"gltf-info",label:"",name:"gltfInfo",readonly:!0,property:{action:(t,e)=>{t._ratioLocking=!0;try{t.set(e)}finally{t._ratioLocking=!1}}},editor:{fullwidth:!0}},{type:"gltf-fill-targets",label:"fill-targets",name:"fillStyleTargets",editor:{fullwidth:!0}},{type:"gltf-play-targets",label:"play-targets",name:"playTargets",editor:{fullwidth:!0}}],"value-property":"source",help:"scene/component/gltf-object"};let lm=class extends(lc(ac)){constructor(){super(...arguments),this._ratioLocking=!1}get hasTextProperty(){return!1}is3dish(){return!0}get controls(){return[]}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath();const s=this._topViewSnapshot;if(s)t.drawImage(s,e,n,r,i);else{t.rect(e,n,r,i),t.fillStyle="#f0f0f0",t.fill(),t.strokeStyle="#999",t.lineWidth=1,t.stroke();const s=this.getState("src"),o=s&&s.split("/").pop()?.replace(/\.[^.]+$/,"")||"GLTF",a=Math.max(10,.12*Math.min(r,i));t.fillStyle="#666",t.font=`${a}px sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillText(o,e+r/2,n+i/2,.9*r)}}async ready(){await super.ready(),this._ensureTopViewSnapshot()}onchange(t,e){super.onchange(t,e),"src"in t&&(this._topViewSnapshot=void 0,this._ensureTopViewSnapshot())}_ensureTopViewSnapshot(){const t=this.getState("src");if(!t)return;const e=kp.getTopViewCache(t);if(e)return this._topViewSnapshot=e,void this.invalidate();const n=this.app.url(t);kp.loadGLTF(n).then(e=>{if(this.getState("src")!==t)return;const n=kp.getTopViewCache(t);if(n)return this._topViewSnapshot=n,void this.invalidate();const r=kp.renderTopView(e.scene);kp.setTopViewCache(t,r),this._topViewSnapshot=r,this.invalidate()})}buildRealObject(){return new kp(this)}get nature(){return cm}get source(){return this.getState("src")}set source(t){this.setState("src",t)}set dimension(t){const{width:e=1,height:n=1,depth:r=1}=t;this.setState({width:e,height:n,depth:r}),this.realObject?.updateDimension()}_applyRatioLock(t){if(!("width"in t||"height"in t||"depth"in t))return t;const e=this.state.width||1,n=this.state.height||1,r=this.state.depth||1,i=hd([(t.width??e)/e,(t.height??n)/n,(t.depth??r)/r]);return i?{...t,width:Math.round(e*i),height:Math.round(n*i),depth:Math.round(r*i)}:t}set(t,e){"string"==typeof t&&(t={[t]:e}),this.state.ratioLock&&!this._ratioLocking&&(this._ratioLocking=!0,t=this._applyRatioLock(t));try{return super.set(t)}finally{this._ratioLocking=!1}}setState(t,e){"string"==typeof t&&(t={[t]:e}),this.state.ratioLock&&!this._ratioLocking&&(this._ratioLocking=!0,t=this._applyRatioLock(t));try{return super.setState(t)}finally{this._ratioLocking=!1}}get play(){return!1!==this.getState("play")}set play(t){this.setState("play",t)}get nodes(){return this.getState("nodes")}set nodes(t){this.setState("nodes",t)}get animations(){return this.getState("animations")}set animations(t){this.setState("animations",t)}get playTargets(){return this.getState("playTargets")}set playTargets(t){this.setState("playTargets",t)}get fillStyleTargets(){return this.getState("fillStyleTargets")}set fillStyleTargets(t){this.setState("fillStyleTargets",t)}get nodeNames(){const t=this.realObject;return t?.nodeNames??[]}get animationNames(){const t=this.realObject;return t?.animationNames??[]}};lm=Lp([og("gltf-object")],lm);const hm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"light-type",name:"lightType",property:{options:["","point","directional"]}},{type:"number",label:"intensity",name:"intensity"},{type:"number",label:"distance",name:"distance"},{type:"number",label:"decay",name:"decay"},{type:"checkbox",label:"cast-shadow",name:"castShadow"},{type:"number",label:"near",name:"near",placeholder:"0.5"},{type:"number",label:"far",name:"far",placeholder:"1000"},{type:"number",label:"fov",name:"fov",placeholder:"90"},{type:"number",label:"zoom",name:"zoom",placeholder:"1"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/light"};class dm extends Yh{updatePointLight(){const{lightType:t="point",distance:n=0,intensity:r=10,decay:i=1,fillStyle:s="white",castShadow:o,near:a=.5,far:c=1e3,fov:l=90,zoom:h=1,showHelper:d}=this.component.state;if(this.object3d.color=new e.Color(s),"point"==t&&(this.object3d.distance=n,this.object3d.decay=i),this.object3d.intensity=r,this.object3d.castShadow=o,o){const t=this.object3d.shadow?.camera;t.far=c,t.near=a,t.fov=l,t.zoom=h}if(d){const t=this.object3d.shadow?.camera;this.helper||(this.helper=new e.CameraHelper(t),this.object3d.add(this.helper))}else this.helper&&(this.object3d.remove(this.helper),delete this.helper)}getObject3dInstance(){const{lightType:t="point"}=this.component.state;return"point"==t?new e.PointLight:new e.DirectionalLight}update(){this.clear(),this.build(),this.updateDimension(),this.updateHidden(),this.updatePointLight()}}let um=class extends af{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new dm(this)}get anchors(){return[]}get nature(){return hm}};um=Lp([og("light")],um);const pm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"}],help:"scene/component/wall"};class fm extends Sg{buildGeometry(){const{width:t=0,height:n=0,depth:r=0}=this.component.state,i=new e.BoxGeometry(1,1,1);i.scale(t,r,n),this.object3d.geometry=i}}let gm=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new fm(this)}get nature(){return pm}};gm=Lp([og("wall")],gm);const mm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"}],help:"scene/component/floor-plate"};class ym extends Yh{clear(){return this._topTexture&&(this._topTexture.dispose(),this._topTexture=void 0),this._mesh=void 0,super.clear()}build(){super.build();const{width:t,height:n,depth:r=1}=this.component.state;if(!t||!n)return;const i=Math.abs(t),s=Math.abs(n),o=Math.max(r,.5),a=new e.BoxGeometry(i,o,s),c=this._buildTopMaterial(),l=this._buildSideMaterial(),h=[l,l,c,l,l,l];this._mesh=new e.Mesh(a,h),this._mesh.position.y=o/2,this._mesh.receiveShadow=!0,this._mesh.castShadow=!1,this.object3d.add(this._mesh)}_buildTopMaterial(){const{alpha:t=1}=this.component.state,n=zh(this.component.state.material3d),r=Yh.buildFillStyleTexture(this.component);if(r){this._topTexture=r;const i=new e.MeshStandardMaterial({map:r,side:e.DoubleSide,transparent:!0,opacity:t,depthWrite:t>=.9});return jh(i,n),i}const{fillStyle:i}=this.component.state,s="string"==typeof i&&"none"!==i?i:"#e0e0e0",o=new e.MeshStandardMaterial({color:s,side:e.DoubleSide,transparent:!0,opacity:t,depthWrite:t>=.9});return jh(o,n),o}_buildSideMaterial(){const{strokeStyle:t,alpha:n=1}=this.component.state,r="string"==typeof t&&t?t:"#999999";return new e.MeshStandardMaterial({color:r,side:e.DoubleSide,transparent:!0,opacity:.8*n,depthWrite:n>=.9})}updateAlpha(){if(!this._mesh)return;const{alpha:t=1}=this.component.state,e=this._mesh.material;for(let n=0;n<e.length;n++){const r=e[n];r.opacity=2===n?t:.8*t,r.transparent=!0,r.depthWrite=t>=.9}}updateFillStyle(){if(!this._mesh)return;this._topTexture&&(this._topTexture.dispose(),this._topTexture=void 0);const t=this._mesh.material;t[2].dispose(),t[2]=this._buildTopMaterial()}updateStrokeStyle(){if(!this._mesh)return;const t=this._mesh.material,e=this._buildSideMaterial();for(let n=0;n<t.length;n++)2!==n&&(t[n].dispose(),t[n]=e)}}let bm=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new ym(this)}get nature(){return mm}};function vm(t,e){return"none"===t?0:t.endsWith("arrow")?1.5*e:0}function _m(t,n,r,i){const s=[];for(let o=1;o<=i;o++){const a=o/i,c=1-a;s.push(new e.Vector3(c*c*t.x+2*c*a*n.x+a*a*r.x,c*c*t.y+2*c*a*n.y+a*a*r.y,c*c*t.z+2*c*a*n.z+a*a*r.z))}return s}bm=Lp([og("floor-plate")],bm);class xm extends Yh{getObject3dInstance(){return new e.Group}get gizmoTransformable(){return!0}get syncZPosOffset(){return 0}syncFromObject3D(){}applyDimensionFromGizmo(t){}build(){super.build(),this._buildLine()}get smoothedPath(){const t=this.worldPath;if(t.length<2)return t;const{round:n=0}=this.component.state;if(n<=0||t.length<3)return t;const r=[];r.push(t[0]);for(let i=1;i<t.length;i++){const s=t[i-1],o=t[i],a=t[i+1];if(!a){r.push(o);break}const c=s.x-o.x,l=s.y-o.y,h=s.z-o.z,d=Math.sqrt(c*c+l*l+h*h),u=Math.min(n,d/2),p=a.x-o.x,f=a.y-o.y,g=a.z-o.z,m=Math.sqrt(p*p+f*f+g*g),y=Math.min(n,m/2),b=d>0?new e.Vector3(o.x+c/d*u,o.y+l/d*u,o.z+h/d*u):o.clone(),v=m>0?new e.Vector3(o.x+p/m*y,o.y+f/m*y,o.z+g/m*y):o.clone();r.push(b),r.push(..._m(b,o,v,8))}return r}_buildLine(){const t=this.smoothedPath;if(t.length<2)return;const{strokeStyle:n,lineWidth:r=2,alpha:i=1,lineDash:s,begin:o="none",beginSize:a="size5",end:c="none",endSize:l="size5"}=this.component.state,h=Math.max(r,1),d="string"==typeof n&&"transparent"!==n?Eh(n):"#000000",g=new e.Color(d),m=this._getResolution(),y=o,b=c,v=vm(y,h),_=vm(b,h),x=t[0],w=t[t.length-1],M=(new e.Vector3).subVectors(t[1],x).normalize(),S=(new e.Vector3).subVectors(t[t.length-2],w).normalize(),k=[...t];v>0&&(k[0]=x.clone().add(M.clone().multiplyScalar(v))),_>0&&(k[k.length-1]=w.clone().add(S.clone().multiplyScalar(_)));const A=new f;A.setPositions(k.flatMap(t=>[t.x,t.y,t.z]));const E=function(t,e){switch(t){case"round-dot":return{dashSize:e,gapSize:e};case"square-dot":return{dashSize:2*e,gapSize:e};case"dash":return{dashSize:4*e,gapSize:1.5*e};case"dash-dot":return{dashSize:4*e,gapSize:2*e};case"long-dash":return{dashSize:6*e,gapSize:3*e};case"long-dash-dot":return{dashSize:6*e,gapSize:2*e};case"long-dash-dot-dot":return{dashSize:6*e,gapSize:e};default:return null}}(s,h),C=new p({color:g.getHex(),linewidth:h,worldUnits:!0,transparent:i<1,opacity:i,resolution:m,dashed:!!E,dashSize:E?.dashSize??1,gapSize:E?.gapSize??1,dashScale:1});if(this._line2=new u(A,C),this._line2.computeLineDistances(),this.object3d.add(this._line2),"none"!==y){const t=wh(y,xh(a,h));if(t){const n=(new e.Quaternion).setFromUnitVectors(new e.Vector3(1,0,0),M.clone().negate());this._placeTip(t,x,n,g,i,m)}}if("none"!==b){const t=wh(b,xh(l,h));if(t){const n=(new e.Quaternion).setFromUnitVectors(new e.Vector3(1,0,0),S.clone().negate());this._placeTip(t,w,n,g,i,m)}}}_placeTip(t,e,n,r,i,s){const o=t.mesh||t.line2||t.group;if(o){if(o.position.copy(e),o.setRotationFromQuaternion(n),t.mesh){const e=t.mesh.material;e.color.copy(r),e.transparent=i<1,e.opacity=i}else if(t.line2){const e=t.line2.material;e.color.copy(r),e.transparent=i<1,e.opacity=i,e.resolution.copy(s)}else t.group&&t.group.traverse(t=>{if(t.material){const e=t.material;e.color&&e.color.copy(r),e.transparent=i<1,e.opacity=i,e.resolution&&e.resolution.copy(s)}});this.object3d.add(o)}}_getResolution(){const t=this.threeContainer?.renderer3d;if(t){return t.getSize(new e.Vector2)}return new e.Vector2(window.innerWidth,window.innerHeight)}onGizmoDragEnd(t){const e=this._component,n=e.path;if(!n||n.length<2)return;const r=this.object3d,{width:i=0,height:s=0}=e.parent?.bounds??{},{x:o,y:a}=e.center,c=r.position,l=r.rotation,h=r.scale,d=this.position;if(Math.abs(c.x-d.x)<.001&&Math.abs(c.y-d.y)<.001&&Math.abs(c.z-d.z)<.001&&Math.abs(l.x)<.001&&Math.abs(l.y)<.001&&Math.abs(l.z)<.001&&Math.abs(h.x-1)<.001&&Math.abs(h.y-1)<.001&&Math.abs(h.z-1)<.001)return;const u=xm.computeBakedPath(n,{x:o,y:a},{width:i,height:s},r);this._suppressOnchange=!0,e.set({rotation:0,rotationX:0,rotationY:0,zPos:0}),e.mutatePath(null,()=>u),this._suppressOnchange=!1,this.update()}static computeBakedPath(t,n,r,i){const s=r.width,o=r.height,a=n.x,c=n.y;return i.updateMatrixWorld(!0),t.map(t=>{const n=new e.Vector3(t.x-a,t.z||0,t.y-c).applyMatrix4(i.matrixWorld),r={x:n.x+s/2,y:n.z+o/2};return Math.abs(n.y)>.001&&(r.z=n.y),r})}updateStrokeStyle(){this.updateDimension()}updateAlpha(){this.updateDimension()}updateDimension(){this.clear(),this.build()}onchange(t,e){("path"in t||"from"in t||"to"in t)&&(this.updateDimension(),this.updatePosition()),("round"in t||"lineDash"in t||"lineWidth"in t||"begin"in t||"end"in t||"beginSize"in t||"endSize"in t)&&this.updateDimension(),super.onchange(t,e)}clear(){for(;this.object3d.children.length>0;){const t=this.object3d.children[0];this.object3d.remove(t),Bh(t)}return this._line2=void 0,super.clear()}}class wm extends xm{get worldPath(){const t=this.component.path;if(!t||t.length<2)return[];const{x:n,y:r}=this.component.center;return t.map(t=>new e.Vector3(t.x-n,t.z||0,t.y-r))}}Xh("line",t=>new wm(t));class Mm extends xm{get worldPath(){const t=this.component.path;if(!t||t.length<2)return[];const{x:n,y:r}=this.component.center;return t.map(t=>new e.Vector3(t.x-n,t.z||0,t.y-r))}}Xh("polyline",t=>new Mm(t));class Sm extends Yh{build(){super.build()}update(){}}const km={far:1e5,fov:80,near:1,zoom:1};class Am extends Yh{build(){super.build()}update(){super.update(),this.updateCamera()}getObject3dInstance(){return new e.PerspectiveCamera}updateCamera(){const{near:t=km.near,far:e=km.far,fov:n=km.fov,zoom:r=km.zoom}=this.component.state;this.object3d.far=e,this.object3d.fov=n,this.object3d.near=t,this.object3d.zoom=r}}class Em extends Yh{getObject3dInstance(){return new e.Group}}class Cm extends Sg{buildGeometry(){const{width:t,height:n}=this.component.state.dimension;this.object3d.geometry=new e.PlaneGeometry(t,n)}buildMaterial(){this.object3d.material=new e.MeshStandardMaterial({opacity:0,side:e.DoubleSide,blending:e.NoBlending})}}class Tm extends Yh{getObject3dInstance(){return new e.Scene}dispose(){for(const t of this.object3d.children)Bh(t);this._animationMixer&&(this._animationMixer.stopAllAction(),this._animationMixer.uncacheRoot(this.object3d),this._animationMixer=void 0),super.dispose()}clear(){return this._floor&&(this.object3d.remove(this._floor),this._floor.material instanceof Array?this._floor.material.forEach(t=>t.dispose()):this._floor.material.dispose(),this._floor.geometry.dispose(),delete this._floor),super.clear()}get floor(){return this._floor}set floor(t){this._floor&&(this.object3d.remove(this._floor),this._floor.clear(),delete this._floor),t&&(this._floor=t,this.object3d.add(t)),this.component.invalidate()}build(){super.build(),this.floor=Jh(this.component)}updateTransform(){}updateDimension(){}updatePosition(){}updateRotate(){}updateScale(){}updateAlpha(){}updateHidden(){}get animationMixer(){return this._animationMixer||(this._animationMixer=new e.AnimationMixer(this.object3d)),this._animationMixer}}const Pm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"precision",name:"precision",property:{options:[{display:"High",value:"highp"},{display:"Medium",value:"mediump"},{display:"Low",value:"lowp"}]}},{type:"checkbox",label:"anti-alias",name:"antialias",property:"antialias"},{type:"checkbox",label:"3dmode",name:"threed",property:"threed"},{type:"checkbox",label:"auto-rotate",name:"autoRotate",property:"autoRotate"},{type:"checkbox",label:"debug",name:"debug",property:"debug"}],help:"scene/component/three-container"};let Dm=class extends Gp{constructor(){super(...arguments),this._capability=new xd}get sceneManager(){return this._capability.sceneManager}get cameraManager(){return this._capability.cameraManager}get rendererManager(){return this._capability.rendererManager}get lightManager(){return this._capability.lightManager}get controlsManager(){return this._capability.controlsManager}get eventManager(){return this._capability.eventManager}containable(t){return!0}is3dContainer(){return!0}getLightingConfig(){return{hemisphere:{skyColor:16777215,groundColor:14540253,intensity:1},directional:{color:16777215,intensity:1.2,attachToCamera:!0,castShadow:!1}}}getCss3DSceneAttribute(){return"three-container:css3d-renderer"}init_scene3d(){this._capability.isInitialized&&this._capability.destroy(),this._capability.init(this,{lightingConfig:this.getLightingConfig(),css3DSceneAttribute:this.getCss3DSceneAttribute(),skipEnvironment:!0,skipPostprocessing:!0,skipShadowMap:!0}),this._capability.buildOverlays(),this._capability.resize(),this.onchangeData&&this.onchangeData(this.data,this.data)}destroy_scene3d(){this.stop(),this._capability.destroy()}stop(){}resize(){this._capability.resize()}get scene3d(){return this._capability.isInitialized||this.init_scene3d(),this._capability.scene3d}get renderer3d(){return this._capability.renderer3d}get mixer(){return this._capability.mixer}get css3DScene(){return this._capability.css3DScene}get css3DRenderer(){return this._capability.css3DRenderer}render_threed(){this._capability.renderThreeD()}get _parentIs3dMode(){return!!this.rootModel?.is3dMode}render(t){this._parentIs3dMode||(this.app.isViewMode&&this.setState("threed",!0),!this.state.threed||this._capability.noSupportWebgl?super.render(t):this._capability.camera&&this._capability.renderCSS3D())}postrender(t){if(this._parentIs3dMode)return;const{left:e,top:n,debug:r,threed:i}=this.state;let{width:s,height:o}=this.bounds;if(s=Math.floor(s),o=Math.floor(o),i){if(this._capability.isInitialized||this.init_scene3d(),this._capability.noSupportWebgl)return void this._capability.showWebglNoSupportText(t,this.state.width,this.state.height);if(!this._capability.renderer3d)return;this._capability.renderThreeD();const i=this._capability.domElement;if(!i||!i.width||!i.height)return;t.drawImage(i,0,0,i.width,i.height,e,n,s,o),r&&this._capability.showDebugFPS(t)}else super.postrender(t)}dispose(){this._capability.dispose(),super.dispose()}get layout(){return gc.get("three")}get nature(){return Pm}getObjectByRaycast(){return this._capability.getObjectByRaycast()}getObjectsByRaycast(){return this._capability.getObjectsByRaycast()}onchange(t,e){(t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&this._capability.destroy(),this._capability.onchange(t)}onmousedown(t){this._capability.onMouseDown(t)}onmouseup(t){this._capability.onMouseUp(t)}onmousemove(t){this._capability.onMouseMove(t)}onmouseleave(t){this._capability.onMouseLeave(t)}onwheel(t){this._capability.onWheel(t)&&this.invalidate()}ondblclick(t){this._capability.onDblClick(t)&&this.invalidate()}ondragstart(t){this._capability.onDragStart(t)}ondragmove(t){this._capability.onDragMove(t)&&this.invalidate()}ondragend(t){this._capability.onDragEnd(t)&&this.invalidate()}ontouchstart(t){this._capability.onTouchStart(t)}onpan(t){this._capability.onPan(t)&&this.invalidate()}ontouchend(t){this._capability.onTouchEnd(t)}onkeydown(t){this._capability.onKeyDown(t)}onpinch(t){this._capability.onPinch(t)&&this.invalidate()}ondoubletap(){this._capability.onDoubleTap(),this.invalidate()}};var Om;Dm=Lp([og("3d-container")],Dm),qh(t=>{const e=t.state.material3d?.spriteMode;return"plane"===e?new Mg(t):new wg(t)}),function(t){t.compile=vl,t.duplicate=_l,t.select=za,t.match=Pa}(Om||(Om={})),Or.registerResidents(()=>({componentResidentsCount:oc.residentsCount,sceneResidentsCount:Op.residentsCount,referenceMapResidentsCount:lg.residentsCount,sceneResidents:oc.residents}));var zm=Object.freeze({__proto__:null,AbsoluteLayout:yc,Animation:ra,AudioPlayer:Of,get Banner(){return nm},Banner3D:em,BoxSelectionManager:yd,get Camera(){return am},Camera3D:om,CameraBookmarkManager:md,CameraManager:nd,CardLayout:vc,Component:oc,Connectable:Id,Container:Gp,ContainerAbstract:jc,ControlsManager:od,get Cube(){return $g},Cube3D:Kg,get Cylinder(){return Jg},Cylinder3D:Zg,DEFAULT:Vi,DPPX:Bi,DataLagTracker:rp,DataSource:sg,Donut:Kf,DonutExtrude:Ng,Ellipse:af,EllipseExtrude:Rg,EventManager3D:ad,EventMap:Lu,FPS:yh,get FloorPlate(){return bm},GESTURES:Ni,get GLTFObject(){return lm},GifView:Pf,GizmoManager:cd,GizmoOperationManager:dd,GlobalRef:Nf,Group:Lf,HTMLAbsoluteLayout:mc,HTMLOverlayContainer:Ff,HTMLOverlayElement:bf,ImageView:yf,InfoWindow:pc,InteractionManager:ud,KEYEVENTS:Hi,Layer:Rc,Layout:gc,LightManager:id,LightObject:dm,Line:sf,Line3D:wm,LinearHorizontalLayout:xc,LinearVerticalLayout:Mc,LoadTracker:sp,LoadingOverlay:xp,LocalRef:Rf,MATERIAL_PRESETS:Oh,MAX_UNDO_SIZE:30,MODE_ADD:3,MODE_EDIT:1,MODE_PASTE_DATABIND:5,MODE_PASTE_STYLE:4,MODE_SHIFT:2,MODE_VIEW:0,get Model(){return Om},MoveHandle:Ic,NOTHING:Pi,Node:tg,OrthoLine:gf,PIXEL_RATIO:bh,Path:Gf,PlacementManager:pd,get PointLight(){return um},Polygon:hf,PolygonExtrude:Bg,Polyline:pf,Polyline3D:Mm,Popup:Yf,RealObject:Yh,RealObjectCamera:Am,RealObjectDomElement:Gh,RealObjectDomTexture:Og,RealObjectDummy:Sm,RealObjectExtrude:jg,RealObjectGLTF:kp,RealObjectGroup:Em,RealObjectLine:xm,RealObjectMesh:Sg,RealObjectPlane:Cm,RealObjectPlane2D:Mg,RealObjectScene:Tm,RealObjectService:eg,RealObjectSprite:bg,RealObjectSprite2D:wg,RealObjectText:Dg,Rect:Rd,RectExtrude:Fg,RectPath:lc,ReferenceMap:lg,RendererManager:rd,RootContainer:ep,Ruler:Bd,SCALE_MIN:kh,SCENE_MODE:Ri,Scene:Op,SceneManager:ed,ScenePopup:Oc,SceneSearchEngine:Ep,ScriptLoader:mg,SearchOverlay:Tp,ServiceComponent:rg,Shape:ac,get Sphere(){return Ug},Sphere3D:Gg,get Sprite(){return Xg},Star:Zf,StarExtrude:Vg,TableLayout:Sc,Text:zf,ThreeCapability:xd,get ThreeContainer(){return Dm},TransitionEffect:Zu,Triangle:Wf,TriangleExtrude:Hg,UNIT_DIMENSION:Ch,UNIT_ROTATE:Dh,UNIT_SCALE:Th,UNIT_TRANSLATE:Ph,ValueHolder:ig,VertexGizmoManager:_d,get Wall(){return gm},Wall3D:fm,animate:na,applyAlpha:Ah,applyMaterial3dProps:jh,buildArrow3D:Sh,compile:sa,create:Ip,createCanvas:vh,createCanvasTexture:_g,createFloor:Jh,createRealObjectFor:Kh,debug:Kr,delta:ta,disposeObject3D:Bh,drawTextTexture:Eg,error:Xr,fontStyle:kg,initFontFamilyWatcher:Gi,inspector:yp,metrics:Or,opaqueColor:Eh,projectToScreen:Gc,registerDefaultRealObjectFactory:qh,registerRealObjectFactory:Xh,renderCanvasTexture:xg,resolveMaterial3d:zh,sceneComponent:og,stopFPSMeasure:mh,textBounds:Pg,textTexture:Cg,toThreeSide:Lh,updateDefaultFontFamily:Yi,version:yg,warn:qr});const Im=globalThis;"undefined"==typeof globalThis||Im.scene||(Im.scene=zm);export{yc as AbsoluteLayout,ra as Animation,Of as AudioPlayer,nm as Banner,em as Banner3D,yd as BoxSelectionManager,am as Camera,om as Camera3D,md as CameraBookmarkManager,nd as CameraManager,vc as CardLayout,oc as Component,Id as Connectable,Gp as Container,jc as ContainerAbstract,od as ControlsManager,$g as Cube,Kg as Cube3D,Jg as Cylinder,Zg as Cylinder3D,Vi as DEFAULT,Bi as DPPX,rp as DataLagTracker,sg as DataSource,Kf as Donut,Ng as DonutExtrude,af as Ellipse,Rg as EllipseExtrude,ad as EventManager3D,Lu as EventMap,yh as FPS,bm as FloorPlate,Ni as GESTURES,lm as GLTFObject,Pf as GifView,cd as GizmoManager,dd as GizmoOperationManager,Nf as GlobalRef,Lf as Group,mc as HTMLAbsoluteLayout,Ff as HTMLOverlayContainer,bf as HTMLOverlayElement,yf as ImageView,pc as InfoWindow,ud as InteractionManager,Hi as KEYEVENTS,Rc as Layer,gc as Layout,id as LightManager,dm as LightObject,sf as Line,wm as Line3D,xc as LinearHorizontalLayout,Mc as LinearVerticalLayout,sp as LoadTracker,xp as LoadingOverlay,Rf as LocalRef,Oh as MATERIAL_PRESETS,Fi as MAX_UNDO_SIZE,Ii as MODE_ADD,Oi as MODE_EDIT,ji as MODE_PASTE_DATABIND,Li as MODE_PASTE_STYLE,zi as MODE_SHIFT,Di as MODE_VIEW,Om as Model,Ic as MoveHandle,Pi as NOTHING,tg as Node,gf as OrthoLine,bh as PIXEL_RATIO,Gf as Path,pd as PlacementManager,um as PointLight,hf as Polygon,Bg as PolygonExtrude,pf as Polyline,Mm as Polyline3D,Yf as Popup,Yh as RealObject,Am as RealObjectCamera,Gh as RealObjectDomElement,Og as RealObjectDomTexture,Sm as RealObjectDummy,jg as RealObjectExtrude,kp as RealObjectGLTF,Em as RealObjectGroup,xm as RealObjectLine,Sg as RealObjectMesh,Cm as RealObjectPlane,Mg as RealObjectPlane2D,Tm as RealObjectScene,eg as RealObjectService,bg as RealObjectSprite,wg as RealObjectSprite2D,Dg as RealObjectText,Rd as Rect,Fg as RectExtrude,lc as RectPath,lg as ReferenceMap,rd as RendererManager,ep as RootContainer,Bd as Ruler,kh as SCALE_MIN,Ri as SCENE_MODE,Op as Scene,ed as SceneManager,Oc as ScenePopup,Ep as SceneSearchEngine,mg as ScriptLoader,Tp as SearchOverlay,rg as ServiceComponent,ac as Shape,Ug as Sphere,Gg as Sphere3D,Xg as Sprite,Zf as Star,Vg as StarExtrude,Sc as TableLayout,zf as Text,xd as ThreeCapability,Dm as ThreeContainer,Zu as TransitionEffect,Wf as Triangle,Hg as TriangleExtrude,Ch as UNIT_DIMENSION,Dh as UNIT_ROTATE,Th as UNIT_SCALE,Ph as UNIT_TRANSLATE,ig as ValueHolder,_d as VertexGizmoManager,gm as Wall,fm as Wall3D,na as animate,Ah as applyAlpha,jh as applyMaterial3dProps,Sh as buildArrow3D,sa as compile,Ip as create,vh as createCanvas,_g as createCanvasTexture,Jh as createFloor,Kh as createRealObjectFor,Kr as debug,ta as delta,Bh as disposeObject3D,Eg as drawTextTexture,Xr as error,kg as fontStyle,Gi as initFontFamilyWatcher,yp as inspector,Or as metrics,Eh as opaqueColor,Gc as projectToScreen,qh as registerDefaultRealObjectFactory,Xh as registerRealObjectFactory,xg as renderCanvasTexture,zh as resolveMaterial3d,og as sceneComponent,mh as stopFPSMeasure,Pg as textBounds,Cg as textTexture,Lh as toThreeSide,Yi as updateDefaultFontFamily,yg as version,qr as warn};
51
51
  //# sourceMappingURL=things-scene.mjs.map