@hatiolab/things-scene 9.0.0-beta.81 → 9.0.0-beta.82

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatiolab/things-scene",
3
- "version": "9.0.0-beta.81",
3
+ "version": "9.0.0-beta.82",
4
4
  "description": "2D graphic library",
5
5
  "main": "things-scene-min.js",
6
6
  "module": "things-scene.mjs",
@@ -70,5 +70,5 @@ const Bot=globalThis,Uot=Bot.trustedTypes,$ot=Uot?Uot.createPolicy("lit-html",{c
70
70
  </button>`:sat}
71
71
  ${r?oat`<button class="closable" @click=${this.closeContainer}>close</button>`:sat}
72
72
  </div>
73
- `,this.element)}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}Mat=new WeakMap,Let.register("container",Cat);const Rat=Math.sqrt(3),Dat=2;function Lat(t,e,r,n,i){var o,a,s,c,l=5+i,u=r.x,h=r.y,f=n.x,d=n.y;if(Math.abs(u-f)>l&&Math.abs(h-d)>l){var p=(d-h)/(f-u),g=h-p*u;if(Math.abs(e-(p*t+g))>l)return!1}return u>f?(a=u,o=f):(a=f,o=u),h>d?(c=h,s=d):(c=d,s=h),!(a+5<t)&&(!(o-5>t)&&(!(c+5<e)&&!(s-5>e)))}function jat(t,e,r,n=2){for(let i=0;i<r.length-1;i++)if(Lat(t,e,r[i],r[i+1],n))return!0;return!1}function Nat(t,e,r,n){if("arrow"!=t.slice(-5))return r;var i=Math.atan2(n.y-r.y,n.x-r.x),o=1.5*e;return{x:r.x+Math.cos(i)*o,y:r.y+Math.sin(i)*o}}function Fat(t,e,r){var{lineWidth:n=Dat,strokeStyle:i="#000000",lineCap:o=!1,alpha:a=1,begin:s="none",end:c="none",beginSize:l="size5",endSize:u="size5"}=r;if(("none"!=s||"none"!=c)&&(n=Number(n)||Dat,t.lineCap=o,t.lineWidth=n,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=a,"none"!=s&&zat(t,e[0],e[1],n,s,Bat(l,n)),"none"!=c)){let r=e.length;zat(t,e[r-1],e[r-2],n,c,Bat(u,n))}}function zat(t,e,r,n,i,o){var{x:a,y:s}=e,c=Math.atan2(r.y-s,r.x-a);switch(t.beginPath(),t.translate(a,s),t.rotate(c),i){case"oval":t.ellipse(0,0,o.X,o.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-o.X,0),t.lineTo(0,-o.Y),t.lineTo(o.X,0),t.lineTo(0,o.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(Rat*o.X,-o.Y),t.lineTo(Rat*o.X,o.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Rat*o.X,-o.Y),t.lineTo(-o.X/1.5+Rat*o.X,0),t.lineTo(Rat*o.X,o.Y),t.fill();break;case"open-arrow":t.moveTo(Rat*o.X+n,-o.Y),t.lineTo(n,0),t.lineTo(Rat*o.X+n,o.Y),t.stroke()}t.rotate(-c),t.translate(-a,-s),t.closePath()}function Bat(t,e){let r={};switch(e*=1.2,t){case"size1":r.X=e,r.Y=e;break;case"size2":r.X=1.5*e,r.Y=e;break;case"size3":r.X=2*e,r.Y=e;break;case"size4":r.X=e,r.Y=1.5*e;break;case"size5":default:r.X=1.5*e,r.Y=1.5*e;break;case"size6":r.X=2*e,r.Y=1.5*e;break;case"size7":r.X=e,r.Y=2*e;break;case"size8":r.X=1.5*e,r.Y=2*e;break;case"size9":r.X=2*e,r.Y=2*e}return r}const Uat="N",$at="S",Yat="E",Gat="W";class Hat{constructor({component:t,anchor:e,position:r,self:n}){this.component=t,this._anchorName=e,this._position=r,this.self=n}get position(){const t=this.anchor;if(t){var{position:e}=t;const r=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(r.x,r.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 Yat;const r=e.position;return r.y<=t.top?Uat:r.y>=t.top+t.height?$at:r.x<=t.left?Gat:Yat}get boundaryPosition(){const t=this.anchor;if(t){var{position:e}=t,r=0,n=0;switch(this.direction){case $at:n=20;break;case Uat:n=-20;break;case Gat:r=-20;break;default:r=20}e={x:e.x+r,y:e.y+n};const i=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(i.x,i.y)}}}class Wat extends Let{isLine(){return!0}replaceRefids(t){["from","to"].forEach((e=>{const r=this.get(e);if(r?.component){const n=t.get(r.component)||r.component;this.set(e,{...r,component:n})}}))}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:r}=this.getState("from")||{};if(!t)return;const n=this.root?.findByRefid(t);if(!n)return;this._fromEnd=new Hat({component:n,fromto:"from",anchor:e,position:r,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:r}=this.getState("to")||{};if(!t)return;const n=this.root?.findByRefid(t);if(!n)return;this._toEnd=new Hat({component:n,fromto:"to",anchor:e,position:r,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},r){r&&(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},r)}render(t){var{begin:e="none",end:r="none",lineWidth:n,round:i=0}=this.state,o=this.drawPath;Fat(t,o,this.state),t.beginPath();var a=Nat(e,n,o[0],o[1]),s=Nat(r,n,o[o.length-1],o[o.length-2]);o=[a,...o.slice(1,-1),s];var c={x:a.x,y:a.y};t.moveTo(a.x,a.y);for(var l=1;l<o.length;l++){const e=c;c=o[l];const r=o[l+1];if(e.x===c.x&&e.y===c.y)continue;if(!r){t.lineTo(c.x,c.y);break}var u=0!==(d=Math.sqrt((e.x-c.x)*(e.x-c.x)+(e.y-c.y)*(e.y-c.y)))?Math.atan2(e.x-c.x,e.y-c.y):0,h=Math.sin(u)*Math.min(i,d/2)+c.x,f=Math.cos(u)*Math.min(i,d/2)+c.y;const n=i>0||0!==d?{x:h,y:f}:c;var d;u=0!==(d=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y)))?Math.atan2(r.x-c.x,r.y-c.y):0,h=Math.sin(u)*Math.min(i,d/2)+c.x,f=Math.cos(u)*Math.min(i,d/2)+c.y;const a=i>0||0!==d?{x:h,y:f}:c;t.lineTo(n.x,n.y),i>0&&t.quadraticCurveTo(c.x,c.y,a.x,a.y)}this.drawStroke(t)}contains(t,e){var{lineWidth:r}=this.state;return jat(t,e,this.drawPath,r)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state;var{x1:r,y1:n,x2:i,y2:o}=this.state;return[this.fromEnd?.position||t?.position||{x:r,y:n},this.toEnd?.position||e?.position||{x:i,y:o}]}set path(t){const[e,r]=t,{from:n,to:i}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...n,position:e},to:{...i,position:r}})}get textBounds(){var t,e,r=this.drawPath,n=0;for(let s=1;s<r.length;s++){var i=r[s-1],o=r[s],a=(i.x-o.x)*(i.x-o.x)+(i.y-o.y)*(i.y-o.y);a>n&&(n=Math.ceil(a),t=i,e=o)}var{paddingTop:s,paddingLeft:c,paddingRight:l,paddingBottom:u}=this.state;return u||=0,s||=0,c||=0,l||=0,{left:Math.min(t.x,e.x)+c,top:Math.min(t.y,e.y)+s,width:Math.max(Math.abs(t.x-e.x)-c-l,0),height:Math.max(Math.abs(t.y-e.y)-s-u,0)}}get decorators(){return this.app.isEditMode?["decotag"]:[]}}Wat.getTipNeckPos=Nat,Wat.containedInPath=jat,Wat.drawEndTips=Fat,Let.register("line",Wat);const qat={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 Vat extends(yrt(jet)){is3dish(){return!0}render(t){var{cx:e,cy:r,rx:n,ry:i,startAngle:o,endAngle:a,anticlockwise:s}=this.state;t.beginPath(),t.ellipse(e,r,Math.abs(n),Math.abs(i),0,o||0,a||2*Math.PI,s),void 0!==o&&void 0!==a&&(t.lineTo(e,r),t.closePath())}get path(){var{cx:t,cy:e,rx:r,ry:n}=this.state;return[{x:t-r,y:e-n},{x:t+r,y:e-n},{x:t+r,y:e+n},{x:t-r,y:e+n}]}set path(t){var e=t[0],r=t[2];this.set({cx:e.x+(r.x-e.x)/2,cy:e.y+(r.y-e.y)/2,rx:(r.x-e.x)/2,ry:(r.y-e.y)/2})}contains(t,e){var{cx:r,cy:n,rx:i,ry:o}=this.state,a=(t-r)/(2*i-.5),s=(e-n)/(2*o-.5);return a*a+s*s<.25}outline(t){return function(t,e){var{cx:r,cy:n,rx:i,ry:o}=t.model,a=2*Math.PI*e,s=r+i*Math.cos(a),c=n+o*Math.sin(a);return t.toScene(s,c)}(this,t)}get anchors(){return function(t){var{left:e,top:r,width:n,height:i}=t.bounds,o=e+n/2,a=r+i/2;return[{name:"TOP",position:{x:o,y:r}},{name:"RIGHT",position:{x:e+n,y:a}},{name:"BOTTOM",position:{x:o,y:r+i}},{name:"LEFT",position:{x:e,y:a}}]}(this)}get nature(){return qat}}Let.memoize(Vat.prototype,"path",!1),Let.register("ellipse",Vat);var Xat={ondragstart:function(t,e,r){r.mutatePath(null,(function(r){r.splice(e+1,0,t)}))},ondragmove:function(t,e,r){r.mutatePath(null,(function(r){r[e+1]=t}))},ondragend:function(t,e,r){}};const Kat={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 Qat extends jet{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){var r=this.state.path,n=!1;return r.forEach(((i,o)=>{let a=(o+r.length+1)%r.length,s=i.x,c=i.y,l=r[a].x,u=r[a].y;c>e!=u>e&&t<(l-s)*(e-c)/(u-c)+s&&(n=!n)})),n}get controls(){var t=this.path;return t.map(((e,r)=>{let n=t[r+1>=t.length?0:r+1];return{x:(e.x+n.x)/2,y:(e.y+n.y)/2,handler:Xat}}))}get nature(){return Kat}}Let.memoize(Qat.prototype,"controls",!1),Let.register("polygon",Qat);var Jat={ondragstart:function(t,e,r){r.mutatePath(null,(function(r){r.splice(e,0,t)}))},ondragmove:function(t,e,r){r.mutatePath(null,(function(r){r[e]=t}))},ondragend:function(t,e,r){}};const Zat={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 tst extends Wat{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:r}=this.state;return[this.fromEnd?.position||t?.position||r[0],...r.slice(1,-1),this.toEnd?.position||e?.position||r[r.length-1]]}set path(t){const{from:e,to:r}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...r,position:t[t.length-1]},path:t})}get controls(){var t=this.path,e=[];for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];0==r&&e.push({x:n.x,y:n.y,handler:Jat}),e.push({x:(n.x+i.x)/2,y:(n.y+i.y)/2,handler:Jat}),r==t.length-2&&e.push({x:i.x,y:i.y,handler:Jat})}return e}get nature(){return Zat}}Let.register("polyline",tst);const est={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 rst extends Wat{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:r,direction:n,boundaryPosition:i=t}=this.fromEnd||{},{component:o,direction:a,boundaryPosition:s=e}=this.toEnd||{};var c=[i,s],l=[];i&&l.push(i);var u=r?.bounds;if(u){var h=r.toScene(u.left,u.top);h=this.transcoordT2P(h.x,h.y),u={...u,left:h.x,top:h.y}}var f=u?{left:u.left-20,top:u.top-20,width:u.width+40,height:u.height+40}:{left:i.x,top:i.y,width:0,height:0};u=u||f;var d=o?.bounds;if(d){h=o.toScene(d.left,d.top);h=this.transcoordT2P(h.x,h.y),d={...d,left:h.x,top:h.y}}var p=d?{left:d.left-20,top:d.top-20,width:d.width+40,height:d.height+40}:{left:s.x,top:s.y,width:0,height:0};d=d||p;var g=[f,p];const m=f.left>p.left?p.left:f.left,v=f.top>p.top?p.top:f.top;var y,b,x,w,A,_,E,S,k,M,T={left:m,top:v,width:f.left+f.width>p.left+p.width?f.left+f.width-m:p.left+p.width-m,height:f.top+f.height>p.top+p.height?f.top+f.height-v:p.top+p.height-v},O=0,P=0;u.left+u.width<d.left?(w=0,A=1,k=n,M=a,y=(u.left+u.width+d.left)/2,O=d.left-y):d.left+d.width<u.left&&(w=1,A=0,k=a,M=n,y=(u.left+d.width+d.left)/2,O=u.left-y),u.top+u.height<d.top?(x=0,_=1,E=n,S=a,b=(u.top+u.height+d.top)/2,P=d.top-b):d.top+d.height<u.top&&(x=1,_=0,E=a,S=n,b=(u.top+d.height+d.top)/2,P=u.top-b);var I=[];if(y&&O>P){switch(M){case Gat:switch(k){case Yat:I.push({x:y,y:c[w].y}),I.push({x:y,y:c[A].y});break;case Gat:var C=g[w].top+g[w].height/2>c[A].y?Math.min(g[w].top,c[A].y):Math.max(g[w].top+g[w].height,c[A].y);I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:c[A].y});break;case Uat:case $at:C=k===$at?Math.max(c[w].y,c[A].y):Math.min(c[w].y,c[A].y);I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:c[A].y});break;default:return this.path}break;case Yat:switch(k){case Yat:var R=C=c[w].y<c[A].y?Math.min(g[A].top,c[w].y):Math.max(g[A].top+g[A].height,c[w].y);break;case Gat:R=C=void 0!==b?b:c[w].y<c[A].y?T.top-.5*O:T.top+T.height+.5*O;break;case $at:R=C=void 0!==b?Math.max(b,c[w].y):T.top+T.height;break;case Uat:R=C=b?Math.min(b,g[w].top):T.top;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:R}),I.push({x:c[A].x,y:R});break;case $at:switch(k){case Yat:C=c[w].y,R=c[w].y>c[A].y?c[w].y:g[A].top+g[A].height;break;case Gat:R=C=b?Math.max(b,g[A].top+g[A].height):T.top+T.height;break;case $at:R=C=T.top+T.height;break;case Uat:C=b?Math.min(b,g[w].top):g[w].top,R=b?Math.max(b,g[A].top+g[A].height):g[A].top+g[A].height;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:R}),I.push({x:c[A].x,y:R});break;case Uat:switch(k){case Yat:C=c[w].y,R=c[w].y<c[A].y?c[w].y:g[A].top;break;case Gat:R=C=b?Math.min(b,g[A].top):T.top;break;case $at:C=void 0!==b?Math.max(b,c[w].y):c[w].y,R=void 0!==b?Math.min(b,c[A].y):c[A].y;break;case Uat:R=C=T.top;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:R}),I.push({x:c[A].x,y:R});break;default:return this.path}l.push(...0===w?I:I.reverse())}else if(b){switch(S){case Uat:switch(E){case $at:I.push({x:c[x].x,y:b}),I.push({x:c[_].x,y:b});break;case Uat:var D=g[x].left+g[x].width/2>c[_].x?Math.min(g[x].left,c[_].x):Math.max(g[x].left+g[x].width,c[_].x);I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:c[_].x,y:b});break;case Gat:D=Math.min(c[x].x,c[_].x);I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:c[_].x,y:b});break;case Yat:D=Math.max(c[x].x,c[_].x);I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:c[_].x,y:b});break;default:return this.path}break;case $at:switch(E){case Gat:var L=D=T.left;break;case Yat:L=D=void 0!==y?Math.max(y,c[x].x):T.left+T.width;break;case Uat:L=D=void 0!==y?y:c[x].x<c[_].x?T.left-.5*P:T.left+T.width+.5*P;break;case $at:D=c[x].x,L=c[x].x<c[_].x?Math.min(g[_].left,c[x].x):Math.max(g[_].left+g[_].width,c[x].x);break;default:return this.path}I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;case Yat:switch(E){case Gat:D=void 0!==y?Math.min(y,c[x].x):c[x].x,L=void 0!==y?Math.max(y,c[_].x):c[_].x;break;case Yat:L=D=T.left+T.width;break;case Uat:L=D=void 0!==y?Math.max(y,c[_].x):T.left+T.width;break;case $at:D=c[x].x,L=Math.max(g[_].left+g[_].width,c[x].x);break;default:return this.path}I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;case Gat:switch(E){case Gat:L=D=T.left;break;case Yat:D=void 0!==y?Math.max(y,c[x].x):c[x].x,L=void 0!==y?Math.min(y,c[_].x):c[_].x;break;case Uat:L=D=T.left;break;case $at:D=c[x].x<c[_].x?Math.min(g[_].left,c[x].x):c[x].x,L=Math.min(D,c[_].x);break;default:return this.path}I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;default:return this.path}l.push(...0===x?I:I.reverse())}else switch(n){case Uat:switch(a){case Uat:var j=T.top;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case $at:var N=T.left+T.width;l.push({x:N,y:c[0].y}),l.push({x:N,y:T.top+T.height}),l.push({x:c[1].x,y:T.top+T.height});break;case Yat:N=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:T.left+T.width;l.push({x:N,y:c[0].y}),l.push({x:N,y:c[1].y});break;case Gat:N=T.left;l.push({x:N,y:c[0].y}),l.push({x:N,y:c[1].y});break;default:return this.path}break;case $at:switch(a){case Uat:N=T.left+T.width;l.push({x:N,y:c[0].y}),l.push({x:N,y:T.top}),l.push({x:c[1].x,y:T.top});break;case $at:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case Yat:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case Gat:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;default:return this.path}break;case Gat:switch(a){case Uat:N=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:T.left,j=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(T.top,c[0].y);l.push({x:N,y:c[0].y}),l.push({x:N,y:j}),l.push({x:c[1].x,y:j});break;case $at:N=T.left,j=Math.max(T.top+T.height,c[0].y);l.push({x:N,y:c[0].y}),l.push({x:N,y:j}),l.push({x:c[1].x,y:j});break;case Yat:N=T.left+T.width;l.push({x:c[0].x,y:T.top}),l.push({x:N,y:T.top}),l.push({x:N,y:c[1].y});break;case Gat:N=T.left;l.push({x:N,y:c[0].y}),l.push({x:N,y:c[1].y});break;default:return this.path}break;case Yat:switch(a){case Uat:j=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:T.top;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case $at:j=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case Yat:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case Gat:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;default:return this.path}break;default:return this.path}return s&&l.push(s),[t,...l,e].filter(((t,e,r)=>{if(0===e)return!0;const n=r[e-1];return t.x!==n.x||t.y!==n.y})).filter(((t,e,r)=>{if(0===e||e>=r.length-1)return!0;const n=r[e-1],i=r[e+1];return!(t.x===n.x&&t.x===i.x||t.y===n.y&&t.y===i.y)}))}get nature(){return est}}Let.register("ortholine",rst);const nst={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 ist extends(Fet(jet)){static get noimage(){return ist.NOIMAGE||(ist.NOIMAGE=new Image,ist.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),ist.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){var{left:e,top:r,width:n,height:i,isGray:o=!1,alpha:a=1,src:s}=this.state;if(this.prepareIf(!this._image&&s),t.beginPath(),t.globalAlpha*=a,this._image&&this._image.complete)if(o&&this._offcanvas)t.drawImage(this._offcanvas,e,r,n,i);else try{t.drawImage(this._image,e,r,n,i)}catch(o){t.drawImage(ist.noimage,e,r,n,i)}else!this.app.isViewMode&&t.drawImage(ist.noimage,e,r,n,i)}get nature(){return nst}get hasTextProperty(){return!1}ready(){super.ready(),this.prepareIf(!this._image&&this.state.src)}prepare(t,e){var{src:r,crossOrigin:n}=this.state;if(r){this._image=new Image;try{n&&(this._image.crossOrigin=n),this._image.src=this.app.url(r)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){let t=this._image.width,e=this._image.height;this._offcanvas=Let.createCanvas(t,e);let r=this._offcanvas.getContext("2d");r.drawImage(this._image,0,0);let n=function(t,e,r){try{var n=t.getImageData(0,0,e,r)}catch(t){return stt("Get Image Data Error: "+t.message),null}var i=n.data;for(let t=0;t<e*r*4;t+=4){let e=i[t],r=i[t+1],o=i[t+2],a=parseInt((e+r+o)/3);n.data[t]=a,n.data[t+1]=a,n.data[t+2]=a}return n}(r,t,e);r.putImageData(n,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 r=0;r<t.length;r++)if(t[r].type.startsWith("image/"))return void(this.src=e[r])}}Let.register("image-view",ist);class ost extends(Tat(Fet(Let))){is3dish(){return!0}prerender(){}}var ast={},sst={},cst={};Object.defineProperty(cst,"__esModule",{value:!0});var lst=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=[],r=7;r>=0;r--)e.push(!!(t&1<<r));return e},t.lzwDecode=function(t,e){for(var r,n,i=0,o=function(t){for(var r=0,n=0;n<t;n++)e.charCodeAt(i>>3)&1<<(7&i)&&(r|=1<<n),i++;return r},a=[],s=1<<t,c=s+1,l=t+1,u=[],h=function(){u=[],l=t+1;for(var e=0;e<s;e++)u[e]=[e];u[s]=[],u[c]=null};;)if(n=r,(r=o(l))!==s){if(r===c)break;if(r<u.length)n!==s&&u.push(u[n].concat(u[r][0]));else{if(r!==u.length)throw new Error("Invalid LZW code.");u.push(u[n].concat(u[n][0]))}a.push.apply(a,u[r]),u.length===1<<l&&l<12&&l++}else h();return a},t}();cst.SuperGifUtils=lst,Object.defineProperty(sst,"__esModule",{value:!0});var ust=cst,hst=function(){function t(t,e){this.stream=t,this.handler=e}return t.prototype.parseCT=function(t){for(var e=[],r=0;r<t;r++)e.push(this.stream.readBytes(3));return e},t.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},t.prototype.parseHeader=function(){var t={};if(t.sig=this.stream.read(3),t.ver=this.stream.read(3),"GIF"!==t.sig)throw new Error("Not a GIF file.");t.width=this.stream.readUnsigned(),t.height=this.stream.readUnsigned();var e=ust.SuperGifUtils.byteToBitArr(this.stream.readByte());t.gctFlag=e.shift(),t.colorRes=ust.SuperGifUtils.bitsToNum(e.splice(0,3)),t.sorted=e.shift(),t.gctSize=ust.SuperGifUtils.bitsToNum(e.splice(0,3)),t.bgColor=this.stream.readByte(),t.pixelAspectRatio=this.stream.readByte(),t.gctFlag&&(t.gct=this.parseCT(1<<t.gctSize+1)),this.handler.hdr&&this.handler.hdr(t)},t.prototype.parseExt=function(t){var e=this;switch(t.label=this.stream.readByte(),t.label){case 249:t.extType="gce",function(t){e.stream.readByte();var r=ust.SuperGifUtils.byteToBitArr(e.stream.readByte());t.reserved=r.splice(0,3),t.disposalMethod=ust.SuperGifUtils.bitsToNum(r.splice(0,3)),t.userInput=r.shift(),t.transparencyGiven=r.shift(),t.delayTime=e.stream.readUnsigned(),t.transparencyIndex=e.stream.readByte(),t.terminator=e.stream.readByte(),e.handler.gce&&e.handler.gce(t)}(t);break;case 254:t.extType="com",function(t){t.comment=e.readSubBlocks(),e.handler.com&&e.handler.com(t)}(t);break;case 1:t.extType="pte",function(t){e.stream.readByte(),t.ptHeader=e.stream.readBytes(12),t.ptData=e.readSubBlocks(),e.handler.pte&&e.handler.pte(t)}(t);break;case 255:t.extType="app",function(t){e.stream.readByte(),t.identifier=e.stream.read(8),t.authCode=e.stream.read(3),"NETSCAPE"===t.identifier?function(t){e.stream.readByte(),t.unknown=e.stream.readByte(),t.iterations=e.stream.readUnsigned(),t.terminator=e.stream.readByte(),e.handler.app&&e.handler.app.NETSCAPE&&e.handler.app.NETSCAPE(t)}(t):function(t){t.appData=e.readSubBlocks(),e.handler.app&&e.handler.app[t.identifier]&&e.handler.app[t.identifier](t)}(t)}(t);break;default:t.extType="unknown",function(t){t.data=e.readSubBlocks(),e.handler.unknown&&e.handler.unknown(t)}(t)}},t.prototype.parseImg=function(t){t.leftPos=this.stream.readUnsigned(),t.topPos=this.stream.readUnsigned(),t.width=this.stream.readUnsigned(),t.height=this.stream.readUnsigned();var e=ust.SuperGifUtils.byteToBitArr(this.stream.readByte());t.lctFlag=e.shift(),t.interlaced=e.shift(),t.sorted=e.shift(),t.reserved=e.splice(0,2),t.lctSize=ust.SuperGifUtils.bitsToNum(e.splice(0,3)),t.lctFlag&&(t.lct=this.parseCT(1<<t.lctSize+1)),t.lzwMinCodeSize=this.stream.readByte();var r=this.readSubBlocks();t.pixels=ust.SuperGifUtils.lzwDecode(t.lzwMinCodeSize,r),t.interlaced&&(t.pixels=function(t,e){for(var r=new Array(t.length),n=t.length/e,i=function(n,i){var o=t.slice(i*e,(i+1)*e);r.splice.apply(r,[n*e,e].concat(o))},o=[0,4,2,1],a=[8,8,4,2],s=0,c=0;c<4;c++)for(var l=o[c];l<n;l+=a[c])i(l,s),s++;return r}(t.pixels,t.width)),this.handler.img&&this.handler.img(t)},t.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)},t.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},t}();sst.SuperGifParser=hst;var fst={};Object.defineProperty(fst,"__esModule",{value:!0});var dst=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=[],r=0;r<t;r++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",r=0;r<t;r++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();fst.SuperGifStream=dst,Object.defineProperty(ast,"__esModule",{value:!0});var pst=sst,gst=fst,mst=function(){function t(t,e){var r=this;for(var n 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(){r.pushFrame(),r.canvas.width=r.hdr.width*r.getCanvasScale(),r.canvas.height=r.hdr.height*r.getCanvasScale(),r.playerInit(),r.loading=!1,r.ready=!0,r.loadCallback&&r.loadCallback(r.gifImgElement)}},e)this.options[n]=e[n];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 t.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},t.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)},t.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)},t.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)}},t.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},t.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)},t.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},t.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},t.prototype.parseStream=function(t){try{new pst.SuperGifParser(t,this.handler).parse()}catch(t){this.handleError("parse")}},t.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)},t.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()},t.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},t.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},t.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},t.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}))},t.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var r=this.frames.length,n=t.lctFlag?t.lct:this.hdr.gct;r>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=r-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,r){t!==e.transparency&&(i.data[4*r+0]=n[t][0],i.data[4*r+1]=n[t][1],i.data[4*r+2]=n[t][2],i.data[4*r+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},t.prototype.doNothing=function(){},t.prototype.withProgress=function(t){return function(e){t(e)}},t.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},t.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},t.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},t.prototype.play=function(){this.playing=!0,this.step()},t.prototype.pause=function(){this.playing=!1},t.prototype.isPlaying=function(){return this.playing},t.prototype.getCanvas=function(){return this.canvas},t.prototype.isLoading=function(){return this.loading},t.prototype.isReady=function(){return this.ready},t.prototype.isAutoPlay=function(){return this.options.autoPlay},t.prototype.getLength=function(){return this.frames.length},t.prototype.getCurrentFrame=function(){return this.currentFrameIndex},t.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},t.prototype.loadURL=function(t,e){var r=this;if(this.loadSetup(e)){var n=new XMLHttpRequest;n.open("GET",t,!0),"overrideMimeType"in n?n.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in n?n.responseType="arraybuffer":n.setRequestHeader("Accept-Charset","x-user-defined"),n.onloadstart=function(){r.initialized||r.init()},n.onload=function(){if(200===n.status){var t=n.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var e=new gst.SuperGifStream(t);setTimeout((function(){r.parseStream(e)}),0)}else r.handleError("xhr - response")},n.onerror=function(){r.handleError("xhr")},n.send()}},t.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},t}(),vst=ast.SuperGif=mst;const yst={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 bst extends ost{async oncreate_element(t){var{src:e,play:r}=this.state;this.onchangesrc(e),this.onchangeplay(r)}buildImg(){var t=this.element;t.innerHTML="";var 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){var e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){var 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",0),this._superGif=new vst(e,{autoPlay:!1}),this._superGif.init();for(const t of this.element.children)t.style.width="100%",t.style.height="100%";var r=this._superGif.getCanvas();r.style.width="100%",r.style.height="100%",this._superGif.load((()=>{setTimeout((()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()}),100)}))}ondropfile(t,e){for(let r=0;r<t.length;r++)if(/\.gif$/.test(t[r].name))return void(this.src=e[r])}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 yst}get tagName(){return"div"}}Let.register("gif-view",bst);const xst={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 wst extends(Fet(jet)){static get image(){return wst.IMAGE||(wst.IMAGE=new Image,wst.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5ZzAwBurHDk3WGeRY0bvYrGa1+rqNI22f7dS32ZnUK1GMr0eSK3mEc9dhKMxp+ZTo8kT2emOXS5LQ1kCxbJBocSd2k5PaIjMVzjWcdJPk9ooBnmzx1t5XbIxqBKpJ4NGTgzwKiGpK4do72gb+ZUMIYtCPm9WCPMsYTE5k2hq2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6MJx0bvUwiw4ewgT8zNR0LHUL+OccOpY/3ElzyGKD5pBlMJpDlsOkMythRoNbXh95PJsdA67MrMtAEYbjeDqNo+7oKqWUUkoppZRSSimllFJKFfMXp4vmSjB8n6sAAAAASUVORK5CYII="),wst.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}ready(){super.ready(),this._audio=new Audio,this._audio.addEventListener("canplay",(()=>{this.started&&this._audio.play()}));var{src:t="",loop:e=!1,started:r=!1}=this.state;this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(r)}render(t){var{left:e,top:r,width:n,height:i,src:o}=this.state;t.beginPath(),this.drawImage(t,wst.image,e,r,n,i)}get nature(){return xst}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 console.error(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 r=0;r<t.length;r++)if(t[r].type.startsWith("audio/"))return void(this.src=e[r])}}Let.register("audio",wst);class Ast extends(Fet(Let)){is3dish(){return!0}}Let.register("text",Ast);const _st=["refid","left","top","width","height","rotation","animation"];class Est extends Cat{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});var r=_st.reduce(((e,r)=>(t.hasOwnProperty(r)&&(e[r]=t[r]),e)),{});return super.set(r)}capture(t,e,r){var n=super.capture(t,e,r);if(n!==this)return n}set bounds(t){if(this.__MUTATING__)super.bounds=t;else{var e=this.bounds,r=t.width/e.width,n=t.height/e.height;this.path=this.path.map((i=>({x:t.left+(i.x-e.left)*r,y:t.top+(i.y-e.top)*n}))),this.components&&this.components.forEach((t=>{if(t.mutable)t.mutatePath(null,(function(t){return t.map((function(t){return{x:t.x*r,y:t.y*n}}))}));else{let e=t.bounds,i=t.center,o={x:i.x*(1-r),y:i.y*(1-n)},a=e.width*(1-r),s=e.height*(1-n),c=-(o.x-a/2),l=-(o.y-s/2);t.bounds={left:e.left+c,top:e.top+l,width:e.width*r,height:e.height*n}}}))}}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){var e=Let.union(this.components.map((t=>t.bounds)));return this.components.forEach((t=>{let r=t.bounds;t.bounds={left:r.left-e.left,top:r.top-e.top,width:r.width,height:r.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){var{top:e,left:r,scale:n}=this.state;t.translate(r,e),this.layout.drawables(this).forEach((e=>{e.draw(t)})),t.translate(-r,-e)}}Let.register("group",Est);const Sst={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 kst extends(Fet(jet)){get ref(){var t=this.getState("ref");return t&&"string"==typeof t?this.root.findById(t):null}set ref(t){this.setState("ref",t)}get refScale(){let t=this.ref.bounds,e=this.bounds,r=e.width/t.width,n=e.height/t.height;return"both"===this.model.fit?{x:r,y:n}:{x:Math.min(r,n),y:Math.min(r,n)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){let e=this.ref.center,r=this.center,n=this.refScale;t.translate(r.x,r.y),t.scale(n.x,n.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);this.state;var{left:e,top:r,width:n,height:i}=this.bounds;t.beginPath(),t.rect(e,r,n,i)}get nature(){return Sst}get hasTextProperty(){return!1}}Let.memoize(kst.prototype,"ref",!1),Let.memoize(kst.prototype,"refScale",!1),Let.register("local-ref",kst);class Mst extends(Tat(urt)){render(t){}is3dish(){return!0}get layout(){return Get.get(this.get("layout"))||Het}}const Tst={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 Ost extends Mst{dispose(){this._releaseRef(),super.dispose()}get nature(){return Tst}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){var{mode:e="view",round:r=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=r+"px"}ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();let t=this._element_bounds,{offsetWidth:e,offsetHeight:r}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:r},(!t||t.offsetWidth!=e||t.offsetHeight!=r)&&this.ref&&this.root.target_element){let{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();var{ref:t,fit:e="ratio"}=this.state;if(t){var r=this.app.refProvider;if(r&&t)try{this.__ref=await r.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data}catch(t){stt(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,r){super.onchange(t,e,r),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame((()=>{let{fit:t}=this.state;this.ref.fit(t)})),"data"in t&&this.ref&&requestAnimationFrame((()=>{this.ref.data=t.data}))}}Let.register("global-ref",Ost);const Pst="center-middle",Ist={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",Pst,"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 Cst extends(Fet(jet)){static get image(){return Cst._image||(Cst._image=new Image,Cst._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9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IuFuCImAcS6MQAAAeJJREFUWMPt2FlX2zAQhuHJYmOSFhIggbC0QNn3rS1dKXSH9///Hi58CJLxKIpEWi6YO8c5z4lG/nxGEXmu/1OVLGnhrFaSVQYg1SZetTTvUibqeFZ9QlfmvRWoV1VmCaCRzroXPpsuAjTV7gLUfPahBqD1OQMW/fazAWTKvQRI/ZgUSJR7U8CM/dHZ+/2VcatWdvdEZAaYUhiAwkerJXt0rnzXwdRKmHfDM0fHD5kxjTFyVLzVfvvirn7+cDJWjhy7c7XlYuwc6Urvu2tRhRypyhwAf1sKY+TIxfQA+H39q5wxc+RgVrcBduTmZTlj5khnDgH4IzKpMGaOVCbvyyvRGTNHGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Cst._image}ready(){super.ready(),this.show&&this.onchangeShow(!0)}render(t){var{left:e,top:r,width:n,height:i}=this.bounds;t.beginPath(),this.drawImage(t,Cst.image,e,r,n,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||Jet.show(this,this.getState("board"),{origin:this.getState("origin")||Pst,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(){Jet.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 Ist}}Let.register("popup",Cst);class Rst extends Let{render(t){var{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let r=1;r<e.length;r++)t.lineTo(e[r].x,e[r].y);t.closePath(),this.drawStroke(t)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){var r=this.state.path,n=!1;return r.forEach(((i,o)=>{let a=(o+r.length+1)%r.length,s=i.x,c=i.y,l=r[a].x,u=r[a].y;c>e!=u>e&&t<(l-s)*(e-c)/(u-c)+s&&(n=!n)})),n}}Let.register("path",Rst);const Dst={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 Lst extends jet{contains(t,e){var{x1:r,y1:n,x2:i,y2:o,x3:a,y3:s}=this.state,c=[r,n,i,o,a,s],l=!1;for(let r=0;r<c.length;r+=2){let n=(r+2)%c.length,i=c[r],o=c[r+1],a=c[n+1];o>e!=a>e&&t<(c[n]-i)*(e-o)/(a-o)+i&&(l=!l)}return l}get mutable(){return!0}get path(){var{x1:t,y1:e,x2:r,y2:n,x3:i,y3:o}=this.state;return[{x:t,y:e},{x:r,y:n},{x:i,y:o}]}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 Dst}}Let.memoize(Lst.prototype,"path",!1),Let.register("triangle",Lst);const jst={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"};var Nst={ondragmove:function(t,e,r){r.controls;var{cx:n,rx:i}=r.model;i=Math.abs(i);var o=(r.fromParent(t.x,t.y).x-n)/i*100;o=o>=100||o<=-100?100:Math.abs(o),r.set({ratio:o})}};class Fst extends Vat{is3dish(){return!1}render(t){var{ratio:e=50,cx:r,cy:n,rx:i,ry:o,startAngle:a,endAngle:s,anticlockwise:c}=this.state;i=Math.abs(i),o=Math.abs(o),t.beginPath(),t.ellipse(r,n,i,o,0,a||0,s||2*Math.PI,c),t.moveTo(r+i/100*e,n),t.ellipse(r,n,i/100*e,o/100*e,0,a||0,s||2*Math.PI,!0)}contains(t,e){var{cx:r,cy:n,rx:i,ry:o,ratio:a}=this.state,s=(t-r)/(2*(i=Math.abs(i))-.5),c=(e-n)/(2*(o=Math.abs(o))-.5),l=(t-r)/(i/100*a*2-.5),u=(e-n)/(o/100*a*2-.5),h=!1;return s*s+c*c<.25&&l*l+u*u>.25&&(h=!h),h}get controls(){var{cx:t,cy:e,rx:r,ratio:n}=this.state;return[{x:t+(r=Math.abs(r))/100*n,y:e,handler:Nst}]}get nature(){return jst}}Let.memoize(Fst.prototype,"controls",!1),Let.register("donut",Fst);const zst={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"};var Bst={ondragmove:function(t,e,r){r.controls;var{cy:n,ry:i}=r.model,o=(r.fromParent(t.x,t.y).y-n)/i*100+100;o>=100?o=100:o<=0&&(o=0),r.set({ratio:o})}};class Ust extends Vat{is3dish(){return!1}render(t){var{ratio:e=30,wing:r=5,cx:n,cy:i,rx:o,ry:a,startAngle:s,endAngle:c,anticlockwise:l}=this.state;if(r<3)return;const u=1.5707963267948966;var h=2*Math.PI/r,f=o-e/100*o,d=a-e/100*a;t.save(),t.beginPath(),t.translate(n,i),t.moveTo(o*Math.cos(-u),a*Math.sin(-u)),t.lineTo((o-f)*(Math.cos(h-u)+Math.cos(0-u))/2,(a-d)*(Math.sin(h-u)+Math.sin(0-u))/2);for(var p=1;p<r;p++)t.lineTo(o*Math.cos(h*p-u),a*Math.sin(h*p-u)),t.lineTo((o-f)*(Math.cos(h*(p+1)-u)+Math.cos(h*p-u))/2,(a-d)*(Math.sin(h*(p+1)-u)+Math.sin(h*p-u))/2);t.closePath(),t.restore()}get controls(){var{cx:t,cy:e,ry:r,ratio:n}=this.state;return[{x:t,y:e-r+r*(n/100),handler:Bst}]}get nature(){return zst}}Let.memoize(Ust.prototype,"controls",!1),Let.register("star",Ust);const $st={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class Yst extends(yrt(jet)){is3dish(){return!1}isDescendible(){return!1}render(t){const{cx:e,cy:r,anticlockwise:n}=this.state,i=this.app?.scale||1;t.beginPath(),t.scale(1/i,1/i),t.ellipse(e,r,Math.abs(Yst.RADIUS),Math.abs(Yst.RADIUS),0,0,2*Math.PI,n),t.scale(i,i),t.closePath()}get path(){var{cx:t,cy:e}=this.state;return[{x:t-Yst.RADIUS,y:e-Yst.RADIUS},{x:t+Yst.RADIUS,y:e-Yst.RADIUS},{x:t+Yst.RADIUS,y:e+Yst.RADIUS},{x:t-Yst.RADIUS,y:e+Yst.RADIUS}]}set path(t){var e=t[0],r=t[2];this.set({cx:e.x+(r.x-e.x)/2,cy:e.y+(r.y-e.y)/2})}contains(t,e){var{cx:r,cy:n}=this.state,i=(t-r)/(2*Yst.RADIUS-.5),o=(e-n)/(2*Yst.RADIUS-.5);return i*i+o*o<.25}outline(t){var{cx:e,cy:r}=this.state;return this.toScene(e,r)}get nature(){return $st}}Yst.RADIUS=5,Let.memoize(Yst.prototype,"path",!1),Let.register("node",Yst);var Gst=0;const Hst=new FinalizationRegistry((()=>{Gst--}));var Wst={},qst={},Vst=[];function Xst(t){var e="SCRIPT"==t.target.tagName?Wst:qst,r=t.target.src||t.target.href;e[r]=!0,Vst.forEach(((t,n)=>{let{resolve:i,scripts:o,styles:a}=t;if(e==Wst){let t=o.indexOf(r);t>-1&&t<o.length-1&&Qst(o[t+1])}for(let t=0;t<o.length;t++)if(!Wst[o[t]])return;if(a)for(let t=0;t<a.length;t++)if(!qst[a[t]])return;i(),Vst[n]=null})),Vst=Vst.filter(Boolean)}function Kst(t){var e=t.target.src,r="SCRIPT"==t.target.tagName?Wst:qst;Vst.forEach(((n,i)=>{let{reject:o,scripts:a,styles:s}=n,c=!1;if(r===Wst){for(let t=0;t<a.length;t++)if(a[t]==e){c=!0;break}}else if(s)for(let t=0;t<s.length;t++)if(s[t]==e){c=!0;break}c&&(o(t),Vst[i]=null)})),Vst=Vst.filter(Boolean),delete r[e],document.head.removeChild(t.target)}function Qst(t){Wst[t]=!1;var e=document.createElement("script");e.onload=Xst,e.onerror=Kst,e.type="text/javascript",e.src=t,document.head.appendChild(e)}var Jst=0,Zst=performance.now(),tct=0;requestAnimationFrame((function t(){requestAnimationFrame(t),tct++;var e=performance.now(),r=e-Zst;r<1e3||(Jst=Math.round(1e3*tct/r),Zst=e,tct=0)}));var ect=Zrt;t.AbsoluteLayout=Zet,t.AudioPlayer=wst,t.CardLayout=ert,t.Component=Let,t.Connectable=yrt,t.Container=Cat,t.ContainerAbstract=urt,t.DEFAULT=ptt,t.DPPX=htt,t.DataSource=t=>class extends t{_convertDataFormat(t,e){var r;if("json"===e)r=JSON.parse(t);else r=t;return r}isDataSource(){return!0}},t.Donut=Fst,t.Ellipse=Vat,t.EventMap=Uit,t.FPS=function(){return Jst},t.GESTURES=ftt,t.GifView=bst,t.GlobalRef=Ost,t.Group=Est,t.HTMLAbsoluteLayout=Het,t.HTMLOverlayContainer=Mst,t.HTMLOverlayElement=ost,t.ImageView=ist,t.InfoWindow=$et,t.KEYEVENTS=dtt,t.Layer=hrt,t.Layout=Get,t.Line=Wat,t.LinearHorizontalLayout=nrt,t.LinearVerticalLayout=ort,t.LocalRef=kst,t.MAX_UNDO_SIZE=30,t.MODE_ADD=3,t.MODE_EDIT=1,t.MODE_PASTE_DATABIND=5,t.MODE_PASTE_STYLE=4,t.MODE_SHIFT=2,t.MODE_VIEW=0,t.Model=ect,t.MoveHandle=crt,t.NOTHING={},t.Node=Yst,t.OrthoLine=rst,t.Path=Rst,t.Polygon=Qat,t.Polyline=tst,t.Popup=Cst,t.Rect=wrt,t.RectPath=Fet,t.ReferenceMap=class{static get residents(){return Gst}static get residentsCount(){return Gst}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,Gst++,Hst.register(this,Gst)}dispose(){if(this.disposer)for(let t in this.references)this.disposer.call(null,t,this.references[t]);delete this.references,delete this.counters}get ids(){return Object.keys(this.references)}create(t){var e=this;return new Promise((function(r,n){e.creator?e.creator.call(null,t,(function(e){!function(e){e.release=function(){this.disposer&&this.disposer.call(null,t,e),delete e.release,ltt("RELEASED",t)},r(e)}(e)}),(function(t){n(t)})):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))}))}add(t,e){var r=this,n=new Promise((function(n,i){var o=r.references[t];if(o)o===e?i(Error("Reference ID and target duplicate")):e?i(Error("Reference ID duplicate")):n(o);else{function a(e){e.release=function(){r.release(this)},r.references[t]=e,r.counters[t]=1,n(e)}if(e)a(e);else{if(!r.creator)return void i(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));r.creator.call(null,t,(function(t){a(t)}),(function(t){i(t)}))}}}));return this.references[t]||(this.references[t]=n),n}async get(t,e=!1){var r=this.references[t];if(r){if(!(r instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,r}if(e)return r=await r,this.counters[t]++,r}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(let e in this.references){if(this.references[e]===t)return e}return-1}release(t){var e=this._id(t),r=this.references[e];r?(this.counters[e]--,0==this.counters[e]&&(this.disposer&&this.disposer.call(null,e,r),delete this.references[e],delete this.counters[e],delete t.release,ltt("RELEASED",e))):stt("No Referenced ID")}},t.RootContainer=eot,t.Ruler=_rt,t.SCENE_MODE={VIEW:0,EDIT:1,SHIFT:2,ADD:3},t.Scene=got,t.ScenePopup=Jet,t.ScriptLoader=class{static load(t,e){return"string"==typeof t&&(t=[t]),"string"==typeof e&&(e=[e]),new Promise((function(r,n){if((!t||t instanceof Array)&&(!e||e instanceof Array)){var i,o=!0;if(e&&e.forEach((t=>{qst.hasOwnProperty(t)||function(t){qst[t]=!1;var e=document.createElement("link");e.onload=Xst,e.onerror=Kst,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),qst[t]||(o=!1)})),t&&t.length>0&&t.forEach((t=>{Wst.hasOwnProperty(t)?Wst[t]||(o=!1):i=i||t})),i)Qst(i);else if(o)return void r(void 0);Vst.push({resolve:r,reject:n,scripts:t,styles:e})}else n("invalid sources for load")}))}},t.Shape=jet,t.Star=Ust,t.TableLayout=art,t.Text=Ast,t.Triangle=Lst,t.ValueHolder=t=>class extends t{animOnValueChange(t,e=!1,r){if(t!=this._lastValue){if(e)var n=t-(Number(r)||0);else n=t-(this._lastValue||0);this._lastValue=t,this._anim_alpha=-n,this.animate({step:t=>{this._anim_alpha=n*(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=Eet(this.getState("value"),this)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(X9(t)))}},t.create=function({target:t,model:e,style:r,layers:n=[],handlers:i=[],mode:o=0,refProvider:a,dataSubscriptionProvider:s,dataStorage:c=mot,baseUrl:l,fitMode:u}){var h=null;if("string"==typeof t){if(!(h=document.getElementById(t)))throw`target element '${t}' is not exist`;if(h.firstChild)throw`target element '${t}' is not empty`}else h=t;h&&h.style&&(h.style.position="absolute",h.style.cursor="default",h.style.overflow="hidden");var f=new aot(o,a);return f.baseUrl=l,f.dataSubscriptionProvider=s,f.dataStorage=c,new got(new eot({target_element:h,model:e,style:r,layers:n,handlers:i,fitMode:u},f))},t.debug=ltt,t.error=stt,t.initFontFamilyWatcher=mtt,t.license=function(){},t.polyfill="done",t.sceneComponent=function(t){return function(e){return Array.isArray(t)?t.forEach((t=>{Let.register(t,e)})):Let.register(t,e),e}},t.updateDefaultFontFamily=gtt,t.version="0.0.0",t.warn=ctt,Object.defineProperty(t,"__esModule",{value:!0})}));
73
+ `,this.element)}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}Mat=new WeakMap,Let.register("container",Cat);const Rat=Math.sqrt(3),Dat=2;function Lat(t,e,r,n,i){var o,a,s,c,l=5+i,u=r.x,h=r.y,f=n.x,d=n.y;if(Math.abs(u-f)>l&&Math.abs(h-d)>l){var p=(d-h)/(f-u),g=h-p*u;if(Math.abs(e-(p*t+g))>l)return!1}return u>f?(a=u,o=f):(a=f,o=u),h>d?(c=h,s=d):(c=d,s=h),!(a+5<t)&&(!(o-5>t)&&(!(c+5<e)&&!(s-5>e)))}function jat(t,e,r,n=2){for(let i=0;i<r.length-1;i++)if(Lat(t,e,r[i],r[i+1],n))return!0;return!1}function Nat(t,e,r,n){if("arrow"!=t.slice(-5))return r;var i=Math.atan2(n.y-r.y,n.x-r.x),o=1.5*e;return{x:r.x+Math.cos(i)*o,y:r.y+Math.sin(i)*o}}function Fat(t,e,r){var{lineWidth:n=Dat,strokeStyle:i="#000000",lineCap:o=!1,alpha:a=1,begin:s="none",end:c="none",beginSize:l="size5",endSize:u="size5"}=r;if(("none"!=s||"none"!=c)&&(n=Number(n)||Dat,t.lineCap=o,t.lineWidth=n,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=a,"none"!=s&&zat(t,e[0],e[1],n,s,Bat(l,n)),"none"!=c)){let r=e.length;zat(t,e[r-1],e[r-2],n,c,Bat(u,n))}}function zat(t,e,r,n,i,o){var{x:a,y:s}=e,c=Math.atan2(r.y-s,r.x-a);switch(t.beginPath(),t.translate(a,s),t.rotate(c),i){case"oval":t.ellipse(0,0,o.X,o.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-o.X,0),t.lineTo(0,-o.Y),t.lineTo(o.X,0),t.lineTo(0,o.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(Rat*o.X,-o.Y),t.lineTo(Rat*o.X,o.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Rat*o.X,-o.Y),t.lineTo(-o.X/1.5+Rat*o.X,0),t.lineTo(Rat*o.X,o.Y),t.fill();break;case"open-arrow":t.moveTo(Rat*o.X+n,-o.Y),t.lineTo(n,0),t.lineTo(Rat*o.X+n,o.Y),t.stroke()}t.rotate(-c),t.translate(-a,-s),t.closePath()}function Bat(t,e){let r={};switch(e*=1.2,t){case"size1":r.X=e,r.Y=e;break;case"size2":r.X=1.5*e,r.Y=e;break;case"size3":r.X=2*e,r.Y=e;break;case"size4":r.X=e,r.Y=1.5*e;break;case"size5":default:r.X=1.5*e,r.Y=1.5*e;break;case"size6":r.X=2*e,r.Y=1.5*e;break;case"size7":r.X=e,r.Y=2*e;break;case"size8":r.X=1.5*e,r.Y=2*e;break;case"size9":r.X=2*e,r.Y=2*e}return r}const Uat="N",$at="S",Yat="E",Gat="W";class Hat{constructor({component:t,anchor:e,position:r,self:n}){this.component=t,this._anchorName=e,this._position=r,this.self=n}get position(){const t=this.anchor;if(t){var{position:e}=t;const r=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(r.x,r.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 Yat;const r=e.position;return r.y<=t.top?Uat:r.y>=t.top+t.height?$at:r.x<=t.left?Gat:Yat}get boundaryPosition(){const t=this.anchor;if(t){var{position:e}=t,r=0,n=0;switch(this.direction){case $at:n=20;break;case Uat:n=-20;break;case Gat:r=-20;break;default:r=20}e={x:e.x+r,y:e.y+n};const i=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(i.x,i.y)}}}class Wat extends Let{isLine(){return!0}replaceRefids(t){["from","to"].forEach((e=>{const r=this.get(e);if(r?.component){const n=t.get(r.component)||r.component;this.set(e,{...r,component:n})}}))}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:r}=this.getState("from")||{};if(!t)return;const n=this.root?.findByRefid(t);if(!n)return;this._fromEnd=new Hat({component:n,fromto:"from",anchor:e,position:r,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:r}=this.getState("to")||{};if(!t)return;const n=this.root?.findByRefid(t);if(!n)return;this._toEnd=new Hat({component:n,fromto:"to",anchor:e,position:r,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},r){r&&(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},r)}render(t){var{begin:e="none",end:r="none",lineWidth:n,round:i=0}=this.state,o=this.drawPath;Fat(t,o,this.state),t.beginPath();var a=Nat(e,n,o[0],o[1]),s=Nat(r,n,o[o.length-1],o[o.length-2]);o=[a,...o.slice(1,-1),s];var c={x:a.x,y:a.y};t.moveTo(a.x,a.y);for(var l=1;l<o.length;l++){const e=c;c=o[l];const r=o[l+1];if(e.x===c.x&&e.y===c.y)continue;if(!r){t.lineTo(c.x,c.y);break}var u=0!==(d=Math.sqrt((e.x-c.x)*(e.x-c.x)+(e.y-c.y)*(e.y-c.y)))?Math.atan2(e.x-c.x,e.y-c.y):0,h=Math.sin(u)*Math.min(i,d/2)+c.x,f=Math.cos(u)*Math.min(i,d/2)+c.y;const n=i>0||0!==d?{x:h,y:f}:c;var d;u=0!==(d=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y)))?Math.atan2(r.x-c.x,r.y-c.y):0,h=Math.sin(u)*Math.min(i,d/2)+c.x,f=Math.cos(u)*Math.min(i,d/2)+c.y;const a=i>0||0!==d?{x:h,y:f}:c;t.lineTo(n.x,n.y),i>0&&t.quadraticCurveTo(c.x,c.y,a.x,a.y)}this.drawStroke(t)}contains(t,e){var{lineWidth:r}=this.state;return jat(t,e,this.drawPath,r)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state;var{x1:r,y1:n,x2:i,y2:o}=this.state;return[this.fromEnd?.position||t?.position||{x:r,y:n},this.toEnd?.position||e?.position||{x:i,y:o}]}set path(t){const[e,r]=t,{from:n,to:i}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...n,position:e},to:{...i,position:r}})}get textBounds(){var t,e,r=this.drawPath,n=0;for(let s=1;s<r.length;s++){var i=r[s-1],o=r[s],a=(i.x-o.x)*(i.x-o.x)+(i.y-o.y)*(i.y-o.y);a>n&&(n=Math.ceil(a),t=i,e=o)}var{paddingTop:s,paddingLeft:c,paddingRight:l,paddingBottom:u}=this.state;return u||=0,s||=0,c||=0,l||=0,{left:Math.min(t.x,e.x)+c,top:Math.min(t.y,e.y)+s,width:Math.max(Math.abs(t.x-e.x)-c-l,0),height:Math.max(Math.abs(t.y-e.y)-s-u,0)}}get decorators(){return this.app.isEditMode?["decotag"]:[]}}Wat.getTipNeckPos=Nat,Wat.containedInPath=jat,Wat.drawEndTips=Fat,Let.register("line",Wat);const qat={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 Vat extends(yrt(jet)){is3dish(){return!0}render(t){var{cx:e,cy:r,rx:n,ry:i,startAngle:o,endAngle:a,anticlockwise:s}=this.state;t.beginPath(),t.ellipse(e,r,Math.abs(n),Math.abs(i),0,o||0,a||2*Math.PI,s),void 0!==o&&void 0!==a&&(t.lineTo(e,r),t.closePath())}get path(){var{cx:t,cy:e,rx:r,ry:n}=this.state;return[{x:t-r,y:e-n},{x:t+r,y:e-n},{x:t+r,y:e+n},{x:t-r,y:e+n}]}set path(t){var e=t[0],r=t[2];this.set({cx:e.x+(r.x-e.x)/2,cy:e.y+(r.y-e.y)/2,rx:(r.x-e.x)/2,ry:(r.y-e.y)/2})}contains(t,e){var{cx:r,cy:n,rx:i,ry:o}=this.state,a=(t-r)/(2*i-.5),s=(e-n)/(2*o-.5);return a*a+s*s<.25}outline(t){return function(t,e){var{cx:r,cy:n,rx:i,ry:o}=t.model,a=2*Math.PI*e,s=r+i*Math.cos(a),c=n+o*Math.sin(a);return t.toScene(s,c)}(this,t)}get anchors(){return function(t){var{left:e,top:r,width:n,height:i}=t.bounds,o=e+n/2,a=r+i/2;return[{name:"TOP",position:{x:o,y:r}},{name:"RIGHT",position:{x:e+n,y:a}},{name:"BOTTOM",position:{x:o,y:r+i}},{name:"LEFT",position:{x:e,y:a}}]}(this)}get nature(){return qat}}Let.memoize(Vat.prototype,"path",!1),Let.register("ellipse",Vat);var Xat={ondragstart:function(t,e,r){r.mutatePath(null,(function(r){r.splice(e+1,0,t)}))},ondragmove:function(t,e,r){r.mutatePath(null,(function(r){r[e+1]=t}))},ondragend:function(t,e,r){}};const Kat={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 Qat extends jet{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){var r=this.state.path,n=!1;return r.forEach(((i,o)=>{let a=(o+r.length+1)%r.length,s=i.x,c=i.y,l=r[a].x,u=r[a].y;c>e!=u>e&&t<(l-s)*(e-c)/(u-c)+s&&(n=!n)})),n}get controls(){var t=this.path;return t.map(((e,r)=>{let n=t[r+1>=t.length?0:r+1];return{x:(e.x+n.x)/2,y:(e.y+n.y)/2,handler:Xat}}))}get nature(){return Kat}}Let.memoize(Qat.prototype,"controls",!1),Let.register("polygon",Qat);var Jat={ondragstart:function(t,e,r){r.mutatePath(null,(function(r){r.splice(e,0,t)}))},ondragmove:function(t,e,r){r.mutatePath(null,(function(r){r[e]=t}))},ondragend:function(t,e,r){}};const Zat={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 tst extends Wat{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:r}=this.state;return[this.fromEnd?.position||t?.position||r[0],...r.slice(1,-1),this.toEnd?.position||e?.position||r[r.length-1]]}set path(t){const{from:e,to:r}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...r,position:t[t.length-1]},path:t})}get controls(){var t=this.path,e=[];for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];0==r&&e.push({x:n.x,y:n.y,handler:Jat}),e.push({x:(n.x+i.x)/2,y:(n.y+i.y)/2,handler:Jat}),r==t.length-2&&e.push({x:i.x,y:i.y,handler:Jat})}return e}get nature(){return Zat}}Let.register("polyline",tst);const est={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 rst extends Wat{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:r,direction:n,boundaryPosition:i=t}=this.fromEnd||{},{component:o,direction:a,boundaryPosition:s=e}=this.toEnd||{};var c=[i,s],l=[];i&&l.push(i);var u=r?.bounds;if(u){var h=r.toScene(u.left,u.top);h=this.transcoordT2P(h.x,h.y),u={...u,left:h.x,top:h.y}}var f=u?{left:u.left-20,top:u.top-20,width:u.width+40,height:u.height+40}:{left:i.x,top:i.y,width:0,height:0};u=u||f;var d=o?.bounds;if(d){h=o.toScene(d.left,d.top);h=this.transcoordT2P(h.x,h.y),d={...d,left:h.x,top:h.y}}var p=d?{left:d.left-20,top:d.top-20,width:d.width+40,height:d.height+40}:{left:s.x,top:s.y,width:0,height:0};d=d||p;var g=[f,p];const m=f.left>p.left?p.left:f.left,v=f.top>p.top?p.top:f.top;var y,b,x,w,A,_,E,S,k,M,T={left:m,top:v,width:f.left+f.width>p.left+p.width?f.left+f.width-m:p.left+p.width-m,height:f.top+f.height>p.top+p.height?f.top+f.height-v:p.top+p.height-v},O=0,P=0;u.left+u.width<d.left?(w=0,A=1,k=n,M=a,y=(u.left+u.width+d.left)/2,O=d.left-y):d.left+d.width<u.left&&(w=1,A=0,k=a,M=n,y=(u.left+d.width+d.left)/2,O=u.left-y),u.top+u.height<d.top?(x=0,_=1,E=n,S=a,b=(u.top+u.height+d.top)/2,P=d.top-b):d.top+d.height<u.top&&(x=1,_=0,E=a,S=n,b=(u.top+d.height+d.top)/2,P=u.top-b);var I=[];if(y&&O>P){switch(M){case Gat:switch(k){case Yat:I.push({x:y,y:c[w].y}),I.push({x:y,y:c[A].y});break;case Gat:var C=g[w].top+g[w].height/2>c[A].y?Math.min(g[w].top,c[A].y):Math.max(g[w].top+g[w].height,c[A].y);I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:c[A].y});break;case Uat:case $at:C=k===$at?Math.max(c[w].y,c[A].y):Math.min(c[w].y,c[A].y);I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:c[A].y});break;default:return this.path}break;case Yat:switch(k){case Yat:var R=C=c[w].y<c[A].y?Math.min(g[A].top,c[w].y):Math.max(g[A].top+g[A].height,c[w].y);break;case Gat:R=C=void 0!==b?b:c[w].y<c[A].y?T.top-.5*O:T.top+T.height+.5*O;break;case $at:R=C=void 0!==b?Math.max(b,c[w].y):T.top+T.height;break;case Uat:R=C=b?Math.min(b,g[w].top):T.top;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:R}),I.push({x:c[A].x,y:R});break;case $at:switch(k){case Yat:C=c[w].y,R=c[w].y>c[A].y?c[w].y:g[A].top+g[A].height;break;case Gat:R=C=b?Math.max(b,g[A].top+g[A].height):T.top+T.height;break;case $at:R=C=T.top+T.height;break;case Uat:C=b?Math.min(b,g[w].top):g[w].top,R=b?Math.max(b,g[A].top+g[A].height):g[A].top+g[A].height;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:R}),I.push({x:c[A].x,y:R});break;case Uat:switch(k){case Yat:C=c[w].y,R=c[w].y<c[A].y?c[w].y:g[A].top;break;case Gat:R=C=b?Math.min(b,g[A].top):T.top;break;case $at:C=void 0!==b?Math.max(b,c[w].y):c[w].y,R=void 0!==b?Math.min(b,c[A].y):c[A].y;break;case Uat:R=C=T.top;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:y,y:C}),I.push({x:y,y:R}),I.push({x:c[A].x,y:R});break;default:return this.path}l.push(...0===w?I:I.reverse())}else if(b){switch(S){case Uat:switch(E){case $at:I.push({x:c[x].x,y:b}),I.push({x:c[_].x,y:b});break;case Uat:var D=g[x].left+g[x].width/2>c[_].x?Math.min(g[x].left,c[_].x):Math.max(g[x].left+g[x].width,c[_].x);I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:c[_].x,y:b});break;case Gat:D=Math.min(c[x].x,c[_].x);I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:c[_].x,y:b});break;case Yat:D=Math.max(c[x].x,c[_].x);I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:c[_].x,y:b});break;default:return this.path}break;case $at:switch(E){case Gat:var L=D=T.left;break;case Yat:L=D=void 0!==y?Math.max(y,c[x].x):T.left+T.width;break;case Uat:L=D=void 0!==y?y:c[x].x<c[_].x?T.left-.5*P:T.left+T.width+.5*P;break;case $at:D=c[x].x,L=c[x].x<c[_].x?Math.min(g[_].left,c[x].x):Math.max(g[_].left+g[_].width,c[x].x);break;default:return this.path}I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;case Yat:switch(E){case Gat:D=void 0!==y?Math.min(y,c[x].x):c[x].x,L=void 0!==y?Math.max(y,c[_].x):c[_].x;break;case Yat:L=D=T.left+T.width;break;case Uat:L=D=void 0!==y?Math.max(y,c[_].x):T.left+T.width;break;case $at:D=c[x].x,L=Math.max(g[_].left+g[_].width,c[x].x);break;default:return this.path}I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;case Gat:switch(E){case Gat:L=D=T.left;break;case Yat:D=void 0!==y?Math.max(y,c[x].x):c[x].x,L=void 0!==y?Math.min(y,c[_].x):c[_].x;break;case Uat:L=D=T.left;break;case $at:D=c[x].x<c[_].x?Math.min(g[_].left,c[x].x):c[x].x,L=Math.min(D,c[_].x);break;default:return this.path}I.push({x:D,y:c[x].y}),I.push({x:D,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;default:return this.path}l.push(...0===x?I:I.reverse())}else switch(n){case Uat:switch(a){case Uat:var j=T.top;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case $at:var N=T.left+T.width;l.push({x:N,y:c[0].y}),l.push({x:N,y:T.top+T.height}),l.push({x:c[1].x,y:T.top+T.height});break;case Yat:N=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:T.left+T.width;l.push({x:N,y:c[0].y}),l.push({x:N,y:c[1].y});break;case Gat:N=T.left;l.push({x:N,y:c[0].y}),l.push({x:N,y:c[1].y});break;default:return this.path}break;case $at:switch(a){case Uat:N=T.left+T.width;l.push({x:N,y:c[0].y}),l.push({x:N,y:T.top}),l.push({x:c[1].x,y:T.top});break;case $at:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case Yat:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case Gat:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;default:return this.path}break;case Gat:switch(a){case Uat:N=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:T.left,j=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(T.top,c[0].y);l.push({x:N,y:c[0].y}),l.push({x:N,y:j}),l.push({x:c[1].x,y:j});break;case $at:N=T.left,j=Math.max(T.top+T.height,c[0].y);l.push({x:N,y:c[0].y}),l.push({x:N,y:j}),l.push({x:c[1].x,y:j});break;case Yat:N=T.left+T.width;l.push({x:c[0].x,y:T.top}),l.push({x:N,y:T.top}),l.push({x:N,y:c[1].y});break;case Gat:N=T.left;l.push({x:N,y:c[0].y}),l.push({x:N,y:c[1].y});break;default:return this.path}break;case Yat:switch(a){case Uat:j=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:T.top;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case $at:j=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case Yat:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;case Gat:j=T.top+T.height;l.push({x:c[0].x,y:j}),l.push({x:c[1].x,y:j});break;default:return this.path}break;default:return this.path}return s&&l.push(s),[t,...l,e].filter(((t,e,r)=>{if(0===e)return!0;const n=r[e-1];return t.x!==n.x||t.y!==n.y})).filter(((t,e,r)=>{if(0===e||e>=r.length-1)return!0;const n=r[e-1],i=r[e+1];return!(t.x===n.x&&t.x===i.x||t.y===n.y&&t.y===i.y)}))}get nature(){return est}}Let.register("ortholine",rst);const nst={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 ist extends(Fet(jet)){static get noimage(){return ist.NOIMAGE||(ist.NOIMAGE=new Image,ist.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),ist.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){var{left:e,top:r,width:n,height:i,isGray:o=!1,alpha:a=1,src:s}=this.state;if(this.prepareIf(!this._image&&s),t.beginPath(),t.globalAlpha*=a,this._image&&this._image.complete)if(o&&this._offcanvas)t.drawImage(this._offcanvas,e,r,n,i);else try{t.drawImage(this._image,e,r,n,i)}catch(o){t.drawImage(ist.noimage,e,r,n,i)}else!this.app.isViewMode&&t.drawImage(ist.noimage,e,r,n,i)}get nature(){return nst}get hasTextProperty(){return!1}ready(){super.ready(),this.prepareIf(!this._image&&this.state.src)}prepare(t,e){var{src:r,crossOrigin:n}=this.state;if(r){this._image=new Image;try{n&&(this._image.crossOrigin=n),this._image.src=this.app.url(r)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){let t=this._image.width,e=this._image.height;this._offcanvas=Let.createCanvas(t,e);let r=this._offcanvas.getContext("2d");r.drawImage(this._image,0,0);let n=function(t,e,r){try{var n=t.getImageData(0,0,e,r)}catch(t){return stt("Get Image Data Error: "+t.message),null}var i=n.data;for(let t=0;t<e*r*4;t+=4){let e=i[t],r=i[t+1],o=i[t+2],a=parseInt((e+r+o)/3);n.data[t]=a,n.data[t+1]=a,n.data[t+2]=a}return n}(r,t,e);r.putImageData(n,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 r=0;r<t.length;r++)if(t[r].type.startsWith("image/"))return void(this.src=e[r])}}Let.register("image-view",ist);class ost extends(Tat(Fet(Let))){is3dish(){return!0}prerender(){}}var ast={},sst={},cst={};Object.defineProperty(cst,"__esModule",{value:!0});var lst=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=[],r=7;r>=0;r--)e.push(!!(t&1<<r));return e},t.lzwDecode=function(t,e){for(var r,n,i=0,o=function(t){for(var r=0,n=0;n<t;n++)e.charCodeAt(i>>3)&1<<(7&i)&&(r|=1<<n),i++;return r},a=[],s=1<<t,c=s+1,l=t+1,u=[],h=function(){u=[],l=t+1;for(var e=0;e<s;e++)u[e]=[e];u[s]=[],u[c]=null};;)if(n=r,(r=o(l))!==s){if(r===c)break;if(r<u.length)n!==s&&u.push(u[n].concat(u[r][0]));else{if(r!==u.length)throw new Error("Invalid LZW code.");u.push(u[n].concat(u[n][0]))}a.push.apply(a,u[r]),u.length===1<<l&&l<12&&l++}else h();return a},t}();cst.SuperGifUtils=lst,Object.defineProperty(sst,"__esModule",{value:!0});var ust=cst,hst=function(){function t(t,e){this.stream=t,this.handler=e}return t.prototype.parseCT=function(t){for(var e=[],r=0;r<t;r++)e.push(this.stream.readBytes(3));return e},t.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},t.prototype.parseHeader=function(){var t={};if(t.sig=this.stream.read(3),t.ver=this.stream.read(3),"GIF"!==t.sig)throw new Error("Not a GIF file.");t.width=this.stream.readUnsigned(),t.height=this.stream.readUnsigned();var e=ust.SuperGifUtils.byteToBitArr(this.stream.readByte());t.gctFlag=e.shift(),t.colorRes=ust.SuperGifUtils.bitsToNum(e.splice(0,3)),t.sorted=e.shift(),t.gctSize=ust.SuperGifUtils.bitsToNum(e.splice(0,3)),t.bgColor=this.stream.readByte(),t.pixelAspectRatio=this.stream.readByte(),t.gctFlag&&(t.gct=this.parseCT(1<<t.gctSize+1)),this.handler.hdr&&this.handler.hdr(t)},t.prototype.parseExt=function(t){var e=this;switch(t.label=this.stream.readByte(),t.label){case 249:t.extType="gce",function(t){e.stream.readByte();var r=ust.SuperGifUtils.byteToBitArr(e.stream.readByte());t.reserved=r.splice(0,3),t.disposalMethod=ust.SuperGifUtils.bitsToNum(r.splice(0,3)),t.userInput=r.shift(),t.transparencyGiven=r.shift(),t.delayTime=e.stream.readUnsigned(),t.transparencyIndex=e.stream.readByte(),t.terminator=e.stream.readByte(),e.handler.gce&&e.handler.gce(t)}(t);break;case 254:t.extType="com",function(t){t.comment=e.readSubBlocks(),e.handler.com&&e.handler.com(t)}(t);break;case 1:t.extType="pte",function(t){e.stream.readByte(),t.ptHeader=e.stream.readBytes(12),t.ptData=e.readSubBlocks(),e.handler.pte&&e.handler.pte(t)}(t);break;case 255:t.extType="app",function(t){e.stream.readByte(),t.identifier=e.stream.read(8),t.authCode=e.stream.read(3),"NETSCAPE"===t.identifier?function(t){e.stream.readByte(),t.unknown=e.stream.readByte(),t.iterations=e.stream.readUnsigned(),t.terminator=e.stream.readByte(),e.handler.app&&e.handler.app.NETSCAPE&&e.handler.app.NETSCAPE(t)}(t):function(t){t.appData=e.readSubBlocks(),e.handler.app&&e.handler.app[t.identifier]&&e.handler.app[t.identifier](t)}(t)}(t);break;default:t.extType="unknown",function(t){t.data=e.readSubBlocks(),e.handler.unknown&&e.handler.unknown(t)}(t)}},t.prototype.parseImg=function(t){t.leftPos=this.stream.readUnsigned(),t.topPos=this.stream.readUnsigned(),t.width=this.stream.readUnsigned(),t.height=this.stream.readUnsigned();var e=ust.SuperGifUtils.byteToBitArr(this.stream.readByte());t.lctFlag=e.shift(),t.interlaced=e.shift(),t.sorted=e.shift(),t.reserved=e.splice(0,2),t.lctSize=ust.SuperGifUtils.bitsToNum(e.splice(0,3)),t.lctFlag&&(t.lct=this.parseCT(1<<t.lctSize+1)),t.lzwMinCodeSize=this.stream.readByte();var r=this.readSubBlocks();t.pixels=ust.SuperGifUtils.lzwDecode(t.lzwMinCodeSize,r),t.interlaced&&(t.pixels=function(t,e){for(var r=new Array(t.length),n=t.length/e,i=function(n,i){var o=t.slice(i*e,(i+1)*e);r.splice.apply(r,[n*e,e].concat(o))},o=[0,4,2,1],a=[8,8,4,2],s=0,c=0;c<4;c++)for(var l=o[c];l<n;l+=a[c])i(l,s),s++;return r}(t.pixels,t.width)),this.handler.img&&this.handler.img(t)},t.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)},t.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},t}();sst.SuperGifParser=hst;var fst={};Object.defineProperty(fst,"__esModule",{value:!0});var dst=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=[],r=0;r<t;r++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",r=0;r<t;r++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();fst.SuperGifStream=dst,Object.defineProperty(ast,"__esModule",{value:!0});var pst=sst,gst=fst,mst=function(){function t(t,e){var r=this;for(var n 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(){r.pushFrame(),r.canvas.width=r.hdr.width*r.getCanvasScale(),r.canvas.height=r.hdr.height*r.getCanvasScale(),r.playerInit(),r.loading=!1,r.ready=!0,r.loadCallback&&r.loadCallback(r.gifImgElement)}},e)this.options[n]=e[n];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 t.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},t.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)},t.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)},t.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)}},t.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},t.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)},t.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},t.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},t.prototype.parseStream=function(t){try{new pst.SuperGifParser(t,this.handler).parse()}catch(t){this.handleError("parse")}},t.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)},t.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()},t.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},t.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},t.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},t.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}))},t.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var r=this.frames.length,n=t.lctFlag?t.lct:this.hdr.gct;r>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=r-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,r){t!==e.transparency&&(i.data[4*r+0]=n[t][0],i.data[4*r+1]=n[t][1],i.data[4*r+2]=n[t][2],i.data[4*r+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},t.prototype.doNothing=function(){},t.prototype.withProgress=function(t){return function(e){t(e)}},t.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},t.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},t.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},t.prototype.play=function(){this.playing=!0,this.step()},t.prototype.pause=function(){this.playing=!1},t.prototype.isPlaying=function(){return this.playing},t.prototype.getCanvas=function(){return this.canvas},t.prototype.isLoading=function(){return this.loading},t.prototype.isReady=function(){return this.ready},t.prototype.isAutoPlay=function(){return this.options.autoPlay},t.prototype.getLength=function(){return this.frames.length},t.prototype.getCurrentFrame=function(){return this.currentFrameIndex},t.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},t.prototype.loadURL=function(t,e){var r=this;if(this.loadSetup(e)){var n=new XMLHttpRequest;n.open("GET",t,!0),"overrideMimeType"in n?n.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in n?n.responseType="arraybuffer":n.setRequestHeader("Accept-Charset","x-user-defined"),n.onloadstart=function(){r.initialized||r.init()},n.onload=function(){if(200===n.status){var t=n.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var e=new gst.SuperGifStream(t);setTimeout((function(){r.parseStream(e)}),0)}else r.handleError("xhr - response")},n.onerror=function(){r.handleError("xhr")},n.send()}},t.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},t}(),vst=ast.SuperGif=mst;const yst={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 bst extends ost{async oncreate_element(t){var{src:e,play:r}=this.state;this.onchangesrc(e),this.onchangeplay(r)}buildImg(){var t=this.element;t.innerHTML="";var 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){var e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){var 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",0),this._superGif=new vst(e,{autoPlay:!1}),this._superGif.init();for(const t of this.element.children)t.style.width="100%",t.style.height="100%";var r=this._superGif.getCanvas();r.style.width="100%",r.style.height="100%",this._superGif.load((()=>{setTimeout((()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()}),100)}))}ondropfile(t,e){for(let r=0;r<t.length;r++)if(/\.gif$/.test(t[r].name))return void(this.src=e[r])}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 yst}get tagName(){return"div"}}Let.register("gif-view",bst);const xst={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 wst extends(Fet(jet)){static get image(){return wst.IMAGE||(wst.IMAGE=new Image,wst.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5ZzAwBurHDk3WGeRY0bvYrGa1+rqNI22f7dS32ZnUK1GMr0eSK3mEc9dhKMxp+ZTo8kT2emOXS5LQ1kCxbJBocSd2k5PaIjMVzjWcdJPk9ooBnmzx1t5XbIxqBKpJ4NGTgzwKiGpK4do72gb+ZUMIYtCPm9WCPMsYTE5k2hq2ZvzujlCE1iRmwf3dvmRyKsT0T7b9I7HEPCpqCiqT2IIqaT1pI0noQZdlFC8l/PbYPAnRORT56VBEE6FXkb49agmByKhJ71BME6FsvEntUFQTdqekisUdlQWCXhovEHtUFAWbTapHYo8YgmFybO3vsUWcQYGmxSOxRbRAMprkisUfFQVKmrX18sxt7VB0ENjT1xir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SP6jiKZghwRaaWLnP/AkcSKKJIniEcUs8QfjFLdEmRvkSxB4lfn0QN6DY+lshQpHiT96Dlr6r5hxRUpHST9ZEY71X7DOmOZQVZLsd5Q8wzrPxYYJDiKNqOBG1ZCkZKzrNXu6lHvkjChSFqQsdTPg45ApXtYaUXKr9TNuPcvqO2pVMkitFXAL2a79/qr3HQvVSTXUtofCl79RDXh5CDpw3pwu6+9kRlvtiI5VtPhmHLltT4EKVQkfb8pcOHrXqk6nBAksUjgpKtuYsskaxGKYT0+84uYgziE4YQgMdx0m8PRfis2MbL33PMXoVjD6PEunI4HSjDjStiJP08vQk9hZzQ7oH/geoLYCUBDW4rf4FqCDFt7THUO6B+4jiDn2XNTW7zf4hqCMND4BOsGyw+yAmh0x+QeFh7EeqD5Ce8nLDrI8NpbDyIWHIQNruo4GyAPlhrEzuixBxHLDDJMnfYgYolBricHNfjIdgMWF+Qyu+pkgX4HCwuymL57ELGkIHZG7z2IWE6Q5VV7vGMhQewbtMcZiwhyHj26ne9+xs8PcvDQHnFFqCD7Au0RW4TK+fOKqw4eoOcqYqgU53HR3/5uShFPCfKey9hFDyJO/vAi7RDZnp7X5igyUH72xSDW1E2Pn4tMRCQgR8vLwbgii4gcmLvqQcSPGtIPX3M08wn6I4qYQ94cM/Yw9Xxhmw+X/59wHrtMlX1AmIkzdyaaAnLg1Nnw8WGYSk40X/BOh4+El6LMSBnN2Cd0tPq4w/LJXGrMbCX06PZ2dcM65yzlNertShSHf3SzRAyPM332IcSAHUKPi8EHmXU0l8Uglmni0yipDoi16s+jJKejhywLooz68yiMEcHr2qM4h81CJ++VPJfTu5UwBpv4Pp9DJSi6MJx0bvUwiw4ewgT8zNR0LHUL+OccOpY/3ElzyGKD5pBlMJpDlsOkMythRoNbXh95PJsdA67MrMtAEYbjeDqNo+7oKqWUUkoppZRSSimllFJKFfMXp4vmSjB8n6sAAAAASUVORK5CYII="),wst.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}ready(){super.ready(),this._audio=new Audio,this._audio.addEventListener("canplay",(()=>{this.started&&this._audio.play()}));var{src:t="",loop:e=!1,started:r=!1}=this.state;this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(r)}render(t){var{left:e,top:r,width:n,height:i,src:o}=this.state;t.beginPath(),this.drawImage(t,wst.image,e,r,n,i)}get nature(){return xst}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 console.error(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 r=0;r<t.length;r++)if(t[r].type.startsWith("audio/"))return void(this.src=e[r])}}Let.register("audio",wst);class Ast extends(Fet(Let)){is3dish(){return!0}}Let.register("text",Ast);const _st=["refid","left","top","width","height","rotation","animation"];class Est extends Cat{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});var r=_st.reduce(((e,r)=>(t.hasOwnProperty(r)&&(e[r]=t[r]),e)),{});return super.set(r)}capture(t,e,r){var n=super.capture(t,e,r);if(n!==this)return n}set bounds(t){if(this.__MUTATING__)super.bounds=t;else{var e=this.bounds,r=t.width/e.width,n=t.height/e.height;this.path=this.path.map((i=>({x:t.left+(i.x-e.left)*r,y:t.top+(i.y-e.top)*n}))),this.components&&this.components.forEach((t=>{if(t.mutable)t.mutatePath(null,(function(t){return t.map((function(t){return{x:t.x*r,y:t.y*n}}))}));else{let e=t.bounds,i=t.center,o={x:i.x*(1-r),y:i.y*(1-n)},a=e.width*(1-r),s=e.height*(1-n),c=-(o.x-a/2),l=-(o.y-s/2);t.bounds={left:e.left+c,top:e.top+l,width:e.width*r,height:e.height*n}}}))}}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){var e=Let.union(this.components.map((t=>t.bounds)));return this.components.forEach((t=>{let r=t.bounds;t.bounds={left:r.left-e.left,top:r.top-e.top,width:r.width,height:r.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){var{top:e,left:r,scale:n}=this.state;t.translate(r,e),this.layout.drawables(this).forEach((e=>{e.draw(t)})),t.translate(-r,-e)}}Let.register("group",Est);const Sst={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 kst extends(Fet(jet)){get ref(){var t=this.getState("ref");return t&&"string"==typeof t?this.root.findById(t):null}set ref(t){this.setState("ref",t)}get refScale(){let t=this.ref.bounds,e=this.bounds,r=e.width/t.width,n=e.height/t.height;return"both"===this.model.fit?{x:r,y:n}:{x:Math.min(r,n),y:Math.min(r,n)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){let e=this.ref.center,r=this.center,n=this.refScale;t.translate(r.x,r.y),t.scale(n.x,n.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);this.state;var{left:e,top:r,width:n,height:i}=this.bounds;t.beginPath(),t.rect(e,r,n,i)}get nature(){return Sst}get hasTextProperty(){return!1}}Let.memoize(kst.prototype,"ref",!1),Let.memoize(kst.prototype,"refScale",!1),Let.register("local-ref",kst);class Mst extends(Tat(urt)){render(t){}is3dish(){return!0}get layout(){return Get.get(this.get("layout"))||Het}}const Tst={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 Ost extends Mst{dispose(){this._releaseRef(),super.dispose()}get nature(){return Tst}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){var{mode:e="view",round:r=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=r+"px"}ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();let t=this._element_bounds,{offsetWidth:e,offsetHeight:r}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:r},(!t||t.offsetWidth!=e||t.offsetHeight!=r)&&this.ref&&this.root.target_element){let{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();var{ref:t,fit:e="ratio"}=this.state;if(t){var r=this.app.refProvider;if(r&&t)try{this.__ref=await r.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data}catch(t){stt(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,r){super.onchange(t,e,r),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame((()=>{let{fit:t}=this.state;this.ref.fit(t)})),"data"in t&&this.ref&&requestAnimationFrame((()=>{this.ref.data=t.data}))}}Let.register("global-ref",Ost);const Pst="center-middle",Ist={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",Pst,"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 Cst extends(Fet(jet)){static get image(){return Cst._image||(Cst._image=new Image,Cst._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjAgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkM4QzQxNUMzMzBEMTFFQ0JEM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/ZgUSJR7U8CM/dHZ+/2VcatWdvdEZAaYUhiAwkerJXt0rnzXwdRKmHfDM0fHD5kxjTFyVLzVfvvirn7+cDJWjhy7c7XlYuwc6Urvu2tRhRypyhwAf1sKY+TIxfQA+H39q5wxc+RgVrcBduTmZTlj5khnDgH4IzKpMGaOVCbvyyvRGTNHGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Cst._image}ready(){super.ready(),this.show&&this.onchangeShow(!0)}render(t){var{left:e,top:r,width:n,height:i}=this.bounds;t.beginPath(),this.drawImage(t,Cst.image,e,r,n,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||Jet.show(this,this.getState("board"),{origin:this.getState("origin")||Pst,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(){Jet.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 Ist}}Let.register("popup",Cst);class Rst extends Let{render(t){var{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let r=1;r<e.length;r++)t.lineTo(e[r].x,e[r].y);t.closePath(),this.drawStroke(t)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){var r=this.state.path,n=!1;return r.forEach(((i,o)=>{let a=(o+r.length+1)%r.length,s=i.x,c=i.y,l=r[a].x,u=r[a].y;c>e!=u>e&&t<(l-s)*(e-c)/(u-c)+s&&(n=!n)})),n}}Let.register("path",Rst);const Dst={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 Lst extends jet{contains(t,e){var{x1:r,y1:n,x2:i,y2:o,x3:a,y3:s}=this.state,c=[r,n,i,o,a,s],l=!1;for(let r=0;r<c.length;r+=2){let n=(r+2)%c.length,i=c[r],o=c[r+1],a=c[n+1];o>e!=a>e&&t<(c[n]-i)*(e-o)/(a-o)+i&&(l=!l)}return l}get mutable(){return!0}get path(){var{x1:t,y1:e,x2:r,y2:n,x3:i,y3:o}=this.state;return[{x:t,y:e},{x:r,y:n},{x:i,y:o}]}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 Dst}}Let.memoize(Lst.prototype,"path",!1),Let.register("triangle",Lst);const jst={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"};var Nst={ondragmove:function(t,e,r){r.controls;var{cx:n,rx:i}=r.model;i=Math.abs(i);var o=(r.fromParent(t.x,t.y).x-n)/i*100;o=o>=100||o<=-100?100:Math.abs(o),r.set({ratio:o})}};class Fst extends Vat{is3dish(){return!1}render(t){var{ratio:e=50,cx:r,cy:n,rx:i,ry:o,startAngle:a,endAngle:s,anticlockwise:c}=this.state;i=Math.abs(i),o=Math.abs(o),t.beginPath(),t.ellipse(r,n,i,o,0,a||0,s||2*Math.PI,c),t.moveTo(r+i/100*e,n),t.ellipse(r,n,i/100*e,o/100*e,0,a||0,s||2*Math.PI,!0)}contains(t,e){var{cx:r,cy:n,rx:i,ry:o,ratio:a}=this.state,s=(t-r)/(2*(i=Math.abs(i))-.5),c=(e-n)/(2*(o=Math.abs(o))-.5),l=(t-r)/(i/100*a*2-.5),u=(e-n)/(o/100*a*2-.5),h=!1;return s*s+c*c<.25&&l*l+u*u>.25&&(h=!h),h}get controls(){var{cx:t,cy:e,rx:r,ratio:n}=this.state;return[{x:t+(r=Math.abs(r))/100*n,y:e,handler:Nst}]}get nature(){return jst}}Let.memoize(Fst.prototype,"controls",!1),Let.register("donut",Fst);const zst={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"};var Bst={ondragmove:function(t,e,r){r.controls;var{cy:n,ry:i}=r.model,o=(r.fromParent(t.x,t.y).y-n)/i*100+100;o>=100?o=100:o<=0&&(o=0),r.set({ratio:o})}};class Ust extends Vat{is3dish(){return!1}render(t){var{ratio:e=30,wing:r=5,cx:n,cy:i,rx:o,ry:a,startAngle:s,endAngle:c,anticlockwise:l}=this.state;if(r<3)return;const u=1.5707963267948966;var h=2*Math.PI/r,f=o-e/100*o,d=a-e/100*a;t.save(),t.beginPath(),t.translate(n,i),t.moveTo(o*Math.cos(-u),a*Math.sin(-u)),t.lineTo((o-f)*(Math.cos(h-u)+Math.cos(0-u))/2,(a-d)*(Math.sin(h-u)+Math.sin(0-u))/2);for(var p=1;p<r;p++)t.lineTo(o*Math.cos(h*p-u),a*Math.sin(h*p-u)),t.lineTo((o-f)*(Math.cos(h*(p+1)-u)+Math.cos(h*p-u))/2,(a-d)*(Math.sin(h*(p+1)-u)+Math.sin(h*p-u))/2);t.closePath(),t.restore()}get controls(){var{cx:t,cy:e,ry:r,ratio:n}=this.state;return[{x:t,y:e-r+r*(n/100),handler:Bst}]}get nature(){return zst}}Let.memoize(Ust.prototype,"controls",!1),Let.register("star",Ust);const $st={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class Yst extends(yrt(jet)){is3dish(){return!1}isDescendible(){return!1}render(t){const{cx:e,cy:r,anticlockwise:n}=this.state,i=this.app?.scale||1;t.beginPath(),t.scale(1/i,1/i),t.ellipse(e,r,Math.abs(Yst.RADIUS),Math.abs(Yst.RADIUS),0,0,2*Math.PI,n),t.scale(i,i),t.closePath()}get path(){var{cx:t,cy:e}=this.state;return[{x:t-Yst.RADIUS,y:e-Yst.RADIUS},{x:t+Yst.RADIUS,y:e-Yst.RADIUS},{x:t+Yst.RADIUS,y:e+Yst.RADIUS},{x:t-Yst.RADIUS,y:e+Yst.RADIUS}]}set path(t){var e=t[0],r=t[2];this.set({cx:e.x+(r.x-e.x)/2,cy:e.y+(r.y-e.y)/2})}contains(t,e){var{cx:r,cy:n}=this.state,i=(t-r)/(2*Yst.RADIUS-.5),o=(e-n)/(2*Yst.RADIUS-.5);return i*i+o*o<.25}outline(t){var{cx:e,cy:r}=this.state;return this.toScene(e,r)}get nature(){return $st}}Yst.RADIUS=5,Let.memoize(Yst.prototype,"path",!1),Let.register("node",Yst);var Gst=0;const Hst=new FinalizationRegistry((()=>{Gst--}));var Wst={},qst={},Vst=[];function Xst(t){var e="SCRIPT"==t.target.tagName?Wst:qst,r=t.target.src||t.target.href;e[r]=!0,Vst.forEach(((t,n)=>{let{resolve:i,scripts:o,styles:a}=t;if(e==Wst){let t=o.indexOf(r);t>-1&&t<o.length-1&&Qst(o[t+1])}for(let t=0;t<o.length;t++)if(!Wst[o[t]])return;if(a)for(let t=0;t<a.length;t++)if(!qst[a[t]])return;i(),Vst[n]=null})),Vst=Vst.filter(Boolean)}function Kst(t){var e=t.target.src,r="SCRIPT"==t.target.tagName?Wst:qst;Vst.forEach(((n,i)=>{let{reject:o,scripts:a,styles:s}=n,c=!1;if(r===Wst){for(let t=0;t<a.length;t++)if(a[t]==e){c=!0;break}}else if(s)for(let t=0;t<s.length;t++)if(s[t]==e){c=!0;break}c&&(o(t),Vst[i]=null)})),Vst=Vst.filter(Boolean),delete r[e],document.head.removeChild(t.target)}function Qst(t){Wst[t]=!1;var e=document.createElement("script");e.onload=Xst,e.onerror=Kst,e.type="text/javascript",e.src=t,document.head.appendChild(e)}var Jst=0,Zst=performance.now(),tct=0;requestAnimationFrame((function t(){requestAnimationFrame(t),tct++;var e=performance.now(),r=e-Zst;r<1e3||(Jst=Math.round(1e3*tct/r),Zst=e,tct=0)}));var ect=Zrt;t.AbsoluteLayout=Zet,t.AudioPlayer=wst,t.CardLayout=ert,t.Component=Let,t.Connectable=yrt,t.Container=Cat,t.ContainerAbstract=urt,t.DEFAULT=ptt,t.DPPX=htt,t.DataSource=t=>class extends t{_convertDataFormat(t,e){var r;if("json"===e)r=JSON.parse(t);else r=t;return r}isDataSource(){return!0}},t.Donut=Fst,t.Ellipse=Vat,t.EventMap=Uit,t.FPS=function(){return Jst},t.GESTURES=ftt,t.GifView=bst,t.GlobalRef=Ost,t.Group=Est,t.HTMLAbsoluteLayout=Het,t.HTMLOverlayContainer=Mst,t.HTMLOverlayElement=ost,t.ImageView=ist,t.InfoWindow=$et,t.KEYEVENTS=dtt,t.Layer=hrt,t.Layout=Get,t.Line=Wat,t.LinearHorizontalLayout=nrt,t.LinearVerticalLayout=ort,t.LocalRef=kst,t.MAX_UNDO_SIZE=30,t.MODE_ADD=3,t.MODE_EDIT=1,t.MODE_PASTE_DATABIND=5,t.MODE_PASTE_STYLE=4,t.MODE_SHIFT=2,t.MODE_VIEW=0,t.Model=ect,t.MoveHandle=crt,t.NOTHING={},t.Node=Yst,t.OrthoLine=rst,t.Path=Rst,t.Polygon=Qat,t.Polyline=tst,t.Popup=Cst,t.Rect=wrt,t.RectPath=Fet,t.ReferenceMap=class{static get residents(){return Gst}static get residentsCount(){return Gst}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,Gst++,Hst.register(this,Gst)}dispose(){if(this.disposer)for(let t in this.references)this.disposer.call(null,t,this.references[t]);delete this.references,delete this.counters}get ids(){return Object.keys(this.references)}create(t){var e=this;return new Promise((function(r,n){e.creator?e.creator.call(null,t,(function(e){!function(e){e.release=function(){this.disposer&&this.disposer.call(null,t,e),delete e.release,ltt("RELEASED",t)},r(e)}(e)}),(function(t){n(t)})):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))}))}add(t,e){var r=this,n=new Promise((function(n,i){var o=r.references[t];if(o)o===e?i(Error("Reference ID and target duplicate")):e?i(Error("Reference ID duplicate")):n(o);else{function a(e){e.release=function(){r.release(this)},r.references[t]=e,r.counters[t]=1,n(e)}if(e)a(e);else{if(!r.creator)return void i(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));r.creator.call(null,t,(function(t){a(t)}),(function(t){i(t)}))}}}));return this.references[t]||(this.references[t]=n),n}async get(t,e=!1){var r=this.references[t];if(r){if(!(r instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,r}if(e)return r=await r,this.counters[t]++,r}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(let e in this.references){if(this.references[e]===t)return e}return-1}release(t){var e=this._id(t),r=this.references[e];r?(this.counters[e]--,0==this.counters[e]&&(this.disposer&&this.disposer.call(null,e,r),delete this.references[e],delete this.counters[e],delete t.release,ltt("RELEASED",e))):stt("No Referenced ID")}},t.RootContainer=eot,t.Ruler=_rt,t.SCENE_MODE={VIEW:0,EDIT:1,SHIFT:2,ADD:3},t.Scene=got,t.ScenePopup=Jet,t.ScriptLoader=class{static load(t,e){return"string"==typeof t&&(t=[t]),"string"==typeof e&&(e=[e]),new Promise((function(r,n){if((!t||t instanceof Array)&&(!e||e instanceof Array)){var i,o=!0;if(e&&e.forEach((t=>{qst.hasOwnProperty(t)||function(t){qst[t]=!1;var e=document.createElement("link");e.onload=Xst,e.onerror=Kst,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),qst[t]||(o=!1)})),t&&t.length>0&&t.forEach((t=>{Wst.hasOwnProperty(t)?Wst[t]||(o=!1):i=i||t})),i)Qst(i);else if(o)return void r(void 0);Vst.push({resolve:r,reject:n,scripts:t,styles:e})}else n("invalid sources for load")}))}},t.Shape=jet,t.Star=Ust,t.TableLayout=art,t.Text=Ast,t.Triangle=Lst,t.ValueHolder=t=>class extends t{animOnValueChange(t,e=!1,r){if(t!=this._lastValue){if(e)var n=t-(Number(r)||0);else n=t-(this._lastValue||0);this._lastValue=t,this._anim_alpha=-n,this.animate({step:t=>{this._anim_alpha=n*(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=Eet(this.getState("value"),this)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(X9(t)))}},t.create=function({target:t,model:e,style:r,layers:n=[],handlers:i=[],mode:o=0,refProvider:a,dataSubscriptionProvider:s,dataStorage:c=mot,baseUrl:l,fitMode:u}){var h=null;if("string"==typeof t){if(!(h=document.getElementById(t)))throw`target element '${t}' is not exist`;if(h.firstChild)throw`target element '${t}' is not empty`}else h=t;h&&h.style&&(h.style.position="absolute",h.style.cursor="default",h.style.overflow="hidden");var f=new aot(o,a);return f.baseUrl=l,f.dataSubscriptionProvider=s,f.dataStorage=c,new got(new eot({target_element:h,model:e,style:r,layers:n,handlers:i,fitMode:u},f))},t.debug=ltt,t.error=stt,t.initFontFamilyWatcher=mtt,t.license=function(){},t.polyfill="done",t.sceneComponent=function(t){return function(e){return Array.isArray(t)?t.forEach((t=>{Let.register(t,e)})):Let.register(t,e),e}},t.updateDefaultFontFamily=gtt,t.version="0.0.0",t.warn=ctt,Object.defineProperty(t,"__esModule",{value:!0})}));
74
74
  //# sourceMappingURL=things-scene-min.js.map