@hatiolab/things-scene 10.0.0-beta.8 → 10.0.0-beta.9

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
@@ -48,5 +48,5 @@ return!t||t.scalable?this.context2D:this.auxContext2D}draw(t){this.canvas&&this.
48
48
  </button>`:M}
49
49
  ${n?k`<button class="closable" @click=${this.closeContainer}>close</button>`:M}
50
50
  </div>
51
- `,this.element)}catch(t){}}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}Yu=new WeakMap,tc.memoize(Hu.prototype,"bounds",!0),tc.register("container",Hu);const Wu=Math.sqrt(3),Xu=2;function qu(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 Ku(t,e,n,r=2){for(let i=0;i<n.length-1;i++)if(qu(t,e,n[i],n[i+1],r))return!0;return!1}function $u(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 Qu(t,e,n){let{lineWidth:r=Xu,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)||Xu,t.lineCap=s,t.lineWidth=r,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=o,"none"!=a&&Zu(t,e[0],e[1],r,a,Ju(l,r)),"none"!=c)){const n=e.length;Zu(t,e[n-1],e[n-2],r,c,Ju(h,r))}}function Zu(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(Wu*s.X,-s.Y),t.lineTo(Wu*s.X,s.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Wu*s.X,-s.Y),t.lineTo(-s.X/1.5+Wu*s.X,0),t.lineTo(Wu*s.X,s.Y),t.fill();break;case"open-arrow":t.moveTo(Wu*s.X+r,-s.Y),t.lineTo(r,0),t.lineTo(Wu*s.X+r,s.Y),t.stroke()}t.rotate(-c),t.translate(-o,-a),t.closePath()}function Ju(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 tp="N",ep="S",np="E",rp="W";class ip{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 np;const n=e.position;return n.y<=t.top?tp:n.y>=t.top+t.height?ep:n.x<=t.left?rp:np}get boundaryPosition(){const t=this.anchor;if(t){let{position:e}=t,n=0,r=0;switch(this.direction){case ep:r=20;break;case tp:r=-20;break;case rp: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 sp extends tc{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 ip({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 ip({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;Qu(t,s,this.state),t.beginPath();const o=$u(e,r,s[0],s[1]),a=$u(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 Ku(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"]:[]}}sp.getTipNeckPos=$u,sp.containedInPath=Ku,sp.drawEndTips=Qu,tc.register("line",sp);const op={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 ap extends(sd(ec)){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 op}}tc.memoize(ap.prototype,"path",!1),tc.register("ellipse",ap);const cp={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){}},lp={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 hp extends ec{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:cp}})}get nature(){return lp}}tc.memoize(hp.prototype,"controls",!1),tc.register("polygon",hp);const dp={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){}},up={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 pp extends sp{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:dp}),e.push({x:(r.x+i.x)/2,y:(r.y+i.y)/2,handler:dp}),n==t.length-2&&e.push({x:i.x,y:i.y,handler:dp})}return e}get nature(){return up}}tc.register("polyline",pp);const fp={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 gp extends sp{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,_,A,S,M,k,E,C,T=0,P=0;d.left+d.width<p.left?(_=0,A=1,E=r,C=o,v=(d.left+d.width+p.left)/2,T=p.left-v):p.left+p.width<d.left&&(_=1,A=0,E=o,C=r,v=(d.left+p.width+p.left)/2,T=d.left-v),d.top+d.height<p.top?(w=0,S=1,M=r,k=o,x=(d.top+d.height+p.top)/2,P=p.top-x):p.top+p.height<d.top&&(w=1,S=0,M=o,k=r,x=(d.top+p.height+p.top)/2,P=d.top-x);const O=[];if(v&&T>P){let t,e,n;switch(C){case rp:switch(E){case np:O.push({x:v,y:c[_].y}),O.push({x:v,y:c[A].y});break;case rp:t=g[_].top+g[_].height/2,e=t>c[A].y?Math.min(g[_].top,c[A].y):Math.max(g[_].top+g[_].height,c[A].y),O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:c[A].y});break;case tp:case ep:e=E===ep?Math.max(c[_].y,c[A].y):Math.min(c[_].y,c[A].y),O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:c[A].y});break;default:return this.path}break;case np:switch(E){case np:e=c[_].y<c[A].y?Math.min(g[A].top,c[_].y):Math.max(g[A].top+g[A].height,c[_].y),n=e;break;case rp:e=void 0!==x?x:c[_].y<c[A].y?b.top-.5*T:b.top+b.height+.5*T,n=e;break;case ep:e=void 0!==x?Math.max(x,c[_].y):b.top+b.height,n=e;break;case tp:e=x?Math.min(x,g[_].top):b.top,n=e;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;case ep:switch(E){case np:e=c[_].y,n=c[_].y>c[A].y?c[_].y:g[A].top+g[A].height;break;case rp:e=x?Math.max(x,g[A].top+g[A].height):b.top+b.height,n=e;break;case ep:e=b.top+b.height,n=e;break;case tp:e=x?Math.min(x,g[_].top):g[_].top,n=x?Math.max(x,g[A].top+g[A].height):g[A].top+g[A].height;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;case tp:switch(E){case np:e=c[_].y,n=c[_].y<c[A].y?c[_].y:g[A].top;break;case rp:e=x?Math.min(x,g[A].top):b.top,n=e;break;case ep:e=void 0!==x?Math.max(x,c[_].y):c[_].y,n=void 0!==x?Math.min(x,c[A].y):c[A].y;break;case tp:e=b.top,n=e;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;default:return this.path}l.push(...0===_?O:O.reverse())}else if(x){let t,e,n;switch(k){case tp:switch(M){case ep:O.push({x:c[w].x,y:x}),O.push({x:c[S].x,y:x});break;case tp:t=g[w].left+g[w].width/2,e=t>c[S].x?Math.min(g[w].left,c[S].x):Math.max(g[w].left+g[w].width,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;case rp:e=Math.min(c[w].x,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;case np:e=Math.max(c[w].x,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;default:return this.path}break;case ep:switch(M){case rp:e=b.left,n=e;break;case np:e=void 0!==v?Math.max(v,c[w].x):b.left+b.width,n=e;break;case tp:e=void 0!==v?v:c[w].x<c[S].x?b.left-.5*P:b.left+b.width+.5*P,n=e;break;case ep:e=c[w].x,n=c[w].x<c[S].x?Math.min(g[S].left,c[w].x):Math.max(g[S].left+g[S].width,c[w].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;case np:switch(M){case rp:e=void 0!==v?Math.min(v,c[w].x):c[w].x,n=void 0!==v?Math.max(v,c[S].x):c[S].x;break;case np:e=b.left+b.width,n=e;break;case tp:e=void 0!==v?Math.max(v,c[S].x):b.left+b.width,n=e;break;case ep:e=c[w].x,n=Math.max(g[S].left+g[S].width,c[w].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;case rp:switch(M){case rp:e=b.left,n=e;break;case np:e=void 0!==v?Math.max(v,c[w].x):c[w].x,n=void 0!==v?Math.min(v,c[S].x):c[S].x;break;case tp:e=b.left,n=e;break;case ep:e=c[w].x<c[S].x?Math.min(g[S].left,c[w].x):c[w].x,n=Math.min(e,c[S].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;default:return this.path}l.push(...0===w?O:O.reverse())}else{let t,e;switch(r){case tp:switch(o){case tp:e=b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case ep: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 np: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 rp: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 ep:switch(o){case tp: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 ep:case np:case rp: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 rp:switch(o){case tp: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 ep: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 np: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 rp: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 np:switch(o){case tp: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 ep: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 np:case rp: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 fp}}tc.register("ortholine",gp);const mp={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 yp extends(rc(ec)){static get noimage(){return yp.NOIMAGE||(yp.NOIMAGE=new Image,yp.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),yp.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(yp.noimage,e,n,r,i)}else!this.app.isViewMode&&t.drawImage(yp.noimage,e,n,r,i)}get nature(){return mp}get hasTextProperty(){return!1}async ready(){await super.ready(),this.prepareIf(!this._image&&this.state.src)}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=tc.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 Wr("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])}}tc.register("image-view",yp);class bp extends(Bu(rc(tc))){is3dish(){return!0}prerender(){}}var vp,xp,wp={},_p={},Ap={};function Sp(){if(xp)return _p;xp=1,Object.defineProperty(_p,"__esModule",{value:!0});var t=function(){if(vp)return Ap;vp=1,Object.defineProperty(Ap,"__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 Ap.SuperGifUtils=t,Ap}(),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 _p.SuperGifParser=e,_p}var Mp,kp,Ep={};var Cp=function(){if(kp)return wp;kp=1,Object.defineProperty(wp,"__esModule",{value:!0});var t=Sp(),e=function(){if(Mp)return Ep;Mp=1,Object.defineProperty(Ep,"__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 Ep.SuperGifStream=t,Ep}(),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 wp.SuperGif=n,wp}();const Tp={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 Pp extends bp{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 Cp.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 Tp}get tagName(){return"div"}}tc.register("gif-view",Pp);const Op={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 Dp extends(rc(ec)){static get image(){return Dp.IMAGE||(Dp.IMAGE=new Image,Dp.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5ZzAwBurHDk3WGeRY0bvYrGa1+rqNI22f7dS32ZnUK1GMr0eSK3mEc9dhKMxp+ZTo8kT2emOXS5LQ1kCxbJBocSd2k5PaIjMVzjWcdJPk9ooBnmzx1t5XbIxqBKpJ4NGTgzwKiGpK4do72gb+ZUMIYtCPm9WCPMsYTE5k2hq2ZvzujlCE1iRmwf3dvmRyKsT0T7b9I7HEPCpqCiqT2IIqaT1pI0noQZdlFC8l/PbYPAnRORT56VBEE6FXkb49agmByKhJ71BME6FsvEntUFQTdqekisUdlQWCXhovEHtUFAWbTapHYo8YgmFybO3vsUWcQYGmxSOxRbRAMprkisU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started=!1,delete this._audio}async ready(){super.ready(),this._audio=new Audio,this._audio.addEventListener("canplay",()=>{this.started&&this._audio.play()});const{src:t="",loop:e=!1,started:n=!1}=this.state;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,Dp.image,e,n,r,i)}get nature(){return Op}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 Wr(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])}}tc.register("audio",Dp);class Ip extends(rc(tc)){is3dish(){return!0}}tc.register("text",Ip);const zp=["refid","left","top","width","height","rotation","animation"];class jp extends Hu{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});const n=zp.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=tc.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)}}tc.memoize(jp.prototype,"bounds",!0),tc.register("group",jp);const Rp={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 Lp extends(rc(ec)){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 Rp}get hasTextProperty(){return!1}}tc.memoize(Lp.prototype,"ref",!1),tc.memoize(Lp.prototype,"refScale",!1),tc.register("local-ref",Lp);class Fp extends(Bu(Pc)){render(t){}is3dish(){return!0}get layout(){return lc.get(this.get("layout"))||hc}}const Np={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 Bp extends Fp{dispose(){this._releaseRef(),super.dispose()}get nature(){return Np}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)try{this.__ref=await n.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data}catch(t){Wr(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})}}tc.register("global-ref",Bp);const Yp="center-middle",Gp={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",Yp,"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 Up extends(rc(ec)){static get image(){return Up._image||(Up._image=new Image,Up._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjAgKE1hY2ludG9zaCkiIHhtcE1NOklu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mvRWoV1VmCaCRzroXPpsuAjTV7gLUfPahBqD1OQMW/fazAWTKvQRI/ZgUSJR7U8CM/dHZ+/2VcatWdvdEZAaYUhiAwkerJXt0rnzXwdRKmHfDM0fHD5kxjTFyVLzVfvvirn7+cDJWjhy7c7XlYuwc6Urvu2tRhRypyhwAf1sKY+TIxfQA+H39q5wxc+RgVrcBduTmZTlj5khnDgH4IzKpMGaOVCbvyyvRGTNHGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Up._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,Up.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||kc.show(this,this.getState("board"),{origin:this.getState("origin")||Yp,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(){kc.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 Gp}}tc.register("popup",Up);class Vp extends tc{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}}tc.register("path",Vp);const Hp={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 Wp extends ec{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 Hp}}tc.memoize(Wp.prototype,"path",!1),tc.register("triangle",Wp);const Xp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"},qp={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 Kp extends ap{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:qp}]}get nature(){return Xp}}tc.memoize(Kp.prototype,"controls",!1),tc.register("donut",Kp);const $p={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"},Qp={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 Zp extends ap{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:Qp}]}get nature(){return $p}}tc.memoize(Zp.prototype,"controls",!1),tc.register("star",Zp);const Jp={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class tf extends(sd(ec)){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(tf.RADIUS),Math.abs(tf.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-tf.RADIUS,y:e-tf.RADIUS},{x:t+tf.RADIUS,y:e-tf.RADIUS},{x:t+tf.RADIUS,y:e+tf.RADIUS},{x:t-tf.RADIUS,y:e+tf.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*tf.RADIUS-.5),s=(e-r)/(2*tf.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 Jp}}function ef(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=Ds(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(mr(t)))}}}function nf(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 rf(t){return function(e){return Array.isArray(t)?t.forEach(t=>{tc.register(t,e)}):tc.register(t,e),e}}tf.RADIUS=5,tc.memoize(tf.prototype,"path",!1),tc.register("node",tf);let sf=0;const of=new FinalizationRegistry(()=>{sf--});class af{static get residents(){return sf}static get residentsCount(){return sf}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,sf++,of.register(this,sf)}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,qr("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 Wr("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,qr("RELEASED",e)))}}const cf={},lf={};let hf=[];function df(t){const e=t.target,n="SCRIPT"===e.tagName?cf:lf,r=e.src||e.href;n[r]=!0,hf.forEach((t,e)=>{if(!t)return;const{resolve:i,scripts:s,styles:o}=t;if(n===cf){const t=s.indexOf(r);t>-1&&t<s.length-1&&pf(s[t+1])}s.some(t=>!cf[t])||o?.some(t=>!lf[t])||(i(),hf[e]=null)}),hf=hf.filter(Boolean)}function uf(t){if("string"==typeof t)return;const e=t.target,n=e.src,r="SCRIPT"===e.tagName?cf:lf;hf.forEach((e,i)=>{if(!e)return;const{reject:s,scripts:o,styles:a}=e;(r===cf&&o.includes(n)||r===lf&&!!a?.includes(n))&&(s(t),hf[i]=null)}),hf=hf.filter(Boolean),delete r[n],document.head.removeChild(e)}function pf(t){cf[t]=!1;const e=document.createElement("script");e.onload=df,e.onerror=uf,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class ff{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 lf||function(t){lf[t]=!1;const e=document.createElement("link");e.onload=df,e.onerror=uf,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),lf[t]||(s=!1)}),n&&n.length>0)for(const t of n)t in cf?cf[t]||(s=!1):i??=t;if(i)pf(i);else if(s)return void t();hf.push({resolve:t,reject:e,scripts:n,styles:r})})}}const gf="0.0.0";class mf extends Oh{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;yh(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=Oh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(bh(t)):e.opacity=0)}}function yf(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 bf(t){const{lineWidth:n=0}=t.state;let{width:r,height:i}=t.bounds;r+=n,i+=n;const s=yf(2*r),o=yf(2*i),a=hh(s,o),c=new e.CanvasTexture(a);return vf(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 vf(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 xf extends mf{buildMaterial(){const t=this.object3d.material;t&&t.dispose(),this.object3d.material=new e.SpriteMaterial({map:bf(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 wf extends Oh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const t=Sh(this.component.state.material3d),n=new e.PlaneGeometry(1,1);n.rotateX(-Math.PI/2),this.object3d.geometry=n;const r=bf(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;yh(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=Sh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return Th(this.object3d),super.clear()}}class _f extends Oh{getObject3dInstance(){return new e.Mesh}build(){super.build(),this.buildGeometry(),this.buildMaterial()}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;yh(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=Oh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(bh(t)):e.opacity=0)}updateStrokeStyle(){const t=this.object3d.getObjectByName("__edgeLines__");t&&(this.object3d.remove(t),Th(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=Sh(this.component.state.material3d);this.object3d.material=new e.MeshStandardMaterial({transparent:!0,side:kh(t.side),metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity,opacity:t.opacity,envMapIntensity:t.envMapIntensity})}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=Sh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.opacity=e.opacity,t.transparent=e.opacity<1,t.envMapIntensity=e.envMapIntensity,t.side=kh(e.side)}clear(){return Th(this.object3d),super.clear()}}function Af(t,e,n,r){return[["bold",t],["italic",e],[n+"px",!0],[r,!0]].filter(t=>t[1]).map(t=>t[0]).join(" ")}function Sf(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 Mf(t,e,n){const{bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black"}=n||{},c=t.getContext("2d");c.imageSmoothingEnabled=!1,c.fillStyle=a,c.strokeStyle=a,c.font=Af(r,i,o,s),c.textBaseline="top",c.textAlign="left",c.fillText(String(e),0,0)}function kf(t,n,r,i){const s=Sf(2*n),o=Sf(2*r),a=hh(s,o);a.getContext("2d").scale(2,2),Mf(a,t,i);const c=new e.CanvasTexture(a);return c.needsUpdate=!0,c.wrapS=e.RepeatWrapping,c.wrapT=e.RepeatWrapping,c.offset.set(0,1-2*r/o),c.repeat.set(2*n/s,2*r/o),c.minFilter=e.LinearFilter,c.colorSpace=e.SRGBColorSpace,c}function Ef(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=Af(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 Cf extends _f{get syncZPosOffset(){return this.effectiveDepth}buildGeometry(){}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",fillStyle:c}=this.component.state,l=Math.abs(e)||1,h=Math.abs(n)||1,d=kf(this.component.text,l,h,{bold:r,italic:i,fontFamily:s,fontSize:o,fontColor:a});d?(t.map&&t.map.dispose(),t.map=d,d.needsUpdate=!0):"string"==typeof c&&("transparent"!==c?t.color.set(bh(c)):t.opacity=0)}updateAlpha(){const{alpha:t=1,fontColor:e="black"}=this.component.state;yh(this.object3d.material,t,e),this.object3d.material.transparent=!0}}jh("text",t=>new Cf(t));class Tf extends Oh{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=Sh(this.component.state.material3d),i=new e.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const s=bf(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;yh(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=Sh(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),Th(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),super.dispose()}}const Pf={input:"css3d",select:"css3d",textarea:"css3d",button:"css3d",iframe:"css3d",video:"css3d",label:"texture",table:"texture",progress:"texture"};function Of(t){const e=function(t){const e=t.state?.material3d?.renderMode;if("css3d"===e||"texture"===e)return e;const n=t.model?.type??"";return Pf[n]??"css3d"}(t);return"texture"===e?new Tf(t):new Dh(t)}jh("html-overlay-element",Of),jh("html-overlay-container",Of);class Df{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,x=this.bb,w=x.max.x-x.min.x,_=x.max.y-x.min.y;return Math.abs(c-d)<.01?[new e.Vector2(a/w,1-l/v),new e.Vector2(h/w,1-u/v),new e.Vector2(p/w,1-g/v),new e.Vector2(m/w,1-b/v)]:[new e.Vector2(c/_,1-l/v),new e.Vector2(d/_,1-u/v),new e.Vector2(f/_,1-g/v),new e.Vector2(y/_,1-b/v)]}}class If extends Oh{clear(){return this._mesh=void 0,super.clear()}get shape(){return null}get boundUVGenerator(){return this._boundUVGenerator||(this._boundUVGenerator=new Df),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=Sh(this.component.state.material3d),n={metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity,opacity:t.opacity,transparent:t.opacity<1,envMapIntensity:t.envMapIntensity,side:kh(t.side)};return[new e.MeshStandardMaterial(n),new e.MeshStandardMaterial(n)]}createTexture(){function t(t){let e=0;if(t&&!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}const{width:n,height:r}=this.component.bounds,i=t(n),s=t(r),o=hh(i,s);this.component.render(o.getContext("2d"));const a=new e.CanvasTexture(o);return a.needsUpdate=!0,a.wrapS=e.RepeatWrapping,a.wrapT=e.RepeatWrapping,a.offset.set(0,1-r/s),a.repeat.set(n/i,r/s),a.minFilter=e.LinearFilter,a}getMaterials(){if(!this._mesh)return;const t=this._mesh.material;return Array.isArray(t)?t:void 0}updateMaterial3d(){super.updateMaterial3d();const t=Sh(this.component.state.material3d),e=kh(t.side),n=this.getMaterials();if(n)for(const r of n)r.metalness=t.metalness,r.roughness=t.roughness,r.emissive.set(t.emissive),r.emissiveIntensity=t.emissiveIntensity,r.opacity=t.opacity,r.transparent=t.opacity<1,r.envMapIntensity=t.envMapIntensity,r.side=e}updateAlpha(){const{alpha:t=1,fillStyle:e,strokeStyle:n}=this.component.state,r=this.getMaterials();r&&(yh(r[0],t,e),yh(r[1],t,n))}updateStrokeStyle(){const t=this.getMaterials();if(!t)return;const{strokeStyle:e}=this.component.state;t[1].color.set(bh(e))}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.getMaterials();if(!e)return;const n=e[0],r=Oh.buildFillStyleTexture(this.component);r?(n.map&&n.map.dispose(),n.map=r):n.color.set(bh(t))}updateDimension(){super.updateDimension()}}class zf extends If{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))}}jh("ellipse",t=>new zf(t));class jf extends If{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}}jh("rect",t=>new jf(t));class Rf extends If{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}}jh("polygon",t=>new Rf(t));class Lf extends If{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}}jh("donut",t=>new Lf(t));class Ff extends If{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}}jh("triangle",t=>new Ff(t));class Nf extends If{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}}jh("star",t=>new Nf(t));const Bf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/sphere"};class Yf extends _f{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 Gf=class extends ap{is3dish(){return!0}buildRealObject(){return new Yf(this)}get nature(){return Bf}};Gf=Ru([rf("sphere")],Gf);const Uf={mutable:!1,resizable:!0,rotatable:!0,properties:[]};let Vf=class extends(rc(ec)){is3dish(){return!0}buildRealObject(){return new xf(this)}get nature(){return Uf}};Vf=Ru([rf("sprite")],Vf);const Hf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cube"};class Wf extends _f{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 Xf=class extends(rc(ec)){is3dish(){return!0}buildRealObject(){return new Wf(this)}get nature(){return Hf}};Xf=Ru([rf("cube")],Xf);const qf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cylinder"};class Kf extends _f{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 $f=class extends ap{is3dish(){return!0}buildRealObject(){return new Kf(this)}get nature(){return qf}};$f=Ru([rf("cylinder")],$f);const Qf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"color",label:"box-color",name:"boxColor",property:"boxColor"}],help:"scene/component/banner"};class Zf extends Oh{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=Sh(this.component.state.material3d),o=new e.BoxGeometry(t,r,n),a=new e.MeshStandardMaterial({color:i,side:e.FrontSide,metalness:s.metalness,roughness:s.roughness,emissive:new e.Color(s.emissive),emissiveIntensity:s.emissiveIntensity}),c=new e.Mesh(o,a);return c.castShadow=s.castShadow,c.receiveShadow=s.receiveShadow,c}createTextureBoard(t,n){let r;const i=Sh(this.component.state.material3d),{fillStyle:s="#ccaa76"}=this.component.state,o=Oh.buildFillStyleTexture(this.component);r=o?new e.MeshStandardMaterial({map:o,metalness:i.metalness,roughness:i.roughness,emissive:new e.Color(i.emissive),emissiveIntensity:i.emissiveIntensity}):new e.MeshStandardMaterial({color:s||"#ccaa76",side:e.FrontSide,metalness:i.metalness,roughness:i.roughness,emissive:new e.Color(i.emissive),emissiveIntensity:i.emissiveIntensity});const a=new e.PlaneGeometry(t,n,1,1),c=new e.Mesh(a,r);return c.castShadow=i.castShadow,c.receiveShadow=i.receiveShadow,c}updateMaterial3d(){super.updateMaterial3d();const t=Sh(this.component.state.material3d);this.object3d.traverse(e=>{if(e.isMesh){const n=e.material;n&&(n.metalness=t.metalness,n.roughness=t.roughness,n.emissive.set(t.emissive),n.emissiveIntensity=t.emissiveIntensity),e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow}})}}let Jf=class extends(rc(ec)){is3dish(){return!0}get nature(){return Qf}buildRealObject(){return new Zf(this)}};var tg;Jf=Ru([rf("banner")],Jf);const eg={far:1e5,fov:80,near:1,zoom:1},ng={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 rg extends Oh{getObject3dInstance(){return new e.Mesh}updateCamera(){const{near:t=eg.near,far:n=eg.far,fov:r=eg.fov,zoom:i=eg.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 ig=tg=class extends(rc(ec)){is3dish(){return!0}static get image(){return tg._image||(tg._image=new Image,tg._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1IAAANSAQMAAABV6G1EAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEX6+voBAQGV71ZvAAAFO0lEQVR42u3dMZLkNBiGYakUKFRIqKOISxDvETiCTBEQcgQOQE7clyAi8REm7KDXIhgYoMa/7fbIX+2K9w022MCP/25Z28GW5RwRERERERERERERERERERERERERERERERERERERERERERERERHRl9mv7fdPn7879sf8Mcq3J3r5EJXaUy3Wddrcd6qNybx9F2/lZ63H+nVCa9Oe9elZa5ksa/dDbE+3fsm4v27C89bd+i6W3l+XdcnSWtuxyvPW+hqorbWb0Jr7Pl3m4tjfVMIZ625d6L5pxTPWw7rQY9P6pqu1dF8aq5d83cE3rXrGWluIxV6h53eotv4c1V3Ln7Nm66ZvvZf8SSues16sD2jubz2sC839fmvYiz7t//LJna27wsr7VjlnNWtPeHTfNlae2bZvnaTePUd+74fqV2LNxv6zdN8O3z9HSWhlc4F+dOvdsKbe2+F7q+zPddq6W2ts6r31vrN825/rtPWwvvcL5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XT903Ld1qGrzf9smmdWhyTddNzf8t8UqdtK/dZGq8P2DZ1ZnHcrQ/osWO5PkvDuby7NE58Yctk7Qq3PSv3+bpc3F0aJ56wF+uLX9xu6eOb4es9z/vWc0vR3oZuByjnf2t/fP/54B/2WvvWEREREREREREREREREREREREREREREREREREREREREREREREREX2J/QlrTpqHD8xO1gAAAABJRU5ErkJggg=="),tg._image}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,tg.image,e,n,r,i)}buildRealObject(){return new rg(this)}get nature(){return ng}};ig=tg=Ru([rf("camera")],ig);const sg="KHR_materials_pbrSpecularGlossiness";class og{constructor(t){this.name=sg,this.parser=t}extendMaterialParams(t,e){const n=this.parser.json.materials?.[t],r=n?.extensions?.[sg];if(!r)return Promise.resolve();const i=[];if(Array.isArray(r.diffuseFactor)){const[t,n,i,s]=r.diffuseFactor;e.color||(e.color=new l),e.color.setRGB(t,n,i,h),e.opacity=s}null!=r.diffuseTexture&&i.push(this.parser.assignTexture(e,"map",r.diffuseTexture,d));const s=r.glossinessFactor??1;e.roughness=1-s;const o=r.specularFactor??[1,1,1],a=Math.max(o[0],o[1],o[2]);return e.metalness=a>.5?a:0,Promise.all(i)}}const ag={once:e.LoopOnce,repeat:e.LoopRepeat,pingpong:e.LoopPingPong};class cg extends Oh{constructor(){super(...arguments),this.objectSize=new e.Vector3,this._nodeIndex=new Map,this._originals=new Map,this._animationActions=new Map,this._fillStyleOriginals=new Map,this._loadGen=0}static _getSharedLoader(t){if(!cg._sharedLoader){const t=new E;!function(t){t.register(t=>new og(t))}(t);const e=new C;e.setDecoderPath("/node_modules/three/examples/jsm/libs/draco/"),t.setDRACOLoader(e);const n=new T;n.setTranscoderPath("/node_modules/three/examples/jsm/libs/basis/"),t.setKTX2Loader(n),t.setMeshoptDecoder(P),t.setCrossOrigin("anonymous"),cg._sharedLoader=t}return cg._sharedLoader.ktx2Loader?.detectSupport(t),cg._sharedLoader}build(){super.build();const{src:t}=this.component.state;if(!t)return void this.clear();const e=++this._loadGen,n=cg._getSharedLoader(this.threeContainer.renderer3d),r=this.component.app.url(t);n.load(r,t=>{e===this._loadGen&&this.gltfLoaded(t)},void 0,t=>{e===this._loadGen&&(Wr("GLTFLoader.load",t),this.clear(),this._showErrorPlaceholder(),this.component.setState({loadError:String(t)}))})}gltfLoaded(t){this.component.state.loadError&&this.component.setState({loadError:void 0});const n=t.scene,r=t.animations,i=n.clone();i.userData.context=this,i.traverse(t=>{t.isMesh&&(t.castShadow=!0)});const s=(new e.Box3).setFromObject(i),o=s.getCenter(i.position),a=s.getSize(new e.Vector3);o.multiplyScalar(-1);const c=this.component.state.src;if(c){const t=cg._topViewCache.get(c);t?this.component._topViewSnapshot=t:this._renderTopViewSnapshot(c,i)}this.clear(),this.object3d.userData.context=this,this.objectSize=a,this.pivot=new e.Object3D,this.object3d.add(this.pivot),this.pivot.add(i),this._buildNodeIndex(i),this.updateDimension(),r&&r.length&&this._setupAnimations(r);const l=this.component.state.nodes;l&&this._applyNodeStates(l),this.updateFillStyle()}_renderTopViewSnapshot(t,e){const n=cg.renderTopView(e);cg._topViewCache.set(t,n),this.component._topViewSnapshot=n,this.component.invalidate()}static renderTopView(t){const n=256,r=new e.Scene,i=t.parent;r.add(t);const s=new e.AmbientLight(16777215,.8);r.add(s);const o=new e.DirectionalLight(16777215,1);o.position.set(0,10,0),r.add(o);const a=(new e.Box3).setFromObject(t),c=a.getSize(new e.Vector3),l=a.getCenter(new e.Vector3),h=(c.x||1)/2*1.02,d=(c.z||1)/2*1.02,u=new e.OrthographicCamera(-h,h,d,-d,.01,10*c.y+1);u.position.set(l.x,a.max.y+c.y,l.z),u.lookAt(l.x,l.y,l.z);const p=h/d,f=p>=1?n:Math.round(n*p),g=p>=1?Math.round(n/p):n,m=new e.WebGLRenderer({antialias:!0,alpha:!0});m.setClearColor(0,0),m.setSize(f,g),m.render(r,u),i?i.add(t):r.remove(t);const y=document.createElement("canvas");y.width=f,y.height=g;const b=y.getContext("2d");return b&&b.drawImage(m.domElement,0,0),m.dispose(),y}static getTopViewCache(t){return cg._topViewCache.get(t)}static setTopViewCache(t,e){cg._topViewCache.set(t,e)}_buildNodeIndex(t){this._nodeIndex.clear(),this._originals.clear(),t.traverse(t=>{if(!t.name)return;this._nodeIndex.set(t.name,t);const e={visible:t.visible,scale:t.scale.clone()};if(t.isMesh){const n=t.material;n&&(e.color=n.color.clone(),e.opacity=n.opacity,e.transparent=n.transparent,e.emissive=n.emissive.clone(),e.emissiveIntensity=n.emissiveIntensity)}this._originals.set(t.name,e)})}getNode(t){return this._nodeIndex.get(t)}get nodeNames(){return Array.from(this._nodeIndex.keys())}_applyNodeStates(t){for(const[e,n]of Object.entries(t)){const t=this._nodeIndex.get(e);if(t&&(void 0!==n.visible&&(t.visible=n.visible),void 0!==n.scale&&t.scale.setScalar(n.scale),t.isMesh)){const e=t.material;if(!e)continue;void 0!==n.color&&e.color.set(n.color),void 0!==n.opacity&&(e.opacity=n.opacity,e.transparent=n.opacity<1),void 0!==n.emissive&&e.emissive.set(n.emissive),void 0!==n.emissiveIntensity&&(e.emissiveIntensity=n.emissiveIntensity)}}}_resetNode(t){const e=this._nodeIndex.get(t),n=this._originals.get(t);if(e&&n&&(e.visible=n.visible,e.scale.copy(n.scale),e.isMesh)){const t=e.material;t&&n.color&&(t.color.copy(n.color),t.opacity=n.opacity,t.transparent=n.transparent,t.emissive.copy(n.emissive),t.emissiveIntensity=n.emissiveIntensity)}}_resetAllNodes(){for(const t of this._originals.keys())this._resetNode(t)}_setupAnimations(t){const e=this.threeContainer.mixer;this._animationActions.clear();for(const n of t){const t=e.clipAction(n);this._animationActions.set(n.name,t)}!1!==this.component.state.autoPlay&&this._animationActions.forEach(t=>t.play());const n=this.component.state.animations;n&&this._applyAnimationStates(n)}_applyAnimationStates(t){for(const[n,r]of Object.entries(t)){const t=this._animationActions.get(n);t&&(void 0!==r.loop&&(t.loop=ag[r.loop]??e.LoopRepeat,"once"===r.loop&&(t.clampWhenFinished=!0)),void 0!==r.speed&&(t.timeScale=r.speed),void 0!==r.weight&&(t.weight=r.weight),void 0!==r.play&&(r.play?t.play():t.stop()))}}get animationNames(){return Array.from(this._animationActions.keys())}_showErrorPlaceholder(){const t=new e.BoxGeometry(1,1,1),n=new e.MeshStandardMaterial({color:13369344,wireframe:!0}),r=new e.Mesh(t,n);r.name="__error_placeholder__",this.object3d.add(r)}updateFillStyle(){const t=this.component.state.fillStyleTargets;if(!t||0===t.length)return;const{fillStyle:e}=this.component.state;if(!e)return;const n=Oh.buildFillStyleTexture(this.component);for(const r of t){const t=this._nodeIndex.get(r);if(!t||!t.isMesh)continue;const i=t.material;i&&(this._fillStyleOriginals.has(r)||this._fillStyleOriginals.set(r,{color:i.color.clone(),map:i.map,opacity:i.opacity,transparent:i.transparent}),n?(i.map&&i.map!==this._fillStyleOriginals.get(r)?.map&&i.map.dispose(),n.needsUpdate=!0,i.map=n):"string"==typeof e&&("transparent"!==e?i.color.set(e):(i.opacity=0,i.transparent=!0)))}}_restoreFillStyleTargets(t){for(const e of t){const t=this._fillStyleOriginals.get(e);if(!t)continue;const n=this._nodeIndex.get(e);if(!n||!n.isMesh)continue;const r=n.material;r&&(r.map&&r.map!==t.map&&r.map.dispose(),r.color.copy(t.color),r.map=t.map,r.opacity=t.opacity,r.transparent=t.transparent,this._fillStyleOriginals.delete(e))}}clear(){return this._animationActions.forEach(t=>t.stop()),this._animationActions.clear(),this._nodeIndex.clear(),this._originals.clear(),this._fillStyleOriginals.clear(),this.pivot&&Th(this.pivot),this.pivot=void 0,this.objectSize=void 0,super.clear()}updateDimension(){const{width:t=1,height:e=1,depth:n=1}=this.component.state,{x:r=1,y:i=1,z:s=1}=this.objectSize||{};this.pivot&&this.pivot.scale.set(t/r,n/i,e/s),this.component.invalidate()}updateSource(){this.build()}onchange(t,e){if(super.onchange(t,e),"src"in t&&this.updateSource(),"nodes"in t){this._resetAllNodes();const e=t.nodes;e&&Object.keys(e).length>0&&this._applyNodeStates(e)}if("animations"in t){const e=t.animations;e&&this._applyAnimationStates(e)}if("fillStyleTargets"in t){const t=e.fillStyleTargets??[];t.length>0&&this._restoreFillStyleTargets(t),this.updateFillStyle()}"autoPlay"in t&&(!1!==t.autoPlay?this._animationActions.forEach(t=>t.play()):this._animationActions.forEach(t=>t.stop()))}}cg._topViewCache=new Map,cg._sharedLoader=null;const lg={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)}},{type:"gltf-info",label:"",name:"gltfInfo",readonly:!0,property:{action:(t,e)=>{t.set(e)}},editor:{fullwidth:!0}},{type:"gltf-fill-targets",label:"fill-targets",name:"fillStyleTargets",editor:{fullwidth:!0}}],"value-property":"source",help:"scene/component/gltf-object"};let hg=class extends(rc(ec)){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=cg.getTopViewCache(t);if(e)return this._topViewSnapshot=e,void this.invalidate();const n=this.app.url(t),r=new E;r.setCrossOrigin("anonymous"),r.load(n,e=>{if(this.getState("src")!==t)return;const n=cg.renderTopView(e.scene);cg.setTopViewCache(t,n),this._topViewSnapshot=n,this.invalidate()})}buildRealObject(){return new cg(this)}get nature(){return lg}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()}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 autoPlay(){return!1!==this.getState("autoPlay")}set autoPlay(t){this.setState("autoPlay",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??[]}};hg=Ru([rf("gltf-object")],hg);const dg={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 ug extends Oh{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 pg=class extends ap{is3dish(){return!0}buildRealObject(){return new ug(this)}get anchors(){return[]}get nature(){return dg}};pg=Ru([rf("light")],pg);const fg={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"}],help:"scene/component/wall"};class gg extends _f{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 mg=class extends(rc(ec)){is3dish(){return!0}buildRealObject(){return new gg(this)}get nature(){return fg}};mg=Ru([rf("wall")],mg);class yg extends Oh{build(){super.build()}update(){}}const bg={far:1e5,fov:80,near:1,zoom:1};class vg extends Oh{build(){super.build()}update(){super.update(),this.updateCamera()}getObject3dInstance(){return new e.PerspectiveCamera}updateCamera(){const{near:t=bg.near,far:e=bg.far,fov:n=bg.fov,zoom:r=bg.zoom}=this.component.state;this.object3d.far=e,this.object3d.fov=n,this.object3d.near=t,this.object3d.zoom=r}}class xg extends Oh{getObject3dInstance(){return new e.Group}}class wg extends _f{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 _g extends Oh{getObject3dInstance(){return new e.Scene}dispose(){for(const t of this.object3d.children)Th(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=Nh(this.component)}updateTransform(){}updateDimension(){}updatePosition(){}updateRotate(){}updateScale(){}updateAlpha(){}updateHidden(){}get animationMixer(){return this._animationMixer||(this._animationMixer=new e.AnimationMixer(this.object3d)),this._animationMixer}}const Ag={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 Sg=class extends Hu{constructor(){super(...arguments),this._capability=new Zh}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:14540253,groundColor:3355443,intensity:.035}}}getCss3DSceneAttribute(){return"three-container:css3d-renderer"}init_scene3d(){this._capability.isInitialized&&this._capability.destroy(),this._capability.init(this,{lightingConfig:this.getLightingConfig(),css3DSceneAttribute:this.getCss3DSceneAttribute()}),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 zoom(){return this._capability.zoom}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;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 lc.get("three")}get nature(){return Ag}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 Mg;Sg=Ru([rf("3d-container")],Sg),Rh(t=>{const e=t.state.material3d?.spriteMode;return"plane"===e?new wf(t):new xf(t)}),function(t){t.compile=hl,t.duplicate=dl,t.select=Ea,t.match=Sa}(Mg||(Mg={})),Or.registerResidents(()=>({componentResidentsCount:tc.residentsCount,sceneResidentsCount:Iu.residentsCount,referenceMapResidentsCount:af.residentsCount,sceneResidents:tc.residents}));var kg=Object.freeze({__proto__:null,AbsoluteLayout:dc,Animation:ta,AudioPlayer:Dp,get Banner(){return Jf},Banner3D:Zf,get Camera(){return ig},Camera3D:rg,CameraManager:Gh,CardLayout:pc,Component:tc,Connectable:sd,Container:Hu,ContainerAbstract:Pc,ControlsManager:Wh,get Cube(){return Xf},Cube3D:Wf,get Cylinder(){return $f},Cylinder3D:Kf,DEFAULT:Bi,DPPX:Li,DataSource:nf,Donut:Kp,DonutExtrude:Lf,Ellipse:ap,EllipseExtrude:zf,EventManager3D:Xh,EventMap:iu,FPS:ch,GESTURES:Fi,get GLTFObject(){return hg},GifView:Pp,GizmoManager:qh,GizmoOperationManager:Kh,GlobalRef:Bp,Group:jp,HTMLAbsoluteLayout:hc,HTMLOverlayContainer:Fp,HTMLOverlayElement:bp,ImageView:yp,InfoWindow:ac,InteractionManager:$h,KEYEVENTS:Ni,Layer:Oc,Layout:lc,LightManager:Vh,LightObject:ug,Line:sp,LinearHorizontalLayout:gc,LinearVerticalLayout:yc,LocalRef:Lp,MATERIAL_PRESETS:Ah,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 Mg},MoveHandle:Cc,NOTHING:Ci,Node:tf,OrthoLine:gp,PIXEL_RATIO:lh,Path:Vp,PlacementManager:Qh,get PointLight(){return pg},Polygon:hp,PolygonExtrude:Rf,Polyline:pp,Popup:Up,RealObject:Oh,RealObjectCamera:vg,RealObjectDomElement:Dh,RealObjectDomTexture:Tf,RealObjectDummy:yg,RealObjectExtrude:If,RealObjectGLTF:cg,RealObjectGroup:xg,RealObjectMesh:_f,RealObjectPlane:wg,RealObjectPlane2D:wf,RealObjectScene:_g,RealObjectSprite:mf,RealObjectSprite2D:xf,RealObjectText:Cf,Rect:cd,RectExtrude:jf,RectPath:rc,ReferenceMap:af,RendererManager:Uh,RootContainer:bu,Ruler:hd,SCALE_MIN:mh,SCENE_MODE:ji,Scene:Iu,SceneManager:Yh,ScenePopup:kc,ScriptLoader:ff,Shape:ec,get Sphere(){return Gf},Sphere3D:Yf,get Sprite(){return Vf},Star:Zp,StarExtrude:Nf,TableLayout:bc,Text:Ip,ThreeCapability:Zh,get ThreeContainer(){return Sg},Triangle:Wp,TriangleExtrude:Ff,UNIT_DIMENSION:vh,UNIT_ROTATE:_h,UNIT_SCALE:xh,UNIT_TRANSLATE:wh,ValueHolder:ef,get Wall(){return mg},Wall3D:gg,animate:Jo,applyAlpha:yh,buildArrow3D:gh,compile:na,create:ju,createCanvas:hh,createCanvasTexture:bf,createFloor:Nh,createRealObjectFor:Lh,debug:qr,delta:Qo,disposeObject3D:Th,drawTextTexture:Mf,error:Wr,fontStyle:Af,initFontFamilyWatcher:Gi,inspector:Pu,metrics:Or,opaqueColor:bh,projectToScreen:Fc,registerDefaultRealObjectFactory:Rh,registerRealObjectFactory:jh,renderCanvasTexture:vf,resolveMaterial3d:Sh,sceneComponent:rf,stopFPSMeasure:ah,textBounds:Ef,textTexture:kf,toThreeSide:kh,updateDefaultFontFamily:Yi,version:gf,warn:Xr});const Eg=globalThis;"undefined"==typeof globalThis||Eg.scene||(Eg.scene=kg);export{dc as AbsoluteLayout,ta as Animation,Dp as AudioPlayer,Jf as Banner,Zf as Banner3D,ig as Camera,rg as Camera3D,Gh as CameraManager,pc as CardLayout,tc as Component,sd as Connectable,Hu as Container,Pc as ContainerAbstract,Wh as ControlsManager,Xf as Cube,Wf as Cube3D,$f as Cylinder,Kf as Cylinder3D,Bi as DEFAULT,Li as DPPX,nf as DataSource,Kp as Donut,Lf as DonutExtrude,ap as Ellipse,zf as EllipseExtrude,Xh as EventManager3D,iu as EventMap,ch as FPS,Fi as GESTURES,hg as GLTFObject,Pp as GifView,qh as GizmoManager,Kh as GizmoOperationManager,Bp as GlobalRef,jp as Group,hc as HTMLAbsoluteLayout,Fp as HTMLOverlayContainer,bp as HTMLOverlayElement,yp as ImageView,ac as InfoWindow,$h as InteractionManager,Ni as KEYEVENTS,Oc as Layer,lc as Layout,Vh as LightManager,ug as LightObject,sp as Line,gc as LinearHorizontalLayout,yc as LinearVerticalLayout,Lp as LocalRef,Ah as MATERIAL_PRESETS,Ri as MAX_UNDO_SIZE,Di as MODE_ADD,Pi as MODE_EDIT,zi as MODE_PASTE_DATABIND,Ii as MODE_PASTE_STYLE,Oi as MODE_SHIFT,Ti as MODE_VIEW,Mg as Model,Cc as MoveHandle,Ci as NOTHING,tf as Node,gp as OrthoLine,lh as PIXEL_RATIO,Vp as Path,Qh as PlacementManager,pg as PointLight,hp as Polygon,Rf as PolygonExtrude,pp as Polyline,Up as Popup,Oh as RealObject,vg as RealObjectCamera,Dh as RealObjectDomElement,Tf as RealObjectDomTexture,yg as RealObjectDummy,If as RealObjectExtrude,cg as RealObjectGLTF,xg as RealObjectGroup,_f as RealObjectMesh,wg as RealObjectPlane,wf as RealObjectPlane2D,_g as RealObjectScene,mf as RealObjectSprite,xf as RealObjectSprite2D,Cf as RealObjectText,cd as Rect,jf as RectExtrude,rc as RectPath,af as ReferenceMap,Uh as RendererManager,bu as RootContainer,hd as Ruler,mh as SCALE_MIN,ji as SCENE_MODE,Iu as Scene,Yh as SceneManager,kc as ScenePopup,ff as ScriptLoader,ec as Shape,Gf as Sphere,Yf as Sphere3D,Vf as Sprite,Zp as Star,Nf as StarExtrude,bc as TableLayout,Ip as Text,Zh as ThreeCapability,Sg as ThreeContainer,Wp as Triangle,Ff as TriangleExtrude,vh as UNIT_DIMENSION,_h as UNIT_ROTATE,xh as UNIT_SCALE,wh as UNIT_TRANSLATE,ef as ValueHolder,mg as Wall,gg as Wall3D,Jo as animate,yh as applyAlpha,gh as buildArrow3D,na as compile,ju as create,hh as createCanvas,bf as createCanvasTexture,Nh as createFloor,Lh as createRealObjectFor,qr as debug,Qo as delta,Th as disposeObject3D,Mf as drawTextTexture,Wr as error,Af as fontStyle,Gi as initFontFamilyWatcher,Pu as inspector,Or as metrics,bh as opaqueColor,Fc as projectToScreen,Rh as registerDefaultRealObjectFactory,jh as registerRealObjectFactory,vf as renderCanvasTexture,Sh as resolveMaterial3d,rf as sceneComponent,ah as stopFPSMeasure,Ef as textBounds,kf as textTexture,kh as toThreeSide,Yi as updateDefaultFontFamily,gf as version,Xr as warn};
51
+ `,this.element)}catch(t){}}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}Yu=new WeakMap,tc.memoize(Hu.prototype,"bounds",!0),tc.register("container",Hu);const Wu=Math.sqrt(3),Xu=2;function qu(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 Ku(t,e,n,r=2){for(let i=0;i<n.length-1;i++)if(qu(t,e,n[i],n[i+1],r))return!0;return!1}function $u(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 Qu(t,e,n){let{lineWidth:r=Xu,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)||Xu,t.lineCap=s,t.lineWidth=r,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=o,"none"!=a&&Zu(t,e[0],e[1],r,a,Ju(l,r)),"none"!=c)){const n=e.length;Zu(t,e[n-1],e[n-2],r,c,Ju(h,r))}}function Zu(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(Wu*s.X,-s.Y),t.lineTo(Wu*s.X,s.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Wu*s.X,-s.Y),t.lineTo(-s.X/1.5+Wu*s.X,0),t.lineTo(Wu*s.X,s.Y),t.fill();break;case"open-arrow":t.moveTo(Wu*s.X+r,-s.Y),t.lineTo(r,0),t.lineTo(Wu*s.X+r,s.Y),t.stroke()}t.rotate(-c),t.translate(-o,-a),t.closePath()}function Ju(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 tp="N",ep="S",np="E",rp="W";class ip{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 np;const n=e.position;return n.y<=t.top?tp:n.y>=t.top+t.height?ep:n.x<=t.left?rp:np}get boundaryPosition(){const t=this.anchor;if(t){let{position:e}=t,n=0,r=0;switch(this.direction){case ep:r=20;break;case tp:r=-20;break;case rp: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 sp extends tc{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 ip({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 ip({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;Qu(t,s,this.state),t.beginPath();const o=$u(e,r,s[0],s[1]),a=$u(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 Ku(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"]:[]}}sp.getTipNeckPos=$u,sp.containedInPath=Ku,sp.drawEndTips=Qu,tc.register("line",sp);const op={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 ap extends(sd(ec)){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 op}}tc.memoize(ap.prototype,"path",!1),tc.register("ellipse",ap);const cp={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){}},lp={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 hp extends ec{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:cp}})}get nature(){return lp}}tc.memoize(hp.prototype,"controls",!1),tc.register("polygon",hp);const dp={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){}},up={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 pp extends sp{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:dp}),e.push({x:(r.x+i.x)/2,y:(r.y+i.y)/2,handler:dp}),n==t.length-2&&e.push({x:i.x,y:i.y,handler:dp})}return e}get nature(){return up}}tc.register("polyline",pp);const fp={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 gp extends sp{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,_,A,S,M,k,E,C,T=0,P=0;d.left+d.width<p.left?(_=0,A=1,E=r,C=o,v=(d.left+d.width+p.left)/2,T=p.left-v):p.left+p.width<d.left&&(_=1,A=0,E=o,C=r,v=(d.left+p.width+p.left)/2,T=d.left-v),d.top+d.height<p.top?(w=0,S=1,M=r,k=o,x=(d.top+d.height+p.top)/2,P=p.top-x):p.top+p.height<d.top&&(w=1,S=0,M=o,k=r,x=(d.top+p.height+p.top)/2,P=d.top-x);const O=[];if(v&&T>P){let t,e,n;switch(C){case rp:switch(E){case np:O.push({x:v,y:c[_].y}),O.push({x:v,y:c[A].y});break;case rp:t=g[_].top+g[_].height/2,e=t>c[A].y?Math.min(g[_].top,c[A].y):Math.max(g[_].top+g[_].height,c[A].y),O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:c[A].y});break;case tp:case ep:e=E===ep?Math.max(c[_].y,c[A].y):Math.min(c[_].y,c[A].y),O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:c[A].y});break;default:return this.path}break;case np:switch(E){case np:e=c[_].y<c[A].y?Math.min(g[A].top,c[_].y):Math.max(g[A].top+g[A].height,c[_].y),n=e;break;case rp:e=void 0!==x?x:c[_].y<c[A].y?b.top-.5*T:b.top+b.height+.5*T,n=e;break;case ep:e=void 0!==x?Math.max(x,c[_].y):b.top+b.height,n=e;break;case tp:e=x?Math.min(x,g[_].top):b.top,n=e;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;case ep:switch(E){case np:e=c[_].y,n=c[_].y>c[A].y?c[_].y:g[A].top+g[A].height;break;case rp:e=x?Math.max(x,g[A].top+g[A].height):b.top+b.height,n=e;break;case ep:e=b.top+b.height,n=e;break;case tp:e=x?Math.min(x,g[_].top):g[_].top,n=x?Math.max(x,g[A].top+g[A].height):g[A].top+g[A].height;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;case tp:switch(E){case np:e=c[_].y,n=c[_].y<c[A].y?c[_].y:g[A].top;break;case rp:e=x?Math.min(x,g[A].top):b.top,n=e;break;case ep:e=void 0!==x?Math.max(x,c[_].y):c[_].y,n=void 0!==x?Math.min(x,c[A].y):c[A].y;break;case tp:e=b.top,n=e;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;default:return this.path}l.push(...0===_?O:O.reverse())}else if(x){let t,e,n;switch(k){case tp:switch(M){case ep:O.push({x:c[w].x,y:x}),O.push({x:c[S].x,y:x});break;case tp:t=g[w].left+g[w].width/2,e=t>c[S].x?Math.min(g[w].left,c[S].x):Math.max(g[w].left+g[w].width,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;case rp:e=Math.min(c[w].x,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;case np:e=Math.max(c[w].x,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;default:return this.path}break;case ep:switch(M){case rp:e=b.left,n=e;break;case np:e=void 0!==v?Math.max(v,c[w].x):b.left+b.width,n=e;break;case tp:e=void 0!==v?v:c[w].x<c[S].x?b.left-.5*P:b.left+b.width+.5*P,n=e;break;case ep:e=c[w].x,n=c[w].x<c[S].x?Math.min(g[S].left,c[w].x):Math.max(g[S].left+g[S].width,c[w].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;case np:switch(M){case rp:e=void 0!==v?Math.min(v,c[w].x):c[w].x,n=void 0!==v?Math.max(v,c[S].x):c[S].x;break;case np:e=b.left+b.width,n=e;break;case tp:e=void 0!==v?Math.max(v,c[S].x):b.left+b.width,n=e;break;case ep:e=c[w].x,n=Math.max(g[S].left+g[S].width,c[w].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;case rp:switch(M){case rp:e=b.left,n=e;break;case np:e=void 0!==v?Math.max(v,c[w].x):c[w].x,n=void 0!==v?Math.min(v,c[S].x):c[S].x;break;case tp:e=b.left,n=e;break;case ep:e=c[w].x<c[S].x?Math.min(g[S].left,c[w].x):c[w].x,n=Math.min(e,c[S].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;default:return this.path}l.push(...0===w?O:O.reverse())}else{let t,e;switch(r){case tp:switch(o){case tp:e=b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case ep: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 np: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 rp: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 ep:switch(o){case tp: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 ep:case np:case rp: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 rp:switch(o){case tp: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 ep: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 np: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 rp: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 np:switch(o){case tp: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 ep: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 np:case rp: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 fp}}tc.register("ortholine",gp);const mp={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 yp extends(rc(ec)){static get noimage(){return yp.NOIMAGE||(yp.NOIMAGE=new Image,yp.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),yp.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(yp.noimage,e,n,r,i)}else!this.app.isViewMode&&t.drawImage(yp.noimage,e,n,r,i)}get nature(){return mp}get hasTextProperty(){return!1}async ready(){await super.ready(),this.prepareIf(!this._image&&this.state.src)}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=tc.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 Wr("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])}}tc.register("image-view",yp);class bp extends(Bu(rc(tc))){is3dish(){return!0}prerender(){}}var vp,xp,wp={},_p={},Ap={};function Sp(){if(xp)return _p;xp=1,Object.defineProperty(_p,"__esModule",{value:!0});var t=function(){if(vp)return Ap;vp=1,Object.defineProperty(Ap,"__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 Ap.SuperGifUtils=t,Ap}(),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 _p.SuperGifParser=e,_p}var Mp,kp,Ep={};var Cp=function(){if(kp)return wp;kp=1,Object.defineProperty(wp,"__esModule",{value:!0});var t=Sp(),e=function(){if(Mp)return Ep;Mp=1,Object.defineProperty(Ep,"__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 Ep.SuperGifStream=t,Ep}(),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 wp.SuperGif=n,wp}();const Tp={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 Pp extends bp{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 Cp.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 Tp}get tagName(){return"div"}}tc.register("gif-view",Pp);const Op={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 Dp extends(rc(ec)){static get image(){return Dp.IMAGE||(Dp.IMAGE=new Image,Dp.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5ZzAwBurHDk3WGeRY0bvYrGa1+rqNI22f7dS32ZnUK1GMr0eSK3mEc9dhKMxp+ZTo8kT2emOXS5LQ1kCxbJBocSd2k5PaIjMVzjWcdJPk9ooBnmzx1t5XbIxqBKpJ4NGTgzwKiGpK4do72gb+ZUMIYtCPm9WCPMsYTE5k2hq2ZvzujlCE1iRmwf3dvmRyKsT0T7b9I7HEPCpqCiqT2IIqaT1pI0noQZdlFC8l/PbYPAnRORT56VBEE6FXkb49agmByKhJ71BME6FsvEntUFQ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FJKFfMXp4vmSjB8n6sAAAAASUVORK5CYII="),Dp.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}async ready(){super.ready(),this._audio=new Audio,this._audio.addEventListener("canplay",()=>{this.started&&this._audio.play()});const{src:t="",loop:e=!1,started:n=!1}=this.state;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,Dp.image,e,n,r,i)}get nature(){return Op}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 Wr(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])}}tc.register("audio",Dp);class Ip extends(rc(tc)){is3dish(){return!0}}tc.register("text",Ip);const zp=["refid","left","top","width","height","rotation","animation"];class jp extends Hu{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});const n=zp.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=tc.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)}}tc.memoize(jp.prototype,"bounds",!0),tc.register("group",jp);const Rp={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 Lp extends(rc(ec)){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 Rp}get hasTextProperty(){return!1}}tc.memoize(Lp.prototype,"ref",!1),tc.memoize(Lp.prototype,"refScale",!1),tc.register("local-ref",Lp);class Fp extends(Bu(Pc)){render(t){}is3dish(){return!0}get layout(){return lc.get(this.get("layout"))||hc}}const Np={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 Bp extends Fp{dispose(){this._releaseRef(),super.dispose()}get nature(){return Np}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)try{this.__ref=await n.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data}catch(t){Wr(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})}}tc.register("global-ref",Bp);const Yp="center-middle",Gp={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",Yp,"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 Up extends(rc(ec)){static get image(){return Up._image||(Up._image=new Image,Up._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vb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IpEWi6YO8c5z4lG/nxGEXmu/1OVLGnhrFaSVQYg1SZetTTvUibqeFZ9QlfmvRWoV1VmCaCRzroXPpsuAjTV7gLUfPahBqD1OQMW/fazAWTKvQRI/ZgUSJR7U8CM/dHZ+/2VcatWdvdEZAaYUhiAwkerJXt0rnzXwdRKmHfDM0fHD5kxjTFyVLzVfvvirn7+cDJWjhy7c7XlYuwc6Urvu2tRhRypyhwAf1sKY+TIxfQA+H39q5wxc+RgVrcBduTmZTlj5khnDgH4IzKpMGaOVCbvyyvRGTNHGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Up._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,Up.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||kc.show(this,this.getState("board"),{origin:this.getState("origin")||Yp,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(){kc.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 Gp}}tc.register("popup",Up);class Vp extends tc{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}}tc.register("path",Vp);const Hp={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 Wp extends ec{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 Hp}}tc.memoize(Wp.prototype,"path",!1),tc.register("triangle",Wp);const Xp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"},qp={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 Kp extends ap{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:qp}]}get nature(){return Xp}}tc.memoize(Kp.prototype,"controls",!1),tc.register("donut",Kp);const $p={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"},Qp={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 Zp extends ap{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:Qp}]}get nature(){return $p}}tc.memoize(Zp.prototype,"controls",!1),tc.register("star",Zp);const Jp={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class tf extends(sd(ec)){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(tf.RADIUS),Math.abs(tf.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-tf.RADIUS,y:e-tf.RADIUS},{x:t+tf.RADIUS,y:e-tf.RADIUS},{x:t+tf.RADIUS,y:e+tf.RADIUS},{x:t-tf.RADIUS,y:e+tf.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*tf.RADIUS-.5),s=(e-r)/(2*tf.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 Jp}}function ef(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=Ds(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(mr(t)))}}}function nf(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 rf(t){return function(e){return Array.isArray(t)?t.forEach(t=>{tc.register(t,e)}):tc.register(t,e),e}}tf.RADIUS=5,tc.memoize(tf.prototype,"path",!1),tc.register("node",tf);let sf=0;const of=new FinalizationRegistry(()=>{sf--});class af{static get residents(){return sf}static get residentsCount(){return sf}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,sf++,of.register(this,sf)}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,qr("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 Wr("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,qr("RELEASED",e)))}}const cf={},lf={};let hf=[];function df(t){const e=t.target,n="SCRIPT"===e.tagName?cf:lf,r=e.src||e.href;n[r]=!0,hf.forEach((t,e)=>{if(!t)return;const{resolve:i,scripts:s,styles:o}=t;if(n===cf){const t=s.indexOf(r);t>-1&&t<s.length-1&&pf(s[t+1])}s.some(t=>!cf[t])||o?.some(t=>!lf[t])||(i(),hf[e]=null)}),hf=hf.filter(Boolean)}function uf(t){if("string"==typeof t)return;const e=t.target,n=e.src,r="SCRIPT"===e.tagName?cf:lf;hf.forEach((e,i)=>{if(!e)return;const{reject:s,scripts:o,styles:a}=e;(r===cf&&o.includes(n)||r===lf&&!!a?.includes(n))&&(s(t),hf[i]=null)}),hf=hf.filter(Boolean),delete r[n],document.head.removeChild(e)}function pf(t){cf[t]=!1;const e=document.createElement("script");e.onload=df,e.onerror=uf,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class ff{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 lf||function(t){lf[t]=!1;const e=document.createElement("link");e.onload=df,e.onerror=uf,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),lf[t]||(s=!1)}),n&&n.length>0)for(const t of n)t in cf?cf[t]||(s=!1):i??=t;if(i)pf(i);else if(s)return void t();hf.push({resolve:t,reject:e,scripts:n,styles:r})})}}const gf="0.0.0";class mf extends Oh{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;yh(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=Oh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(bh(t)):e.opacity=0)}}function yf(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 bf(t){const{lineWidth:n=0}=t.state;let{width:r,height:i}=t.bounds;r+=n,i+=n;const s=yf(2*r),o=yf(2*i),a=hh(s,o),c=new e.CanvasTexture(a);return vf(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 vf(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 xf extends mf{buildMaterial(){const t=this.object3d.material;t&&t.dispose(),this.object3d.material=new e.SpriteMaterial({map:bf(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 wf extends Oh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const t=Sh(this.component.state.material3d),n=new e.PlaneGeometry(1,1);n.rotateX(-Math.PI/2),this.object3d.geometry=n;const r=bf(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;yh(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=Sh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return Th(this.object3d),super.clear()}}class _f extends Oh{getObject3dInstance(){return new e.Mesh}build(){super.build(),this.buildGeometry(),this.buildMaterial()}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;yh(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=Oh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(bh(t)):e.opacity=0)}updateStrokeStyle(){const t=this.object3d.getObjectByName("__edgeLines__");t&&(this.object3d.remove(t),Th(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=Sh(this.component.state.material3d);this.object3d.material=new e.MeshStandardMaterial({transparent:!0,side:kh(t.side),metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity,opacity:t.opacity,envMapIntensity:t.envMapIntensity})}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=Sh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.opacity=e.opacity,t.transparent=e.opacity<1,t.envMapIntensity=e.envMapIntensity,t.side=kh(e.side)}clear(){return Th(this.object3d),super.clear()}}function Af(t,e,n,r){return[["bold",t],["italic",e],[n+"px",!0],[r,!0]].filter(t=>t[1]).map(t=>t[0]).join(" ")}function Sf(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 Mf(t,e,n){const{bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black"}=n||{},c=t.getContext("2d");c.imageSmoothingEnabled=!1,c.fillStyle=a,c.strokeStyle=a,c.font=Af(r,i,o,s),c.textBaseline="top",c.textAlign="left",c.fillText(String(e),0,0)}function kf(t,n,r,i){const s=Sf(2*n),o=Sf(2*r),a=hh(s,o);a.getContext("2d").scale(2,2),Mf(a,t,i);const c=new e.CanvasTexture(a);return c.needsUpdate=!0,c.wrapS=e.RepeatWrapping,c.wrapT=e.RepeatWrapping,c.offset.set(0,1-2*r/o),c.repeat.set(2*n/s,2*r/o),c.minFilter=e.LinearFilter,c.colorSpace=e.SRGBColorSpace,c}function Ef(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=Af(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 Cf extends _f{get syncZPosOffset(){return this.effectiveDepth}buildGeometry(){}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",fillStyle:c}=this.component.state,l=Math.abs(e)||1,h=Math.abs(n)||1,d=kf(this.component.text,l,h,{bold:r,italic:i,fontFamily:s,fontSize:o,fontColor:a});d?(t.map&&t.map.dispose(),t.map=d,d.needsUpdate=!0):"string"==typeof c&&("transparent"!==c?t.color.set(bh(c)):t.opacity=0)}updateAlpha(){const{alpha:t=1,fontColor:e="black"}=this.component.state;yh(this.object3d.material,t,e),this.object3d.material.transparent=!0}}jh("text",t=>new Cf(t));class Tf extends Oh{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=Sh(this.component.state.material3d),i=new e.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const s=bf(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;yh(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=Sh(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),Th(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),super.dispose()}}const Pf={input:"css3d",select:"css3d",textarea:"css3d",button:"css3d",iframe:"css3d",video:"css3d",label:"texture",table:"texture",progress:"texture"};function Of(t){const e=function(t){const e=t.state?.material3d?.renderMode;if("css3d"===e||"texture"===e)return e;const n=t.model?.type??"";return Pf[n]??"css3d"}(t);return"texture"===e?new Tf(t):new Dh(t)}jh("html-overlay-element",Of),jh("html-overlay-container",Of);class Df{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,x=this.bb,w=x.max.x-x.min.x,_=x.max.y-x.min.y;return Math.abs(c-d)<.01?[new e.Vector2(a/w,1-l/v),new e.Vector2(h/w,1-u/v),new e.Vector2(p/w,1-g/v),new e.Vector2(m/w,1-b/v)]:[new e.Vector2(c/_,1-l/v),new e.Vector2(d/_,1-u/v),new e.Vector2(f/_,1-g/v),new e.Vector2(y/_,1-b/v)]}}class If extends Oh{clear(){return this._mesh=void 0,super.clear()}get shape(){return null}get boundUVGenerator(){return this._boundUVGenerator||(this._boundUVGenerator=new Df),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=Sh(this.component.state.material3d),n={metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity,opacity:t.opacity,transparent:t.opacity<1,envMapIntensity:t.envMapIntensity,side:kh(t.side)};return[new e.MeshStandardMaterial(n),new e.MeshStandardMaterial(n)]}createTexture(){function t(t){let e=0;if(t&&!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}const{width:n,height:r}=this.component.bounds,i=t(n),s=t(r),o=hh(i,s);this.component.render(o.getContext("2d"));const a=new e.CanvasTexture(o);return a.needsUpdate=!0,a.wrapS=e.RepeatWrapping,a.wrapT=e.RepeatWrapping,a.offset.set(0,1-r/s),a.repeat.set(n/i,r/s),a.minFilter=e.LinearFilter,a}getMaterials(){if(!this._mesh)return;const t=this._mesh.material;return Array.isArray(t)?t:void 0}updateMaterial3d(){super.updateMaterial3d();const t=Sh(this.component.state.material3d),e=kh(t.side),n=this.getMaterials();if(n)for(const r of n)r.metalness=t.metalness,r.roughness=t.roughness,r.emissive.set(t.emissive),r.emissiveIntensity=t.emissiveIntensity,r.opacity=t.opacity,r.transparent=t.opacity<1,r.envMapIntensity=t.envMapIntensity,r.side=e}updateAlpha(){const{alpha:t=1,fillStyle:e,strokeStyle:n}=this.component.state,r=this.getMaterials();r&&(yh(r[0],t,e),yh(r[1],t,n))}updateStrokeStyle(){const t=this.getMaterials();if(!t)return;const{strokeStyle:e}=this.component.state;t[1].color.set(bh(e))}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.getMaterials();if(!e)return;const n=e[0],r=Oh.buildFillStyleTexture(this.component);r?(n.map&&n.map.dispose(),n.map=r):n.color.set(bh(t))}updateDimension(){super.updateDimension()}}class zf extends If{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))}}jh("ellipse",t=>new zf(t));class jf extends If{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}}jh("rect",t=>new jf(t));class Rf extends If{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}}jh("polygon",t=>new Rf(t));class Lf extends If{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}}jh("donut",t=>new Lf(t));class Ff extends If{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}}jh("triangle",t=>new Ff(t));class Nf extends If{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}}jh("star",t=>new Nf(t));const Bf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/sphere"};class Yf extends _f{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 Gf=class extends ap{is3dish(){return!0}buildRealObject(){return new Yf(this)}get nature(){return Bf}};Gf=Ru([rf("sphere")],Gf);const Uf={mutable:!1,resizable:!0,rotatable:!0,properties:[]};let Vf=class extends(rc(ec)){is3dish(){return!0}buildRealObject(){return new xf(this)}get nature(){return Uf}};Vf=Ru([rf("sprite")],Vf);const Hf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cube"};class Wf extends _f{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 Xf=class extends(rc(ec)){is3dish(){return!0}buildRealObject(){return new Wf(this)}get nature(){return Hf}};Xf=Ru([rf("cube")],Xf);const qf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cylinder"};class Kf extends _f{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 $f=class extends ap{is3dish(){return!0}buildRealObject(){return new Kf(this)}get nature(){return qf}};$f=Ru([rf("cylinder")],$f);const Qf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"color",label:"box-color",name:"boxColor",property:"boxColor"}],help:"scene/component/banner"};class Zf extends Oh{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=Sh(this.component.state.material3d),o=new e.BoxGeometry(t,r,n),a=new e.MeshStandardMaterial({color:i,side:e.FrontSide,metalness:s.metalness,roughness:s.roughness,emissive:new e.Color(s.emissive),emissiveIntensity:s.emissiveIntensity}),c=new e.Mesh(o,a);return c.castShadow=s.castShadow,c.receiveShadow=s.receiveShadow,c}createTextureBoard(t,n){let r;const i=Sh(this.component.state.material3d),{fillStyle:s="#ccaa76"}=this.component.state,o=Oh.buildFillStyleTexture(this.component);r=o?new e.MeshStandardMaterial({map:o,metalness:i.metalness,roughness:i.roughness,emissive:new e.Color(i.emissive),emissiveIntensity:i.emissiveIntensity}):new e.MeshStandardMaterial({color:s||"#ccaa76",side:e.FrontSide,metalness:i.metalness,roughness:i.roughness,emissive:new e.Color(i.emissive),emissiveIntensity:i.emissiveIntensity});const a=new e.PlaneGeometry(t,n,1,1),c=new e.Mesh(a,r);return c.castShadow=i.castShadow,c.receiveShadow=i.receiveShadow,c}updateMaterial3d(){super.updateMaterial3d();const t=Sh(this.component.state.material3d);this.object3d.traverse(e=>{if(e.isMesh){const n=e.material;n&&(n.metalness=t.metalness,n.roughness=t.roughness,n.emissive.set(t.emissive),n.emissiveIntensity=t.emissiveIntensity),e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow}})}}let Jf=class extends(rc(ec)){is3dish(){return!0}get nature(){return Qf}buildRealObject(){return new Zf(this)}};var tg;Jf=Ru([rf("banner")],Jf);const eg={far:1e5,fov:80,near:1,zoom:1},ng={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 rg extends Oh{getObject3dInstance(){return new e.Mesh}updateCamera(){const{near:t=eg.near,far:n=eg.far,fov:r=eg.fov,zoom:i=eg.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 ig=tg=class extends(rc(ec)){is3dish(){return!0}static get image(){return tg._image||(tg._image=new Image,tg._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1IAAANSAQMAAABV6G1EAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEX6+voBAQGV71ZvAAAFO0lEQVR42u3dMZLkNBiGYakUKFRIqKOISxDvETiCTBEQcgQOQE7clyAi8REm7KDXIhgYoMa/7fbIX+2K9w022MCP/25Z28GW5RwRERERERERERERERERERERERERERERERERERERERERERERERHRl9mv7fdPn7879sf8Mcq3J3r5EJXaUy3Wddrcd6qNybx9F2/lZ63H+nVCa9Oe9elZa5ksa/dDbE+3fsm4v27C89bd+i6W3l+XdcnSWtuxyvPW+hqorbWb0Jr7Pl3m4tjfVMIZ625d6L5pxTPWw7rQY9P6pqu1dF8aq5d83cE3rXrGWluIxV6h53eotv4c1V3Ln7Nm66ZvvZf8SSues16sD2jubz2sC839fmvYiz7t//LJna27wsr7VjlnNWtPeHTfNlae2bZvnaTePUd+74fqV2LNxv6z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bYs1+dRfrvQ5LpvHOaFNq3SZ8n/faEt6twDtli7wrJpxT6P1183/di0Ti36u3XT903Ld1qGrzf9smmdWhyTddNzf8t8UqdtK/dZGq8P2DZ1ZnHcrQ/osWO5PkvDuby7NE58Yctk7Qq3PSv3+bpc3F0aJ56wF+uLX9xu6eOb4es9z/vWc0vR3oZuByjnf2t/fP/54B/2WvvWEREREREREREREREREREREREREREREREREREREREREREREREREX2J/QlrTpqHD8xO1gAAAABJRU5ErkJggg=="),tg._image}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,tg.image,e,n,r,i)}buildRealObject(){return new rg(this)}get nature(){return ng}};ig=tg=Ru([rf("camera")],ig);const sg="KHR_materials_pbrSpecularGlossiness";class og{constructor(t){this.name=sg,this.parser=t}extendMaterialParams(t,e){const n=this.parser.json.materials?.[t],r=n?.extensions?.[sg];if(!r)return Promise.resolve();const i=[];if(Array.isArray(r.diffuseFactor)){const[t,n,i,s]=r.diffuseFactor;e.color||(e.color=new l),e.color.setRGB(t,n,i,h),e.opacity=s}null!=r.diffuseTexture&&i.push(this.parser.assignTexture(e,"map",r.diffuseTexture,d));const s=r.glossinessFactor??1;e.roughness=1-s;const o=r.specularFactor??[1,1,1],a=Math.max(o[0],o[1],o[2]);return e.metalness=a>.5?a:0,Promise.all(i)}}const ag={once:e.LoopOnce,repeat:e.LoopRepeat,pingpong:e.LoopPingPong};class cg extends Oh{constructor(){super(...arguments),this.objectSize=new e.Vector3,this._nodeIndex=new Map,this._originals=new Map,this._animationActions=new Map,this._fillStyleOriginals=new Map,this._loadGen=0}static getSharedLoader(t){if(!cg._sharedLoader){const t=new E;!function(t){t.register(t=>new og(t))}(t);const e=new C;e.setDecoderPath("/node_modules/three/examples/jsm/libs/draco/"),t.setDRACOLoader(e);const n=new T;n.setTranscoderPath("/node_modules/three/examples/jsm/libs/basis/"),t.setKTX2Loader(n),t.setMeshoptDecoder(P),t.setCrossOrigin("anonymous"),cg._sharedLoader=t}return t&&cg._sharedLoader.ktx2Loader?.detectSupport(t),cg._sharedLoader}build(){super.build();const{src:t}=this.component.state;if(!t)return void this.clear();const e=++this._loadGen,n=cg.getSharedLoader(this.threeContainer.renderer3d),r=this.component.app.url(t);n.load(r,t=>{e===this._loadGen&&this.gltfLoaded(t)},void 0,t=>{e===this._loadGen&&(Wr("GLTFLoader.load",t),this.clear(),this._showErrorPlaceholder(),this.component.setState({loadError:String(t)}))})}gltfLoaded(t){this.component.state.loadError&&this.component.setState({loadError:void 0});const n=t.scene,r=t.animations,i=n.clone();i.userData.context=this,i.traverse(t=>{t.isMesh&&(t.castShadow=!0)});const s=(new e.Box3).setFromObject(i),o=s.getCenter(i.position),a=s.getSize(new e.Vector3);o.multiplyScalar(-1);const c=this.component.state.src;if(c){const t=cg._topViewCache.get(c);t?this.component._topViewSnapshot=t:this._renderTopViewSnapshot(c,i)}this.clear(),this.object3d.userData.context=this,this.objectSize=a,this.pivot=new e.Object3D,this.object3d.add(this.pivot),this.pivot.add(i),this._buildNodeIndex(i),this.updateDimension(),r&&r.length&&this._setupAnimations(r);const l=this.component.state.nodes;l&&this._applyNodeStates(l),this.updateFillStyle()}_renderTopViewSnapshot(t,e){const n=cg.renderTopView(e);cg._topViewCache.set(t,n),this.component._topViewSnapshot=n,this.component.invalidate()}static renderTopView(t){const n=256,r=new e.Scene,i=t.parent;r.add(t);const s=new e.AmbientLight(16777215,.8);r.add(s);const o=new e.DirectionalLight(16777215,1);o.position.set(0,10,0),r.add(o);const a=(new e.Box3).setFromObject(t),c=a.getSize(new e.Vector3),l=a.getCenter(new e.Vector3),h=(c.x||1)/2*1.02,d=(c.z||1)/2*1.02,u=new e.OrthographicCamera(-h,h,d,-d,.01,10*c.y+1);u.position.set(l.x,a.max.y+c.y,l.z),u.lookAt(l.x,l.y,l.z);const p=h/d,f=p>=1?n:Math.round(n*p),g=p>=1?Math.round(n/p):n,m=new e.WebGLRenderer({antialias:!0,alpha:!0});m.setClearColor(0,0),m.setSize(f,g),m.render(r,u),i?i.add(t):r.remove(t);const y=document.createElement("canvas");y.width=f,y.height=g;const b=y.getContext("2d");return b&&b.drawImage(m.domElement,0,0),m.dispose(),y}static getTopViewCache(t){return cg._topViewCache.get(t)}static setTopViewCache(t,e){cg._topViewCache.set(t,e)}_buildNodeIndex(t){this._nodeIndex.clear(),this._originals.clear(),t.traverse(t=>{if(!t.name)return;this._nodeIndex.set(t.name,t);const e={visible:t.visible,scale:t.scale.clone()};if(t.isMesh){const n=t.material;n&&(e.color=n.color.clone(),e.opacity=n.opacity,e.transparent=n.transparent,e.emissive=n.emissive.clone(),e.emissiveIntensity=n.emissiveIntensity)}this._originals.set(t.name,e)})}getNode(t){return this._nodeIndex.get(t)}get nodeNames(){return Array.from(this._nodeIndex.keys())}_applyNodeStates(t){for(const[e,n]of Object.entries(t)){const t=this._nodeIndex.get(e);if(t&&(void 0!==n.visible&&(t.visible=n.visible),void 0!==n.scale&&t.scale.setScalar(n.scale),t.isMesh)){const e=t.material;if(!e)continue;void 0!==n.color&&e.color.set(n.color),void 0!==n.opacity&&(e.opacity=n.opacity,e.transparent=n.opacity<1),void 0!==n.emissive&&e.emissive.set(n.emissive),void 0!==n.emissiveIntensity&&(e.emissiveIntensity=n.emissiveIntensity)}}}_resetNode(t){const e=this._nodeIndex.get(t),n=this._originals.get(t);if(e&&n&&(e.visible=n.visible,e.scale.copy(n.scale),e.isMesh)){const t=e.material;t&&n.color&&(t.color.copy(n.color),t.opacity=n.opacity,t.transparent=n.transparent,t.emissive.copy(n.emissive),t.emissiveIntensity=n.emissiveIntensity)}}_resetAllNodes(){for(const t of this._originals.keys())this._resetNode(t)}_setupAnimations(t){const e=this.threeContainer.mixer;this._animationActions.clear();for(const n of t){const t=e.clipAction(n);this._animationActions.set(n.name,t)}!1!==this.component.state.autoPlay&&this._animationActions.forEach(t=>t.play());const n=this.component.state.animations;n&&this._applyAnimationStates(n)}_applyAnimationStates(t){for(const[n,r]of Object.entries(t)){const t=this._animationActions.get(n);t&&(void 0!==r.loop&&(t.loop=ag[r.loop]??e.LoopRepeat,"once"===r.loop&&(t.clampWhenFinished=!0)),void 0!==r.speed&&(t.timeScale=r.speed),void 0!==r.weight&&(t.weight=r.weight),void 0!==r.play&&(r.play?t.play():t.stop()))}}get animationNames(){return Array.from(this._animationActions.keys())}_showErrorPlaceholder(){const t=new e.BoxGeometry(1,1,1),n=new e.MeshStandardMaterial({color:13369344,wireframe:!0}),r=new e.Mesh(t,n);r.name="__error_placeholder__",this.object3d.add(r)}updateFillStyle(){const t=this.component.state.fillStyleTargets;if(!t||0===t.length)return;const{fillStyle:e}=this.component.state;if(!e)return;const n=Oh.buildFillStyleTexture(this.component);for(const r of t){const t=this._nodeIndex.get(r);if(!t||!t.isMesh)continue;const i=t.material;i&&(this._fillStyleOriginals.has(r)||this._fillStyleOriginals.set(r,{color:i.color.clone(),map:i.map,opacity:i.opacity,transparent:i.transparent}),n?(i.map&&i.map!==this._fillStyleOriginals.get(r)?.map&&i.map.dispose(),n.needsUpdate=!0,i.map=n):"string"==typeof e&&("transparent"!==e?i.color.set(e):(i.opacity=0,i.transparent=!0)))}}_restoreFillStyleTargets(t){for(const e of t){const t=this._fillStyleOriginals.get(e);if(!t)continue;const n=this._nodeIndex.get(e);if(!n||!n.isMesh)continue;const r=n.material;r&&(r.map&&r.map!==t.map&&r.map.dispose(),r.color.copy(t.color),r.map=t.map,r.opacity=t.opacity,r.transparent=t.transparent,this._fillStyleOriginals.delete(e))}}clear(){return this._animationActions.forEach(t=>t.stop()),this._animationActions.clear(),this._nodeIndex.clear(),this._originals.clear(),this._fillStyleOriginals.clear(),this.pivot&&Th(this.pivot),this.pivot=void 0,this.objectSize=void 0,super.clear()}updateDimension(){const{width:t=1,height:e=1,depth:n=1}=this.component.state,{x:r=1,y:i=1,z:s=1}=this.objectSize||{};this.pivot&&this.pivot.scale.set(t/r,n/i,e/s),this.component.invalidate()}updateSource(){this.build()}onchange(t,e){if(super.onchange(t,e),"src"in t&&this.updateSource(),"nodes"in t){this._resetAllNodes();const e=t.nodes;e&&Object.keys(e).length>0&&this._applyNodeStates(e)}if("animations"in t){const e=t.animations;e&&this._applyAnimationStates(e)}if("fillStyleTargets"in t){const t=e.fillStyleTargets??[];t.length>0&&this._restoreFillStyleTargets(t),this.updateFillStyle()}"autoPlay"in t&&(!1!==t.autoPlay?this._animationActions.forEach(t=>t.play()):this._animationActions.forEach(t=>t.stop()))}}cg._topViewCache=new Map,cg._sharedLoader=null;const lg={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)}},{type:"gltf-info",label:"",name:"gltfInfo",readonly:!0,property:{action:(t,e)=>{t.set(e)}},editor:{fullwidth:!0}},{type:"gltf-fill-targets",label:"fill-targets",name:"fillStyleTargets",editor:{fullwidth:!0}}],"value-property":"source",help:"scene/component/gltf-object"};let hg=class extends(rc(ec)){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=cg.getTopViewCache(t);if(e)return this._topViewSnapshot=e,void this.invalidate();const n=this.app.url(t);cg.getSharedLoader().load(n,e=>{if(this.getState("src")!==t)return;const n=cg.renderTopView(e.scene);cg.setTopViewCache(t,n),this._topViewSnapshot=n,this.invalidate()})}buildRealObject(){return new cg(this)}get nature(){return lg}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()}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 autoPlay(){return!1!==this.getState("autoPlay")}set autoPlay(t){this.setState("autoPlay",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??[]}};hg=Ru([rf("gltf-object")],hg);const dg={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 ug extends Oh{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 pg=class extends ap{is3dish(){return!0}buildRealObject(){return new ug(this)}get anchors(){return[]}get nature(){return dg}};pg=Ru([rf("light")],pg);const fg={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"}],help:"scene/component/wall"};class gg extends _f{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 mg=class extends(rc(ec)){is3dish(){return!0}buildRealObject(){return new gg(this)}get nature(){return fg}};mg=Ru([rf("wall")],mg);class yg extends Oh{build(){super.build()}update(){}}const bg={far:1e5,fov:80,near:1,zoom:1};class vg extends Oh{build(){super.build()}update(){super.update(),this.updateCamera()}getObject3dInstance(){return new e.PerspectiveCamera}updateCamera(){const{near:t=bg.near,far:e=bg.far,fov:n=bg.fov,zoom:r=bg.zoom}=this.component.state;this.object3d.far=e,this.object3d.fov=n,this.object3d.near=t,this.object3d.zoom=r}}class xg extends Oh{getObject3dInstance(){return new e.Group}}class wg extends _f{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 _g extends Oh{getObject3dInstance(){return new e.Scene}dispose(){for(const t of this.object3d.children)Th(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=Nh(this.component)}updateTransform(){}updateDimension(){}updatePosition(){}updateRotate(){}updateScale(){}updateAlpha(){}updateHidden(){}get animationMixer(){return this._animationMixer||(this._animationMixer=new e.AnimationMixer(this.object3d)),this._animationMixer}}const Ag={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 Sg=class extends Hu{constructor(){super(...arguments),this._capability=new Zh}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:14540253,groundColor:3355443,intensity:.035}}}getCss3DSceneAttribute(){return"three-container:css3d-renderer"}init_scene3d(){this._capability.isInitialized&&this._capability.destroy(),this._capability.init(this,{lightingConfig:this.getLightingConfig(),css3DSceneAttribute:this.getCss3DSceneAttribute()}),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 zoom(){return this._capability.zoom}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;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 lc.get("three")}get nature(){return Ag}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 Mg;Sg=Ru([rf("3d-container")],Sg),Rh(t=>{const e=t.state.material3d?.spriteMode;return"plane"===e?new wf(t):new xf(t)}),function(t){t.compile=hl,t.duplicate=dl,t.select=Ea,t.match=Sa}(Mg||(Mg={})),Or.registerResidents(()=>({componentResidentsCount:tc.residentsCount,sceneResidentsCount:Iu.residentsCount,referenceMapResidentsCount:af.residentsCount,sceneResidents:tc.residents}));var kg=Object.freeze({__proto__:null,AbsoluteLayout:dc,Animation:ta,AudioPlayer:Dp,get Banner(){return Jf},Banner3D:Zf,get Camera(){return ig},Camera3D:rg,CameraManager:Gh,CardLayout:pc,Component:tc,Connectable:sd,Container:Hu,ContainerAbstract:Pc,ControlsManager:Wh,get Cube(){return Xf},Cube3D:Wf,get Cylinder(){return $f},Cylinder3D:Kf,DEFAULT:Bi,DPPX:Li,DataSource:nf,Donut:Kp,DonutExtrude:Lf,Ellipse:ap,EllipseExtrude:zf,EventManager3D:Xh,EventMap:iu,FPS:ch,GESTURES:Fi,get GLTFObject(){return hg},GifView:Pp,GizmoManager:qh,GizmoOperationManager:Kh,GlobalRef:Bp,Group:jp,HTMLAbsoluteLayout:hc,HTMLOverlayContainer:Fp,HTMLOverlayElement:bp,ImageView:yp,InfoWindow:ac,InteractionManager:$h,KEYEVENTS:Ni,Layer:Oc,Layout:lc,LightManager:Vh,LightObject:ug,Line:sp,LinearHorizontalLayout:gc,LinearVerticalLayout:yc,LocalRef:Lp,MATERIAL_PRESETS:Ah,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 Mg},MoveHandle:Cc,NOTHING:Ci,Node:tf,OrthoLine:gp,PIXEL_RATIO:lh,Path:Vp,PlacementManager:Qh,get PointLight(){return pg},Polygon:hp,PolygonExtrude:Rf,Polyline:pp,Popup:Up,RealObject:Oh,RealObjectCamera:vg,RealObjectDomElement:Dh,RealObjectDomTexture:Tf,RealObjectDummy:yg,RealObjectExtrude:If,RealObjectGLTF:cg,RealObjectGroup:xg,RealObjectMesh:_f,RealObjectPlane:wg,RealObjectPlane2D:wf,RealObjectScene:_g,RealObjectSprite:mf,RealObjectSprite2D:xf,RealObjectText:Cf,Rect:cd,RectExtrude:jf,RectPath:rc,ReferenceMap:af,RendererManager:Uh,RootContainer:bu,Ruler:hd,SCALE_MIN:mh,SCENE_MODE:ji,Scene:Iu,SceneManager:Yh,ScenePopup:kc,ScriptLoader:ff,Shape:ec,get Sphere(){return Gf},Sphere3D:Yf,get Sprite(){return Vf},Star:Zp,StarExtrude:Nf,TableLayout:bc,Text:Ip,ThreeCapability:Zh,get ThreeContainer(){return Sg},Triangle:Wp,TriangleExtrude:Ff,UNIT_DIMENSION:vh,UNIT_ROTATE:_h,UNIT_SCALE:xh,UNIT_TRANSLATE:wh,ValueHolder:ef,get Wall(){return mg},Wall3D:gg,animate:Jo,applyAlpha:yh,buildArrow3D:gh,compile:na,create:ju,createCanvas:hh,createCanvasTexture:bf,createFloor:Nh,createRealObjectFor:Lh,debug:qr,delta:Qo,disposeObject3D:Th,drawTextTexture:Mf,error:Wr,fontStyle:Af,initFontFamilyWatcher:Gi,inspector:Pu,metrics:Or,opaqueColor:bh,projectToScreen:Fc,registerDefaultRealObjectFactory:Rh,registerRealObjectFactory:jh,renderCanvasTexture:vf,resolveMaterial3d:Sh,sceneComponent:rf,stopFPSMeasure:ah,textBounds:Ef,textTexture:kf,toThreeSide:kh,updateDefaultFontFamily:Yi,version:gf,warn:Xr});const Eg=globalThis;"undefined"==typeof globalThis||Eg.scene||(Eg.scene=kg);export{dc as AbsoluteLayout,ta as Animation,Dp as AudioPlayer,Jf as Banner,Zf as Banner3D,ig as Camera,rg as Camera3D,Gh as CameraManager,pc as CardLayout,tc as Component,sd as Connectable,Hu as Container,Pc as ContainerAbstract,Wh as ControlsManager,Xf as Cube,Wf as Cube3D,$f as Cylinder,Kf as Cylinder3D,Bi as DEFAULT,Li as DPPX,nf as DataSource,Kp as Donut,Lf as DonutExtrude,ap as Ellipse,zf as EllipseExtrude,Xh as EventManager3D,iu as EventMap,ch as FPS,Fi as GESTURES,hg as GLTFObject,Pp as GifView,qh as GizmoManager,Kh as GizmoOperationManager,Bp as GlobalRef,jp as Group,hc as HTMLAbsoluteLayout,Fp as HTMLOverlayContainer,bp as HTMLOverlayElement,yp as ImageView,ac as InfoWindow,$h as InteractionManager,Ni as KEYEVENTS,Oc as Layer,lc as Layout,Vh as LightManager,ug as LightObject,sp as Line,gc as LinearHorizontalLayout,yc as LinearVerticalLayout,Lp as LocalRef,Ah as MATERIAL_PRESETS,Ri as MAX_UNDO_SIZE,Di as MODE_ADD,Pi as MODE_EDIT,zi as MODE_PASTE_DATABIND,Ii as MODE_PASTE_STYLE,Oi as MODE_SHIFT,Ti as MODE_VIEW,Mg as Model,Cc as MoveHandle,Ci as NOTHING,tf as Node,gp as OrthoLine,lh as PIXEL_RATIO,Vp as Path,Qh as PlacementManager,pg as PointLight,hp as Polygon,Rf as PolygonExtrude,pp as Polyline,Up as Popup,Oh as RealObject,vg as RealObjectCamera,Dh as RealObjectDomElement,Tf as RealObjectDomTexture,yg as RealObjectDummy,If as RealObjectExtrude,cg as RealObjectGLTF,xg as RealObjectGroup,_f as RealObjectMesh,wg as RealObjectPlane,wf as RealObjectPlane2D,_g as RealObjectScene,mf as RealObjectSprite,xf as RealObjectSprite2D,Cf as RealObjectText,cd as Rect,jf as RectExtrude,rc as RectPath,af as ReferenceMap,Uh as RendererManager,bu as RootContainer,hd as Ruler,mh as SCALE_MIN,ji as SCENE_MODE,Iu as Scene,Yh as SceneManager,kc as ScenePopup,ff as ScriptLoader,ec as Shape,Gf as Sphere,Yf as Sphere3D,Vf as Sprite,Zp as Star,Nf as StarExtrude,bc as TableLayout,Ip as Text,Zh as ThreeCapability,Sg as ThreeContainer,Wp as Triangle,Ff as TriangleExtrude,vh as UNIT_DIMENSION,_h as UNIT_ROTATE,xh as UNIT_SCALE,wh as UNIT_TRANSLATE,ef as ValueHolder,mg as Wall,gg as Wall3D,Jo as animate,yh as applyAlpha,gh as buildArrow3D,na as compile,ju as create,hh as createCanvas,bf as createCanvasTexture,Nh as createFloor,Lh as createRealObjectFor,qr as debug,Qo as delta,Th as disposeObject3D,Mf as drawTextTexture,Wr as error,Af as fontStyle,Gi as initFontFamilyWatcher,Pu as inspector,Or as metrics,bh as opaqueColor,Fc as projectToScreen,Rh as registerDefaultRealObjectFactory,jh as registerRealObjectFactory,vf as renderCanvasTexture,Sh as resolveMaterial3d,rf as sceneComponent,ah as stopFPSMeasure,Ef as textBounds,kf as textTexture,kh as toThreeSide,Yi as updateDefaultFontFamily,gf as version,Xr as warn};
52
52
  //# sourceMappingURL=things-scene.mjs.map