@hatiolab/things-scene 10.0.0-beta.115 → 10.0.0-beta.116

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.
@@ -69,5 +69,5 @@ const Gf=globalThis,Vf=t=>t,Uf=Gf.trustedTypes,$f=Uf?Uf.createPolicy("lit-html",
69
69
  </button>`:dg}
70
70
  ${n?lg`<button class="closable" @click=${this.closeContainer}>close</button>`:dg}
71
71
  </div>
72
- `,this.element)}catch(t){}}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}Og=new WeakMap,oc.memoize(Lg.prototype,"bounds",!0),oc.register("container",Lg);const jg=Math.sqrt(3),Fg=2;function Ng(t,e,n,i,r){const s=5+r,o=n.x,a=n.y,c=i.x,l=i.y;if(Math.abs(o-c)>s&&Math.abs(a-l)>s){const n=(l-a)/(c-o),i=a-n*o;if(Math.abs(e-(n*t+i))>s)return!1}let h,d,u,p;return o>c?(d=o,h=c):(d=c,h=o),a>l?(p=a,u=l):(p=l,u=a),!(d+5<t)&&(!(h-5>t)&&(!(p+5<e)&&!(u-5>e)))}function Hg(t,e,n,i=2){for(let r=0;r<n.length-1;r++)if(Ng(t,e,n[r],n[r+1],i))return!0;return!1}function Bg(t,e,n,i){if("arrow"!=t.slice(-5))return n;const r=Math.atan2(i.y-n.y,i.x-n.x),s=1.5*e;return{x:n.x+Math.cos(r)*s,y:n.y+Math.sin(r)*s}}function Yg(t,e,n){let{lineWidth:i=Fg,strokeStyle:r="#000000",lineCap:s=!1,alpha:o=1,begin:a="none",end:c="none",beginSize:l="size5",endSize:h="size5"}=n;if(("none"!=a||"none"!=c)&&(i=Number(i)||Fg,t.lineCap=s,t.lineWidth=i,t.strokeStyle=r,t.fillStyle=r,t.globalAlpha*=o,"none"!=a&&Gg(t,e[0],e[1],i,a,Vg(l,i)),"none"!=c)){const n=e.length;Gg(t,e[n-1],e[n-2],i,c,Vg(h,i))}}function Gg(t,e,n,i,r,s){const{x:o,y:a}=e,c=Math.atan2(n.y-a,n.x-o);switch(t.beginPath(),t.translate(o,a),t.rotate(c),r){case"oval":t.ellipse(0,0,s.X,s.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-s.X,0),t.lineTo(0,-s.Y),t.lineTo(s.X,0),t.lineTo(0,s.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(jg*s.X,-s.Y),t.lineTo(jg*s.X,s.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(jg*s.X,-s.Y),t.lineTo(-s.X/1.5+jg*s.X,0),t.lineTo(jg*s.X,s.Y),t.fill();break;case"open-arrow":t.moveTo(jg*s.X+i,-s.Y),t.lineTo(i,0),t.lineTo(jg*s.X+i,s.Y),t.stroke();break;case"cross":t.moveTo(-s.X,-s.Y),t.lineTo(s.X,s.Y),t.moveTo(s.X,-s.Y),t.lineTo(-s.X,s.Y),t.stroke()}t.rotate(-c),t.translate(-o,-a),t.closePath()}function Vg(t,e){const n={X:0,Y:0};switch(e*=1.2,t){case"size1":n.X=e,n.Y=e;break;case"size2":n.X=1.5*e,n.Y=e;break;case"size3":n.X=2*e,n.Y=e;break;case"size4":n.X=e,n.Y=1.5*e;break;case"size5":default:n.X=1.5*e,n.Y=1.5*e;break;case"size6":n.X=2*e,n.Y=1.5*e;break;case"size7":n.X=e,n.Y=2*e;break;case"size8":n.X=1.5*e,n.Y=2*e;break;case"size9":n.X=2*e,n.Y=2*e}return n}const Ug="N",$g="S",Wg="E",Xg="W";class qg{constructor({component:t,anchor:e,position:n,self:i}){this.component=t,this._anchorName=e,this._position=n,this.self=i}get position(){const t=this.anchor;if(t){const{position:e}=t,n=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(n.x,n.y)}return this._position}set position({x:t,y:e}){this._position={x:t,y:e}}get anchor(){return this.component?.findAnchor(this._anchorName)}get direction(){const t=this.component.bounds,e=this.anchor;if(!e)return Wg;const n=e.position;return n.y<=t.top?Ug:n.y>=t.top+t.height?$g:n.x<=t.left?Xg:Wg}get boundaryPosition(){const t=this.anchor;if(t){let{position:e}=t,n=0,i=0;switch(this.direction){case $g:i=20;break;case Ug:i=-20;break;case Xg:n=-20;break;default:n=20}e={x:e.x+n,y:e.y+i};const r=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(r.x,r.y)}}}class Kg extends oc{isLine(){return!0}is3dish(){return!0}replaceRefids(t){["from","to"].forEach(e=>{const n=this.get(e);if(n?.component){const i=t.get(n.component)||n.component;this.set(e,{...n,component:i})}})}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:n}=this.getState("from")||{};if(!t)return;const i=this.root?.findByRefid?.(t);if(!i)return;this._fromEnd=new qg({component:i,fromto:"from",anchor:e,position:n,self:this})}return this._fromEnd}get from(){return this.getState("from")}set from(t){delete this._fromEnd,this.set("from",t)}get toEnd(){if(this.parent&&!this._toEnd){const{component:t,anchor:e,position:n}=this.getState("to")||{};if(!t)return;const i=this.root?.findByRefid?.(t);if(!i)return;this._toEnd=new qg({component:i,fromto:"to",anchor:e,position:n,self:this})}return this._toEnd}get to(){return this.getState("to")}set to(t){delete this._toEnd,this.set("to",t)}move({x:t,y:e},n){n&&(this.from={position:this._fromEnd?.position||this.getState("from")?.position||{x:0,y:0}},this.to={position:this._toEnd?.position||this.getState("to")?.position||{x:0,y:0}}),super.move({x:t,y:e})}render(t){const{begin:e="none",end:n="none",lineWidth:i,round:r=0}=this.state;let s=this.drawPath;Yg(t,s,this.state),t.beginPath();const o=Bg(e,i,s[0],s[1]),a=Bg(n,i,s[s.length-1],s[s.length-2]);s=[o,...s.slice(1,-1),a];let c={x:o.x,y:o.y};t.moveTo(o.x,o.y);for(let e=1;e<s.length;e++){const n=c;c=s[e];const i=s[e+1];if(n.x===c.x&&n.y===c.y)continue;if(!i){t.lineTo(c.x,c.y);break}let o=Math.sqrt((n.x-c.x)*(n.x-c.x)+(n.y-c.y)*(n.y-c.y)),a=0!==o?Math.atan2(n.x-c.x,n.y-c.y):0,l=Math.sin(a)*Math.min(r,o/2)+c.x,h=Math.cos(a)*Math.min(r,o/2)+c.y;const d=r>0||0!==o?{x:l,y:h}:c;o=Math.sqrt((i.x-c.x)*(i.x-c.x)+(i.y-c.y)*(i.y-c.y)),a=0!==o?Math.atan2(i.x-c.x,i.y-c.y):0,l=Math.sin(a)*Math.min(r,o/2)+c.x,h=Math.cos(a)*Math.min(r,o/2)+c.y;const u=r>0||0!==o?{x:l,y:h}:c;t.lineTo(d.x,d.y),r>0&&t.quadraticCurveTo(c.x,c.y,u.x,u.y)}this.drawStroke(t,void 0)}contains(t,e){const{lineWidth:n}=this.state;return Hg(t,e,this.drawPath,n)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state,{x1:n,y1:i,x2:r,y2:s}=this.state;return[this.fromEnd?.position||t?.position||{x:n,y:i},this.toEnd?.position||e?.position||{x:r,y:s}]}set path(t){const[e,n]=t,{from:i,to:r}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...i,position:e},to:{...r,position:n}})}get textBounds(){const t=this.drawPath;let e,n,i=0;for(let r=1;r<t.length;r++){const s=t[r-1],o=t[r],a=(s.x-o.x)*(s.x-o.x)+(s.y-o.y)*(s.y-o.y);a>i&&(i=Math.ceil(a),e=s,n=o)}let{paddingTop:r,paddingLeft:s,paddingRight:o,paddingBottom:a}=this.state;return a||=0,r||=0,s||=0,o||=0,{left:Math.min(e.x,n.x)+s,top:Math.min(e.y,n.y)+r,width:Math.max(Math.abs(e.x-n.x)-s-o,0),height:Math.max(Math.abs(e.y-n.y)-r-a,0)}}get decorators(){return this.app.isEditMode?["decotag"]:[]}}Kg.getTipNeckPos=Bg,Kg.containedInPath=Hg,Kg.drawEndTips=Yg,oc.register("line",Kg);const Qg={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 Zg extends(Lp(ac)){is3dish(){return!0}render(t){const{cx:e,cy:n,rx:i,ry:r,startAngle:s,endAngle:o,anticlockwise:a}=this.state;t.beginPath(),t.ellipse(e,n,Math.abs(i),Math.abs(r),0,s||0,o||2*Math.PI,a),void 0!==s&&void 0!==o&&(t.lineTo(e,n),t.closePath())}get path(){const{cx:t,cy:e,rx:n,ry:i}=this.state;return[{x:t-n,y:e-i},{x:t+n,y:e-i},{x:t+n,y:e+i},{x:t-n,y:e+i}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2,rx:(n.x-e.x)/2,ry:(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:i,rx:r,ry:s}=this.state,o=(t-n)/(2*r-.5),a=(e-i)/(2*s-.5);return o*o+a*a<.25}outline(t){return function(t,e){const{cx:n,cy:i,rx:r,ry:s}=t.model,o=2*Math.PI*e,a=n+r*Math.cos(o),c=i+s*Math.sin(o);return t.toScene(a,c)}(this,t)}get anchors(){return function(t){const{left:e,top:n,width:i,height:r}=t.bounds,s=e+i/2,o=n+r/2;return[{name:"TOP",position:{x:s,y:n}},{name:"RIGHT",position:{x:e+i,y:o}},{name:"BOTTOM",position:{x:s,y:n+r}},{name:"LEFT",position:{x:e,y:o}}]}(this)}get nature(){return Qg}}oc.memoize(Zg.prototype,"path",!1),oc.register("ellipse",Zg);const Jg={object:{fill:"rgba(180,180,180,0.18)",stroke:"#888888",icon:"?",label:"object"},transport:{fill:"rgba(100,180,255,0.18)",stroke:"#3a78c8",icon:"⇄",label:"transport"},facility:{fill:"rgba(160,140,220,0.18)",stroke:"#6b4ec8",icon:"◫",label:"facility"},vehicle:{fill:"rgba(120,200,140,0.18)",stroke:"#3a8c5e",icon:"⊙",label:"vehicle"},region:{fill:"rgba(220,200,100,0.18)",stroke:"#a0892a",icon:"▢",label:"region"},path:{fill:"rgba(200,140,160,0.18)",stroke:"#a0506a",icon:"⌐",label:"path"},"3d-asset":{fill:"rgba(255,180,80,0.18)",stroke:"#c87a2a",icon:"◈",label:"3D asset"}},tm=[{type:"string",label:"placeholder-label",name:"placeholderLabel",description:'사용자에게 표시할 추가 라벨 (예: "Stocker A1")'},{type:"string",label:"hint",name:"placeholderHint",description:"구체화 시 참고 — 도면의 원본 식별자 / VLM 라벨 등"}];function em(t,e,n,i,r){const{left:s,top:o,width:a,height:c}=e,l=Math.max(a,1),h=Math.max(c,1);t.save(),t.fillStyle=n.fill,t.fillRect(s,o,l,h),t.strokeStyle=n.stroke,t.lineWidth=1.5,t.setLineDash([4,3]),t.strokeRect(s,o,l,h),t.setLineDash([]),t.restore(),Math.min(l,h)>=24&&(t.save(),t.fillStyle=n.stroke,t.font=`bold ${Math.min(20,.4*Math.min(l,h))}px Arial`,t.textAlign="center",t.textBaseline="middle",t.fillText(n.icon,s+l/2,o+h/2),t.restore());const d=i?`${n.label}: ${i}`:n.label;h>=32&&(t.save(),t.fillStyle=n.stroke,t.font="10px Arial",t.textAlign="center",t.textBaseline="bottom",t.fillText(d,s+l/2,o+h-4),t.restore()),r&&h>=40&&(t.save(),t.fillStyle=n.stroke,t.font="9px Arial",t.textAlign="right",t.textBaseline="top",t.fillText(`hint: ${r}`,s+l-4,o+4),t.restore())}const nm={mutable:!1,resizable:!0,rotatable:!0,properties:[...tm,{type:"placeholder-convert",label:"",name:"_convert"}],help:"scene/component/placeholder"};class im extends(lc(ac)){get nature(){return nm}render(t){const{placeholderLabel:e,placeholderHint:n}=this.state;em(t,this.bounds,Jg.object,e,n)}}oc.register("placeholder",im);const rm=["placeholder"];function sm(t,e=[]){return!!t&&(!!rm.includes(t)||e.includes(t))}const om={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e+1,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){const i=n[e+1];n[e+1]={...i||{},x:t.x,y:t.y}})},ondragend:function(t,e,n){}},am={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 cm extends ac{is3dish(){return!0}get mutable(){return!0}get pathExtendable(){return!0}get cornerEditable(){return!0}get path(){return this.state.path??[]}set path(t){this.set("path",t)}contains(t,e){const n=this.path;let i=!1;return n.forEach((r,s)=>{const o=(s+n.length+1)%n.length,a=r.x,c=r.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(i=!i)}),i}get controls(){const t=this.path;return t.map((e,n)=>{const i=t[n+1>=t.length?0:n+1];return{x:(e.x+i.x)/2,y:(e.y+i.y)/2,handler:om}})}get nature(){return am}}oc.memoize(cm.prototype,"controls",!1),oc.register("polygon",cm);const lm=[];class hm extends(ul(cm)){constructor(t,e){super(t,e),this._components=[]}replaceRefids(t){this.components.forEach(e=>e.replaceRefids(t))}get showMoveHandle(){return!0}get showOverflow(){return!1}dispose(){this.components.slice().forEach(t=>t.dispose()),super.dispose()}isContainer(){return!0}containable(t){return t.isDescendible(this)}get hasTextProperty(){return!1}get components(){return this._components}get focusible(){return!0}get layout(){return gc.get(this.get("layout"))||yc}reflow(){this.layout.reflow(this),this.components&&this.components.forEach(t=>{t.isContainer()&&t.reflow()})}get hierarchy(){const t=super.hierarchy;return this.components?.length&&(t.components=this.components.map(t=>t.hierarchy)),t}reparent(t,e={}){t&&t.parent!==this&&this.addComponent(t,{silent:!0})}addComponent(t,e=!1){const{ghost:n=!1,silent:i=!1}="boolean"==typeof e?{ghost:e}:e,r=t.parent;if(r){if(this===r)return;r.removeComponent(t,n||i)}const s=this._components.push(t)-1;i&&(t._silentAdd=!0),t.parent=this,t.added(this),n||i||this.trigger("add",this,t,s),t.delegate_on(this),i?(r&&this.root?._removeTraverse?.(t),this.trigger("add",this,t,s),t.trigger("added",this,t,s),delete t._silentAdd):n||t.trigger("added",this,t,s),this.root&&this.root.isReady&&t.ready()}removeComponent(t,e=!1){const n=this._components.indexOf(t);-1!=n&&(this._components.splice(n,1),t.parent=null,t.removed(this),e||(this.trigger("remove",this,t),t.trigger("removed",this,t)),t.delegate_off(this))}insertComponentAt(t,e,n=!1){const i=t.parent;i&&i.removeComponent(t,n);const r=this._components.splice(0,e);this._components=r.concat(t,this._components),e=this._components.indexOf(t),t.parent=this,t.added(this),n||this.trigger("add",this,t,e),t.delegate_on(this),n||t.trigger("added",this,t,e)}add(t,e=!1){return t instanceof Array?(t.forEach(t=>{-1==this._components.indexOf(t)&&this.addComponent(t,e)}),this):this.add.call(this,[t],e)}remove(t,e=!1){return t instanceof Array?this._components?(t.forEach(t=>this.removeComponent(t,e)),this):this:this.remove.call(this,[t],e)}getAt(t){if(this._components)return this._components[t]}forEach(t,e){this._components&&this._components.forEach(t,e)}traverse(t,e){t.call(e,this),this._components&&this._components.forEach(n=>{n.isContainer()?n.traverse(t,e):t.call(e,n)})}indexOf(t){return(this._components||lm).indexOf(t)}size(){return(this._components||lm).length}moveChildAt(t,e){const n=this.indexOf(e);if(-1==n)return;let i=this._components.splice(0,n);const r=this._components.splice(1);this._components=i.concat(r),t=Math.max(0,t),t=Math.min(t,this._components.length),i=this._components.splice(0,t),this._components=i.concat(e,this._components)}moveChildForward(t){const e=this.indexOf(t);-1!=e&&e!=this.size()-1&&(this._components[e]=this._components[e+1],this._components[e+1]=t)}moveChildBackward(t){const e=this.indexOf(t);-1!=e&&0!=e&&(this._components[e]=this._components[e-1],this._components[e-1]=t)}moveChildToFront(t){const e=this.indexOf(t);if(-1==e||e==this.size()-1)return;const n=this._components.splice(0,e),i=this._components.splice(1);this._components=n.concat(i,this._components)}moveChildToBack(t){const e=this.indexOf(t);if(-1==e||0==e)return;const n=this._components.splice(0,e),i=this._components.splice(1);this._components=this._components.concat(n,i)}symmetryX(t){super.symmetryX(t),this.components.map(t=>{t.symmetryX(0)})}findAll(t,...e){if("string"==typeof t)return za(t,this,e[0]||this);if("function"!=typeof t)return[];let n=[];for(let i=this.components.length-1;i>=0;i--){const r=this.components[i].findAll(t,...e);r&&(n=n.concat(r))}return t(this,...e)&&n.push(this),n}findFirst(t,...e){if("string"==typeof t)return za(t,this,e[0])[0];if("function"==typeof t){for(let n=this.components.length-1;n>=0;n--){const i=this.components[n].findFirst(t,...e);if(null!=i)return i}return t(this,...e)?this:void 0}}findById(t){return this.root.findAllById?.(t)?.[0]}findByRefid(t){return this.root.findByRefid?.(t)}capture(t,e,n){if(!this.app.isEditMode&&this.hidden)return!1;const i=this.fromParent(t,e);if(!this.contains(i.x,i.y))return!1;const r=this.bounds;i.x-=r.left,i.y-=r.top;const s=this.layout.capturables(this);for(let r=s.length-1;r>=0;r--){const o=s[r];let a;if(a="static"==o.position?o.capture(i.x,i.y,n):o.capture(t,e,n),a)return a}return this.capturable&&!n?.(this)&&this}capturePath(t,e){if(e){if(e.indexOf(this)>-1)return!1;for(let t=0;t<e.length;t++)if(!this.containable(e[t]))return!1}const n=[],{left:i,top:r,width:s,height:o}=this.bounds;for(let e=0;e<t.length;e++){const a=this.fromParent(t[e].x,t[e].y);if(a.x<i||a.x>i+s||a.y<r||a.y>r+o)return!1;a.x-=i,a.y-=r,n.push(a)}const a=this.layout.capturables(this);for(let t=a.length-1;t>=0;t--){const i=a[t];if(!i.isContainer())continue;const r=i.capturePath(n,e);if(r)return r}return this.focusible&&this}render(t){"popup"!==this.position&&super.render(t)}postrender(t){if("popup"===this.position)return void super.postrender(t);const e=this.layout.drawables(this);if(e.length>0){let{left:n=0,top:i=0,width:r,height:s}=this.bounds;t.save(),this.showOverflow||(t.beginPath(),t.rect(n,i,r,s),t.clip(),t.closePath()),t.translate(n,i),e.forEach(e=>{const n=this.root?.transitionEffect;n?.isReparenting(e)?n.renderComponent(e,this.root?.model_layer):e.draw(this.position&&"static"!==this.position?t:this.getContext(e))}),t.translate(-n,-i),t.restore()}super.postrender(t)}trim(){this.components.forEach(t=>{t.trim()}),super.trim()}}["layout"].forEach(t=>oc.memoize(hm.prototype,t,!1));const dm={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){const i=n[e];n[e]={...i||{},x:t.x,y:t.y}})},ondragend:function(t,e,n){}},um={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 pm extends Kg{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:n}=this.state;return[this.fromEnd?.position||t?.position||n[0],...n.slice(1,-1),this.toEnd?.position||e?.position||n[n.length-1]]}set path(t){const{from:e,to:n}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...n,position:t[t.length-1]},path:t})}get controls(){const t=this.path,e=[];for(let n=0;n<t.length-1;n++){const i=t[n],r=t[n+1];0==n&&e.push({x:i.x,y:i.y,handler:dm}),e.push({x:(i.x+r.x)/2,y:(i.y+r.y)/2,handler:dm}),n==t.length-2&&e.push({x:r.x,y:r.y,handler:dm})}return e}get nature(){return um}}oc.register("polyline",pm);const fm={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 gm extends Kg{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:n,direction:i,boundaryPosition:r=t}=this.fromEnd||{},{component:s,direction:o,boundaryPosition:a=e}=this.toEnd||{},c=[r,a],l=[];r&&l.push(r);let h,d=n?.bounds;d&&(h=n.toScene(d.left,d.top),h=this.transcoordT2P(h.x,h.y),d={...d,left:h.x,top:h.y});const u=d?{left:d.left-20,top:d.top-20,width:d.width+40,height:d.height+40}:{left:r.x,top:r.y,width:0,height:0};d=d||u;let p=s?.bounds;p&&(h=s.toScene(p.left,p.top),h=this.transcoordT2P(h.x,h.y),p={...p,left:h.x,top:h.y});const f=p?{left:p.left-20,top:p.top-20,width:p.width+40,height:p.height+40}:{left:a.x,top:a.y,width:0,height:0};p=p||f;const g=[u,f],m=u.left>f.left?f.left:u.left,y=u.top>f.top?f.top:u.top,b={left:m,top:y,width:u.left+u.width>f.left+f.width?u.left+u.width-m:f.left+f.width-m,height:u.top+u.height>f.top+f.height?u.top+u.height-y:f.top+f.height-y};let _,v,x,w,M,S,A,k,E,C,T=0,P=0;d.left+d.width<p.left?(w=0,M=1,E=i,C=o,_=(d.left+d.width+p.left)/2,T=p.left-_):p.left+p.width<d.left&&(w=1,M=0,E=o,C=i,_=(d.left+p.width+p.left)/2,T=d.left-_),d.top+d.height<p.top?(x=0,S=1,A=i,k=o,v=(d.top+d.height+p.top)/2,P=p.top-v):p.top+p.height<d.top&&(x=1,S=0,A=o,k=i,v=(d.top+p.height+p.top)/2,P=d.top-v);const D=[];if(_&&T>P){let t,e,n;switch(C){case Xg:switch(E){case Wg:D.push({x:_,y:c[w].y}),D.push({x:_,y:c[M].y});break;case Xg:t=g[w].top+g[w].height/2,e=t>c[M].y?Math.min(g[w].top,c[M].y):Math.max(g[w].top+g[w].height,c[M].y),D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:c[M].y});break;case Ug:case $g:e=E===$g?Math.max(c[w].y,c[M].y):Math.min(c[w].y,c[M].y),D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:c[M].y});break;default:return this.path}break;case Wg:switch(E){case Wg:e=c[w].y<c[M].y?Math.min(g[M].top,c[w].y):Math.max(g[M].top+g[M].height,c[w].y),n=e;break;case Xg:e=void 0!==v?v:c[w].y<c[M].y?b.top-.5*T:b.top+b.height+.5*T,n=e;break;case $g:e=void 0!==v?Math.max(v,c[w].y):b.top+b.height,n=e;break;case Ug:e=v?Math.min(v,g[w].top):b.top,n=e;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:n}),D.push({x:c[M].x,y:n});break;case $g:switch(E){case Wg:e=c[w].y,n=c[w].y>c[M].y?c[w].y:g[M].top+g[M].height;break;case Xg:e=v?Math.max(v,g[M].top+g[M].height):b.top+b.height,n=e;break;case $g:e=b.top+b.height,n=e;break;case Ug:e=v?Math.min(v,g[w].top):g[w].top,n=v?Math.max(v,g[M].top+g[M].height):g[M].top+g[M].height;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:n}),D.push({x:c[M].x,y:n});break;case Ug:switch(E){case Wg:e=c[w].y,n=c[w].y<c[M].y?c[w].y:g[M].top;break;case Xg:e=v?Math.min(v,g[M].top):b.top,n=e;break;case $g:e=void 0!==v?Math.max(v,c[w].y):c[w].y,n=void 0!==v?Math.min(v,c[M].y):c[M].y;break;case Ug:e=b.top,n=e;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:n}),D.push({x:c[M].x,y:n});break;default:return this.path}l.push(...0===w?D:D.reverse())}else if(v){let t,e,n;switch(k){case Ug:switch(A){case $g:D.push({x:c[x].x,y:v}),D.push({x:c[S].x,y:v});break;case Ug:t=g[x].left+g[x].width/2,e=t>c[S].x?Math.min(g[x].left,c[S].x):Math.max(g[x].left+g[x].width,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:c[S].x,y:v});break;case Xg:e=Math.min(c[x].x,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:c[S].x,y:v});break;case Wg:e=Math.max(c[x].x,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:c[S].x,y:v});break;default:return this.path}break;case $g:switch(A){case Xg:e=b.left,n=e;break;case Wg:e=void 0!==_?Math.max(_,c[x].x):b.left+b.width,n=e;break;case Ug:e=void 0!==_?_:c[x].x<c[S].x?b.left-.5*P:b.left+b.width+.5*P,n=e;break;case $g:e=c[x].x,n=c[x].x<c[S].x?Math.min(g[S].left,c[x].x):Math.max(g[S].left+g[S].width,c[x].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:n,y:v}),D.push({x:n,y:c[S].y});break;case Wg:switch(A){case Xg:e=void 0!==_?Math.min(_,c[x].x):c[x].x,n=void 0!==_?Math.max(_,c[S].x):c[S].x;break;case Wg:e=b.left+b.width,n=e;break;case Ug:e=void 0!==_?Math.max(_,c[S].x):b.left+b.width,n=e;break;case $g:e=c[x].x,n=Math.max(g[S].left+g[S].width,c[x].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:n,y:v}),D.push({x:n,y:c[S].y});break;case Xg:switch(A){case Xg:e=b.left,n=e;break;case Wg:e=void 0!==_?Math.max(_,c[x].x):c[x].x,n=void 0!==_?Math.min(_,c[S].x):c[S].x;break;case Ug:e=b.left,n=e;break;case $g:e=c[x].x<c[S].x?Math.min(g[S].left,c[x].x):c[x].x,n=Math.min(e,c[S].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:n,y:v}),D.push({x:n,y:c[S].y});break;default:return this.path}l.push(...0===x?D:D.reverse())}else{let t,e;switch(i){case Ug:switch(o){case Ug:e=b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case $g:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top+b.height}),l.push({x:c[1].x,y:b.top+b.height});break;case Wg:t=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;case Xg:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case $g:switch(o){case Ug:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top}),l.push({x:c[1].x,y:b.top});break;case $g:case Wg:case Xg:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;case Xg:switch(o){case Ug:t=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:b.left,e=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(b.top,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case $g:t=b.left,e=Math.max(b.top+b.height,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case Wg:t=b.left+b.width,l.push({x:c[0].x,y:b.top}),l.push({x:t,y:b.top}),l.push({x:t,y:c[1].y});break;case Xg:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case Wg:switch(o){case Ug:e=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case $g:e=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case Wg:case Xg:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;default:return this.path}}return a&&l.push(a),[t,...l,e].filter((t,e,n)=>{if(0===e)return!0;const i=n[e-1];return t.x!==i.x||t.y!==i.y}).filter((t,e,n)=>{if(0===e||e>=n.length-1)return!0;const i=n[e-1],r=n[e+1];return!(t.x===i.x&&t.x===r.x||t.y===i.y&&t.y===r.y)})}get nature(){return fm}}oc.register("ortholine",gm);const mm={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 ym extends(lc(ac)){static get noimage(){return ym.NOIMAGE||(ym.NOIMAGE=new Image,ym.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),ym.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){const{left:e,top:n,width:i,height:r,isGray:s=!1,alpha:o=1,src:a}=this.state;if(this.prepareIf(!this._image&&a),t.beginPath(),t.globalAlpha*=o,this._image&&this._image.complete)if(s&&this._offcanvas)t.drawImage(this._offcanvas,e,n,i,r);else try{t.drawImage(this._image,e,n,i,r)}catch(s){t.drawImage(ym.noimage,e,n,i,r)}else!this.app.isViewMode&&t.drawImage(ym.noimage,e,n,i,r)}get nature(){return mm}get hasTextProperty(){return!1}async ready(){await super.ready();const{src:t}=this.state;if(!this._image&&t){const e=this.root?.app?.loadTracker;if(e){const n=new Promise((t,e)=>{this.prepare(()=>t(),t=>e(t))});e.track(`image:${t}`,"image",t,n)}else this.prepareIf(!0)}}prepare(t,e){const{src:n,crossOrigin:i}=this.state;if(n){this._image=new Image;try{i&&(this._image.crossOrigin=i),this._image.src=this.app.url(n)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){const t=this._image.width,e=this._image.height;this._offcanvas=oc.createCanvas(t,e);const n=this._offcanvas.getContext("2d");n.drawImage(this._image,0,0);const i=function(t,e,n){let i;try{i=t.getImageData(0,0,e,n)}catch(t){return Fi("Get Image Data Error: "+(t instanceof Error?t.message:String(t))),null}const r=i.data;for(let t=0;t<e*n*4;t+=4){const e=r[t],n=r[t+1],s=r[t+2],o=Math.floor((e+n+s)/3);i.data[t]=o,i.data[t+1]=o,i.data[t+2]=o}return i}(n,t,e);n.putImageData(i,0,0)}t(this)},this._image.onerror=t=>{this._image&&!this._image.currentSrc&&(this._image=null),e(t)}}else t(this)}get src(){return this.get("src")}set src(t){this.set("src",t)}onchange(t,e){(t.hasOwnProperty("src")||t.hasOwnProperty("isGray"))&&(this._offcanvas=null,this._image=null,this.prepareIf(t.src))}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("image/"))return void(this.src=e[n])}}oc.register("image-view",ym);class bm extends(Dg(lc(oc))){is3dish(){return!0}prerender(){}}var _m,vm,xm={},wm={},Mm={};function Sm(){if(vm)return wm;vm=1,Object.defineProperty(wm,"__esModule",{value:!0});var t=function(){if(_m)return Mm;_m=1,Object.defineProperty(Mm,"__esModule",{value:!0});var t=function(){function t(){}return t.bitsToNum=function(t){return t.reduce(function(t,e){return 2*t+e},0)},t.byteToBitArr=function(t){for(var e=[],n=7;n>=0;n--)e.push(!!(t&1<<n));return e},t.lzwDecode=function(t,e){for(var n,i,r=0,s=function(t){for(var n=0,i=0;i<t;i++)e.charCodeAt(r>>3)&1<<(7&r)&&(n|=1<<i),r++;return n},o=[],a=1<<t,c=a+1,l=t+1,h=[],d=function(){h=[],l=t+1;for(var e=0;e<a;e++)h[e]=[e];h[a]=[],h[c]=null};;)if(i=n,(n=s(l))!==a){if(n===c)break;if(n<h.length)i!==a&&h.push(h[i].concat(h[n][0]));else{if(n!==h.length)throw new Error("Invalid LZW code.");h.push(h[i].concat(h[i][0]))}o.push.apply(o,h[n]),h.length===1<<l&&l<12&&l++}else d();return o},t}();return Mm.SuperGifUtils=t,Mm}(),e=function(){function e(t,e){this.stream=t,this.handler=e}return e.prototype.parseCT=function(t){for(var e=[],n=0;n<t;n++)e.push(this.stream.readBytes(3));return e},e.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},e.prototype.parseHeader=function(){var e={};if(e.sig=this.stream.read(3),e.ver=this.stream.read(3),"GIF"!==e.sig)throw new Error("Not a GIF file.");e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.gctFlag=n.shift(),e.colorRes=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.sorted=n.shift(),e.gctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.bgColor=this.stream.readByte(),e.pixelAspectRatio=this.stream.readByte(),e.gctFlag&&(e.gct=this.parseCT(1<<e.gctSize+1)),this.handler.hdr&&this.handler.hdr(e)},e.prototype.parseExt=function(e){var n=this;switch(e.label=this.stream.readByte(),e.label){case 249:e.extType="gce",function(e){n.stream.readByte();var i=t.SuperGifUtils.byteToBitArr(n.stream.readByte());e.reserved=i.splice(0,3),e.disposalMethod=t.SuperGifUtils.bitsToNum(i.splice(0,3)),e.userInput=i.shift(),e.transparencyGiven=i.shift(),e.delayTime=n.stream.readUnsigned(),e.transparencyIndex=n.stream.readByte(),e.terminator=n.stream.readByte(),n.handler.gce&&n.handler.gce(e)}(e);break;case 254:e.extType="com",function(t){t.comment=n.readSubBlocks(),n.handler.com&&n.handler.com(t)}(e);break;case 1:e.extType="pte",function(t){n.stream.readByte(),t.ptHeader=n.stream.readBytes(12),t.ptData=n.readSubBlocks(),n.handler.pte&&n.handler.pte(t)}(e);break;case 255:e.extType="app",function(t){n.stream.readByte(),t.identifier=n.stream.read(8),t.authCode=n.stream.read(3),"NETSCAPE"===t.identifier?function(t){n.stream.readByte(),t.unknown=n.stream.readByte(),t.iterations=n.stream.readUnsigned(),t.terminator=n.stream.readByte(),n.handler.app&&n.handler.app.NETSCAPE&&n.handler.app.NETSCAPE(t)}(t):function(t){t.appData=n.readSubBlocks(),n.handler.app&&n.handler.app[t.identifier]&&n.handler.app[t.identifier](t)}(t)}(e);break;default:e.extType="unknown",function(t){t.data=n.readSubBlocks(),n.handler.unknown&&n.handler.unknown(t)}(e)}},e.prototype.parseImg=function(e){e.leftPos=this.stream.readUnsigned(),e.topPos=this.stream.readUnsigned(),e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.lctFlag=n.shift(),e.interlaced=n.shift(),e.sorted=n.shift(),e.reserved=n.splice(0,2),e.lctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.lctFlag&&(e.lct=this.parseCT(1<<e.lctSize+1)),e.lzwMinCodeSize=this.stream.readByte();var i=this.readSubBlocks();e.pixels=t.SuperGifUtils.lzwDecode(e.lzwMinCodeSize,i),e.interlaced&&(e.pixels=function(t,e){for(var n=new Array(t.length),i=t.length/e,r=function(i,r){var s=t.slice(r*e,(r+1)*e);n.splice.apply(n,[i*e,e].concat(s))},s=[0,4,2,1],o=[8,8,4,2],a=0,c=0;c<4;c++)for(var l=s[c];l<i;l+=o[c])r(l,a),a++;return n}(e.pixels,e.width)),this.handler.img&&this.handler.img(e)},e.prototype.parseBlock=function(){var t={};switch(t.sentinel=this.stream.readByte(),String.fromCharCode(t.sentinel)){case"!":t.type="ext",this.parseExt(t);break;case",":t.type="img",this.parseImg(t);break;case";":t.type="eof",this.handler.eof&&this.handler.eof(t);break;default:throw new Error("Unknown block: 0x"+t.sentinel.toString(16))}"eof"!==t.type&&setTimeout(this.parseBlock.bind(this),0)},e.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},e}();return wm.SuperGifParser=e,wm}var Am,km,Em={};var Cm=function(){if(km)return xm;km=1,Object.defineProperty(xm,"__esModule",{value:!0});var t=Sm(),e=function(){if(Am)return Em;Am=1,Object.defineProperty(Em,"__esModule",{value:!0});var t=function(){function t(t){this.data=t,this.position=0}return t.prototype.readByte=function(){if(this.position>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.position++]:255&this.data.charCodeAt(this.position++)},t.prototype.readBytes=function(t){for(var e=[],n=0;n<t;n++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",n=0;n<t;n++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();return Em.SuperGifStream=t,Em}(),n=function(){function n(t,e){var n=this;for(var i in this.gifImgElement=t,this.options={autoPlay:!0},this.loading=!1,this.ready=!1,this.transparency=null,this.delay=null,this.disposalMethod=null,this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,this.playing=!0,this.forward=!0,this.ctxScaled=!1,this.frames=[],this.frameOffsets=[],this.initialized=!1,this.currentFrameIndex=-1,this.iterationCount=0,this.stepping=!1,this.handler={hdr:this.withProgress(this.doHdr.bind(this)),gce:this.withProgress(this.doGCE.bind(this)),com:this.withProgress(this.doNothing.bind(this)),app:{NETSCAPE:this.withProgress(this.doNothing.bind(this))},img:this.withProgress(this.doImg.bind(this)),eof:function(){n.pushFrame(),n.canvas.width=n.hdr.width*n.getCanvasScale(),n.canvas.height=n.hdr.height*n.getCanvasScale(),n.playerInit(),n.loading=!1,n.ready=!0,n.loadCallback&&n.loadCallback(n.gifImgElement)}},e)this.options[i]=e[i];this.onEndListener=e.onEnd,this.loopDelay=e.loopDelay||0,this.overrideLoopMode=null!=e.loopMode?e.loopMode:"auto",this.drawWhileLoading=null==e.drawWhileLoading||e.drawWhileLoading}return n.prototype.init=function(){var t=this.gifImgElement.parentNode,e=document.createElement("div");this.canvas=document.createElement("canvas"),this.canvasContext=this.canvas.getContext("2d"),this.tmpCanvas=document.createElement("canvas"),e.className=this.options.enclosingClass||"super-gif",e.appendChild(this.canvas),t&&(t.insertBefore(e,this.gifImgElement),t.removeChild(this.gifImgElement)),this.initialized=!0},n.prototype.loadSetup=function(t){return!this.loading&&(t&&(this.loadCallback=t),this.loading=!0,this.frames=[],this.clear(),this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,!0)},n.prototype.completeLoop=function(){this.onEndListener&&this.onEndListener(this.gifImgElement),this.iterationCount++,!1!==this.overrideLoopMode||this.iterationCount<0?this.doStep():(this.stepping=!1,this.playing=!1)},n.prototype.doStep=function(){if(this.stepping=this.playing,this.stepping){this.stepFrame(1);var t=10*this.frames[this.currentFrameIndex].delay;t||(t=100),0===this.getNextFrameNo()?(t+=this.loopDelay,setTimeout(this.completeLoop.bind(this),t)):setTimeout(this.doStep.bind(this),t)}},n.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},n.prototype.putFrame=function(){var t;this.currentFrameIndex=parseInt(this.currentFrameIndex.toString(),10),this.currentFrameIndex>this.frames.length-1&&(this.currentFrameIndex=0),this.currentFrameIndex<0&&(this.currentFrameIndex=0),t=this.frameOffsets[this.currentFrameIndex],this.tmpCanvas.getContext("2d").putImageData(this.frames[this.currentFrameIndex].data,t.x,t.y),this.canvasContext.globalCompositeOperation="copy",this.canvasContext.drawImage(this.tmpCanvas,0,0)},n.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},n.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},n.prototype.parseStream=function(e){try{new t.SuperGifParser(e,this.handler).parse()}catch(t){this.handleError("parse")}},n.prototype.setSizes=function(t,e){this.canvas.width=t*this.getCanvasScale(),this.canvas.height=e*this.getCanvasScale(),this.tmpCanvas.width=t,this.tmpCanvas.height=e,this.tmpCanvas.style.width=t+"px",this.tmpCanvas.style.height=e+"px",this.tmpCanvas.getContext("2d").setTransform(1,0,0,1,0,0)},n.prototype.drawError=function(){this.canvasContext.fillStyle="black",this.canvasContext.fillRect(0,0,this.hdr.width,this.hdr.height),this.canvasContext.strokeStyle="red",this.canvasContext.lineWidth=3,this.canvasContext.moveTo(0,0),this.canvasContext.lineTo(this.hdr.width,this.hdr.height),this.canvasContext.moveTo(0,this.hdr.height),this.canvasContext.lineTo(this.hdr.width,0),this.canvasContext.stroke()},n.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},n.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},n.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},n.prototype.pushFrame=function(){this.frame&&(this.frames.push({data:this.frame.getImageData(0,0,this.hdr.width,this.hdr.height),delay:this.delay}),this.frameOffsets.push({x:0,y:0}))},n.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var n=this.frames.length,i=t.lctFlag?t.lct:this.hdr.gct;n>0&&(3===this.lastDisposalMethod?null!==this.disposalRestoreFromIdx?this.frame.putImageData(frames[this.disposalRestoreFromIdx].data,0,0):this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height):this.disposalRestoreFromIdx=n-1,2===this.lastDisposalMethod&&this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height));var r=this.frame.getImageData(t.leftPos,t.topPos,t.width,t.height);t.pixels.forEach(function(t,n){t!==e.transparency&&(r.data[4*n+0]=i[t][0],r.data[4*n+1]=i[t][1],r.data[4*n+2]=i[t][2],r.data[4*n+3]=255)}),this.frame.putImageData(r,t.leftPos,t.topPos),this.ctxScaled||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.ctxScaled=!0),this.drawWhileLoading&&(this.canvasContext.drawImage(this.tmpCanvas,0,0),this.drawWhileLoading=this.options.autoPlay),this.lastImg=t},n.prototype.doNothing=function(){},n.prototype.withProgress=function(t){return function(e){t(e)}},n.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},n.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},n.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},n.prototype.play=function(){this.playing=!0,this.step()},n.prototype.pause=function(){this.playing=!1},n.prototype.isPlaying=function(){return this.playing},n.prototype.getCanvas=function(){return this.canvas},n.prototype.isLoading=function(){return this.loading},n.prototype.isReady=function(){return this.ready},n.prototype.isAutoPlay=function(){return this.options.autoPlay},n.prototype.getLength=function(){return this.frames.length},n.prototype.getCurrentFrame=function(){return this.currentFrameIndex},n.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},n.prototype.loadURL=function(t,n){var i=this;if(this.loadSetup(n)){var r=new XMLHttpRequest;r.open("GET",t,!0),"overrideMimeType"in r?r.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in r?r.responseType="arraybuffer":r.setRequestHeader("Accept-Charset","x-user-defined"),r.onloadstart=function(){i.initialized||i.init()},r.onload=function(){if(200===r.status){var t=r.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var n=new e.SuperGifStream(t);setTimeout(function(){i.parseStream(n)},0)}else i.handleError("xhr - response")},r.onerror=function(){i.handleError("xhr")},r.send()}},n.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},n}();return xm.SuperGif=n,xm}();const Tm={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 Pm extends bm{async oncreate_element(t){const{src:e,play:n}=this.state;this.onchangesrc(e),this.onchangeplay(n)}buildImg(){const t=this.element;if(!t)return document.createElement("img");t.replaceChildren();const e=document.createElement("img");return e.style.width="100%",e.style.height="100%",t.appendChild(e),e}onchange(t,e){super.onchange(t,e),"src"in t&&this.onchangesrc(t.src),"play"in t&&this.onchangeplay(t.play)}setElementProperties(t){}onchangeplay(t){const e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){const e=this.buildImg();t||(t="data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw=="),e.src=t,e.setAttribute("rel:animated_src",t),e.setAttribute("rel:auto_play",String(0)),this._superGif=new Cm.SuperGif(e,{autoPlay:!1}),this._superGif.init(),this.element&&Array.from(this.element.children).forEach(t=>{t.style.width="100%",t.style.height="100%"});const n=this._superGif.getCanvas();n.style.width="100%",n.style.height="100%",this._superGif.load(()=>{setTimeout(()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()},100)})}ondropfile(t,e){for(let n=0;n<t.length;n++)if(/\.gif$/.test(t[n].name))return void(this.src=e[n])}get src(){return this.getState("src")}set src(t){this.set("src",t)}get play(){return this.getState("play")}set play(t){this.setState("play",t)}get nature(){return Tm}get tagName(){return"div"}}oc.register("gif-view",Pm);const Dm={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 Om extends(lc(ac)){static get image(){return Om.IMAGE||(Om.IMAGE=new Image,Om.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5ZzAwBurHDk3WGeRY0bvYrGa1+rqNI22f7dS32ZnUK1GMr0eSK3mEc9dhKMxp+ZTo8kT2emOXS5LQ1kCxbJBocSd2k5PaIjMVzjWcdJPk9ooBnmzx1t5XbIxqBKpJ4NGTgzwKiGpK4do72gb+ZUMIYtCPm9WCPMsYTE5k2hq2ZvzujlCE1iRmwf3dvmRyKsT0T7b9I7HEPCpqCiqT2IIqaT1pI0noQZdlFC8l/PbYPAnRORT56VBEE6FXkb49agmByKhJ71BME6FsvEntUFQTdqekisUdlQWCXhovEHtUFAWbTapHYo8YgmFybO3vsUWcQYGmxSOxRbRAMprkisUfFQVKmrX18sxt7VB0ENjT1xir2qDxIwkFi3v89e+xRfxAMzfzzIfZ4hyAYDR9zwVuLPd4jCDrTwoLYGb5LEFi3/+E3rweR6urX20c/Fvls2Pvwm9mDSGIPhv8YPyGf3/eo9Ye7O8B2FIShAAooakEttex/rbODad5/yTHIAjqn505IQPv+Xz06dz+4VXORHEZcgAcB8updM8F6e25jBzwIkE07l+x8amMnPDp6nsNJ+BoZ7Q6F8egqAda9VEuRNlZjBzwYkMskdXR73okd8GBAJiKYjBcZKKqG9OiKDbgdfxJ5VhsBPDiQZhaouD3p4hfw4EAmwxisz3MSHwAPEmQ1TB1N+SmXWoAHC7JbZsWl/IxLLcCDBplNo3lrfMLsmwAPGmShAxX5/1vOEzjEz3iyfQ/hI36W4TctsUesOAifPdrQg8M++KYl95iCBkjI1r8634betBAPHZDTPFAmD3zLiHgogVTziMsahz0eIh5aIGHGRSJ2mFtHPR4iHhQIP2UvWGMf8wk74qEIEib7rLjPiBfxiAcCwp8V+Nae3uMdRhAPDIR/J5f/Q2DTcC+hIB7qIGEq3Ti9bx+sryMeAAgS70OK8G2kBD8L8QBAoLWU3g3vUVIc6D0txAMAsY+4jBWowXHO64gHBGKfYJ2T5qY1BxcL98BB+PQ+XiS9xxh9EQ8ChA6C5UXWIUoE9MBB8LVHQoS7ib8/dRn3sAcJ6bQRSdH96RDxIEH4QEX+AHF4LxHEAwUh12xyr1V8lwjiQYDYF8kuf1jluUQQDwrEvkhW8Wc6LhHUgwfhi4QPlHm7LRHawx4kpE191Dq8lgjhAYDQa1cftYrPEiE8OJDb40uqyzdQCA8WhAzL4G/PT4c3WrgHD2IfllGl53V37zsgHg5ApPNvVvq4Fn4spx4oiH1W3CwtEV+PDhEPJyBSkVX4aa7emkM83ICEKWpGM7wdvYCCeDgCEYpcwhLxczhEPFyBCEUWnRL5T6X59SBASBF+9l28TL5F7uEORCZyCUvEx+S7yT0cgoRVb9JaXLR1qUdfgksQ0fTbgmhFB20d8HAKEha14+F8f1sHPNyCiL6EqK+n20/rgIdjkFC0Ho1s6Gndvcc9ICkr/ey8/rHO6vp9KawL8DAFOV6l9Fyub7IbflsCag1qRfVsXWvxHjxIejU+BHZV6uvHD1XiEb++Bw8i+dNd+Wv0eCQmhcPhRPwUUt2DB5G1sfa1aeyzAuyJj9x2HjyIdKzIKw5SI14ieFtvo3kIQERj3lVhkUOnRD7AnjV5369QkAOJZeCH+Jh41xOLs73dQwAifY6dpxCCbjTDzLf1Bm1Y93tAIDOWXcLPvrHyr2hVoEAceEAgDQzB4jetk0/c2OXRHB48EJCpa4dgpYh2ETxtrshz7zx4ICCzfuTSDn8p/EOS9OTjwgMB+cABP3yWYuOPIofs33LigYCULlpZNXJppVU30Vf14kGAUCLijf1D71lN9FW9eFiA9KgZ8FPpPUsSnufGA+8hvAg2Kpz0nrX//qp+PIgpC3i6xJRITOye9fn1VT15ICCrVlQG5rywo0H8x965bVkNwmCYQ2kR6Gmb939WXV65dFnI/tPdjPBfO7XMN4EkTUJtqZp4sCJ1+8jwkhMu0KpMxFXFA8hlVfQSMxGH5mDK1VKV8QCyvTVtUiYyo7V358VStfGoAEFMhGYhEwloxZy9WKo2Hjwg5iSOvFDXeUYd33+PuVfHgwnEBWLocDJp+IIa2fyvperjwQRiXCKGosyXqoA+YfsIELuYu4HAt+msMknfDK4jfQJIzOZ2IPAQWJtFOhQKivR2IDZ6Awis7V0iLxqBI7uEZo19dakTogLSwKvf8yk8Jq6CGK0GKvWlatG7b7kkUU/Lo1gdXWn7/4E0j0qeJDpqN/ABqQcgJgdqURb4chjQktIugDS6wFFiz3JgaJj7AGJmholAe9YKhoZLJ0Ca6smjwJ4VwVN96gVIE5GM71kHaGKxGyAtRDaB2NBhLVmpHyANRKzDO28W7FS3HQFpaIWa8TrfCXQwegJSL5k+8M9UJ+pm9QTEnCIZrR0MDQeQ9ua0iCcYQaBTV0CqNXQW/yiyYG7W1heQanPaCkciBXuH1BkQJzHcDQxmpgGkPatl4WkbCXO/bW9AqlNg4H0PPMi6A1IxkQmOZ8D0ousNSMVEEuyreTAQ6Q7IRJeCX2YZQHhv6SrBOmpkM+YUzN0BqSRQCupmTeCP9wdkhiOREwtEzgGEsWcF9BhK9R8fQDiN7A8DiR0CKXQlj/q9IM8OgXjIzcKBlAHkD6FulgNzJwPIHwpo8mQAkX3LiPq9dKUMAQk9AqmcqmjuBAJCPQIpA4guIAsKJA0gnwNy3A4kDyBIHCEPxAwgf8gPILqA5AFEF5CxZX0lIHYc6rqADLf380BmFMgxgIzUyf8MJKLTRelKHgKy9wgkjfS7LiA0gKgC8vQn3HUA4RQ5LKPIAQciWbqIEg0YkLNDIHYUyqkCsmKN5vg3+W0AYTRATaPY+uu1IwS6UMGAlO6AFPjSCQMStaNh53cdcPG7Hx1Uupo+rx+Bltn1BuTAj5BptEV/bHAAwbnJMICwRmtUDOSEA8s4Rmtw3nITGD6TwUNoG0Ca7xi2YKSPj2eKXQFxQWKA2QbGMWEMMGseOb7C7T47uJS1JyAzVbTjqZdU3zbHzMXWS+qp4Fgn8Ahy/QCRGqQcwU1vGnN7fylboWn8Bzg//hyjxltvdcl45bwFfYKzFyBy11UU9BnjuoqfWizVlQXulpzBTNbaB5Aid+VRrkBFB630AMS9BC8FK2ggE7u/FGy1kvfcB9TKQufX5uUXNWl3EjvWCi4k/u9A3Ddq1CpTIQGe6VN1qd8ArcvDQNw3S41Kn6qQmOq5e7pRr+8fAYLiIJtFrrvYRMYL0q06vj8EZLXUriJzRY8H1xEagOCK7gkghRg6RQYO0I6aWPwIEAru80AiMWSdzAeuDXUKyr+WqpAID8hMHC1Ct8F4mUsQ6W8pJMICki0JHCBczAFdBl38G3VE6ErQhhWlih4LWrCSLpaqjggHiGe9mVjRY0YPoelyqcqIcIDEe97rqJFFH7FcLlUZEQ6Qg5plvZiBFNhtri1VFREGEC/Eg4nZoU5vqi1VFREGkIXDQ8xAIhzoT/WlKiLCAFIYPOQMxOPdjfWlKiLCADJRm3YGj+pDE2xktmmpaogwgMz8d8GrumZ4xzpbvinqISJ+hiTWm7wEqoJdI9JEV9JChAEkS3xCZzKecLcgN6YwlRBhAGmweTsblg6qKMM7Vmh321UQ4QAp1VfwhqVJIh+Wm03W0qV0EOEAybXtivkCmWrKeH2EZ/xBaSBCV2L9Re+LYSqJJIxDu1ew07U0EGEBcTtmHty4JuPtQhvLh1BAhK7Uvvq0GK484QZST0GvvFDqeSJ1IA0r2mfDljvqBoJ//rVsq7yZCA6kXgVkJ2f4ijIGMjOfMVsCBBORB2Jy+sM6ijNvaBUqmw/cStZ8EiKciHwp6Rp++88qmxXQeTUxDiJWJ9wSISvBicgXW+dypn1PqWTznlwgwdZdfiLHr5OELEAEASKvJFRE5JCPKbh8OxHdQKJU0crEzRXrJ/IEkFms6tGyrUw9kQeALFRXvK2iSzsRAAi6BLxM+60xdsqJAEBuXMAMxDLVp+gmAgC57/UT4qvVj3TVRCAgSAYL91aXtyNLzUQAIFhAiP8m0/NHOp+ILiBtPFKrs6bgSOcT0QTEB8nO3QR1yKslggKRf+m11UB0HOl8IlqAeCvauXuo8HnfIqIDyCw6G8XMcGiplMingMzCnbuHFp/3LSLPA4nUpqm5YkWNzwsQeQxIDsKjH5wVSU5qJPIJIIt4jjpqNBAekQeBfJOeHWS81FQoo4/I7UDcS3wUh0liTzLqiEgDqddx4ZHDrNZAACIAEMw88HPYWb0GAhABgEDmgf9Vb5oNBCByOxD3uqWYbCHVBgIQuRlIsbfwMEG5gQBE7gSyHMDsOayrxJvHBRC5B0hOxJH1nK4SlUE6QOR+IG6ju3iYQEqDdIDIzUDyZu/jMRHpS/OiRG4FkiPRfTw8kbrvIAJEACAIDpyHC1/GQHhEbgKSXwTyqIeEur6kixEBgABHOTr7YSX1MSFAhA0E307wUU76Y0KACAsI/tvCRzkF+iIuL0AEAYLbR2QOfvhKJ/obRESBxNt5rPSFXN4f7dyNdqMgEIbhAXWwJErT/e7/Wreb5HTT07QVgWSAeW5g7b4n8qOSUCRPEId4HP93SXp5dDNGRJFcQTxihSH+NW1Bb1cXKpIryJAwnG/zhl8ZcSP6jiKZghwRaaWLnP/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="),Om.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}async ready(){super.ready(),this._audio=new Audio;const{src:t="",loop:e=!1,started:n=!1}=this.state;if(t){const e=this.root?.app?.loadTracker;if(e){const n=new Promise((e,n)=>{this._audio.addEventListener("canplay",()=>e(),{once:!0}),this._audio.addEventListener("error",()=>n(new Error(`Audio load failed: ${t}`)),{once:!0})});e.track(`audio:${t}`,"audio",t,n)}}this._audio.addEventListener("canplay",()=>{this.started&&this._audio.play()}),this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(n)}render(t){const{left:e,top:n,width:i,height:r}=this.state;t.beginPath(),this.drawImage(t,Om.image,e,n,i,r)}get nature(){return Dm}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 Fi(t)}}onchangeStarted(t){const e=this._audio;t?4==e.readyState&&e.play():e.pause()}onchangeLoop(t){this._audio.loop=t}onchange(t,e){"src"in t&&this.onchangeSrc(t.src),"started"in t&&this.onchangeStarted(t.started),"loop"in t&&this.onchangeLoop(t.loop)}ondblclick(t){this.started=!this.started}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("audio/"))return void(this.src=e[n])}}oc.register("audio",Om);class zm extends(lc(oc)){is3dish(){return!0}}oc.register("text",zm);const Im=["refid","left","top","width","height","rotation","animation","zPos"];class Rm extends Lg{isGroup(){return!0}is3dish(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});const n=Im.reduce((e,n)=>(t.hasOwnProperty(n)&&(e[n]=t[n]),e),{});return super.set(n,void 0)}capture(t,e,n){const i=super.capture(t,e,n);if(i!==this)return i}set bounds(t){if(this.__MUTATING__)return void(super.bounds=t);const e=this.bounds,n=t.width/e.width,i=t.height/e.height;this.path=this.path.map(r=>({x:t.left+(r.x-e.left)*n,y:t.top+(r.y-e.top)*i})),this.components&&this.components.forEach(t=>{if(t.mutable)t.mutatePath(null,function(t){return t.map(function(t){return{x:t.x*n,y:t.y*i}})});else{const e=t.bounds,r=t.center,s={x:r.x*(1-n),y:r.y*(1-i)},o=e.width*(1-n),a=e.height*(1-i),c=-(s.x-o/2),l=-(s.y-a/2);t.bounds={left:e.left+c,top:e.top+l,width:e.width*n,height:e.height*i}}})}get focusible(){return!1}get bounds(){return super.bounds}get hasTextProperty(){return!1}isIdentifiable(){return!1}calculateBounds(){this.clearCache(),this.__MUTATING__=!0,this.mutateBounds(function(t){const e=oc.union(this.components.map(t=>t.bounds));return this.components.forEach(t=>{const n=t.bounds;t.bounds={left:n.left-e.left,top:n.top-e.top,width:n.width,height:n.height}}),{left:t.left+e.left,top:t.top+e.top,width:e.width,height:e.height}},this),this.__MUTATING__=!1,this.parent.isGroup()&&this.parent.calculateBounds?.()}render(t){}postrender(t){const{top:e,left:n}=this.state;t.translate(n,e),this.layout.drawables(this).forEach(e=>{e.draw(t)}),t.translate(-n,-e)}}oc.memoize(Rm.prototype,"bounds",!0),oc.register("group",Rm);const Lm={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 jm extends(lc(ac)){get ref(){const t=this.getState("ref");return t&&"string"==typeof t?this.root.findById?.(t):null}set ref(t){this.setState("ref",t)}get refScale(){const t=this.ref;if(!t)return{x:1,y:1};const e=t.bounds,n=this.bounds,i=n.width/e.width,r=n.height/e.height;return"both"===this.model.fit?{x:i,y:r}:{x:Math.min(i,r),y:Math.min(i,r)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){const e=this.ref.center,n=this.center,i=this.refScale;t.translate(n.x,n.y),t.scale(i.x,i.y),t.translate(-e.x,-e.y)}}postrender(t){if(this.ref)return this.ref.postrender(t);super.postrender(t)}render(t){if(this.ref)return this.ref.render(t);const{left:e,top:n,width:i,height:r}=this.bounds;t.beginPath(),t.rect(e,n,i,r)}get nature(){return Lm}get hasTextProperty(){return!1}}oc.memoize(jm.prototype,"ref",!1),oc.memoize(jm.prototype,"refScale",!1),oc.register("local-ref",jm);class Fm extends(Dg(fl)){render(t){}is3dish(){return!0}get layout(){return gc.get(this.get("layout"))||mc}}const Nm={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 Hm extends Fm{dispose(){this._releaseRef(),super.dispose()}get nature(){return Nm}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){const{mode:e="view",round:n=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=n+"px"}async ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();const t=this._element_bounds,{offsetWidth:e,offsetHeight:n}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:n},(!t||t.offsetWidth!=e||t.offsetHeight!=n)&&this.ref&&this.root.target_element){const{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();const{ref:t,fit:e="ratio"}=this.state;if(!t)return;const n=this.app.refProvider;if(n&&t){const i=(async()=>{this.__ref=await n.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data})();this.root?.app?.loadTracker?.track(`ref:${t}`,"ref-board",t,i);try{await i}catch(t){Fi(t)}}}get ref(){return this.__ref}set ref(t){this.setState("ref",t)}_releaseRef(){this.__ref&&this.__ref.release&&this.__ref.release(),delete this.__ref}onchange(t,e,n){super.onchange(t,e),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame(()=>{const{fit:t}=this.state;this.ref.fit(t)}),"data"in t&&this.ref&&requestAnimationFrame(()=>{this.ref.data=t.data})}}oc.register("global-ref",Hm);const Bm="center-middle",Ym={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",Bm,"right-middle","left-bottom","center-bottom","right-bottom","auto"]}},{type:"string",label:"title",name:"text"},{type:"data",label:"value",name:"value"},{type:"string",label:"container-ref",name:"containerRef",placeholder:"PopupContainer id (same board)"},{type:"textarea",label:"html-template",name:"htmlTemplate",property:{language:"html"}},{type:"string",label:"anchor-ref",name:"anchorRef",placeholder:"component id (3D-tracked anchor)"},{type:"select",label:"anchor-pin",name:"anchorPin",property:{options:[{display:"Top",value:"top"},{display:"Center",value:"center"},{display:"Bottom",value:"bottom"}]}},{type:"number",label:"anchor-offset-x",name:"anchorOffsetX"},{type:"number",label:"anchor-offset-y",name:"anchorOffsetY"},{type:"number",label:"anchor-offset-z",name:"anchorOffsetZ"},{type:"checkbox",label:"constant-size",name:"constantSize"},{type:"checkbox",label:"tether",name:"tether"},{type:"select",label:"off-screen",name:"offScreen",property:{options:[{display:"Hide",value:"hide"},{display:"Edge-pin",value:"edge-pin"},{display:"Keep last",value:"keep-last"}]}}],help:"scene/component/popup"};class Gm extends(lc(ac)){static get image(){return Gm._image||(Gm._image=new Image,Gm._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjAgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkM4QzQxNUMzMzBEMTFFQ0JEMzZDMDUwQUI4MEI3QTAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkM4QzQxNUQzMzBEMTFFQ0JEMzZDMDUwQUI4MEI3QTAiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpENjlENTQ3RjMzMDkxMUVDQkQzNkMwNTBBQjgwQjdBMCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpENjlENTQ4MDMzMDkxMUVDQkQzNkMwNTBBQjgwQjdBMCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PsiUYSQAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA51BMVEVHcEwzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzOguTm2AAAATHRSTlMARhB73r9B7YLrsqdE+0cq9Avzeg31eQx4aQ+Ks6aUd5DsYKixEX1w8vyT2VjoZ3YezY/cCEDvl+QTvRwJ0ifwK/5T/aw6+IuFuCImAcS6MQAAAeJJREFUWMPt2FlX2zAQhuHJYmOSFhIggbC0QNn3rS1dKXSH9///Hi58CJLxKIpEWi6YO8c5z4lG/nxGEXmu/1OVLGnhrFaSVQYg1SZetTTvUibqeFZ9QlfmvRWoV1VmCaCRzroXPpsuAjTV7gLUfPahBqD1OQMW/fazAWTKvQRI/ZgUSJR7U8CM/dHZ+/2VcatWdvdEZAaYUhiAwkerJXt0rnzXwdRKmHfDM0fHD5kxjTFyVLzVfvvirn7+cDJWjhy7c7XlYuwc6Urvu2tRhRypyhwAf1sKY+TIxfQA+H39q5wxc+RgVrcBduTmZTlj5khnDgH4IzKpMGaOVCbvyyvRGTNHGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Gm._image}async ready(){await super.ready(),this.show&&this.onchangeShow(!0)}render(t){const{left:e,top:n,width:i,height:r}=this.bounds;t.beginPath(),this.drawImage(t,Gm.image,e,n,i,r)}onchange(t,e){"value"in t?this.show?this.onchangeShow(!0):this.show=!0:"show"in t&&this.onchangeShow(this.show)}onchangeShow(t){if(this.app.isEditMode)return;(this.getState("board")||this.getState("containerRef")||this.getState("htmlTemplate"))&&(t?this.openPopup(this.value):this.hidePopup())}openPopup(t,e){if(this.app.isEditMode)return;const n=this.getState("anchorRef"),i=n&&this.rootModel?.findById?this.rootModel.findById(n):void 0;ou.show(this,this.getState("board"),{origin:this.getState("origin")||Bm,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,containerRef:this.getState("containerRef"),htmlTemplate:this.getState("htmlTemplate"),anchor:i,anchorPin:this.getState("anchorPin")||"top",anchorOffsetX:this.getState("anchorOffsetX")??0,anchorOffsetY:this.getState("anchorOffsetY")??0,anchorOffsetZ:this.getState("anchorOffsetZ")??0,constantSize:this.getState("constantSize")??!0,tether:this.getState("tether")??!1,offScreen:this.getState("offScreen")||"hide",...e})}hidePopup(){ou.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 Ym}}oc.register("popup",Gm);const Vm={mutable:!1,resizable:!0,rotatable:!1,properties:[{type:"layout",label:"layout",name:"layoutOption"},{type:"checkbox",label:"constant-size",name:"constantSize"},{type:"checkbox",label:"billboard",name:"billboard"},{type:"checkbox",label:"tether",name:"tether"},{type:"select",label:"off-screen",name:"offScreen",property:{options:[{display:"Hide",value:"hide"},{display:"Edge-pin",value:"edge-pin"},{display:"Keep last",value:"keep-last"}]}}],help:"scene/component/popup-container"};class Um extends Lg{get nature(){return Vm}isPopupContainer(){return!0}}oc.register("popup-container",Um);class $m extends oc{render(t){const{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),this.drawStroke(t,void 0)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let i=!1;return n.forEach((r,s)=>{const o=(s+n.length+1)%n.length,a=r.x,c=r.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(i=!i)}),i}}oc.register("path",$m);const Wm={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 Xm extends ac{is3dish(){return!0}contains(t,e){const{x1:n,y1:i,x2:r,y2:s,x3:o,y3:a}=this.state,c=[n,i,r,s,o,a];let l=!1;for(let n=0;n<c.length;n+=2){const i=(n+2)%c.length,r=c[n],s=c[n+1],o=c[i+1];s>e!=o>e&&t<(c[i]-r)*(e-s)/(o-s)+r&&(l=!l)}return l}get mutable(){return!0}get path(){const{x1:t,y1:e,x2:n,y2:i,x3:r,y3:s}=this.state;return[{x:t,y:e},{x:n,y:i},{x:r,y:s}]}set path(t){this.set({x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y,x3:t[2].x,y3:t[2].y})}get nature(){return Wm}}oc.memoize(Xm.prototype,"path",!1),oc.register("triangle",Xm);const qm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"},Km={ondragmove:function(t,e,n){let{cx:i,rx:r}=n.model;r=Math.abs(r);let s=(n.fromParent(t.x,t.y).x-i)/r*100;s=s>=100||s<=-100?100:Math.abs(s),n.set({ratio:s})}};class Qm extends Zg{is3dish(){return!0}render(t){let{ratio:e=50,cx:n,cy:i,rx:r,ry:s,startAngle:o,endAngle:a,anticlockwise:c}=this.state;r=Math.abs(r),s=Math.abs(s),t.beginPath(),t.ellipse(n,i,r,s,0,o||0,a||2*Math.PI,c),t.moveTo(n+r/100*e,i),t.ellipse(n,i,r/100*e,s/100*e,0,o||0,a||2*Math.PI,!0)}contains(t,e){let{cx:n,cy:i,rx:r,ry:s,ratio:o}=this.state;r=Math.abs(r),s=Math.abs(s);const a=(t-n)/(2*r-.5),c=(e-i)/(2*s-.5),l=(t-n)/(r/100*o*2-.5),h=(e-i)/(s/100*o*2-.5);let d=!1;return a*a+c*c<.25&&l*l+h*h>.25&&(d=!d),d}get controls(){let{cx:t,cy:e,rx:n,ratio:i}=this.state;return n=Math.abs(n),[{x:t+n/100*i,y:e,handler:Km}]}get nature(){return qm}}oc.memoize(Qm.prototype,"controls",!1),oc.register("donut",Qm);const Zm={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"},Jm={ondragmove:function(t,e,n){const{cy:i,ry:r}=n.model;let s=(n.fromParent(t.x,t.y).y-i)/r*100+100;s>=100?s=100:s<=0&&(s=0),n.set({ratio:s})}};class ty extends Zg{is3dish(){return!0}render(t){const{ratio:e=30,wing:n=5,cx:i,cy:r,rx:s,ry:o}=this.state;if(n<3)return;const a=1.5707963267948966,c=2*Math.PI/n,l=s-e/100*s,h=o-e/100*o;t.save(),t.beginPath(),t.translate(i,r),t.moveTo(s*Math.cos(-a),o*Math.sin(-a)),t.lineTo((s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let e=1;e<n;e++)t.lineTo(s*Math.cos(c*e-a),o*Math.sin(c*e-a)),t.lineTo((s-l)*(Math.cos(c*(e+1)-a)+Math.cos(c*e-a))/2,(o-h)*(Math.sin(c*(e+1)-a)+Math.sin(c*e-a))/2);t.closePath(),t.restore()}get controls(){const{cx:t,cy:e,ry:n,ratio:i}=this.state;return[{x:t,y:e-n+n*(i/100),handler:Jm}]}get nature(){return Zm}}oc.memoize(ty.prototype,"controls",!1),oc.register("star",ty);const ey={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class ny extends(Lp(ac)){is3dish(){return!1}isDescendible(){return!1}render(t){const{cx:e,cy:n,anticlockwise:i}=this.state,r=this.app?.scale||1;t.beginPath(),t.scale(1/r,1/r),t.ellipse(e,n,Math.abs(ny.RADIUS),Math.abs(ny.RADIUS),0,0,2*Math.PI,i),t.scale(r,r),t.closePath()}get path(){const{cx:t,cy:e}=this.state;return[{x:t-ny.RADIUS,y:e-ny.RADIUS},{x:t+ny.RADIUS,y:e-ny.RADIUS},{x:t+ny.RADIUS,y:e+ny.RADIUS},{x:t-ny.RADIUS,y:e+ny.RADIUS}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:i}=this.state,r=(t-n)/(2*ny.RADIUS-.5),s=(e-i)/(2*ny.RADIUS-.5);return r*r+s*s<.25}outline(t){const{cx:e,cy:n}=this.state;return this.toScene(e,n)}get nature(){return ey}}ny.RADIUS=5,oc.memoize(ny.prototype,"path",!1),oc.register("node",ny);class iy extends md{getObject3dInstance(){return new w.Mesh}build(){super.build();const{width:t,height:e}=this.component.bounds,n=this.component.state.depth||.5*Math.min(t,e),i=.15*Math.min(t,e,n),r=new v.RoundedBoxGeometry(1,1,1,4,i/Math.min(t,e,n));r.scale(t,n,e),this.object3d.geometry=r,this.object3d.material=new w.MeshStandardMaterial({color:"#5090d0",transparent:!0,opacity:.35,roughness:.6,metalness:.1,side:w.FrontSide,depthWrite:!1}),this.object3d.visible=!!this.component.app?.isEditMode}updateAlpha(){const t=this.object3d.material;t&&(t.opacity=this.component.app?.isEditMode?.35:0)}updateHidden(){this.object3d.visible=!!this.component.app?.isEditMode&&!this.component.state.hidden}updateDimension(){const{width:t,height:e}=this.component.bounds,n=this.component.state.depth||.5*Math.min(t,e);this.object3d.geometry.computeBoundingBox();const i=this.object3d.geometry.boundingBox;if(i){const r=i.max.x-i.min.x,s=i.max.y-i.min.y,o=i.max.z-i.min.z;this.object3d.scale.set(t/r,n/s,e/o)}}updateFillStyle(){}updateStrokeStyle(){}updateText(){}clear(){return rd(this.object3d),super.clear()}}const ry="data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="#5090d0">\n <path d="M32 20a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm0 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12z"/>\n <path d="M55.4 27.2l-3.6-.6c-.4-1.2-.8-2.4-1.4-3.4l2.2-3c.6-.8.4-2-.2-2.6l-3-3c-.8-.6-1.8-.8-2.6-.2l-3 2.2c-1.2-.6-2.2-1-3.4-1.4l-.6-3.6c-.2-1-1-1.6-2-1.6h-4.2c-1 0-1.8.6-2 1.6l-.6 3.6c-1.2.4-2.4.8-3.4 1.4l-3-2.2c-.8-.6-2-.4-2.6.2l-3 3c-.6.8-.8 1.8-.2 2.6l2.2 3c-.6 1.2-1 2.2-1.4 3.4l-3.6.6c-1 .2-1.6 1-1.6 2v4.2c0 1 .6 1.8 1.6 2l3.6.6c.4 1.2.8 2.4 1.4 3.4l-2.2 3c-.6.8-.4 2 .2 2.6l3 3c.8.6 1.8.8 2.6.2l3-2.2c1.2.6 2.2 1 3.4 1.4l.6 3.6c.2 1 1 1.6 2 1.6h4.2c1 0 1.8-.6 2-1.6l.6-3.6c1.2-.4 2.4-.8 3.4-1.4l3 2.2c.8.6 2 .4 2.6-.2l3-3c.6-.8.8-1.8.2-2.6l-2.2-3c.6-1.2 1-2.2 1.4-3.4l3.6-.6c1-.2 1.6-1 1.6-2v-4.2c0-1-.6-1.8-1.6-2z"/>\n</svg>');class sy extends(lc(oc)){static get icon(){return sy._defaultIcon||(sy._defaultIcon=new Image,sy._defaultIcon.src=ry),sy._defaultIcon}get serviceName(){}get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new iy(this)}render(t){if(this.app?.isViewMode)return;const{left:e,top:n,width:i,height:r}=this.bounds,s=this.constructor.icon;t.beginPath(),t.globalAlpha=.6,this.drawImage(t,s,e,n,i,r),t.globalAlpha=1}added(t){super.added(t);const e=this.serviceName;e&&(this._registeredRoot=this.root,this._registeredRoot?.registerService?.(e,this))}removed(t){const e=this.serviceName;e&&this._registeredRoot&&(this._registeredRoot.unregisterService?.(e),this._registeredRoot=void 0),super.removed(t)}get controls(){return[]}}function oy(t){return class extends t{animOnValueChange(t,e=!1,n){if(t==this._lastValue)return;if(this.root?.app?.suppressAnimations)return this._lastValue=t,this._anim_alpha=0,void this.invalidate();let i;i=e?t-(Number(n)||0):t-(this._lastValue||0),this._lastValue=t,this._anim_alpha=-i,this.animate({step:t=>{this._anim_alpha=i*(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=Ss(this.getState("value"),this,void 0)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(ci(t)))}}}function ay(t){return class extends t{_convertDataFormat(t,e){let n;if("json"===e)n=JSON.parse(t);else n=t;return n}isDataSource(){return!0}}}function cy(t){var e;return(e=class extends t{is3dish(){return!0}get hasTextProperty(){return!1}get capturable(){return!1}render(t){}}).raycastTargetDefault=!1,e}const ly="$base_url",hy=[{type:"gltf-preset",label:"preset",name:"preset"},{type:"gltf-selector",label:"url",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:ly,defaultStorage:"3d-model",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0,category:"application"},observe:function(t){const e=this.parentNode?.querySelector("[name=gltfInfo]");e&&(e.src=t);const n=this.parentNode?.querySelector("[name=fillStyleTargets]");n&&(n.src=t);const i=this.parentNode?.querySelector("[name=playTargets]");i&&(i.src=t)}},{type:"gltf-info",label:"",name:"gltfInfo",readonly:!0,property:{action:(t,e)=>{t._ratioLocking=!0;try{t.set(e)}finally{t._ratioLocking=!1}}},editor:{fullwidth:!0}},{type:"gltf-fill-targets",label:"fill-targets",name:"fillStyleTargets",editor:{fullwidth:!0}},{type:"gltf-play-targets",label:"play-targets",name:"playTargets",editor:{fullwidth:!0}}];function dy(t){return class extends t{constructor(){super(...arguments),this._snapshotLoading=!1,this._ratioLocking=!1}is3dish(){return!0}get hasTextProperty(){return!1}get controls(){return[]}render(t){const{left:e,top:n,width:i,height:r}=this.bounds;t.beginPath();const s=this._topViewSnapshot;if(s)return void t.drawImage(s,e,n,i,r);this._ensureTopViewSnapshot(),t.rect(e,n,i,r),t.fillStyle="#f0f0f0",t.fill(),t.strokeStyle="#999",t.lineWidth=1,t.stroke();const o=this.getState("src"),a=o&&o.split("/").pop()?.replace(/\.[^.]+$/,"")||"GLTF",c=Math.max(10,.12*Math.min(i,r));t.fillStyle="#666",t.font=`${c}px sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillText(a,e+i/2,n+r/2,.9*i)}onchange(t,e){super.onchange?.(t,e),"src"in t&&(this._topViewSnapshot=void 0)}_ensureTopViewSnapshot(){if(this._snapshotLoading)return;const t=this.getState("src");if(!t)return;const e=xd.getTopViewCache(t);if(e)return this._topViewSnapshot=e,void this.invalidate();this._snapshotLoading=!0;const n=this.app.url(t);xd.loadGLTF(n).then(e=>{if(this._snapshotLoading=!1,this.getState("src")!==t)return;const n=xd.getTopViewCache(t);if(n)return this._topViewSnapshot=n,void this.invalidate();const i=xd.renderTopView(e.scene);xd.setTopViewCache(t,i),this._topViewSnapshot=i,this.invalidate()}).catch(()=>{this._snapshotLoading=!1})}buildRealObject(){return new xd(this)}get source(){return this.getState("src")}set source(t){this.setState("src",t)}get play(){return!1!==this.getState("play")}set play(t){this.setState("play",t)}get nodes(){return this.getState("nodes")}set nodes(t){this.setState("nodes",t)}get animations(){return this.getState("animations")}set animations(t){this.setState("animations",t)}get playTargets(){return this.getState("playTargets")}set playTargets(t){this.setState("playTargets",t)}get fillStyleTargets(){return this.getState("fillStyleTargets")}set fillStyleTargets(t){this.setState("fillStyleTargets",t)}get nodeNames(){const t=this.realObject;return t?.nodeNames??[]}get animationNames(){const t=this.realObject;return t?.animationNames??[]}set dimension(t){const{width:e=1,height:n=1,depth:i=1}=t;this.setState({width:e,height:n,depth:i}),this.realObject?.updateDimension()}_applyRatioLock(t){if(!("width"in t||"height"in t||"depth"in t))return t;const e=this.state.width||1,n=this.state.height||1,i=this.state.depth||1,r=hp([(t.width??e)/e,(t.height??n)/n,(t.depth??i)/i]);return r?{...t,width:Math.round(e*r),height:Math.round(n*r),depth:Math.round(i*r)}:t}set(t,e){if("string"==typeof t&&(t={[t]:e}),this.state?.ratioLock&&!this._ratioLocking){this._ratioLocking=!0;try{t=this._applyRatioLock(t)}finally{}}try{return super.set(t)}finally{this._ratioLocking=!1}}setState(t,e){if("string"==typeof t&&(t={[t]:e}),this.state?.ratioLock&&!this._ratioLocking){this._ratioLocking=!0;try{t=this._applyRatioLock(t)}finally{}}try{return super.setState(t)}finally{this._ratioLocking=!1}}}}function uy(t){return function(e){return Array.isArray(t)?t.forEach(t=>{oc.register(t,e)}):oc.register(t,e),e}}const py={x:0,y:0,z:0,w:1};function fy(t){const e=t/2;return{x:0,y:Math.sin(e),z:0,w:Math.cos(e)}}function gy(t,e){const n=t.rotation,i=e.rotation,r=e.position,s=n.w*r.x+n.y*r.z-n.z*r.y,o=n.w*r.y+n.z*r.x-n.x*r.z,a=n.w*r.z+n.x*r.y-n.y*r.x,c=-n.x*r.x-n.y*r.y-n.z*r.z,l=s*n.w+c*-n.x+o*-n.z-a*-n.y,h=o*n.w+c*-n.y+a*-n.x-s*-n.z,d=a*n.w+c*-n.z+s*-n.y-o*-n.x,u={x:n.w*i.x+n.x*i.w+n.y*i.z-n.z*i.y,y:n.w*i.y-n.x*i.z+n.y*i.w+n.z*i.x,z:n.w*i.z+n.x*i.y-n.y*i.x+n.z*i.w,w:n.w*i.w-n.x*i.x-n.y*i.y-n.z*i.z};return{position:{x:t.position.x+l,y:t.position.y+h,z:t.position.z+d},rotation:u}}const my={east:{axis:{x:1,y:0,z:0},yaw:0,idSuffix:"east"},west:{axis:{x:-1,y:0,z:0},yaw:Math.PI,idSuffix:"west"},south:{axis:{x:0,y:0,z:1},yaw:-Math.PI/2,idSuffix:"south"},north:{axis:{x:0,y:0,z:-1},yaw:Math.PI/2,idSuffix:"north"}};function yy(t){const{carrierWorld:e,width:n,depth:i,entryHeight:r,approachDistance:s,sides:o,toolType:a,tolerance:c,priority:l}=t,h=n/2,d=i/2;return o.map(t=>{const n=my[t],i="string"==typeof a?a:a[t]??"unknown",o={position:{x:n.axis.x*("east"===t||"west"===t?h:0),y:r,z:n.axis.z*("north"===t||"south"===t?d:0)},rotation:fy(n.yaw)},u={position:{x:o.position.x+n.axis.x*s,y:r,z:o.position.z+n.axis.z*s},rotation:fy(n.yaw)};return{id:`entry-${n.idSuffix}`,toolType:i,approach:gy(e,u),engage:gy(e,o),tolerance:c,priority:l}})}function by(t){const{carrierWorld:e,topY:n,approachDistance:i,toolType:r,tolerance:s,priority:o,id:a}=t,c={position:{x:0,y:n,z:0},rotation:{...py}};return{id:a??"top",toolType:r,approach:gy(e,{position:{x:0,y:n+i,z:0},rotation:{...py}}),engage:gy(e,c),tolerance:s,priority:o}}function _y(t,e){return t.filter(t=>t.toolType===e.toolType)}function vy(t,e){if(0===t.length)return null;const n=t.map(t=>{const n=t.approach.position.x-e.x,i=t.approach.position.y-e.y,r=t.approach.position.z-e.z;return{f:t,dist:Math.sqrt(n*n+i*i+r*r)}});return n.sort((t,e)=>{const n=t.f.priority??0,i=e.f.priority??0;return n!==i?n-i:t.dist-e.dist}),n[0].f}class xy{positionAt(t,e,n){return 0!==t?null:e.localPosition??{x:0,y:0,z:0}}capacity(t){return 1}}const wy=new xy;class My{constructor(t){this.owner=t}positionAt(t,e,n,i){if(0!==t)return null;const r=this.owner?.state?.width??0,s=this.owner?.state?.height??0,o=i?.state?.width??0,a=i?.state?.height??0;return{x:Math.max(0,(r-o)/2),y:Math.max(0,(s-a)/2),z:0}}capacity(t){return t.maxCount??1}}function Sy(t){return{id:t?.state?.id??t?.id??t?.refid,type:t?.state?.type??t?.type}}const Ay=new w.Euler,ky="_transferSlotId";function Ey(t){return class extends t{get slots(){return[]}get arrangementStrategy(){return wy}canReceive(t){const e=null!==this.findSlot(t);return zd.log({role:"target",contract:"canReceive",component:this,args:{carrier:Sy(t)},result:e}),e}findSlot(t){const e=this.slots;if(!e.length)return zd.log({role:"target",contract:"findSlot",component:this,args:{carrier:Sy(t)},result:null}),null;for(const n of e){if(n.allowedTypes?.length){const e=t?.state?.type??t?.type;if(!e||!n.allowedTypes.includes(e))continue}const e=n.maxCount??this.arrangementStrategy.capacity(n),i=this._countOccupied(n.id);if(!(i>=e))return zd.log({role:"target",contract:"findSlot",component:this,args:{carrier:Sy(t)},result:{slotId:n.id,occupied:i,max:e}}),n}return zd.log({role:"target",contract:"findSlot",component:this,args:{carrier:Sy(t)},result:null}),null}async receive(t,e={}){zd.log({role:"target",contract:"receive:enter",component:this,args:{carrier:Sy(t),options:e}});const n=this.findSlot(t);if(!n){zd.log({role:"target",contract:"receive:reject",component:this,args:{carrier:Sy(t)},result:{reason:"no-slot"}}),this.trigger("transfer-rejected",{type:"transfer-rejected",component:t,container:this,reason:"no-slot"});const e=new Error("receive rejected: no-slot");throw e.reason="no-slot",e}const i=this._countOccupied(n.id),r=this.arrangementStrategy.positionAt(i,n,i,t);zd.log({role:"target",contract:"arrangementStrategy.positionAt",component:this,args:{idx:i,slotId:n.id,occupantCount:i,carrier:Sy(t)},result:r}),t[ky]=n.id;const s=t._realObject;let o,a;s?.object3d&&(s.object3d.updateWorldMatrix(!0,!1),o=new w.Vector3,a=new w.Quaternion,s.object3d.getWorldPosition(o),s.object3d.getWorldQuaternion(a));const{animated:c=!1,duration:l,ease:h}=e;this.reparent?.(t,{animated:c,duration:l,ease:h}),!c&&t._realObject&&(t._realObject.suppressTransform=!1);{const e=this._realObject?.receivingSurfaceY??0,i={};if(r&&(i.left=r.x,i.top=r.y),0!==e)i.zPos=0;else if(n.localPosition&&Number.isFinite(n.localPosition.z)){const t=this._realObject?.geometricOffsetY??0;i.zPos=n.localPosition.z+t}const s=this.acceptanceRotation?.(t,n);zd.log({role:"target",contract:"acceptanceRotation",component:this,args:{carrier:Sy(t),slotId:n.id},result:s}),s&&(Ay.setFromQuaternion(new w.Quaternion(s.x,s.y,s.z,s.w),"XYZ"),i.rotationX=Ay.x,i.rotation=-Ay.y,i.rotationY=Ay.z);const o=this.normalizePose?.(t,n);"function"==typeof this.normalizePose&&zd.log({role:"target",contract:"normalizePose",component:this,args:{carrier:Sy(t),slotId:n.id},result:o}),o&&Object.assign(i,o),Object.keys(i).length&&(t.setState?.(i),zd.log({role:"target",contract:"receive:setState",component:this,args:{carrier:Sy(t),keys:Object.keys(i)}}))}this.trigger("transfer-received",{type:"transfer-received",component:t,container:this,slotId:n.id,preReceiveWorldPos:o,preReceiveWorldQuat:a}),zd.log({role:"target",contract:"receive:done",component:this,args:{carrier:Sy(t),slotId:n.id}})}async dispatch(t,e,n={}){const i=new jd({source:this,target:e,carrier:t,options:n,physical:async()=>{delete t[ky]}}),r=await i.execute();"rolled-back"!==r.phase?this.trigger("transfer-dispatched",{type:"transfer-dispatched",component:t,container:this,target:e}):this.trigger("transfer-rejected",{type:"transfer-rejected",component:t,container:this,reason:r.rejectReason??"rejected"})}route(t){return null}resolveRoute(t,e){}rejectRoute(t,e="rejected"){this.trigger("transfer-rejected",{type:"transfer-rejected",component:t,container:this,reason:e})}acceptanceRotation(t,e){}canAccept(t){const e=(()=>{const e=this.slots;if(!e.length)return{ok:!1,reason:"no-slots-defined"};const n=this.findSlot(t);if(!n){const n=t?.state?.type??t?.type;for(const t of e)if(!t.allowedTypes?.length||!n||t.allowedTypes.includes(n))return{ok:!1,reason:"all-slots-full"};return{ok:!1,reason:"type-not-accepted"}}return{ok:!0,slot:n}})();return zd.log({role:"target",contract:"canAccept",component:this,args:{carrier:Sy(t)},result:e.ok?{ok:!0,slotId:e.slot.id}:{ok:!1,reason:e.reason}}),e}accept(t,e){return this.receive(t,e)}deliveryWorldRotation(t){const e=this.acceptanceRotation?.(t);if(!e)return;const n=this._realObject?.object3d;if(!n)return;n.updateWorldMatrix(!0,!1);const i=new w.Quaternion;n.getWorldQuaternion(i);const r=new w.Quaternion(e.x,e.y,e.z,e.w);return i.clone().multiply(r)}deliveryWorldPosition(t){const e=this._realObject,n=e?.object3d;if(!n)return;n.updateWorldMatrix(!0,!1);const i=new w.Vector3;n.getWorldPosition(i);const r=e.receivingSurfaceY;if("number"==typeof r&&0!==r){const t=r-(e.geometricOffsetY??0),s=new w.Vector3(0,t,0);return n.localToWorld(s),{x:i.x,y:s.y,z:i.z}}return{x:i.x,y:i.y,z:i.z}}attachPointFor(t){const e=t?.[ky];if(!e)return null;const n=this.slots.find(t=>t.id===e);return n?{position:n.localPosition??{x:0,y:0,z:0},rotation:n.localRotation??{x:0,y:0,z:0},slotId:n.id}:null}_countOccupied(t){const e=this.components;return e?e.filter(e=>e.parent===this&&e[ky]===t).length:0}}}function Cy(t){if(!t||"object"!=typeof t)return!1;const e=t;return"function"==typeof e.canReserveAtJoinPoint&&"function"==typeof e.reserveAtJoinPoint&&"function"==typeof e.commitReservation&&"function"==typeof e.releaseReservation&&e.carrierMap instanceof Map}function Ty(t){if(!t||"object"!=typeof t)return!1;const e=t;return"function"==typeof e.slotAt&&"function"==typeof e.findFreeSlot&&"function"==typeof e.findSlotsWithSKU&&"function"==typeof e.reservePut&&"function"==typeof e.reservePick&&"function"==typeof e.commitReservation&&"function"==typeof e.releaseReservation&&e.slots instanceof Map}function Py(t){return`${t.level}.${t.bay}.${t.depth}`}function Dy(t){const e=t.split(".");if(3!==e.length)return null;const[n,i,r]=e.map(t=>Number.parseInt(t,10));return Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(r)?{level:n,bay:i,depth:r}:null}let Oy=1;function zy(t,e){return t.startSimMs<e.endSimMs&&e.startSimMs<t.endSimMs}const Iy={resolveConflict:(t,e)=>t.priority!==e.priority?t.priority<e.priority?"b-yields":"a-yields":t.id<e.id?"b-yields":"a-yields"};class Ry{constructor(t=Iy){this._byResource=new Map,this._byReserver=new Map,this._listeners=new Set,this._conflictLog=[],this._maxConflictLog=1e3,this._yieldPolicy=t}add(t){const e={...t,id:"res-"+Oy++},n=(this._byResource.get(e.resource)??[]).filter(t=>zy(t.timeWindow,e.timeWindow));if(0===n.length)return this._insert(e),this._emit({kind:"added",reservation:e}),{ok:!0,reservation:e};const i=n.map(t=>{const n=this._yieldPolicy.resolveConflict(e,t);return{a:e,b:t,decision:n}}),r=i.every(t=>"b-yields"===t.decision);if(r){const i=n.slice();for(const t of i)this._remove(t),this._emit({kind:"evicted",reservation:t,by:e});return this._insert(e),this._emit({kind:"added",reservation:e}),this._appendConflictLog({simTime:e.timeWindow.startSimMs,resource:e.resource,proposed:t,existing:i,outcome:"preempted"}),{ok:"preempted",reservation:e,evicted:i}}return this._appendConflictLog({simTime:e.timeWindow.startSimMs,resource:e.resource,proposed:t,existing:n.slice(),outcome:"rejected"}),{ok:!1,conflicts:i}}conflictLog(){return[...this._conflictLog]}setMaxConflictLog(t){this._maxConflictLog=Math.max(1,t)}_appendConflictLog(t){this._conflictLog.push(t),this._conflictLog.length>this._maxConflictLog&&this._conflictLog.shift()}conflicts(t,e){return(this._byResource.get(t)??[]).filter(t=>zy(t.timeWindow,e))}release(t){this._remove(t)&&this._emit({kind:"released",reservation:t})}releaseAllOf(t){const e=(this._byReserver.get(t)??[]).slice();for(const t of e)this._remove(t),this._emit({kind:"released",reservation:t});return e}forResource(t){return[...this._byResource.get(t)??[]]}forReserver(t){return[...this._byReserver.get(t)??[]]}all(){const t=[];for(const e of this._byResource.values())t.push(...e);return t}clear(){this._byResource.clear(),this._byReserver.clear(),this._conflictLog.length=0}subscribe(t){return this._listeners.add(t),()=>{this._listeners.delete(t)}}_insert(t){let e=this._byResource.get(t.resource);e||(e=[],this._byResource.set(t.resource,e));const n=e.findIndex(e=>e.timeWindow.startSimMs>t.timeWindow.startSimMs);n<0?e.push(t):e.splice(n,0,t);let i=this._byReserver.get(t.reserverId);i||(i=[],this._byReserver.set(t.reserverId,i)),i.push(t)}_remove(t){const e=this._byResource.get(t.resource);if(!e)return!1;const n=e.findIndex(e=>e.id===t.id);if(n<0)return!1;e.splice(n,1),0===e.length&&this._byResource.delete(t.resource);const i=this._byReserver.get(t.reserverId);if(i){const e=i.findIndex(e=>e.id===t.id);e>=0&&i.splice(e,1),0===i.length&&this._byReserver.delete(t.reserverId)}return!0}_emit(t){this._listeners.forEach(e=>e(t))}}const Ly=new Ry;"undefined"!=typeof globalThis&&(globalThis.__THINGS_SCENE_RESERVATION_TABLE__=Ly);class jy{constructor(){this.nodes=new Map,this.edges=new Map,this.laneEndpoints=new Map}addNode(t){this.nodes.has(t.id)||(this.nodes.set(t.id,t),this.edges.set(t.id,[]))}addEdge(t){const e=this.edges.get(t.fromNode);if(!e)throw new Error(`NavGraph.addEdge: source node not found: ${t.fromNode}`);if(!this.nodes.has(t.toNode))throw new Error(`NavGraph.addEdge: target node not found: ${t.toNode}`);e.push(t)}edgesFrom(t){return this.edges.get(t)??[]}findNearestNode(t){let e=null,n=1/0;for(const i of this.nodes.values()){const r=Fy(i.position,t);r<n&&(n=r,e=i)}return e}}function Fy(t,e){const n=t.x-e.x,i=t.y-e.y,r=t.z-e.z;return n*n+i*i+r*r}function Ny(t,e){return Math.sqrt(Fy(t,e))}function Hy(t,e,n={}){const i=new jy,r=n.defaultSpeed??100;for(const e of t){const t=e.geometry.centerPoints;if(t.length<2)continue;const n=`${e.id}:start`,s=`${e.id}:end`;i.addNode({id:n,position:t[0],type:"lane-start"}),i.addNode({id:s,position:t[t.length-1],type:"lane-end"}),i.laneEndpoints.set(e.id,{startNodeId:n,endNodeId:s});let o=0;for(let e=1;e<t.length;e++)o+=Ny(t[e-1],t[e]);const a=o/(e.speedLimit??r)*1e3;i.addEdge({fromNode:n,toNode:s,resource:e.id,distance:o,durationMs:a,forward:!0}),"twoway"===e.direction&&i.addEdge({fromNode:s,toNode:n,resource:e.id,distance:o,durationMs:a,forward:!1})}for(const t of e){if(t.lanes.length<2)continue;const e=[];for(const n of t.lanes){const r=i.laneEndpoints.get(n);if(!r)continue;const s=i.nodes.get(r.startNodeId).position,o=i.nodes.get(r.endNodeId).position;let a=0,c=0,l=0;for(const e of t.lanes){if(e===n)continue;const t=i.laneEndpoints.get(e);if(!t)continue;const r=i.nodes.get(t.startNodeId).position,h=i.nodes.get(t.endNodeId).position;a+=Math.min(Fy(s,r),Fy(s,h)),c+=Math.min(Fy(o,r),Fy(o,h)),l++}if(0===l)continue;const h=a<c?r.startNodeId:r.endNodeId;e.push({laneId:n,nodeId:h,pos:i.nodes.get(h).position})}for(let n=0;n<e.length;n++)for(let r=0;r<e.length;r++){if(n===r)continue;const s=e[n],o=e[r],a=Ny(s.pos,o.pos);i.addEdge({fromNode:s.nodeId,toNode:o.nodeId,resource:t.id,distance:a,durationMs:t.crossingTimeMs,forward:!0})}}return i}function By(t,e,n,i={}){const r=t.nodes.get(e),s=t.nodes.get(n);if(!r||!s)return null;const o=i.speed?.max??100,a=e=>{const n=function(t,e){return Math.sqrt(function(t,e){const n=t.x-e.x,i=t.y-e.y,r=t.z-e.z;return n*n+i*i+r*r}(t,e))}(t.nodes.get(e).position,s.position);return n/o*1e3},c=new Map,l=new Set,h=new Set,d={nodeId:e,gScore:0,fScore:a(e)};c.set(e,d),l.add(e);const u=i.startSimMs??0,p=i.deadlineSimMs;for(;l.size>0;){let e=null,i=null;for(const t of l){const n=c.get(t);(!i||n.fScore<i.fScore||n.fScore===i.fScore&&t<e)&&(i=n,e=t)}if(!i||!e)return null;if(e===n){const t=[];let e=i,n=0;for(;e&&e.cameFromEdge;){const i=e.cameFromEdge,r=u+(e.gScore-i.durationMs);t.unshift({resource:i.resource,timeWindow:{startSimMs:r,endSimMs:r+i.durationMs},fromPos:i.fromPos,toPos:i.toPos}),n+=i.distance,e=c.get(i.fromNodeId)}const r=i.gScore;return void 0!==p&&u+r>p?null:{segments:t,totalDurationMs:r,totalDistance:n}}l.delete(e),h.add(e);for(const n of t.edgesFrom(e)){if(h.has(n.toNode))continue;const e=i.gScore+n.durationMs,r=c.get(n.toNode);if(!r||e<r.gScore){const i=t.nodes.get(n.fromNode),r=t.nodes.get(n.toNode),s={nodeId:n.toNode,gScore:e,fScore:e+a(n.toNode),cameFromEdge:{fromNodeId:n.fromNode,resource:n.resource,distance:n.distance,durationMs:n.durationMs,fromPos:i.position,toPos:r.position}};c.set(n.toNode,s),l.add(n.toNode)}}}return null}function Yy(t,e,n=0,i){return t.segments.map(t=>({resource:t.resource,timeWindow:t.timeWindow,reserverId:e,priority:n,metadata:i}))}const Gy={closed:!0,round:0,divisions:24};class Vy{constructor(t,e){this.points=t,this.closed=e;const n=[0];for(let e=1;e<t.length;e++){const i=t[e].x-t[e-1].x,r=t[e].y-t[e-1].y;n.push(n[e-1]+Math.sqrt(i*i+r*r))}this.cumulative=n,this.length=n[n.length-1]??0}sample(t){const e=this.length;if(0===this.points.length)return{x:0,y:0,theta:0};if(0===e)return{x:this.points[0].x,y:this.points[0].y,theta:0};let n=t;this.closed?n=(t%e+e)%e:n<0?n=0:n>e&&(n=e);const i=this.cumulative;let r=0,s=i.length-2;for(;r<s;){const t=r+s>>1;i[t+1]<=n?r=t+1:s=t}const o=i[r+1]-i[r],a=o>0?(n-i[r])/o:0,c=this.points[r],l=this.points[r+1],h=l.x-c.x,d=l.y-c.y;return{x:c.x+h*a,y:c.y+d*a,theta:0===h&&0===d?0:Math.atan2(d,h)}}}function Uy(t,e={}){const n={...Gy,...e},i=t.length;if(0===i)return new Vy([],n.closed);if(1===i)return new Vy([{x:t[0].x,y:t[0].y}],n.closed);const r=[],s=(t,e)=>{if(r.length>0){const n=r[r.length-1];if(Math.abs(n.x-t)<1e-9&&Math.abs(n.y-e)<1e-9)return}r.push({x:t,y:e})},o=(n.closed,i);for(let e=0;e<o;e++){const r=0===e?n.closed?i-1:-1:e-1,o=e===i-1?n.closed?0:-1:e+1,a=r>=0?t[r]:null,c=t[e],l=o>=0?t[o]:null;if(a&&a.x===c.x&&a.y===c.y)continue;const h=a&&l?Os(c,n.round):0;let d,u,p,f;if(a){const t=Math.sqrt((a.x-c.x)**2+(a.y-c.y)**2),e=0!==t?Math.atan2(a.x-c.x,a.y-c.y):0,n=Math.min(h,t/2);d=Math.sin(e)*n+c.x,u=Math.cos(e)*n+c.y}else d=c.x,u=c.y;if(l){const t=Math.sqrt((l.x-c.x)**2+(l.y-c.y)**2),e=0!==t?Math.atan2(l.x-c.x,l.y-c.y):0,n=Math.min(h,t/2);p=Math.sin(e)*n+c.x,f=Math.cos(e)*n+c.y}else p=c.x,f=c.y;if(s(d,u),h>0&&a&&l)for(let t=1;t<=n.divisions;t++){const e=t/n.divisions,i=1-e;s(i*i*d+2*i*e*c.x+e*e*p,i*i*u+2*i*e*c.y+e*e*f)}else d===p&&u===f||s(p,f);if(l&&Cs(c)){const t=Os(l,n.round),e=Math.sqrt((c.x-l.x)**2+(c.y-l.y)**2),i=0!==e?Math.atan2(c.x-l.x,c.y-l.y):0,r=Math.min(t,e/2),o=Ts({x:p,y:f},{x:Math.sin(i)*r+l.x,y:Math.cos(i)*r+l.y},c.bulge);if(o){let t=o.endAngle-o.startAngle;if(o.clockwise)for(;t>0;)t-=2*Math.PI;else for(;t<0;)t+=2*Math.PI;for(let e=1;e<=n.divisions;e++){const i=e/n.divisions,r=o.startAngle+t*i;s(o.cx+o.radius*Math.cos(r),o.cy+o.radius*Math.sin(r))}}}}if(n.closed&&r.length>0){const t=r[0],e=r[r.length-1];(Math.abs(e.x-t.x)>1e-9||Math.abs(e.y-t.y)>1e-9)&&r.push({x:t.x,y:t.y})}return new Vy(r,n.closed)}function $y(t,e){return Uy(t,e).length}const Wy=new w.Vector3,Xy=new w.Quaternion,qy=new w.Matrix4,Ky=new w.Vector3;class Qy{constructor(t,e){t instanceof w.Vector3?this.position=t.clone():this.position=t?new w.Vector3(t.x,t.y,t.z):new w.Vector3,e instanceof w.Quaternion?this.rotation=e.clone():this.rotation=e?new w.Quaternion(e.x,e.y,e.z,e.w):new w.Quaternion}compose(t){const e=Wy.copy(t.position).applyQuaternion(this.rotation).add(this.position),n=Xy.copy(this.rotation).multiply(t.rotation);return new Qy(e,n)}inverse(){const t=Xy.copy(this.rotation).invert(),e=Wy.copy(this.position).applyQuaternion(t).negate();return new Qy(e,t)}transformPoint(t){return t.clone().applyQuaternion(this.rotation).add(this.position)}transformPose(t){return this.compose(t)}toMatrix4(t){const e=t??new w.Matrix4;return e.compose(this.position,this.rotation,Ky.set(1,1,1)),e}static fromMatrix4(t){const e=new w.Vector3,n=new w.Quaternion,i=new w.Vector3;return t.decompose(e,n,i),new Qy(e,n)}static fromObject3D(t,e=!1){if(e){const e=new w.Vector3,n=new w.Quaternion,i=new w.Vector3;return qy.copy(t.matrixWorld).decompose(e,n,i),new Qy(e,n)}return new Qy(t.position,t.quaternion)}applyToObject3D(t){t.position.copy(this.position),t.quaternion.copy(this.rotation)}static identity(){return new Qy}equals(t,e=1e-9){if(Math.abs(this.position.x-t.position.x)>e)return!1;if(Math.abs(this.position.y-t.position.y)>e)return!1;if(Math.abs(this.position.z-t.position.z)>e)return!1;const n=this.rotation.x*t.rotation.x+this.rotation.y*t.rotation.y+this.rotation.z*t.rotation.z+this.rotation.w*t.rotation.w;return 1-Math.abs(n)<e}clone(){return new Qy(this.position,this.rotation)}toJSON(){return{position:{x:this.position.x,y:this.position.y,z:this.position.z},rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z,w:this.rotation.w}}}static fromJSON(t){return new Qy(t.position,t.rotation)}}const Zy=new w.Euler,Jy=new w.Vector3,tb=new w.Quaternion,eb=new w.Vector3;function nb(t){const e=t._realObject;if(e?.position&&e?.rotation){const t=e.position,n=e.rotation,i=(new w.Quaternion).setFromEuler(Zy.set(n.x,n.y,n.z,"XYZ"));return new Qy(new w.Vector3(t.x,t.y,t.z),i)}const n=t.center??{x:0,y:0},i=t.parent?.bounds??{width:0,height:0},r=("function"==typeof t.delta?t.delta():null)??{tx:0,ty:0},s=t.state??{},o=(n.x??0)+(r.tx??0)-(i.width??0)/2,a=(n.y??0)+(r.ty??0)-(i.height??0)/2,c=s.rotation??0,l=s.rotationX??0,h=s.rotationY??0,d=(new w.Quaternion).setFromEuler(Zy.set(l,-c,h,"XYZ"));return new Qy(new w.Vector3(o,0,a),d)}function ib(t){const e=t._realObject?.object3d;if(e)return e.updateWorldMatrix(!0,!1),e.matrixWorld.decompose(Jy,tb,eb),new Qy(Jy,tb);let n=nb(t),i=t.parent;for(;i&&!i.isRootModel?.();)n=nb(i).compose(n),i=i.parent;return n}function rb(t,e){const n=t.parent?.bounds??{width:0,height:0},i=("function"==typeof t.delta?t.delta():null)??{tx:0,ty:0,tz:0},r=t._realObject,s=e.position.x-(i.tx??0)+(n.width??0)/2,o=e.position.z-(i.ty??0)+(n.height??0)/2,a=t.bounds??{width:0,height:0},c={left:s-a.width/2,top:o-a.height/2};if(r){const n=r.syncZPosOffset??0,s=t.parent?._realObject,o=s?.geometricOffsetY??0,a=s?.receivingSurfaceY??0;c.zPos=e.position.y-(i.tz??0)-n+o-a}Zy.setFromQuaternion(e.rotation,"XYZ"),c.rotationX=Zy.x,c.rotation=-Zy.y,c.rotationY=Zy.z,"function"==typeof t.setState?t.setState(c):"function"==typeof t.set&&t.set(c)}function sb(t,e){const n=t.parent;if(!n||n.isRootModel?.())return void rb(t,e);rb(t,ib(n).inverse().compose(e))}function ob(t){return t?/forklift|agv|amr|oht|tugger|worker/i.test(t)?"mobile":/conveyor|sorter|induct|chute|belt/i.test(t)?"flow":/rack|shelf|stocker|cell/i.test(t)?"cell":/pallet|box|parcel|crate|drum|tray/i.test(t)?"atomic":/robot[-_]?arm|crane|lift/i.test(t)?"articulated":/spawn[-_]?point|sink[-_]?point/i.test(t)?"boundary":"":""}function ab(t){const e=[];let n=t.parent;for(;n&&!n.isRootModel?.();){const t=n.state?.id??n.constructor?.name;t&&e.unshift(t),n=n.parent}return e.join(" › ")}function cb(t,e=!0){const n=t.constructor?.name??t.state?.type??"Component",i={type:n,id:t.state?.id??`?${t._id??Math.random().toString(36).slice(2,7)}`,category:ob(n),parentId:t.parent?.state?.id,parentPath:ab(t)},r=t._realObject?.object3d;if(r){r.updateWorldMatrix?.(!0,!1);const t=r.matrixWorld?.elements;t&&(i.pose={position:{x:t[12],y:t[13],z:t[14]},rotation:{x:0,y:0,z:0,w:1}})}if(!0===t.isCarriable&&(i.isCarriable=!0),!0===t.isMover&&(i.isMover=!0),"function"!=typeof t.canReceive&&"function"!=typeof t.canAccept||(i.isHolder=!0),"function"==typeof t.pickupFrames)try{i.isPickable=t.pickupFrames().length>0}catch{i.isPickable=!1}if("string"==typeof t.toolType||"function"==typeof t.toolType?i.toolType="function"==typeof t.toolType?t.toolType():t.toolType:void 0!==t.toolType&&(i.toolType=String(t.toolType)),t.state&&"object"==typeof t.state){const e={};for(const[n,i]of Object.entries(t.state))"string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i&&null!==i||(e[n]=i);i.state=e}if(e){const e=t.components??[];i.childIds=e.map(t=>t.state?.id).filter(Boolean)}return i}function lb(t){function e(t,n){if(!t)return;n.push(cb(t));const i=t.components??[];for(const t of i)e(t,n)}function n(t,e){if(!e)return null;if(e.state?.id===t)return e;const i=e.components??[];for(const e of i){const i=n(t,e);if(i)return i}return null}return{version:"0.1.0",collectComponents(){const n=[];return e(t?.rootModel??t,n),n},getComponent(e){const i=n(e,t?.rootModel??t);if(!i)return null;const r={...cb(i)};if("function"==typeof i.pickupFrames)try{r.pickupFrames=i.pickupFrames()}catch{}if("object"==typeof i.slots)try{r.slots=Array.isArray(i.slots)?i.slots:"function"==typeof i.slots?i.slots():[]}catch{}if("function"==typeof i.acceptanceRotation)try{r.acceptanceWorldQuat=i.deliveryWorldRotation?.(null)??void 0}catch{}if("function"==typeof i.deliveryWorldPosition)try{r.deliveryWorldPosition=i.deliveryWorldPosition(null)}catch{}return r},simStatus(){let e=0;const n=[t?.rootModel??t];for(;n.length>0;){const t=n.pop();if(!t)continue;!0===t.isCarriable&&e++;const i=t.components??[];for(const t of i)n.push(t)}return{simTime:us.now,realTime:"undefined"!=typeof performance?performance.now():Date.now(),speed:us.speed,paused:us.isPaused,carrierCount:e}},transferLog:()=>({entries:Fd.toJSON(),stats:Fd.stats()}),reservations(){const t=[...Ly.all()],e={},n={};for(const i of t)(e[i.resource]??=[]).push(i),(n[i.reserverId]??=[]).push(i);for(const t of Object.values(e))t.sort((t,e)=>t.timeWindow.startSimMs-e.timeWindow.startSimMs);for(const t of Object.values(n))t.sort((t,e)=>t.timeWindow.startSimMs-e.timeWindow.startSimMs);return{simTime:us.now,all:t,byResource:e,byReserver:n}},conflicts(){const t=Ly.conflictLog(),e={},n={};let i=0,r=0;for(const s of t)e[s.resource]=(e[s.resource]??0)+1,n[s.proposed.reserverId]=(n[s.proposed.reserverId]??0)+1,"rejected"===s.outcome?i++:r++;return{simTime:us.now,log:[...t],total:t.length,rejected:i,preempted:r,byResource:e,byReserver:n}}}}function hb(t){const e=lb(t);return"undefined"!=typeof window&&(window.__SCENE_INSPECTOR__=e),e}let db=0;const ub=new FinalizationRegistry(()=>{db--});class pb{static get residents(){return db}static get residentsCount(){return db}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,db++,ub.register(this,db)}dispose(){if(this.disposer)for(const t in this.references)this.disposer(t,this.references[t]);this.references={},this.counters={}}get ids(){return Object.keys(this.references)}create(t){return new Promise((e,n)=>{this.creator?this.creator(t,n=>{n.release=()=>{this.disposer?.(t,n),delete n.release,Hi("RELEASED",t)},e(n)},n):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))})}add(t,e){const n=new Promise((n,i)=>{const r=this.references[t];if(r)r===e?i(Error("Reference ID and target duplicate")):e?i(Error("Reference ID duplicate")):n(r);else{const r=e=>{e.release=()=>{this.release(e)},this.references[t]=e,this.counters[t]=1,n(e)};if(e)r(e);else{if(!this.creator)return void i(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));this.creator(t,r,i)}}});return this.references[t]||(this.references[t]=n),n}async get(t,e=!1){let n=this.references[t];if(n){if(!(n instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,n}if(e)return n=await n,this.counters[t]++,n}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(const e in this.references){if(this.references[e]===t)return e}}release(t){const e=this._id(t);if(!e)return void Fi("No Referenced ID");const n=this.references[e];n&&(this.counters[e]--,0==this.counters[e]&&(this.disposer?.(e,n),delete this.references[e],delete this.counters[e],delete t.release,Hi("RELEASED",e)))}}const fb={},gb={};let mb=[];function yb(t){const e=t.target,n="SCRIPT"===e.tagName?fb:gb,i=e.src||e.href;n[i]=!0,mb.forEach((t,e)=>{if(!t)return;const{resolve:r,scripts:s,styles:o}=t;if(n===fb){const t=s.indexOf(i);t>-1&&t<s.length-1&&_b(s[t+1])}s.some(t=>!fb[t])||o?.some(t=>!gb[t])||(r(),mb[e]=null)}),mb=mb.filter(Boolean)}function bb(t){if("string"==typeof t)return;const e=t.target,n=e.src,i="SCRIPT"===e.tagName?fb:gb;mb.forEach((e,r)=>{if(!e)return;const{reject:s,scripts:o,styles:a}=e;(i===fb&&o.includes(n)||i===gb&&!!a?.includes(n))&&(s(t),mb[r]=null)}),mb=mb.filter(Boolean),delete i[n],document.head.removeChild(e)}function _b(t){fb[t]=!1;const e=document.createElement("script");e.onload=yb,e.onerror=bb,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class vb{static load(t,e){const n="string"==typeof t?[t]:t,i="string"==typeof e?[e]:e;return new Promise(function(t,e){if(n&&!Array.isArray(n)||i&&!Array.isArray(i))return void e(new Error("invalid sources for load"));let r,s=!0;if(i?.forEach(t=>{t in gb||function(t){gb[t]=!1;const e=document.createElement("link");e.onload=yb,e.onerror=bb,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),gb[t]||(s=!1)}),n&&n.length>0)for(const t of n)t in fb?fb[t]||(s=!1):r??=t;if(r)_b(r);else if(s)return void t();mb.push({resolve:t,reject:e,scripts:n,styles:i})})}}const xb="0.0.0";function wb(t){if(!(t>0))return 1;let e=0;if(!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function Mb(t){const{lineWidth:e=0}=t.state;let{width:n,height:i}=t.bounds;n+=e,i+=e;const r=wb(2*n),s=wb(2*i),o=Du(r,s),a=new w.CanvasTexture(o);return Sb(o,t,2),a.needsUpdate=!0,a.wrapS=w.RepeatWrapping,a.wrapT=w.RepeatWrapping,a.offset.set(0,1-2*i/s),a.repeat.set(2*n/r,2*i/s),a.magFilter=w.NearestFilter,a.minFilter=w.LinearFilter,a.colorSpace=w.SRGBColorSpace,a}function Sb(t,e,n){const{lineWidth:i=0}=e.state;let{left:r,top:s}=e.bounds;r-=i/2,s-=i/2;const o=t.getContext("2d");o.scale(n,n),o.translate(-r,-s),e.render(o),e.postrender(o)}function Ab(t,e,n=2){const i=t.getContext("2d");i&&(i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,t.width,t.height),Sb(t,e,n))}const kb=new Set(["cx","cy","cz","zPos","left","top","width","height","depth","lineWidth","rotationX","rotationY","rotation","scale","hidden","alpha","material3d","screenFixed"]);class Eb extends md{get syncZPosOffset(){return this.effectiveDepth}get geometricOffsetY(){return this.effectiveDepth}constructor(t){super(t),this._origInvalidate=t.invalidate.bind(t),t.invalidate=()=>{this._origInvalidate(),this._refreshTextureNow()}}getObject3dInstance(){return new w.Mesh}build(){super.build();const{width:t,height:e}=this.component.bounds;if(!t||!e)return;const n=Hh(this.component.state.material3d),i=new w.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const r=Mb(this.component),s=new w.MeshStandardMaterial({map:r});Gh(s,n),s.transparent=!0,this.object3d.material=s,this.object3d.castShadow=n.castShadow,this.object3d.receiveShadow=n.receiveShadow}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Kh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}_debouncedRebuild(){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=void 0,this._rebuildTexture()},100)}_rebuildTexture(){this.clear(),this.build(),this.updateTransform(),this.updateDimension(),this.updateHidden()}_refreshTextureNow(){const t=this.object3d.material,e=t?.map;if(!e)return;const n=e.source?.data;n&&(Ab(n,this.component,2),e.needsUpdate=!0)}updateFillStyle(){this._debouncedRebuild()}updateStrokeStyle(){this._debouncedRebuild()}updateText(){this._debouncedRebuild()}onchange(t,e){super.onchange(t,e);for(const e of Object.keys(t))if(!kb.has(e)){this._debouncedRebuild();break}}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=Hh(this.component.state.material3d);Gh(t,e),t.transparent=!0,this.object3d.castShadow=e.castShadow,this.object3d.receiveShadow=e.receiveShadow}clear(){return this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),rd(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),this._origInvalidate&&(this.component.invalidate=this._origInvalidate,this._origInvalidate=void 0),super.dispose()}}class Cb extends md{getObject3dInstance(){return new w.Mesh}build(){super.build(),this.buildGeometry(),this.buildMaterial()}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Kh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=md.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(Qh(t)):e.opacity=0)}updateStrokeStyle(){const t=this.object3d.getObjectByName("__edgeLines__");t&&(this.object3d.remove(t),rd(t));const{strokeStyle:e}=this.component.state;if(!e||"transparent"===e||"none"===e)return;const n=this.object3d.geometry;if(!n?.getAttribute("position"))return;const i=new w.EdgesGeometry(n),r=new w.LineBasicMaterial({color:e}),s=new w.LineSegments(i,r);s.name="__edgeLines__",this.object3d.add(s)}updateDimension(){const{width:t,height:e}=this.component.bounds,{depth:n=1}=this.component.state;if(!this.object3d)return;this.object3d.geometry.computeBoundingBox();const i=this.object3d.geometry.boundingBox;if(i){const r=i.max.x-i.min.x,s=i.max.y-i.min.y,o=i.max.z-i.min.z;this.object3d.scale.set(t/r,n/s,e/o)}}buildMaterial(){const t=Hh(this.component.state.material3d),e=new w.MeshStandardMaterial({transparent:!0});Gh(e,t),this.object3d.material=e}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;t&&Gh(t,Hh(this.component.state.material3d))}clear(){return rd(this.object3d),super.clear()}}function Tb(t,e,n,i){return[["bold",t],["italic",e],[n+"px",!0],[i,!0]].filter(t=>t[1]).map(t=>t[0]).join(" ")}function Pb(t){let e=0;if(!((t=Math.abs(t)||1)&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function Db(t,e,n){const{bold:i=!1,italic:r=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",textAlign:c="center",textBaseline:l="middle",width:h=t.width,height:d=t.height,offsetX:u=0,offsetY:p=0}=n||{},f=t.getContext("2d");let g,m;f.imageSmoothingEnabled=!1,f.fillStyle=a,f.strokeStyle=a,f.font=Tb(i,r,o,s),"left"===c||"start"===c?(f.textAlign="left",g=u):"right"===c||"end"===c?(f.textAlign="right",g=u+h):(f.textAlign="center",g=u+h/2);const y=1.2*o,b=String(e).split("\n"),_=y*b.length;m="top"===l||"hanging"===l?p+.1*o:"bottom"===l||"alphabetic"===l?p+d-_+.1*o:p+(d-_)/2+.1*o,f.textBaseline="top";for(const t of b)f.fillText(t,g,m),m+=y}function Ob(t,e,n,i){const r=Pb(2*e),s=Pb(2*n),o=Du(r,s),a=o.getContext("2d"),{fillStyle:c}=i||{};if(c&&"object"==typeof c&&c.colorStops?.length){const t=sd(c,2*e,2*n);t&&a.drawImage(t,0,0)}a.scale(2,2),"string"==typeof c&&""!==c&&"transparent"!==c&&(a.fillStyle=c,a.fillRect(0,0,e,n)),Db(o,t,i);const l=new w.CanvasTexture(o);return l.needsUpdate=!0,l.wrapS=w.RepeatWrapping,l.wrapT=w.RepeatWrapping,l.offset.set(0,1-2*n/s),l.repeat.set(2*e/r,2*n/s),l.minFilter=w.LinearFilter,l.colorSpace=w.SRGBColorSpace,l}function zb(t,e,n,i,r,s,o){const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const t=2*n,c=2*i,l=Pb(t),h=Pb(c),d=Du(l,h),u=d.getContext("2d");if(s.color&&(u.fillStyle=s.color,u.fillRect(0,0,t,c)),s.fitPattern)u.drawImage(a,0,0,t,c);else{const e=2*(s.width||a.naturalWidth),n=2*(s.height||a.naturalHeight),i=2*(s.offsetX||0),r=2*(s.offsetY||0);let o=0,l=0;switch(s.align){case"center":o=(t-e)/2,l=(c-n)/2;break;case"left-top":break;case"left-bottom":l=c-n;break;case"right-top":o=t-e;break;case"right-bottom":o=t-e,l=c-n;break;case"left":l=(c-n)/2;break;case"right":o=t-e,l=(c-n)/2;break;case"top":o=(t-e)/2;break;case"bottom":o=(t-e)/2,l=c-n}const h=i+o,d=r+l;if(s.noRepeat)u.drawImage(a,0,0,a.naturalWidth,a.naturalHeight,h,d,e,n);else{u.save(),u.rect(0,0,t,c),u.clip();const i=h>0?h-Math.ceil(h/e)*e:h;for(let r=d>0?d-Math.ceil(d/n)*n:d;r<c;r+=n)for(let s=i;s<t;s+=e)u.drawImage(a,0,0,a.naturalWidth,a.naturalHeight,s,r,e,n);u.restore()}}e&&(u.scale(2,2),Db(d,e,r));const p=new w.CanvasTexture(d);p.needsUpdate=!0,p.wrapS=w.RepeatWrapping,p.wrapT=w.RepeatWrapping,p.offset.set(0,1-c/h),p.repeat.set(t/l,c/h),p.minFilter=w.LinearFilter,p.colorSpace=w.SRGBColorSpace,o(p)},a.onerror=()=>{const t=Ob(e,n,i,r);o(t)},a.src=t}function Ib(t,e){let{bold:n=!1,italic:i=!1,fontFamily:r="Serif",fontSize:s=10,lineHeight:o="normal"}=e||{};t=void 0===t||""==t?" ":String(t);const a=document.createElement("span");a.style.font=Tb(n,i,s,r),a.style.lineHeight=String(o),a.style.whiteSpace="pre",a.style.position="absolute",a.textContent=t,document.body.appendChild(a);const c=a.getBoundingClientRect();return document.body.removeChild(a),{width:c.width,height:c.height}}class Rb extends Cb{get zPriority(){return hd.DECAL}get syncZPosOffset(){return this.effectiveDepth}get geometricOffsetY(){return this.effectiveDepth}buildGeometry(){this.updateDimension()}updateStrokeStyle(){}updateFillStyle(){this.updateText()}updateDimension(){const{width:t,height:e}=this.component.state,n=Math.abs(t)||1,i=Math.abs(e)||1;this.object3d.geometry&&this.object3d.geometry.dispose();const r=new w.PlaneGeometry(n,i);r.rotateX(-Math.PI/2),this.object3d.geometry=r}updateText(){const t=this.object3d.material;if(!t)return;const{width:e,height:n,bold:i=!1,italic:r=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",textAlign:c="center",textBaseline:l="middle",fillStyle:h}=this.component.state,d=Math.abs(e)||1,u=Math.abs(n)||1,p=this.component.text,f=h&&"none"!==h?h:"transparent",g={bold:i,italic:r,fontFamily:s,fontSize:o,fontColor:a,textAlign:c,textBaseline:l,width:d,height:u,fillStyle:f};if("object"==typeof f&&"pattern"===f?.type&&f.image){return void zb(this.component.app.url(h.image),p,d,u,g,h,e=>{t.map&&t.map.dispose(),t.map=e,t.color.set(16777215),t.needsUpdate=!0})}const m=Ob(p,d,u,g);m?(t.map&&t.map.dispose(),t.map=m,t.color.set(16777215),m.needsUpdate=!0):"string"==typeof h&&(""!==h&&"transparent"!==h?t.color.set(Qh(h)):t.opacity=0)}updateAlpha(){const{alpha:t=1}=this.component.state,e=this.object3d.material;e.opacity=t,e.transparent=!0}}Bu("text",t=>new Rb(t));const Lb={input:"css3d",select:"css3d",textarea:"css3d",button:"css3d",iframe:"css3d",video:"css3d",label:"texture",table:"texture",progress:"texture"};function jb(t){const e=t.model?.type??"";return"texture"===(Lb[e]??"css3d")?new Eb(t):new Fu(t)}Bu("html-overlay-element",jb),Bu("html-overlay-container",jb);class Fb{setShape({extrudedShape:t,extrudedOptions:e}){this.extrudedShape=t,this.bb=new w.Box2,this.bb.setFromPoints(this.extrudedShape?.extractPoints(0).shape),this.extrudedOptions=e}generateTopUV(t,e,n,i,r){const s=e[3*n],o=e[3*n+1],a=e[3*i],c=e[3*i+1],l=e[3*r],h=e[3*r+1],d=this.bb,u=d.max.x-d.min.x,p=d.max.y-d.min.y;return[new w.Vector2((s-d.min.x)/u,1-(o-d.min.y)/p),new w.Vector2((a-d.min.x)/u,1-(c-d.min.y)/p),new w.Vector2((l-d.min.x)/u,1-(h-d.min.y)/p)]}generateSideWallUV(t,e,n,i,r,s){const o=e[3*n],a=e[3*n+1],c=e[3*n+2],l=e[3*i],h=e[3*i+1],d=e[3*i+2],u=e[3*r],p=e[3*r+1],f=e[3*r+2],g=e[3*s],m=e[3*s+1],y=e[3*s+2],b=this.extrudedOptions?.depth||100,_=this.bb,v=_.max.x-_.min.x,x=_.max.y-_.min.y;return Math.abs(a-h)<.01?[new w.Vector2(o/v,1-c/b),new w.Vector2(l/v,1-d/b),new w.Vector2(u/v,1-f/b),new w.Vector2(g/v,1-y/b)]:[new w.Vector2(a/x,1-c/b),new w.Vector2(h/x,1-d/b),new w.Vector2(p/x,1-f/b),new w.Vector2(m/x,1-y/b)]}}class Nb extends md{clear(){return this._mesh=void 0,super.clear()}get shape(){return null}get boundUVGenerator(){return this._boundUVGenerator||(this._boundUVGenerator=new Fb),this._boundUVGenerator}build(){super.build();const t=this.effectiveDepth,e=this.shape;if(!e)return;const n=this.boundUVGenerator;n&&n.setShape({extrudedShape:e,extrudedOptions:{depth:t}});const i=this.createGeometry(e),r=this.createMaterials();this._mesh=new w.Mesh(i,r),this._mesh.rotation.x=-Math.PI/2,this._mesh.rotation.y=-Math.PI,this._mesh.rotation.z=-Math.PI,this._mesh.castShadow=!0,this.object3d.add(this._mesh),this.updateFillStyle(),this.updateStrokeStyle()}createGeometry(t){const e=this.effectiveDepth,{lineWidth:n=0}=this.component.state,i={steps:1,depth:e,bevelEnabled:n>0,bevelThickness:0,bevelSize:n,bevelSegments:1,UVGenerator:this.boundUVGenerator},r=new w.ExtrudeGeometry(t,i);return r.center(),r}createMaterials(){const t=Hh(this.component.state.material3d),e=new w.MeshStandardMaterial;Gh(e,t);const n=new w.MeshStandardMaterial;return Gh(n,t),[e,n]}createTexture(){const{width:t,height:e}=this.component.bounds,n=Pb(t),i=Pb(e),r=Du(n,i);this.component.render(r.getContext("2d"));const s=new w.CanvasTexture(r);return s.needsUpdate=!0,s.wrapS=w.RepeatWrapping,s.wrapT=w.RepeatWrapping,s.offset.set(0,1-e/i),s.repeat.set(t/n,e/i),s.minFilter=w.LinearFilter,s}getMaterials(){if(!this._mesh)return;const t=this._mesh.material;return Array.isArray(t)?t:void 0}updateMaterial3d(){super.updateMaterial3d();const t=this.getMaterials();if(!t)return;const e=Hh(this.component.state.material3d);for(const n of t)Gh(n,e)}updateAlpha(){const{alpha:t=1,fillStyle:e,strokeStyle:n}=this.component.state,i=this.getMaterials();i&&(Kh(i[0],t,e),Kh(i[1],t,n))}updateStrokeStyle(){const t=this.getMaterials();if(!t)return;const{strokeStyle:e}=this.component.state;t[1].color.set(Qh(e))}updateFillStyle(){this._applyCapTexture()}updateText(){this._applyCapTexture()}_applyCapTexture(){const t=this.getMaterials();if(!t)return;const e=t[0],{fillStyle:n}=this.component.state,i=this.component.hasTextProperty?this.component.text:"";if(!i){const t=md.buildFillStyleTexture(this.component);return t?(e.map&&e.map.dispose(),e.map=t,e.color.set(16777215)):(e.map&&(e.map.dispose(),e.map=null),e.color.set(Qh(n))),void(e.needsUpdate=!0)}const{bold:r=!1,italic:s=!1,fontFamily:o="Serif",fontSize:a=10,fontColor:c="black",textAlign:l="center",textBaseline:h="middle",paddingTop:d=0,paddingLeft:u=0,paddingRight:p=0,paddingBottom:f=0}=this.component.state,{width:g,height:m}=this.component.bounds,y=Math.abs(g)||1,b=Math.abs(m)||1,_={bold:r,italic:s,fontFamily:o,fontSize:a,fontColor:c,textAlign:l,textBaseline:h,width:Math.max(y-u-p,0),height:Math.max(b-d-f,0),fillStyle:n,offsetX:u,offsetY:d};if("object"==typeof n&&"pattern"===n?.type&&n.image){return void zb(this.component.app.url(n.image),i,y,b,_,n,t=>{e.map&&e.map.dispose(),e.map=t,e.color.set(16777215),e.needsUpdate=!0})}e.map&&e.map.dispose();const v=Ob(i,y,b,_);e.map=v,e.color.set(16777215),e.needsUpdate=!0}updateDimension(){super.updateDimension()}onchange(t,e){if("path"in t&&this._mesh){const t=this._mesh.geometry,e=this.shape;if(e){const n=this.createGeometry(e);this._mesh.geometry=n,t.dispose()}}super.onchange(t,e)}}class Hb extends Nb{get shape(){const{cx:t=0,cy:e=0,rx:n=1,ry:i=1,startAngle:r=0,endAngle:s=2*Math.PI,anticlockwise:o=!1}=this.component.state,a=new w.EllipseCurve(t,e,Math.abs(n),Math.abs(i),r,s,o,0);return new w.Shape(a.getPoints(50))}}Bu("ellipse",t=>new Hb(t));class Bb extends Nb{get shape(){const{width:t,height:e,round:n=0}=this.component.state,i=cc(n,t,e);if(i>0){const n=i,r=new w.Path;return r.moveTo(n,0),r.lineTo(t-n,0),r.quadraticCurveTo(t,0,t,n),r.lineTo(t,e-n),r.quadraticCurveTo(t,e,t-n,e),r.lineTo(n,e),r.quadraticCurveTo(0,e,0,e-n),r.lineTo(0,n),r.quadraticCurveTo(0,0,n,0),new w.Shape(r.getPoints(12))}const r=new w.Shape;return r.moveTo(0,0),r.lineTo(t,0),r.lineTo(t,e),r.lineTo(0,e),r.lineTo(0,0),r}}function Yb(t,e={}){const n=e.round??0,i=e.divisions??24;if(!t||0===t.length)return new w.Shape;const r=t.some(t=>Cs(t)),s=n>0||t.some(t=>Os(t,0)>0);if(r||s){const e=new w.Path;for(let i=0;i<t.length;i++){const r=t[(i-1+t.length)%t.length],s=t[i],o=t[(i+1)%t.length];if(r.x===s.x&&r.y===s.y)continue;const a=Os(s,n);let c=Math.sqrt((r.x-s.x)**2+(r.y-s.y)**2),l=0!==c?Math.atan2(r.x-s.x,r.y-s.y):0;const h=Math.sin(l)*Math.min(a,c/2)+s.x,d=Math.cos(l)*Math.min(a,c/2)+s.y;c=Math.sqrt((o.x-s.x)**2+(o.y-s.y)**2),l=0!==c?Math.atan2(o.x-s.x,o.y-s.y):0;const u=Math.sin(l)*Math.min(a,c/2)+s.x,p=Math.cos(l)*Math.min(a,c/2)+s.y;if(0===i?e.moveTo(h,d):e.lineTo(h,d),a>0&&e.quadraticCurveTo(s.x,s.y,u,p),Cs(s)){const t=Os(o,n),i=Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2),r=0!==i?Math.atan2(s.x-o.x,s.y-o.y):0,a=Ts({x:u,y:p},{x:Math.sin(r)*Math.min(t,i/2)+o.x,y:Math.cos(r)*Math.min(t,i/2)+o.y},s.bulge);a&&e.absarc(a.cx,a.cy,a.radius,a.startAngle,a.endAngle,a.clockwise)}}return new w.Shape(e.getPoints(i))}const o=new w.Shape;for(let e=0;e<t.length;e++)0===e?o.moveTo(t[e].x,t[e].y):o.lineTo(t[e].x,t[e].y);return o}Bu("rect",t=>new Bb(t));class Gb extends Nb{get shape(){const{path:t=[],round:e=0}=this.component.state;return Yb(t,{round:e,divisions:24})}build(){Object.getPrototypeOf(Nb.prototype).build.call(this);const t=this.effectiveDepth,e=this.shape;if(!e)return;const n=this.boundUVGenerator,i=this.minMax;if(n&&void 0!==i.minX&&void 0!==i.maxX&&void 0!==i.minY&&void 0!==i.maxY){const e=new w.Shape;e.moveTo(i.minX,i.minY),e.lineTo(i.maxX,i.minY),e.lineTo(i.maxX,i.maxY),e.lineTo(i.minX,i.maxY),e.closePath(),n.setShape({extrudedShape:e,extrudedOptions:{depth:t}})}else n&&n.setShape({extrudedShape:e,extrudedOptions:{depth:t}});const r=this.createGeometry(e),s=this.createMaterials();this._mesh=new w.Mesh(r,s),this._mesh.rotation.x=-Math.PI/2,this._mesh.rotation.y=-Math.PI,this._mesh.rotation.z=-Math.PI,this._mesh.castShadow=!0,this.object3d.add(this._mesh),this.updateFillStyle(),this.updateStrokeStyle()}createGeometry(t){const e=this.effectiveDepth,{lineWidth:n=0}=this.component.state,i={steps:1,depth:e,bevelEnabled:n>0,bevelThickness:0,bevelSize:n,bevelSegments:1,UVGenerator:this.boundUVGenerator},r=new w.ExtrudeGeometry(t,i),s=this.minMax;if(void 0!==s.minX&&void 0!==s.maxX&&void 0!==s.minY&&void 0!==s.maxY){const t=(s.minX+s.maxX)/2,e=(s.minY+s.maxY)/2;r.translate(-t,-e,0),r.computeBoundingBox();const n=r.boundingBox;n&&r.translate(0,0,-(n.min.z+n.max.z)/2)}else r.center();return r}get minMax(){if(!this._minMax){const{path:t}=this.component.state;let e,n,i,r;t.forEach((t,s)=>{if(0==s)return e=i=t.x,void(n=r=t.y);e=Math.min(e,t.x),i=Math.max(i,t.x),n=Math.min(n,t.y),r=Math.max(r,t.y)}),this._minMax={minX:e,minY:n,maxX:i,maxY:r}}return this._minMax}}Bu("polygon",t=>new Gb(t));class Vb extends Nb{get shape(){const{cx:t=0,cy:e=0,rx:n=1,ry:i=1,ratio:r=50,startAngle:s=0,endAngle:o=2*Math.PI,anticlockwise:a=!1}=this.component.state,c=Math.abs(n),l=Math.abs(i),h=new w.EllipseCurve(t,e,c,l,s,o,a,0),d=new w.Shape(h.getPoints(50)),u=c/100*r,p=l/100*r;if(u>0&&p>0){const n=new w.EllipseCurve(t,e,u,p,s,o,a,0),i=new w.Path(n.getPoints(50));d.holes.push(i)}return d}}Bu("donut",t=>new Vb(t));class Ub extends Nb{get shape(){const{x1:t=0,y1:e=0,x2:n=0,y2:i=0,x3:r=0,y3:s=0,round:o=0}=this.component.state,a=[{x:t,y:e},{x:n,y:i},{x:r,y:s}];if(o>0){const t=new w.Path;for(let e=0;e<a.length;e++){const n=a[(e-1+a.length)%a.length],i=a[e],r=a[(e+1)%a.length];let s=Math.sqrt((n.x-i.x)**2+(n.y-i.y)**2),c=0!==s?Math.atan2(n.x-i.x,n.y-i.y):0;const l=Math.sin(c)*Math.min(o,s/2)+i.x,h=Math.cos(c)*Math.min(o,s/2)+i.y;s=Math.sqrt((r.x-i.x)**2+(r.y-i.y)**2),c=0!==s?Math.atan2(r.x-i.x,r.y-i.y):0;const d=Math.sin(c)*Math.min(o,s/2)+i.x,u=Math.cos(c)*Math.min(o,s/2)+i.y;0===e?t.moveTo(l,h):t.lineTo(l,h),t.quadraticCurveTo(i.x,i.y,d,u)}return new w.Shape(t.getPoints(12))}const c=new w.Shape;return c.moveTo(t,e),c.lineTo(n,i),c.lineTo(r,s),c.closePath(),c}}Bu("triangle",t=>new Ub(t));class $b extends Nb{get shape(){const{ratio:t=30,wing:e=5,cx:n=0,cy:i=0,rx:r=1,ry:s=1}=this.component.state;if(e<3)return null;const o=Math.PI/2,a=2*Math.PI/e,c=r-t/100*r,l=s-t/100*s,h=new w.Shape;h.moveTo(n+r*Math.cos(-o),i+s*Math.sin(-o)),h.lineTo(n+(r-c)*(Math.cos(a-o)+Math.cos(0-o))/2,i+(s-l)*(Math.sin(a-o)+Math.sin(0-o))/2);for(let t=1;t<e;t++)h.lineTo(n+r*Math.cos(a*t-o),i+s*Math.sin(a*t-o)),h.lineTo(n+(r-c)*(Math.cos(a*(t+1)-o)+Math.cos(a*t-o))/2,i+(s-l)*(Math.sin(a*(t+1)-o)+Math.sin(a*t-o))/2);return h.closePath(),h}}Bu("star",t=>new $b(t));const Wb={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/sphere"};class Xb extends Cb{buildGeometry(){const{rx:t=0,ry:e=0,rz:n}=this.component.state,i=n??t,r=new w.SphereGeometry(1,32,16);r.scale(t,i,e),this.object3d.geometry=r}updateDimension(){this.buildGeometry()}get effectiveDepth(){const{rx:t=0,rz:e}=this.component.state,n=e??t;return Math.max(2*n,1)}}t.Sphere=class extends Zg{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Xb(this)}get nature(){return Wb}},t.Sphere=_f([uy("sphere")],t.Sphere);class qb extends md{getObject3dInstance(){return new w.Sprite}build(){super.build(),this.buildMaterial()}get cz(){const{zPos:t=0}=this.component.state,{height:e}=this.component.bounds,{tz:n=0}=this.component.delta(),i=this.component.parent?._realObject;return t+n+e/2-(i?.geometricOffsetY??0)}get geometricOffsetY(){const{height:t=0}=this.component.bounds;return t/2}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Kh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=md.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(Qh(t)):e.opacity=0)}}class Kb extends qb{buildMaterial(){const t=this.object3d.material;t&&t.dispose(),this.object3d.material=new w.SpriteMaterial({map:Mb(this.component),alphaTest:.01,sizeAttenuation:!1})}get scale(){const{width:t,height:e}=this.component.bounds,n=this.threeContainer,{width:i=1,height:r=1}=n?.bounds??{},{scale:s=1}=this.component.state;return{x:s*t/i,y:s*e/r,z:s}}update(){this.build(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateAlpha(){this.update()}updateText(){this.update()}}const Qb={mutable:!1,resizable:!0,rotatable:!0,properties:[]};t.Sprite=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Kb(this)}get nature(){return Qb}},t.Sprite=_f([uy("sprite")],t.Sprite);const Zb={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cube"};class Jb extends Cb{buildGeometry(){const{width:t=0,height:e=0,depth:n=0}=this.component.state,i=new w.BoxGeometry(1,1,1);i.scale(t,n,e),this.object3d.geometry=i}}t.Cube=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Jb(this)}get nature(){return Zb}},t.Cube=_f([uy("cube")],t.Cube);const t_={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cylinder"};class e_ extends Cb{buildGeometry(){const{rx:t=0,ry:e=0}=this.component.state,n=this.component.state.depth??1,i=new w.CylinderGeometry(1,1,1,25);i.scale(t||1,n||1,e||1),this.object3d.geometry=i}updateDimension(){this.buildGeometry()}}t.Cylinder=class extends Zg{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new e_(this)}get nature(){return t_}},t.Cylinder=_f([uy("cylinder")],t.Cylinder);const n_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"color",label:"box-color",name:"boxColor",property:"boxColor"}],help:"scene/component/banner"};class i_ extends md{get zPriority(){return hd.DECAL}build(){super.build();const{width:t=1,height:e=1,depth:n=1}=this.component.state;this.object3d.add(this.createCube(t,e,n));const i=this.createTextureBoard(t,n);i.position.set(0,0,.5*e+1),this.object3d.add(i)}createCube(t,e,n){const{boxColor:i="#ccaa76"}=this.component.state,r=Hh(this.component.state.material3d),s=new w.BoxGeometry(t,n,e),o=new w.MeshStandardMaterial({color:i,side:w.FrontSide});Gh(o,r);const a=new w.Mesh(s,o);return a.castShadow=r.castShadow,a.receiveShadow=r.receiveShadow,a}createTextureBoard(t,e){const n=Hh(this.component.state.material3d),{fillStyle:i="#ccaa76"}=this.component.state,r=md.buildFillStyleTexture(this.component),s=new w.MeshStandardMaterial(r?{map:r}:{color:i||"#ccaa76",side:w.FrontSide});Gh(s,n);const o=new w.PlaneGeometry(t,e,1,1),a=new w.Mesh(o,s);return a.castShadow=n.castShadow,a.receiveShadow=n.receiveShadow,a}updateMaterial3d(){super.updateMaterial3d();const t=Hh(this.component.state.material3d);this.object3d.traverse(e=>{if(e.isMesh){const n=e.material;n&&Gh(n,t),e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow}})}updateFillStyle(){this.update()}onchange(t,e){super.onchange(t,e),"boxColor"in t&&this.update()}}var r_;t.Banner=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}get nature(){return n_}buildRealObject(){return new i_(this)}},t.Banner=_f([uy("banner")],t.Banner);const s_={far:1e5,fov:80,near:1,zoom:1},o_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"near",name:"near"},{type:"number",label:"far",name:"far"},{type:"number",label:"fov",name:"fov"},{type:"number",label:"zoom",name:"zoom"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/camera"};class a_ extends md{getObject3dInstance(){return new w.Mesh}updateCamera(){const{near:t=s_.near,far:e=s_.far,fov:n=s_.fov,zoom:i=s_.zoom,showHelper:r}=this.component.state;this.camera.far=e,this.camera.fov=n,this.camera.near=t,this.camera.zoom=i,r?this.helper||(this.helper=new w.CameraHelper(this.camera),this.object3d.add(this.helper)):this.helper&&(this.object3d.remove(this.helper),delete this.helper)}build(){super.build();const{width:t=0,height:e=0,depth:n=0,fillStyle:i="lightgray"}=this.component.state;this.object3d.geometry=new w.BoxGeometry(t,n,e);const r=Hh(this.component.state.material3d),s=new w.MeshStandardMaterial({color:i});Gh(s,r),this.object3d.material=s,this.object3d.castShadow=r.castShadow,this.object3d.receiveShadow=r.receiveShadow,this.camera=new w.PerspectiveCamera,this.camera.position.set(0,0,0),this.object3d.add(this.camera),this.object3d.lookAt(0,0,0),this.updateCamera()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=Hh(this.component.state.material3d);Gh(t,e),this.object3d.castShadow=e.castShadow,this.object3d.receiveShadow=e.receiveShadow}}t.Camera=r_=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}static get image(){return r_._image||(r_._image=new Image,r_._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1IAAANSAQMAAABV6G1EAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEX6+voBAQGV71ZvAAAFO0lEQVR42u3dMZLkNBiGYakUKFRIqKOISxDvETiCTBEQcgQOQE7clyAi8REm7KDXIhgYoMa/7fbIX+2K9w022MCP/25Z28GW5RwRERERERERERERERERERERERERERERERERERERERERERERERHRl9mv7fdPn7879sf8Mcq3J3r5EJXaUy3Wddrcd6qNybx9F2/lZ63H+nVCa9Oe9elZa5ksa/dDbE+3fsm4v27C89bd+i6W3l+XdcnSWtuxyvPW+hqorbWb0Jr7Pl3m4tjfVMIZ625d6L5pxTPWw7rQY9P6pqu1dF8aq5d83cE3rXrGWluIxV6h53eotv4c1V3Ln7Nm66ZvvZf8SSues16sD2jubz2sC839fmvYiz7t//LJna27wsr7VjlnNWtPeHTfNlae2bZvnaTePUd+74fqV2LNxv6zdN8O3z9HSWhlc4F+dOvdsKbe2+F7q+zPddq6W2ts6r31vrN825/rtPWwvvcL5losy11uxQNz5U6fYT4w12mrWf80TUNZdetXal/LtwNW6WOFI1Y9bU3GVnfFXM9bneZKwrmKcK4qnKsK52q6uULTzRWFVjpkta/OykKrCq02puWFVhRaSWjlQa0itJrO8oNaQWgloZWFVhnUqjrLN50VBrWi0MpCqwitOqjVdFYQWlFopUGtLLSq0GpjWl5oRaGVBrWy0KpCq+ksP6gVhFYSWllolUGtqrNW/jvBZVYY1IpCKwutIrTqoFbTWUFoxUGtJLSK0KpCq41peaEVhVYa1MpCqwqtprP8oFYUWklo5UGtIrSazvJCKwxqRaGVhVYZ1Ko664ems34UWj8Nav0stBoWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhbW/9L6RWgp37WofIek8j2cyveLTkqrCq0itLLQSkJL+Q5k5budle/HVr73e/24gAHenZ6FlvK9+srzAoLQUp65oDy3QnoeRxFaWWgpz2pRnncThJbyzCDpuUtVaBWhlYWW8qwx5RlqynPovNBSnuUnPaOwCK0stJLQUp4BqjzbVHk+rFNaVWgVoZWFlvJc6Si0lGdzK88cV57bLj2PvgitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqxyyahcrH7JKFysJ54rCuYJwLi+cywnn+vdlLp+rCOfKwrnStXP95zLxiJX7WEFoeaHljO/xEqsaf9/FWqz1bM+VzloP655df2uxrnP9XPHKue7OeMDsuWInyx+Y67T1Yv0gs+cKvay6P5fvZZULrdnYFBbbcr2sdKF1MxbZFdZkLLItq3aay6/vJ102eusD2rJKl633nw/o3n+uxbrpLSv1svL6M95hQ3xYNz33t16sC21Zoc+28Xahm+u+Ic7WhbYs1+dRfrvQ5LpvHOaFNq3SZ8n/faEt6twDtli7wrJpxT6P1183/di0Ti36u3XT903Ld1qGrzf9smmdWhyTddNzf8t8UqdtK/dZGq8P2DZ1ZnHcrQ/osWO5PkvDuby7NE58Yctk7Qq3PSv3+bpc3F0aJ56wF+uLX9xu6eOb4es9z/vWc0vR3oZuByjnf2t/fP/54B/2WvvWEREREREREREREREREREREREREREREREREREREREREREREREREX2J/QlrTpqHD8xO1gAAAABJRU5ErkJggg=="),r_._image}render(t){const{left:e,top:n,width:i,height:r}=this.bounds;t.beginPath(),this.drawImage(t,r_.image,e,n,i,r)}buildRealObject(){return new a_(this)}get nature(){return o_}},t.Camera=r_=_f([uy("camera")],t.Camera);const c_={mutable:!1,resizable:!0,rotatable:!0,properties:[...hy],"value-property":"source",help:"scene/component/gltf-object"};t.GLTFObject=class extends(dy(lc(ac))){get nature(){return c_}},t.GLTFObject=_f([uy("gltf-object")],t.GLTFObject);const l_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"light-type",name:"lightType",property:{options:["","point","directional"]}},{type:"number",label:"intensity",name:"intensity"},{type:"number",label:"distance",name:"distance"},{type:"number",label:"decay",name:"decay"},{type:"checkbox",label:"cast-shadow",name:"castShadow"},{type:"number",label:"near",name:"near",placeholder:"0.5"},{type:"number",label:"far",name:"far",placeholder:"1000"},{type:"number",label:"fov",name:"fov",placeholder:"90"},{type:"number",label:"zoom",name:"zoom",placeholder:"1"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/light"};class h_ extends md{updatePointLight(){const{lightType:t="point",distance:e=0,intensity:n=10,decay:i=1,fillStyle:r="white",castShadow:s,near:o=.5,far:a=1e3,fov:c=90,zoom:l=1,showHelper:h}=this.component.state;if(this.object3d.color=new w.Color(r),"point"==t&&(this.object3d.distance=e,this.object3d.decay=i),this.object3d.intensity=n,this.object3d.castShadow=s,s){const t=this.object3d.shadow?.camera;t.far=a,t.near=o,t.fov=c,t.zoom=l}if(h){const t=this.object3d.shadow?.camera;this.helper||(this.helper=new w.CameraHelper(t),this.object3d.add(this.helper))}else this.helper&&(this.object3d.remove(this.helper),delete this.helper)}getObject3dInstance(){const{lightType:t="point"}=this.component.state;return"point"==t?new w.PointLight:new w.DirectionalLight}update(){this.clear(),this.build(),this.updateDimension(),this.updateHidden(),this.updatePointLight()}}t.PointLight=class extends Zg{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new h_(this)}get anchors(){return[]}get nature(){return l_}},t.PointLight=_f([uy("light")],t.PointLight);const d_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"}],help:"scene/component/wall"};class u_ extends Cb{buildGeometry(){const{width:t=0,height:e=0,depth:n=0}=this.component.state,i=new w.BoxGeometry(1,1,1);i.scale(t,n,e),this.object3d.geometry=i}}t.Wall=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new u_(this)}get nature(){return d_}},t.Wall=_f([uy("wall")],t.Wall);const p_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"},{type:"checkbox",label:"hide-in-2d-view",name:"hideIn2DView"},{type:"checkbox",label:"hide-in-3d-view",name:"hideIn3DView"}],help:"scene/component/floor-plate"};class f_ extends md{get zPriority(){return hd.FLOOR}updateHidden(){const t=this.component.state,e=!!this.component.app?.isViewMode;this.object3d.visible=!(t.hidden||e&&t.hideIn3DView)}clear(){return this._topTexture&&(this._topTexture.dispose(),this._topTexture=void 0),this._mesh=void 0,super.clear()}build(){super.build();const{width:t,height:e,depth:n=1}=this.component.state;if(!t||!e)return;const i=Math.abs(t),r=Math.abs(e),s=Math.max(n,.5),o=new w.BoxGeometry(i,s,r),a=this._buildTopMaterial(),c=this._buildSideMaterial(),l=[c,c,a,c,c,c];this._mesh=new w.Mesh(o,l),this._mesh.position.y=0,this._mesh.receiveShadow=!0,this._mesh.castShadow=!1,this.object3d.add(this._mesh)}_buildTopMaterial(){const{alpha:t=1}=this.component.state,e=Hh(this.component.state.material3d),n=md.buildFillStyleTexture(this.component);if(n){this._topTexture=n;const i=new w.MeshStandardMaterial({map:n,side:w.DoubleSide,transparent:!0,opacity:t,depthWrite:t>=.9});return Gh(i,e),i}const{fillStyle:i}=this.component.state,r="string"==typeof i&&"none"!==i?i:"#e0e0e0",s=new w.MeshStandardMaterial({color:r,side:w.DoubleSide,transparent:!0,opacity:t,depthWrite:t>=.9});return Gh(s,e),s}_buildSideMaterial(){const{strokeStyle:t,alpha:e=1}=this.component.state,n="string"==typeof t&&t?t:"#999999",i=Hh(this.component.state.material3d),r=new w.MeshStandardMaterial({color:n});return Gh(r,i),r.side=w.DoubleSide,r.transparent=!0,r.opacity=.8*e,r.depthWrite=e>=.9,r}updateAlpha(){if(!this._mesh)return;const{alpha:t=1}=this.component.state,e=this._mesh.material;for(let n=0;n<e.length;n++){const i=e[n];i.opacity=2===n?t:.8*t,i.transparent=!0,i.depthWrite=t>=.9}}updateFillStyle(){if(!this._mesh)return;this._topTexture&&(this._topTexture.dispose(),this._topTexture=void 0);const t=this._mesh.material;t[2].dispose(),t[2]=this._buildTopMaterial()}updateStrokeStyle(){if(!this._mesh)return;const t=this._mesh.material,e=this._buildSideMaterial();for(let n=0;n<t.length;n++)2!==n&&(t[n].dispose(),t[n]=e)}}t.FloorPlate=class extends fl{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new f_(this)}get nature(){return p_}get hidden(){return!!this.getState("hideIn2DView")||super.hidden}},t.FloorPlate=_f([uy("floor-plate")],t.FloorPlate);function g_(t,e={}){const n=e.size??5,i=e.color??4500172,r=e.emissive??2245734,s=new w.SphereGeometry(n,16,12),o=new w.MeshStandardMaterial({color:i,emissive:r,emissiveIntensity:.15,metalness:.3,roughness:.4,transparent:!0,opacity:.35}),a=new w.Mesh(s,o);e.position&&a.position.set(e.position[0],e.position[1],e.position[2]),a.userData.alwaysRaycast=!0,a.scale.setScalar(1),a.visible=e.visible??!!t.app?.isEditMode;const c=()=>{o.emissiveIntensity=.9,o.opacity=.95,a.scale.setScalar(1.35),t.invalidate?.()},l=()=>{o.emissiveIntensity=.15,o.opacity=.35,a.scale.setScalar(1),t.invalidate?.()};return t.on("mouseenter",c),t.on("mouseleave",l),a.userData.dispose=()=>{t.off("mouseenter",c),t.off("mouseleave",l)},a}class m_ extends Cb{get zPriority(){return hd.DECAL}get syncZPosOffset(){return this.effectiveDepth}get geometricOffsetY(){return this.effectiveDepth}buildGeometry(){const{width:t,height:e}=this.component.state,n=Math.abs(t)||1,i=Math.abs(e)||1,r=new w.PlaneGeometry(n,i);r.rotateX(-Math.PI/2),this.object3d.geometry=r}updateDimension(){this.update()}build(){super.build();const{width:t,height:e}=this.component.state,n=Math.abs(t)||1,i=Math.abs(e)||1,r=Math.max(2,.04*Math.min(n,i));this.object3d.add(g_(this.component,{size:r,position:[n/2-r,r,-i/2+r]}))}}const y_={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/decal"};let b_=class extends(cy(lc(ac))){buildRealObject(){return new m_(this)}get nature(){return y_}};b_=_f([uy("decal")],b_);class __ extends md{getObject3dInstance(){return new w.Group}get allowedGizmoModes(){return this.component.isGroup?.()?["translate"]:null}}const v_="#dde2e8",x_="#9c9c9c",w_="#e8e8ec",M_=.35;function S_(t,e,n,i,r){if(!e.visible)return new w.MeshStandardMaterial({transparent:!0,opacity:0,depthWrite:!1});const s=e.alpha*n,o="wall"===i?v_:"floor"===i?x_:w_,a=new w.MeshStandardMaterial({metalness:0,roughness:"wall"===i?.6:.85,transparent:s<1,opacity:s,side:r?w.BackSide:w.DoubleSide});return function(t,e,n,i,r,s){if("string"==typeof n&&n&&"transparent"!==n)t.color.set(n);else{if(n&&"object"==typeof n){const i=!s,o=md.buildFillStyleTexture(e,n,{mirror:i,rotation:r});if(o)return t.map&&t.map.dispose(),t.map=o,void t.color.set("#ffffff")}t.color.set(i)}}(a,t,e.fillStyle,o,e.rotation,e.mirror),a}class A_ extends __{get zPriority(){return hd.BACKDROP}get position(){if(this.component.state.fitToBoard){return{x:0,y:super.position.y,z:0}}return super.position}build(){super.build();const t=this.component.state;let e=t.width,n=t.height;if(t.fitToBoard){const t=this.component.rootModel,i=t?.state;i&&Number.isFinite(i.width)&&Number.isFinite(i.height)&&(e=i.width,n=i.height)}const i=this.effectiveDepth||Math.min(e,n)||200,r=t.alpha??1,s=!1!==t.seeThrough,o={east:this._resolveFace("east",v_,!0,M_),west:this._resolveFace("west",v_,!0,M_),north:this._resolveFace("north",v_,!0,M_),south:this._resolveFace("south",v_,!0,M_),floor:this._resolveFace("floor",x_,!0,1),ceiling:this._resolveFace("ceiling",w_,!0,1)},a=[S_(this.component,o.east,r,"wall",s),S_(this.component,o.west,r,"wall",s),S_(this.component,o.ceiling,r,"ceiling",s),S_(this.component,o.floor,r,"floor",s),S_(this.component,o.south,r,"wall",s),S_(this.component,o.north,r,"wall",s)],c=new w.BoxGeometry(e,i,n),l=new w.Mesh(c,a);if(l.receiveShadow=!0,this.object3d.add(l),this.component.app?.isEditMode){const t=new w.LineBasicMaterial({color:4473941,transparent:!0,opacity:.7}),e=new w.LineSegments(new w.EdgesGeometry(c),t);this.object3d.add(e)}const h=.04*Math.min(e,n,i);this.object3d.add(g_(this.component,{size:h,position:[e/2,i/2+h,-n/2]}))}_resolveFace(t,e,n,i){const r=this.component.state,s=r.faces?.[t]??{},o=s.visible,a=s.alpha,c=s.rotation,l=90===c||180===c||270===c?c:0;return{fillStyle:s.fillStyle??e,visible:"boolean"==typeof o?o:n,alpha:"number"==typeof a&&Number.isFinite(a)?a:i,rotation:l,mirror:!0===s.mirror}}updateDimension(){}onchange(t,e){["alpha","width","height","depth","fitToBoard","faces","seeThrough"].some(e=>e in t)?this.update():super.onchange(t,e)}updateAlpha(){}}const k_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"checkbox",label:"fit-to-board",name:"fitToBoard"},{type:"checkbox",label:"see-through",name:"seeThrough"},{type:"backdrop-faces",label:"",name:"faces"}],help:"scene/component/backdrop"};let E_=class extends(cy(lc(ac))){buildRealObject(){return new A_(this)}get nature(){return k_}added(t){super.added?.(t),this.state.fitToBoard&&(this._syncFromRoot(!0),this._attachRootListener())}async ready(){await(super.ready?.()),this.state.fitToBoard&&this._syncFromRoot(!1)}removed(t){this._detachRootListener(),super.removed?.(t)}dispose(){this._detachRootListener(),super.dispose?.()}onchange(t,e){"fitToBoard"in t&&(t.fitToBoard?(this._syncFromRoot(!0),this._attachRootListener()):this._detachRootListener()),super.onchange?.(t,e)}_syncFromRoot(t=!1){const e=this.rootModel;if(!e||e===this)return;const n=e.state;if(!n)return;const i={},r=Number.isFinite(n.width)?n.width:this.state.width,s=Number.isFinite(n.height)?n.height:this.state.height;r!==this.state.width&&(i.width=r),s!==this.state.height&&(i.height=s);const o=Number.isFinite(n.left)?n.left:0,a=Number.isFinite(n.top)?n.top:0;if(o!==this.state.left&&(i.left=o),a!==this.state.top&&(i.top=a),t){const t=this.state.depth;if(!("number"==typeof t&&Number.isFinite(t)&&t>0)){const e=Math.min(r,s);e!==t&&(i.depth=e)}}Object.keys(i).length>0&&this.set(i)}_attachRootListener(){if(this._onRootChange)return;const t=this.rootModel;t&&t!==this&&(this._onRootChange=t=>{("width"in t||"height"in t||"left"in t||"top"in t)&&this._syncFromRoot()},t.on?.("change",this._onRootChange))}_detachRootListener(){if(!this._onRootChange)return;const t=this.rootModel;t?.off?.("change",this._onRootChange),this._onRootChange=void 0}};function C_(t,e){return"none"===t?0:t.endsWith("arrow")?1.5*e:0}function T_(t,e,n,i){const r=[];for(let s=1;s<=i;s++){const o=s/i,a=1-o;r.push(new w.Vector3(a*a*t.x+2*a*o*e.x+o*o*n.x,a*a*t.y+2*a*o*e.y+o*o*n.y,a*a*t.z+2*a*o*e.z+o*o*n.z))}return r}E_=_f([uy("backdrop")],E_);class P_ extends md{getObject3dInstance(){return new w.Group}get gizmoTransformable(){return!0}get syncZPosOffset(){return 0}get geometricOffsetY(){return 0}syncFromObject3D(){}applyDimensionFromGizmo(t){}build(){super.build(),this._buildLine()}get smoothedPath(){const t=this.worldPath;if(t.length<2)return t;const{round:e=0}=this.component.state;if(e<=0||t.length<3)return t;const n=[];n.push(t[0]);for(let i=1;i<t.length;i++){const r=t[i-1],s=t[i],o=t[i+1];if(!o){n.push(s);break}const a=r.x-s.x,c=r.y-s.y,l=r.z-s.z,h=Math.sqrt(a*a+c*c+l*l),d=Math.min(e,h/2),u=o.x-s.x,p=o.y-s.y,f=o.z-s.z,g=Math.sqrt(u*u+p*p+f*f),m=Math.min(e,g/2),y=h>0?new w.Vector3(s.x+a/h*d,s.y+c/h*d,s.z+l/h*d):s.clone(),b=g>0?new w.Vector3(s.x+u/g*m,s.y+p/g*m,s.z+f/g*m):s.clone();n.push(y),n.push(...T_(y,s,b,8))}return n}_buildLine(){const t=this.smoothedPath;if(t.length<2)return;const{strokeStyle:e,lineWidth:n=2,alpha:i=1,lineDash:r,begin:s="none",beginSize:o="size5",end:a="none",endSize:c="size5"}=this.component.state,l=Math.max(n,1),p="string"==typeof e&&"transparent"!==e?Qh(e):"#000000",f=new w.Color(p),g=this._getResolution(),m=s,y=a,b=C_(m,l),_=C_(y,l),v=t[0],x=t[t.length-1],M=(new w.Vector3).subVectors(t[1],v).normalize(),S=(new w.Vector3).subVectors(t[t.length-2],x).normalize(),A=[...t];b>0&&(A[0]=v.clone().add(M.clone().multiplyScalar(b))),_>0&&(A[A.length-1]=x.clone().add(S.clone().multiplyScalar(_)));const k=new u.LineGeometry;k.setPositions(A.flatMap(t=>[t.x,t.y,t.z]));const E=function(t,e){switch(t){case"round-dot":return{dashSize:e,gapSize:e};case"square-dot":return{dashSize:2*e,gapSize:e};case"dash":return{dashSize:4*e,gapSize:1.5*e};case"dash-dot":return{dashSize:4*e,gapSize:2*e};case"long-dash":return{dashSize:6*e,gapSize:3*e};case"long-dash-dot":return{dashSize:6*e,gapSize:2*e};case"long-dash-dot-dot":return{dashSize:6*e,gapSize:e};default:return null}}(r,l),C=new d.LineMaterial({color:f.getHex(),linewidth:l,worldUnits:!0,transparent:i<1,opacity:i,resolution:g,dashed:!!E,dashSize:E?.dashSize??1,gapSize:E?.gapSize??1,dashScale:1});if(this._line2=new h.Line2(k,C),this._line2.computeLineDistances(),this.object3d.add(this._line2),"none"!==m){const t=Iu(m,zu(o,l));if(t){const e=(new w.Quaternion).setFromUnitVectors(new w.Vector3(1,0,0),M.clone().negate());this._placeTip(t,v,e,f,i,g)}}if("none"!==y){const t=Iu(y,zu(c,l));if(t){const e=(new w.Quaternion).setFromUnitVectors(new w.Vector3(1,0,0),S.clone().negate());this._placeTip(t,x,e,f,i,g)}}}_placeTip(t,e,n,i,r,s){const o=t.mesh||t.line2||t.group;if(o){if(o.position.copy(e),o.setRotationFromQuaternion(n),t.mesh){const e=t.mesh.material;e.color.copy(i),e.transparent=r<1,e.opacity=r}else if(t.line2){const e=t.line2.material;e.color.copy(i),e.transparent=r<1,e.opacity=r,e.resolution.copy(s)}else t.group&&t.group.traverse(t=>{if(t.material){const e=t.material;e.color&&e.color.copy(i),e.transparent=r<1,e.opacity=r,e.resolution&&e.resolution.copy(s)}});this.object3d.add(o)}}_getResolution(){const t=this.threeContainer?.renderer3d;if(t){return t.getSize(new w.Vector2)}return new w.Vector2(window.innerWidth,window.innerHeight)}onGizmoDragEnd(t){const e=this._component,n=e.path;if(!n||n.length<2)return;const i=this.object3d,{width:r=0,height:s=0}=e.parent?.bounds??{},{x:o,y:a}=e.center,c=i.position,l=i.rotation,h=i.scale,d=this.position;if(Math.abs(c.x-d.x)<.001&&Math.abs(c.y-d.y)<.001&&Math.abs(c.z-d.z)<.001&&Math.abs(l.x)<.001&&Math.abs(l.y)<.001&&Math.abs(l.z)<.001&&Math.abs(h.x-1)<.001&&Math.abs(h.y-1)<.001&&Math.abs(h.z-1)<.001)return;const u=P_.computeBakedPath(n,{x:o,y:a},{width:r,height:s},i);this._suppressOnchange=!0,e.set({rotation:0,rotationX:0,rotationY:0,zPos:0}),e.mutatePath(null,()=>u),this._suppressOnchange=!1,this.update()}static computeBakedPath(t,e,n,i){const r=n.width,s=n.height,o=e.x,a=e.y;return i.updateMatrixWorld(!0),t.map(t=>{const e=new w.Vector3(t.x-o,t.z||0,t.y-a).applyMatrix4(i.matrixWorld),n={x:e.x+r/2,y:e.z+s/2};return Math.abs(e.y)>.001&&(n.z=e.y),n})}updateStrokeStyle(){this.updateDimension()}updateAlpha(){this.updateDimension()}updateDimension(){this.clear(),this.build()}onchange(t,e){("path"in t||"from"in t||"to"in t)&&(this.updateDimension(),this.updatePosition()),("round"in t||"lineDash"in t||"lineWidth"in t||"begin"in t||"end"in t||"beginSize"in t||"endSize"in t)&&this.updateDimension(),super.onchange(t,e)}clear(){for(;this.object3d.children.length>0;){const t=this.object3d.children[0];this.object3d.remove(t),rd(t)}return this._line2=void 0,super.clear()}}class D_ extends P_{get worldPath(){const t=this.component.path;if(!t||t.length<2)return[];const{x:e,y:n}=this.component.center,i=this.component,r=i.fromEnd?.component?._realObject?.object3d?.position?.y??0,s=i.toEnd?.component?._realObject?.object3d?.position?.y??0;return t.map((i,o)=>{const a=t.length>1?o/(t.length-1):0;return new w.Vector3(i.x-e,i.z||r+(s-r)*a,i.y-n)})}}Bu("line",t=>new D_(t));class O_ extends P_{get worldPath(){const t=this.component.path;if(!t||t.length<2)return[];const{x:e,y:n}=this.component.center;return t.map(t=>new w.Vector3(t.x-e,t.z||0,t.y-n))}}Bu("polyline",t=>new O_(t));class z_ extends P_{get worldPath(){const t=this.component.drawPath;if(!t||t.length<2)return[];const{x:e,y:n}=this.component.center,i=this.component,r=i.fromEnd?.component?._realObject?.object3d?.position?.y??0,s=i.toEnd?.component?._realObject?.object3d?.position?.y??0;return t.map((i,o)=>{const a=t.length>1?o/(t.length-1):0;return new w.Vector3(i.x-e,i.z||r+(s-r)*a,i.y-n)})}}Bu("ortholine",t=>new z_(t)),Bu("group",t=>new __(t));class I_ extends md{build(){super.build()}update(){}}const R_={far:1e5,fov:80,near:1,zoom:1};class L_ extends md{build(){super.build()}update(){super.update(),this.updateCamera()}getObject3dInstance(){return new w.PerspectiveCamera}updateCamera(){const{near:t=R_.near,far:e=R_.far,fov:n=R_.fov,zoom:i=R_.zoom}=this.component.state;this.object3d.far=e,this.object3d.fov=n,this.object3d.near=t,this.object3d.zoom=i}}class j_ extends Cb{buildGeometry(){const{width:t,height:e}=this.component.state.dimension;this.object3d.geometry=new w.PlaneGeometry(t,e)}buildMaterial(){this.object3d.material=new w.MeshStandardMaterial({opacity:0,side:w.DoubleSide,blending:w.NoBlending})}}class F_ extends md{getObject3dInstance(){return new w.Scene}dispose(){for(const t of this.object3d.children)rd(t);this._animationMixer&&(this._animationMixer.stopAllAction(),this._animationMixer.uncacheRoot(this.object3d),this._animationMixer=void 0),super.dispose()}clear(){return this._floor&&(this.object3d.remove(this._floor),this._floor.material instanceof Array?this._floor.material.forEach(t=>t.dispose()):this._floor.material.dispose(),this._floor.geometry.dispose(),delete this._floor),super.clear()}get floor(){return this._floor}set floor(t){this._floor&&(this.object3d.remove(this._floor),this._floor.clear(),delete this._floor),t&&(this._floor=t,this.object3d.add(t)),this.component.invalidate()}build(){super.build(),this.floor=Qu(this.component)}updateTransform(){}updateDimension(){}updatePosition(){}updateRotate(){}updateScale(){}updateAlpha(){}updateHidden(){}get animationMixer(){return this._animationMixer||(this._animationMixer=new w.AnimationMixer(this.object3d)),this._animationMixer}}const N_=new Set(["cx","cy","cz","zPos","left","top","width","height","depth","lineWidth","rotationX","rotationY","rotation","scale","hidden","alpha","material3d","screenFixed"]);class H_ extends md{get syncZPosOffset(){return this.effectiveDepth}get geometricOffsetY(){return this.effectiveDepth}constructor(t){super(t),this._origInvalidate=t.invalidate.bind(t),t.invalidate=()=>{this._origInvalidate(),this._refreshTextureNow()}}getObject3dInstance(){return new w.Mesh}build(){super.build();const{width:t,height:e}=this.component.bounds;if(!t||!e)return;const n=Hh(this.component.state.material3d),i=new w.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const r=Mb(this.component),s=new w.MeshStandardMaterial({map:r});Gh(s,n),s.transparent=!0,this.object3d.material=s,this.object3d.castShadow=n.castShadow,this.object3d.receiveShadow=n.receiveShadow}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Kh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}get dimension(){const{width:t,height:e}=this.component.bounds;return{width:t||1,height:e||1,depth:1}}get scale(){const t=super.scale,{width:e,height:n}=this.dimension;return{x:t.x*e,y:t.y,z:t.z*n}}updateDimension(){this.updateTransform()}_debouncedRebuild(){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=void 0,this.update()},100)}_refreshTextureNow(){const t=this.object3d.material,e=t?.map;if(!e)return;const n=e.source?.data;n&&(Ab(n,this.component,2),e.needsUpdate=!0)}update(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}onchange(t,e){super.onchange(t,e);for(const e of Object.keys(t))if(!N_.has(e)){this._debouncedRebuild();break}}updateFillStyle(){this._debouncedRebuild()}updateStrokeStyle(){this._debouncedRebuild()}updateText(){this._debouncedRebuild()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=Hh(this.component.state.material3d);Gh(t,e),t.transparent=!0,this.object3d.castShadow=e.castShadow,this.object3d.receiveShadow=e.receiveShadow}clear(){return this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),rd(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),this._origInvalidate&&(this.component.invalidate=this._origInvalidate,this._origInvalidate=void 0),super.dispose()}}const B_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"precision",name:"precision",property:{options:[{display:"High",value:"highp"},{display:"Medium",value:"mediump"},{display:"Low",value:"lowp"}]}},{type:"checkbox",label:"anti-alias",name:"antialias",property:"antialias"},{type:"checkbox",label:"3dmode",name:"threed",property:"threed"},{type:"checkbox",label:"auto-rotate",name:"autoRotate",property:"autoRotate"},{type:"checkbox",label:"debug",name:"debug",property:"debug"}],help:"scene/component/three-container"};var Y_;t.ThreeContainer=class extends Lg{constructor(){super(...arguments),this._capability=new Mp}get sceneManager(){return this._capability.sceneManager}get cameraManager(){return this._capability.cameraManager}get rendererManager(){return this._capability.rendererManager}get lightManager(){return this._capability.lightManager}get controlsManager(){return this._capability.controlsManager}get eventManager(){return this._capability.eventManager}containable(t){return!0}is3dContainer(){return!0}getLightingConfig(){return{hemisphere:{skyColor:16777215,groundColor:14540253,intensity:1},directional:{color:16777215,intensity:1.2,attachToCamera:!0,castShadow:!1}}}getCss3DSceneAttribute(){return"three-container:css3d-renderer"}init_scene3d(){this._capability.isInitialized&&this._capability.destroy(),this._capability.init(this,{lightingConfig:this.getLightingConfig(),css3DSceneAttribute:this.getCss3DSceneAttribute(),skipEnvironment:!0,skipPostprocessing:!0,skipShadowMap:!0}),this._capability.buildOverlays(),this._capability.resize(),this.onchangeData&&this.onchangeData(this.data,this.data)}destroy_scene3d(){this.stop(),this._capability.destroy()}stop(){}resize(){this._capability.resize()}get scene3d(){return this._capability.isInitialized||this.init_scene3d(),this._capability.scene3d}get renderer3d(){return this._capability.renderer3d}get mixer(){return this._capability.mixer}get css3DScene(){return this._capability.css3DScene}get css3DRenderer(){return this._capability.css3DRenderer}render_threed(){this._capability.renderThreeD()}get _parentIs3dMode(){return!!this.rootModel?.is3dMode}render(t){this._parentIs3dMode||(this.app.isViewMode&&this.setState("threed",!0),!this.state.threed||this._capability.noSupportWebgl?super.render(t):this._capability.camera&&this._capability.renderCSS3D())}postrender(t){if(this._parentIs3dMode)return;const{left:e,top:n,debug:i,threed:r}=this.state;let{width:s,height:o}=this.bounds;if(s=Math.floor(s),o=Math.floor(o),r){if(this._capability.isInitialized||this.init_scene3d(),this._capability.noSupportWebgl)return void this._capability.showWebglNoSupportText(t,this.state.width,this.state.height);if(!this._capability.renderer3d)return;this._capability.renderThreeD();const r=this._capability.domElement;if(!r||!r.width||!r.height)return;t.drawImage(r,0,0,r.width,r.height,e,n,s,o),i&&this._capability.showDebugFPS(t)}else super.postrender(t)}dispose(){this._capability.dispose(),super.dispose()}get layout(){return gc.get("three")}get nature(){return B_}getObjectByRaycast(){return this._capability.getObjectByRaycast()}getObjectsByRaycast(){return this._capability.getObjectsByRaycast()}onchange(t,e){(t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&this._capability.destroy(),this._capability.onchange(t)}onmousedown(t){this._capability.onMouseDown(t)}onmouseup(t){this._capability.onMouseUp(t)}onmousemove(t){this._capability.onMouseMove(t)}onmouseleave(t){this._capability.onMouseLeave(t)}onwheel(t){this._capability.onWheel(t)&&this.invalidate()}ondblclick(t){this._capability.onDblClick(t)&&this.invalidate()}ondragstart(t){this._capability.onDragStart(t)}ondragmove(t){this._capability.onDragMove(t)&&this.invalidate()}ondragend(t){this._capability.onDragEnd(t)&&this.invalidate()}ontouchstart(t){this._capability.onTouchStart(t)}onpan(t){this._capability.onPan(t)&&this.invalidate()}ontouchend(t){this._capability.onTouchEnd(t)}onkeydown(t){this._capability.onKeyDown(t)}onpinch(t){this._capability.onPinch(t)&&this.invalidate()}ondoubletap(){this._capability.onDoubleTap(),this.invalidate()}},t.ThreeContainer=_f([uy("3d-container")],t.ThreeContainer),Yu(t=>new Eb(t)),t.Model=void 0,(Y_=t.Model||(t.Model={})).compile=Qc,Y_.duplicate=Zc,Y_.select=za,Y_.match=Pa,Mi.registerResidents(()=>({componentResidentsCount:oc.residentsCount,sceneResidentsCount:Bd.residentsCount,referenceMapResidentsCount:pb.residentsCount,sceneResidents:oc.residents}));var G_=Object.freeze({__proto__:null,AbsoluteLayout:yc,Animation:ia,AudioPlayer:Om,BULGE_EPSILON:Es,get Banner(){return t.Banner},Banner3D:i_,BoxSelectionManager:yp,COMMON_PLACEHOLDER_PROPERTIES:tm,CORE_PLACEHOLDER_TYPES:rm,get Camera(){return t.Camera},Camera3D:a_,CameraBookmarkManager:mp,CameraManager:ep,CardLayout:_c,CenteringSlotStrategy:My,Component:oc,Connectable:Lp,Container:Lg,ContainerAbstract:fl,ContainerCapacity:Ey,ControlsManager:sp,get Cube(){return t.Cube},Cube3D:Jb,get Cylinder(){return t.Cylinder},Cylinder3D:e_,DEFAULT:Tr,DEFAULT_PLACEMENT:cd,DPPX:kr,DataLagTracker:_l,DataSource:ay,Donut:Qm,DonutExtrude:Vb,Ellipse:Zg,EllipseExtrude:Hb,EventManager3D:op,EventMap:$c,FPS:Tu,FixedSlotStrategy:xy,get FloorPlate(){return t.FloorPlate},GESTURES:Er,get GLTFObject(){return t.GLTFObject},GLTF_BASE_URL_ALIAS:ly,GenericObject:im,GifView:Pm,GizmoManager:cp,GizmoOperationManager:dp,GlobalRef:Hm,GltfComponent:dy,Group:Rm,HTMLAbsoluteLayout:mc,HTMLOverlayContainer:Fm,HTMLOverlayElement:bm,ImageView:ym,InfoWindow:pc,InteractionManager:up,KEYEVENTS:Cr,Layer:au,Layout:gc,LightManager:ip,LightObject:h_,Line:Kg,Line3D:D_,LinearHorizontalLayout:xc,LinearVerticalLayout:Mc,LoadTracker:xl,LoadingOverlay:Xh,LocalRef:jm,MATERIAL_PRESETS:Nh,MAX_UNDO_SIZE:30,MODE_ADD:3,MODE_EDIT:1,MODE_PASTE_DATABIND:5,MODE_PASTE_STYLE:4,MODE_SHIFT:2,MODE_VIEW:0,get Model(){return t.Model},MoveHandle:ul,NOTHING:Sr,NavGraph:jy,Node:ny,OrthoLine:gm,OrthoLine3D:z_,PIXEL_RATIO:Pu,PLACEHOLDER_THEMES:Jg,Path:$m,PlacementManager:pp,get PointLight(){return t.PointLight},Polygon:cm,PolygonContainer:hm,PolygonExtrude:Gb,PolygonPathPolyline:Vy,Polyline:pm,Polyline3D:O_,Popup:Gm,PopupContainer:Um,Pose6DOF:Qy,RealObject:md,RealObjectCamera:L_,RealObjectDomElement:Fu,RealObjectDomTexture:Eb,RealObjectDummy:I_,RealObjectExternalModel:yd,RealObjectExtrude:Nb,RealObjectGLTF:xd,RealObjectGroup:__,RealObjectLine:P_,RealObjectMesh:Cb,RealObjectPlane:j_,RealObjectPlane2D:H_,RealObjectScene:F_,RealObjectService:iy,RealObjectSprite:qb,RealObjectSprite2D:Kb,RealObjectText:Rb,Rect:Np,RectExtrude:Bb,RectPath:lc,ReferenceMap:pb,RendererManager:np,ReservationTable:Ry,RootContainer:yl,Ruler:Bp,SCALE_MIN:qh,SCENE_MODE:Ar,Scene:Bd,SceneManager:tp,ScenePopup:ou,SceneSearchEngine:Md,ScriptLoader:vb,SearchOverlay:Ad,ServiceComponent:sy,Shape:ac,get Sphere(){return t.Sphere},Sphere3D:Xb,get Sprite(){return t.Sprite},Star:ty,StarExtrude:$b,TRANSFER_SLOT_KEY:ky,TableLayout:Sc,Text:zm,ThreeCapability:Mp,get ThreeContainer(){return t.ThreeContainer},ThreeDOnly:cy,Tracker:Ed,Transfer:jd,TransitionEffect:hl,Triangle:Xm,TriangleExtrude:Ub,UNIT_DIMENSION:Zh,UNIT_ROTATE:ed,UNIT_SCALE:Jh,UNIT_TRANSLATE:td,ValueHolder:oy,VertexGizmoManager:wp,get Wall(){return t.Wall},Wall3D:u_,Z_PRIORITY:hd,addressKey:Py,animate:na,applyAlpha:Kh,applyMaterial3dProps:Gh,applyZPriorityToMaterials:ud,buildArrow3D:Lu,buildContractInspector:lb,buildNavGraph:Hy,buildShapeFromPolygonPath:Yb,buildTether:Qd,bulgeFromDrag:Ds,bulgeHandlePosition:Ps,chooseNearestPickupFrame:vy,clearTether:Jd,compile:sa,computeArcParams:Ts,cornerHandlePosition:zs,cornerRadiusFromDrag:Is,create:Gd,createCanvas:Du,createCanvasTexture:Mb,createFloor:Qu,createRealObjectFor:Gu,createSelectionHandle3D:g_,debug:Hi,delta:ta,disposeObject3D:rd,disposeTether:tu,drawTextTexture:Db,effectiveCornerRadius:Os,error:Fi,filterByToolType:_y,flattenPolygonPath:Uy,fontStyle:Tb,frameClock:fs,getPose:nb,getWorldPose:ib,globalSimClock:us,gltfNatureProperties:hy,hasArc:Cs,initFontFamilyWatcher:Dr,inspector:Vh,installContractInspector:hb,isCarrierLine:Cy,isGenericPlaceholder:sm,isStateDriven:ld,isStorageRack:Ty,metrics:Mi,opaqueColor:Qh,parseAddressKey:Dy,planPathAStar:By,planToReservations:Yy,polygonOffsetForPriority:dd,polygonPathLength:$y,projectToScreen:Wd,quatFromYaw:fy,receiptToJSON:Rd,recommendsLogarithmicDepthForSky:Ju,rectangularFootprintFrames:yy,registerDefaultRealObjectFactory:Yu,registerRealObjectFactory:Bu,renderCanvasTexture:Sb,renderPlaceholder:em,reservationTable:Ly,resolveAnchorWorldPosition:Kd,resolveMaterial3d:Hh,sceneComponent:uy,setPose:rb,setWorldPose:sb,standardYieldPolicy:Iy,stopFPSMeasure:Cu,textBounds:Ib,textTexture:Ob,toThreeSide:Yh,topApproachFrame:by,transferLog:Fd,transferTracer:zd,uniformZ:Rs,updateDefaultFontFamily:Pr,updateTether:Zd,version:xb,warn:Ni});const V_=globalThis;"undefined"==typeof globalThis||V_.scene||(V_.scene=G_),t.AbsoluteLayout=yc,t.Animation=ia,t.AudioPlayer=Om,t.BULGE_EPSILON=Es,t.Banner3D=i_,t.BoxSelectionManager=yp,t.COMMON_PLACEHOLDER_PROPERTIES=tm,t.CORE_PLACEHOLDER_TYPES=rm,t.Camera3D=a_,t.CameraBookmarkManager=mp,t.CameraManager=ep,t.CardLayout=_c,t.CenteringSlotStrategy=My,t.Component=oc,t.Connectable=Lp,t.Container=Lg,t.ContainerAbstract=fl,t.ContainerCapacity=Ey,t.ControlsManager=sp,t.Cube3D=Jb,t.Cylinder3D=e_,t.DEFAULT=Tr,t.DEFAULT_PLACEMENT=cd,t.DPPX=kr,t.DataLagTracker=_l,t.DataSource=ay,t.Donut=Qm,t.DonutExtrude=Vb,t.Ellipse=Zg,t.EllipseExtrude=Hb,t.EventManager3D=op,t.EventMap=$c,t.FPS=Tu,t.FixedSlotStrategy=xy,t.GESTURES=Er,t.GLTF_BASE_URL_ALIAS=ly,t.GenericObject=im,t.GifView=Pm,t.GizmoManager=cp,t.GizmoOperationManager=dp,t.GlobalRef=Hm,t.GltfComponent=dy,t.Group=Rm,t.HTMLAbsoluteLayout=mc,t.HTMLOverlayContainer=Fm,t.HTMLOverlayElement=bm,t.ImageView=ym,t.InfoWindow=pc,t.InteractionManager=up,t.KEYEVENTS=Cr,t.Layer=au,t.Layout=gc,t.LightManager=ip,t.LightObject=h_,t.Line=Kg,t.Line3D=D_,t.LinearHorizontalLayout=xc,t.LinearVerticalLayout=Mc,t.LoadTracker=xl,t.LoadingOverlay=Xh,t.LocalRef=jm,t.MATERIAL_PRESETS=Nh,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.MoveHandle=ul,t.NOTHING=Sr,t.NavGraph=jy,t.Node=ny,t.OrthoLine=gm,t.OrthoLine3D=z_,t.PIXEL_RATIO=Pu,t.PLACEHOLDER_THEMES=Jg,t.Path=$m,t.PlacementManager=pp,t.Polygon=cm,t.PolygonContainer=hm,t.PolygonExtrude=Gb,t.PolygonPathPolyline=Vy,t.Polyline=pm,t.Polyline3D=O_,t.Popup=Gm,t.PopupContainer=Um,t.Pose6DOF=Qy,t.RealObject=md,t.RealObjectCamera=L_,t.RealObjectDomElement=Fu,t.RealObjectDomTexture=Eb,t.RealObjectDummy=I_,t.RealObjectExternalModel=yd,t.RealObjectExtrude=Nb,t.RealObjectGLTF=xd,t.RealObjectGroup=__,t.RealObjectLine=P_,t.RealObjectMesh=Cb,t.RealObjectPlane=j_,t.RealObjectPlane2D=H_,t.RealObjectScene=F_,t.RealObjectService=iy,t.RealObjectSprite=qb,t.RealObjectSprite2D=Kb,t.RealObjectText=Rb,t.Rect=Np,t.RectExtrude=Bb,t.RectPath=lc,t.ReferenceMap=pb,t.RendererManager=np,t.ReservationTable=Ry,t.RootContainer=yl,t.Ruler=Bp,t.SCALE_MIN=qh,t.SCENE_MODE=Ar,t.Scene=Bd,t.SceneManager=tp,t.ScenePopup=ou,t.SceneSearchEngine=Md,t.ScriptLoader=vb,t.SearchOverlay=Ad,t.ServiceComponent=sy,t.Shape=ac,t.Sphere3D=Xb,t.Star=ty,t.StarExtrude=$b,t.TRANSFER_SLOT_KEY=ky,t.TableLayout=Sc,t.Text=zm,t.ThreeCapability=Mp,t.ThreeDOnly=cy,t.Tracker=Ed,t.Transfer=jd,t.TransitionEffect=hl,t.Triangle=Xm,t.TriangleExtrude=Ub,t.UNIT_DIMENSION=Zh,t.UNIT_ROTATE=ed,t.UNIT_SCALE=Jh,t.UNIT_TRANSLATE=td,t.ValueHolder=oy,t.VertexGizmoManager=wp,t.Wall3D=u_,t.Z_PRIORITY=hd,t.addressKey=Py,t.animate=na,t.applyAlpha=Kh,t.applyMaterial3dProps=Gh,t.applyZPriorityToMaterials=ud,t.buildArrow3D=Lu,t.buildContractInspector=lb,t.buildNavGraph=Hy,t.buildShapeFromPolygonPath=Yb,t.buildTether=Qd,t.bulgeFromDrag=Ds,t.bulgeHandlePosition=Ps,t.chooseNearestPickupFrame=vy,t.clearTether=Jd,t.compile=sa,t.computeArcParams=Ts,t.cornerHandlePosition=zs,t.cornerRadiusFromDrag=Is,t.create=Gd,t.createCanvas=Du,t.createCanvasTexture=Mb,t.createFloor=Qu,t.createRealObjectFor=Gu,t.createSelectionHandle3D=g_,t.debug=Hi,t.delta=ta,t.disposeObject3D=rd,t.disposeTether=tu,t.drawTextTexture=Db,t.effectiveCornerRadius=Os,t.error=Fi,t.filterByToolType=_y,t.flattenPolygonPath=Uy,t.fontStyle=Tb,t.frameClock=fs,t.getPose=nb,t.getWorldPose=ib,t.globalSimClock=us,t.gltfNatureProperties=hy,t.hasArc=Cs,t.initFontFamilyWatcher=Dr,t.inspector=Vh,t.installContractInspector=hb,t.isCarrierLine=Cy,t.isGenericPlaceholder=sm,t.isStateDriven=ld,t.isStorageRack=Ty,t.metrics=Mi,t.opaqueColor=Qh,t.parseAddressKey=Dy,t.planPathAStar=By,t.planToReservations=Yy,t.polygonOffsetForPriority=dd,t.polygonPathLength=$y,t.projectToScreen=Wd,t.quatFromYaw=fy,t.receiptToJSON=Rd,t.recommendsLogarithmicDepthForSky=Ju,t.rectangularFootprintFrames=yy,t.registerDefaultRealObjectFactory=Yu,t.registerRealObjectFactory=Bu,t.renderCanvasTexture=Sb,t.renderPlaceholder=em,t.reservationTable=Ly,t.resolveAnchorWorldPosition=Kd,t.resolveMaterial3d=Hh,t.sceneComponent=uy,t.setPose=rb,t.setWorldPose=sb,t.standardYieldPolicy=Iy,t.stopFPSMeasure=Cu,t.textBounds=Ib,t.textTexture=Ob,t.toThreeSide=Yh,t.topApproachFrame=by,t.transferLog=Fd,t.transferTracer=zd,t.uniformZ=Rs,t.updateDefaultFontFamily=Pr,t.updateTether=Zd,t.version=xb,t.warn=Ni});
72
+ `,this.element)}catch(t){}}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}Og=new WeakMap,oc.memoize(Lg.prototype,"bounds",!0),oc.register("container",Lg);const jg=Math.sqrt(3),Fg=2;function Ng(t,e,n,i,r){const s=5+r,o=n.x,a=n.y,c=i.x,l=i.y;if(Math.abs(o-c)>s&&Math.abs(a-l)>s){const n=(l-a)/(c-o),i=a-n*o;if(Math.abs(e-(n*t+i))>s)return!1}let h,d,u,p;return o>c?(d=o,h=c):(d=c,h=o),a>l?(p=a,u=l):(p=l,u=a),!(d+5<t)&&(!(h-5>t)&&(!(p+5<e)&&!(u-5>e)))}function Hg(t,e,n,i=2){for(let r=0;r<n.length-1;r++)if(Ng(t,e,n[r],n[r+1],i))return!0;return!1}function Bg(t,e,n,i){if("arrow"!=t.slice(-5))return n;const r=Math.atan2(i.y-n.y,i.x-n.x),s=1.5*e;return{x:n.x+Math.cos(r)*s,y:n.y+Math.sin(r)*s}}function Yg(t,e,n){let{lineWidth:i=Fg,strokeStyle:r="#000000",lineCap:s=!1,alpha:o=1,begin:a="none",end:c="none",beginSize:l="size5",endSize:h="size5"}=n;if(("none"!=a||"none"!=c)&&(i=Number(i)||Fg,t.lineCap=s,t.lineWidth=i,t.strokeStyle=r,t.fillStyle=r,t.globalAlpha*=o,"none"!=a&&Gg(t,e[0],e[1],i,a,Vg(l,i)),"none"!=c)){const n=e.length;Gg(t,e[n-1],e[n-2],i,c,Vg(h,i))}}function Gg(t,e,n,i,r,s){const{x:o,y:a}=e,c=Math.atan2(n.y-a,n.x-o);switch(t.beginPath(),t.translate(o,a),t.rotate(c),r){case"oval":t.ellipse(0,0,s.X,s.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-s.X,0),t.lineTo(0,-s.Y),t.lineTo(s.X,0),t.lineTo(0,s.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(jg*s.X,-s.Y),t.lineTo(jg*s.X,s.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(jg*s.X,-s.Y),t.lineTo(-s.X/1.5+jg*s.X,0),t.lineTo(jg*s.X,s.Y),t.fill();break;case"open-arrow":t.moveTo(jg*s.X+i,-s.Y),t.lineTo(i,0),t.lineTo(jg*s.X+i,s.Y),t.stroke();break;case"cross":t.moveTo(-s.X,-s.Y),t.lineTo(s.X,s.Y),t.moveTo(s.X,-s.Y),t.lineTo(-s.X,s.Y),t.stroke()}t.rotate(-c),t.translate(-o,-a),t.closePath()}function Vg(t,e){const n={X:0,Y:0};switch(e*=1.2,t){case"size1":n.X=e,n.Y=e;break;case"size2":n.X=1.5*e,n.Y=e;break;case"size3":n.X=2*e,n.Y=e;break;case"size4":n.X=e,n.Y=1.5*e;break;case"size5":default:n.X=1.5*e,n.Y=1.5*e;break;case"size6":n.X=2*e,n.Y=1.5*e;break;case"size7":n.X=e,n.Y=2*e;break;case"size8":n.X=1.5*e,n.Y=2*e;break;case"size9":n.X=2*e,n.Y=2*e}return n}const Ug="N",$g="S",Wg="E",Xg="W";class qg{constructor({component:t,anchor:e,position:n,self:i}){this.component=t,this._anchorName=e,this._position=n,this.self=i}get position(){const t=this.anchor;if(t){const{position:e}=t,n=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(n.x,n.y)}return this._position}set position({x:t,y:e}){this._position={x:t,y:e}}get anchor(){return this.component?.findAnchor(this._anchorName)}get direction(){const t=this.component.bounds,e=this.anchor;if(!e)return Wg;const n=e.position;return n.y<=t.top?Ug:n.y>=t.top+t.height?$g:n.x<=t.left?Xg:Wg}get boundaryPosition(){const t=this.anchor;if(t){let{position:e}=t,n=0,i=0;switch(this.direction){case $g:i=20;break;case Ug:i=-20;break;case Xg:n=-20;break;default:n=20}e={x:e.x+n,y:e.y+i};const r=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(r.x,r.y)}}}class Kg extends oc{isLine(){return!0}is3dish(){return!0}replaceRefids(t){["from","to"].forEach(e=>{const n=this.get(e);if(n?.component){const i=t.get(n.component)||n.component;this.set(e,{...n,component:i})}})}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:n}=this.getState("from")||{};if(!t)return;const i=this.root?.findByRefid?.(t);if(!i)return;this._fromEnd=new qg({component:i,fromto:"from",anchor:e,position:n,self:this})}return this._fromEnd}get from(){return this.getState("from")}set from(t){delete this._fromEnd,this.set("from",t)}get toEnd(){if(this.parent&&!this._toEnd){const{component:t,anchor:e,position:n}=this.getState("to")||{};if(!t)return;const i=this.root?.findByRefid?.(t);if(!i)return;this._toEnd=new qg({component:i,fromto:"to",anchor:e,position:n,self:this})}return this._toEnd}get to(){return this.getState("to")}set to(t){delete this._toEnd,this.set("to",t)}move({x:t,y:e},n){n&&(this.from={position:this._fromEnd?.position||this.getState("from")?.position||{x:0,y:0}},this.to={position:this._toEnd?.position||this.getState("to")?.position||{x:0,y:0}}),super.move({x:t,y:e})}render(t){const{begin:e="none",end:n="none",lineWidth:i,round:r=0}=this.state;let s=this.drawPath;Yg(t,s,this.state),t.beginPath();const o=Bg(e,i,s[0],s[1]),a=Bg(n,i,s[s.length-1],s[s.length-2]);s=[o,...s.slice(1,-1),a];let c={x:o.x,y:o.y};t.moveTo(o.x,o.y);for(let e=1;e<s.length;e++){const n=c;c=s[e];const i=s[e+1];if(n.x===c.x&&n.y===c.y)continue;if(!i){t.lineTo(c.x,c.y);break}let o=Math.sqrt((n.x-c.x)*(n.x-c.x)+(n.y-c.y)*(n.y-c.y)),a=0!==o?Math.atan2(n.x-c.x,n.y-c.y):0,l=Math.sin(a)*Math.min(r,o/2)+c.x,h=Math.cos(a)*Math.min(r,o/2)+c.y;const d=r>0||0!==o?{x:l,y:h}:c;o=Math.sqrt((i.x-c.x)*(i.x-c.x)+(i.y-c.y)*(i.y-c.y)),a=0!==o?Math.atan2(i.x-c.x,i.y-c.y):0,l=Math.sin(a)*Math.min(r,o/2)+c.x,h=Math.cos(a)*Math.min(r,o/2)+c.y;const u=r>0||0!==o?{x:l,y:h}:c;t.lineTo(d.x,d.y),r>0&&t.quadraticCurveTo(c.x,c.y,u.x,u.y)}this.drawStroke(t,void 0)}contains(t,e){const{lineWidth:n}=this.state;return Hg(t,e,this.drawPath,n)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state,{x1:n,y1:i,x2:r,y2:s}=this.state;return[this.fromEnd?.position||t?.position||{x:n,y:i},this.toEnd?.position||e?.position||{x:r,y:s}]}set path(t){const[e,n]=t,{from:i,to:r}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...i,position:e},to:{...r,position:n}})}get textBounds(){const t=this.drawPath;let e,n,i=0;for(let r=1;r<t.length;r++){const s=t[r-1],o=t[r],a=(s.x-o.x)*(s.x-o.x)+(s.y-o.y)*(s.y-o.y);a>i&&(i=Math.ceil(a),e=s,n=o)}let{paddingTop:r,paddingLeft:s,paddingRight:o,paddingBottom:a}=this.state;return a||=0,r||=0,s||=0,o||=0,{left:Math.min(e.x,n.x)+s,top:Math.min(e.y,n.y)+r,width:Math.max(Math.abs(e.x-n.x)-s-o,0),height:Math.max(Math.abs(e.y-n.y)-r-a,0)}}get decorators(){return this.app.isEditMode?["decotag"]:[]}}Kg.getTipNeckPos=Bg,Kg.containedInPath=Hg,Kg.drawEndTips=Yg,oc.register("line",Kg);const Qg={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 Zg extends(Lp(ac)){is3dish(){return!0}render(t){const{cx:e,cy:n,rx:i,ry:r,startAngle:s,endAngle:o,anticlockwise:a}=this.state;t.beginPath(),t.ellipse(e,n,Math.abs(i),Math.abs(r),0,s||0,o||2*Math.PI,a),void 0!==s&&void 0!==o&&(t.lineTo(e,n),t.closePath())}get path(){const{cx:t,cy:e,rx:n,ry:i}=this.state;return[{x:t-n,y:e-i},{x:t+n,y:e-i},{x:t+n,y:e+i},{x:t-n,y:e+i}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2,rx:(n.x-e.x)/2,ry:(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:i,rx:r,ry:s}=this.state,o=(t-n)/(2*r-.5),a=(e-i)/(2*s-.5);return o*o+a*a<.25}outline(t){return function(t,e){const{cx:n,cy:i,rx:r,ry:s}=t.model,o=2*Math.PI*e,a=n+r*Math.cos(o),c=i+s*Math.sin(o);return t.toScene(a,c)}(this,t)}get anchors(){return function(t){const{left:e,top:n,width:i,height:r}=t.bounds,s=e+i/2,o=n+r/2;return[{name:"TOP",position:{x:s,y:n}},{name:"RIGHT",position:{x:e+i,y:o}},{name:"BOTTOM",position:{x:s,y:n+r}},{name:"LEFT",position:{x:e,y:o}}]}(this)}get nature(){return Qg}}oc.memoize(Zg.prototype,"path",!1),oc.register("ellipse",Zg);const Jg={object:{fill:"rgba(180,180,180,0.18)",stroke:"#888888",icon:"?",label:"object"},transport:{fill:"rgba(100,180,255,0.18)",stroke:"#3a78c8",icon:"⇄",label:"transport"},facility:{fill:"rgba(160,140,220,0.18)",stroke:"#6b4ec8",icon:"◫",label:"facility"},vehicle:{fill:"rgba(120,200,140,0.18)",stroke:"#3a8c5e",icon:"⊙",label:"vehicle"},region:{fill:"rgba(220,200,100,0.18)",stroke:"#a0892a",icon:"▢",label:"region"},path:{fill:"rgba(200,140,160,0.18)",stroke:"#a0506a",icon:"⌐",label:"path"},"3d-asset":{fill:"rgba(255,180,80,0.18)",stroke:"#c87a2a",icon:"◈",label:"3D asset"}},tm=[{type:"string",label:"placeholder-label",name:"placeholderLabel",description:'사용자에게 표시할 추가 라벨 (예: "Stocker A1")'},{type:"string",label:"hint",name:"placeholderHint",description:"구체화 시 참고 — 도면의 원본 식별자 / VLM 라벨 등"}];function em(t,e,n,i,r){const{left:s,top:o,width:a,height:c}=e,l=Math.max(a,1),h=Math.max(c,1);t.save(),t.fillStyle=n.fill,t.fillRect(s,o,l,h),t.strokeStyle=n.stroke,t.lineWidth=1.5,t.setLineDash([4,3]),t.strokeRect(s,o,l,h),t.setLineDash([]),t.restore(),Math.min(l,h)>=24&&(t.save(),t.fillStyle=n.stroke,t.font=`bold ${Math.min(20,.4*Math.min(l,h))}px Arial`,t.textAlign="center",t.textBaseline="middle",t.fillText(n.icon,s+l/2,o+h/2),t.restore());const d=i?`${n.label}: ${i}`:n.label;h>=32&&(t.save(),t.fillStyle=n.stroke,t.font="10px Arial",t.textAlign="center",t.textBaseline="bottom",t.fillText(d,s+l/2,o+h-4),t.restore()),r&&h>=40&&(t.save(),t.fillStyle=n.stroke,t.font="9px Arial",t.textAlign="right",t.textBaseline="top",t.fillText(`hint: ${r}`,s+l-4,o+4),t.restore())}const nm={mutable:!1,resizable:!0,rotatable:!0,properties:[...tm,{type:"placeholder-convert",label:"",name:"_convert"}],help:"scene/component/placeholder"};class im extends(lc(ac)){get nature(){return nm}render(t){const{placeholderLabel:e,placeholderHint:n}=this.state;em(t,this.bounds,Jg.object,e,n)}}oc.register("placeholder",im);const rm=["placeholder"];function sm(t,e=[]){return!!t&&(!!rm.includes(t)||e.includes(t))}const om={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e+1,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){const i=n[e+1];n[e+1]={...i||{},x:t.x,y:t.y}})},ondragend:function(t,e,n){}},am={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 cm extends ac{is3dish(){return!0}get mutable(){return!0}get pathExtendable(){return!0}get cornerEditable(){return!0}get path(){return this.state.path??[]}set path(t){this.set("path",t)}contains(t,e){const n=this.path;let i=!1;return n.forEach((r,s)=>{const o=(s+n.length+1)%n.length,a=r.x,c=r.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(i=!i)}),i}get controls(){const t=this.path;return t.map((e,n)=>{const i=t[n+1>=t.length?0:n+1];return{x:(e.x+i.x)/2,y:(e.y+i.y)/2,handler:om}})}get nature(){return am}}oc.memoize(cm.prototype,"controls",!1),oc.register("polygon",cm);const lm=[];class hm extends(ul(cm)){constructor(t,e){super(t,e),this._components=[]}replaceRefids(t){this.components.forEach(e=>e.replaceRefids(t))}get showMoveHandle(){return!0}get showOverflow(){return!1}dispose(){this.components.slice().forEach(t=>t.dispose()),super.dispose()}isContainer(){return!0}containable(t){return t.isDescendible(this)}get hasTextProperty(){return!1}get components(){return this._components}get focusible(){return!0}get layout(){return gc.get(this.get("layout"))||yc}reflow(){this.layout.reflow(this),this.components&&this.components.forEach(t=>{t.isContainer()&&t.reflow()})}get hierarchy(){const t=super.hierarchy;return this.components?.length&&(t.components=this.components.map(t=>t.hierarchy)),t}reparent(t,e={}){t&&t.parent!==this&&this.addComponent(t,{silent:!0})}addComponent(t,e=!1){const{ghost:n=!1,silent:i=!1}="boolean"==typeof e?{ghost:e}:e,r=t.parent;if(r){if(this===r)return;r.removeComponent(t,n||i)}const s=this._components.push(t)-1;i&&(t._silentAdd=!0),t.parent=this,t.added(this),n||i||this.trigger("add",this,t,s),t.delegate_on(this),i?(r&&this.root?._removeTraverse?.(t),this.trigger("add",this,t,s),t.trigger("added",this,t,s),delete t._silentAdd):n||t.trigger("added",this,t,s),this.root&&this.root.isReady&&t.ready()}removeComponent(t,e=!1){const n=this._components.indexOf(t);-1!=n&&(this._components.splice(n,1),t.parent=null,t.removed(this),e||(this.trigger("remove",this,t),t.trigger("removed",this,t)),t.delegate_off(this))}insertComponentAt(t,e,n=!1){const i=t.parent;i&&i.removeComponent(t,n);const r=this._components.splice(0,e);this._components=r.concat(t,this._components),e=this._components.indexOf(t),t.parent=this,t.added(this),n||this.trigger("add",this,t,e),t.delegate_on(this),n||t.trigger("added",this,t,e)}add(t,e=!1){return t instanceof Array?(t.forEach(t=>{-1==this._components.indexOf(t)&&this.addComponent(t,e)}),this):this.add.call(this,[t],e)}remove(t,e=!1){return t instanceof Array?this._components?(t.forEach(t=>this.removeComponent(t,e)),this):this:this.remove.call(this,[t],e)}getAt(t){if(this._components)return this._components[t]}forEach(t,e){this._components&&this._components.forEach(t,e)}traverse(t,e){t.call(e,this),this._components&&this._components.forEach(n=>{n.isContainer()?n.traverse(t,e):t.call(e,n)})}indexOf(t){return(this._components||lm).indexOf(t)}size(){return(this._components||lm).length}moveChildAt(t,e){const n=this.indexOf(e);if(-1==n)return;let i=this._components.splice(0,n);const r=this._components.splice(1);this._components=i.concat(r),t=Math.max(0,t),t=Math.min(t,this._components.length),i=this._components.splice(0,t),this._components=i.concat(e,this._components)}moveChildForward(t){const e=this.indexOf(t);-1!=e&&e!=this.size()-1&&(this._components[e]=this._components[e+1],this._components[e+1]=t)}moveChildBackward(t){const e=this.indexOf(t);-1!=e&&0!=e&&(this._components[e]=this._components[e-1],this._components[e-1]=t)}moveChildToFront(t){const e=this.indexOf(t);if(-1==e||e==this.size()-1)return;const n=this._components.splice(0,e),i=this._components.splice(1);this._components=n.concat(i,this._components)}moveChildToBack(t){const e=this.indexOf(t);if(-1==e||0==e)return;const n=this._components.splice(0,e),i=this._components.splice(1);this._components=this._components.concat(n,i)}symmetryX(t){super.symmetryX(t),this.components.map(t=>{t.symmetryX(0)})}findAll(t,...e){if("string"==typeof t)return za(t,this,e[0]||this);if("function"!=typeof t)return[];let n=[];for(let i=this.components.length-1;i>=0;i--){const r=this.components[i].findAll(t,...e);r&&(n=n.concat(r))}return t(this,...e)&&n.push(this),n}findFirst(t,...e){if("string"==typeof t)return za(t,this,e[0])[0];if("function"==typeof t){for(let n=this.components.length-1;n>=0;n--){const i=this.components[n].findFirst(t,...e);if(null!=i)return i}return t(this,...e)?this:void 0}}findById(t){return this.root.findAllById?.(t)?.[0]}findByRefid(t){return this.root.findByRefid?.(t)}capture(t,e,n){if(!this.app.isEditMode&&this.hidden)return!1;const i=this.fromParent(t,e);if(!this.contains(i.x,i.y))return!1;const r=this.bounds;i.x-=r.left,i.y-=r.top;const s=this.layout.capturables(this);for(let r=s.length-1;r>=0;r--){const o=s[r];let a;if(a="static"==o.position?o.capture(i.x,i.y,n):o.capture(t,e,n),a)return a}return this.capturable&&!n?.(this)&&this}capturePath(t,e){if(e){if(e.indexOf(this)>-1)return!1;for(let t=0;t<e.length;t++)if(!this.containable(e[t]))return!1}const n=[],{left:i,top:r,width:s,height:o}=this.bounds;for(let e=0;e<t.length;e++){const a=this.fromParent(t[e].x,t[e].y);if(a.x<i||a.x>i+s||a.y<r||a.y>r+o)return!1;a.x-=i,a.y-=r,n.push(a)}const a=this.layout.capturables(this);for(let t=a.length-1;t>=0;t--){const i=a[t];if(!i.isContainer())continue;const r=i.capturePath(n,e);if(r)return r}return this.focusible&&this}render(t){"popup"!==this.position&&super.render(t)}postrender(t){if("popup"===this.position)return void super.postrender(t);const e=this.layout.drawables(this);if(e.length>0){let{left:n=0,top:i=0,width:r,height:s}=this.bounds;t.save(),this.showOverflow||(t.beginPath(),t.rect(n,i,r,s),t.clip(),t.closePath()),t.translate(n,i),e.forEach(e=>{const n=this.root?.transitionEffect;n?.isReparenting(e)?n.renderComponent(e,this.root?.model_layer):e.draw(this.position&&"static"!==this.position?t:this.getContext(e))}),t.translate(-n,-i),t.restore()}super.postrender(t)}trim(){this.components.forEach(t=>{t.trim()}),super.trim()}}["layout"].forEach(t=>oc.memoize(hm.prototype,t,!1));const dm={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){const i=n[e];n[e]={...i||{},x:t.x,y:t.y}})},ondragend:function(t,e,n){}},um={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 pm extends Kg{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:n}=this.state;return[this.fromEnd?.position||t?.position||n[0],...n.slice(1,-1),this.toEnd?.position||e?.position||n[n.length-1]]}set path(t){const{from:e,to:n}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...n,position:t[t.length-1]},path:t})}get controls(){const t=this.path,e=[];for(let n=0;n<t.length-1;n++){const i=t[n],r=t[n+1];0==n&&e.push({x:i.x,y:i.y,handler:dm}),e.push({x:(i.x+r.x)/2,y:(i.y+r.y)/2,handler:dm}),n==t.length-2&&e.push({x:r.x,y:r.y,handler:dm})}return e}get nature(){return um}}oc.register("polyline",pm);const fm={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 gm extends Kg{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:n,direction:i,boundaryPosition:r=t}=this.fromEnd||{},{component:s,direction:o,boundaryPosition:a=e}=this.toEnd||{},c=[r,a],l=[];r&&l.push(r);let h,d=n?.bounds;d&&(h=n.toScene(d.left,d.top),h=this.transcoordT2P(h.x,h.y),d={...d,left:h.x,top:h.y});const u=d?{left:d.left-20,top:d.top-20,width:d.width+40,height:d.height+40}:{left:r.x,top:r.y,width:0,height:0};d=d||u;let p=s?.bounds;p&&(h=s.toScene(p.left,p.top),h=this.transcoordT2P(h.x,h.y),p={...p,left:h.x,top:h.y});const f=p?{left:p.left-20,top:p.top-20,width:p.width+40,height:p.height+40}:{left:a.x,top:a.y,width:0,height:0};p=p||f;const g=[u,f],m=u.left>f.left?f.left:u.left,y=u.top>f.top?f.top:u.top,b={left:m,top:y,width:u.left+u.width>f.left+f.width?u.left+u.width-m:f.left+f.width-m,height:u.top+u.height>f.top+f.height?u.top+u.height-y:f.top+f.height-y};let _,v,x,w,M,S,A,k,E,C,T=0,P=0;d.left+d.width<p.left?(w=0,M=1,E=i,C=o,_=(d.left+d.width+p.left)/2,T=p.left-_):p.left+p.width<d.left&&(w=1,M=0,E=o,C=i,_=(d.left+p.width+p.left)/2,T=d.left-_),d.top+d.height<p.top?(x=0,S=1,A=i,k=o,v=(d.top+d.height+p.top)/2,P=p.top-v):p.top+p.height<d.top&&(x=1,S=0,A=o,k=i,v=(d.top+p.height+p.top)/2,P=d.top-v);const D=[];if(_&&T>P){let t,e,n;switch(C){case Xg:switch(E){case Wg:D.push({x:_,y:c[w].y}),D.push({x:_,y:c[M].y});break;case Xg:t=g[w].top+g[w].height/2,e=t>c[M].y?Math.min(g[w].top,c[M].y):Math.max(g[w].top+g[w].height,c[M].y),D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:c[M].y});break;case Ug:case $g:e=E===$g?Math.max(c[w].y,c[M].y):Math.min(c[w].y,c[M].y),D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:c[M].y});break;default:return this.path}break;case Wg:switch(E){case Wg:e=c[w].y<c[M].y?Math.min(g[M].top,c[w].y):Math.max(g[M].top+g[M].height,c[w].y),n=e;break;case Xg:e=void 0!==v?v:c[w].y<c[M].y?b.top-.5*T:b.top+b.height+.5*T,n=e;break;case $g:e=void 0!==v?Math.max(v,c[w].y):b.top+b.height,n=e;break;case Ug:e=v?Math.min(v,g[w].top):b.top,n=e;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:n}),D.push({x:c[M].x,y:n});break;case $g:switch(E){case Wg:e=c[w].y,n=c[w].y>c[M].y?c[w].y:g[M].top+g[M].height;break;case Xg:e=v?Math.max(v,g[M].top+g[M].height):b.top+b.height,n=e;break;case $g:e=b.top+b.height,n=e;break;case Ug:e=v?Math.min(v,g[w].top):g[w].top,n=v?Math.max(v,g[M].top+g[M].height):g[M].top+g[M].height;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:n}),D.push({x:c[M].x,y:n});break;case Ug:switch(E){case Wg:e=c[w].y,n=c[w].y<c[M].y?c[w].y:g[M].top;break;case Xg:e=v?Math.min(v,g[M].top):b.top,n=e;break;case $g:e=void 0!==v?Math.max(v,c[w].y):c[w].y,n=void 0!==v?Math.min(v,c[M].y):c[M].y;break;case Ug:e=b.top,n=e;break;default:return this.path}D.push({x:c[w].x,y:e}),D.push({x:_,y:e}),D.push({x:_,y:n}),D.push({x:c[M].x,y:n});break;default:return this.path}l.push(...0===w?D:D.reverse())}else if(v){let t,e,n;switch(k){case Ug:switch(A){case $g:D.push({x:c[x].x,y:v}),D.push({x:c[S].x,y:v});break;case Ug:t=g[x].left+g[x].width/2,e=t>c[S].x?Math.min(g[x].left,c[S].x):Math.max(g[x].left+g[x].width,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:c[S].x,y:v});break;case Xg:e=Math.min(c[x].x,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:c[S].x,y:v});break;case Wg:e=Math.max(c[x].x,c[S].x),D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:c[S].x,y:v});break;default:return this.path}break;case $g:switch(A){case Xg:e=b.left,n=e;break;case Wg:e=void 0!==_?Math.max(_,c[x].x):b.left+b.width,n=e;break;case Ug:e=void 0!==_?_:c[x].x<c[S].x?b.left-.5*P:b.left+b.width+.5*P,n=e;break;case $g:e=c[x].x,n=c[x].x<c[S].x?Math.min(g[S].left,c[x].x):Math.max(g[S].left+g[S].width,c[x].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:n,y:v}),D.push({x:n,y:c[S].y});break;case Wg:switch(A){case Xg:e=void 0!==_?Math.min(_,c[x].x):c[x].x,n=void 0!==_?Math.max(_,c[S].x):c[S].x;break;case Wg:e=b.left+b.width,n=e;break;case Ug:e=void 0!==_?Math.max(_,c[S].x):b.left+b.width,n=e;break;case $g:e=c[x].x,n=Math.max(g[S].left+g[S].width,c[x].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:n,y:v}),D.push({x:n,y:c[S].y});break;case Xg:switch(A){case Xg:e=b.left,n=e;break;case Wg:e=void 0!==_?Math.max(_,c[x].x):c[x].x,n=void 0!==_?Math.min(_,c[S].x):c[S].x;break;case Ug:e=b.left,n=e;break;case $g:e=c[x].x<c[S].x?Math.min(g[S].left,c[x].x):c[x].x,n=Math.min(e,c[S].x);break;default:return this.path}D.push({x:e,y:c[x].y}),D.push({x:e,y:v}),D.push({x:n,y:v}),D.push({x:n,y:c[S].y});break;default:return this.path}l.push(...0===x?D:D.reverse())}else{let t,e;switch(i){case Ug:switch(o){case Ug:e=b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case $g:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top+b.height}),l.push({x:c[1].x,y:b.top+b.height});break;case Wg:t=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;case Xg:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case $g:switch(o){case Ug:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top}),l.push({x:c[1].x,y:b.top});break;case $g:case Wg:case Xg:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;case Xg:switch(o){case Ug:t=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:b.left,e=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(b.top,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case $g:t=b.left,e=Math.max(b.top+b.height,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case Wg:t=b.left+b.width,l.push({x:c[0].x,y:b.top}),l.push({x:t,y:b.top}),l.push({x:t,y:c[1].y});break;case Xg:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case Wg:switch(o){case Ug:e=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case $g:e=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case Wg:case Xg:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;default:return this.path}}return a&&l.push(a),[t,...l,e].filter((t,e,n)=>{if(0===e)return!0;const i=n[e-1];return t.x!==i.x||t.y!==i.y}).filter((t,e,n)=>{if(0===e||e>=n.length-1)return!0;const i=n[e-1],r=n[e+1];return!(t.x===i.x&&t.x===r.x||t.y===i.y&&t.y===r.y)})}get nature(){return fm}}oc.register("ortholine",gm);const mm={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 ym extends(lc(ac)){static get noimage(){return ym.NOIMAGE||(ym.NOIMAGE=new Image,ym.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),ym.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){const{left:e,top:n,width:i,height:r,isGray:s=!1,alpha:o=1,src:a}=this.state;if(this.prepareIf(!this._image&&a),t.beginPath(),t.globalAlpha*=o,this._image&&this._image.complete)if(s&&this._offcanvas)t.drawImage(this._offcanvas,e,n,i,r);else try{t.drawImage(this._image,e,n,i,r)}catch(s){t.drawImage(ym.noimage,e,n,i,r)}else!this.app.isViewMode&&t.drawImage(ym.noimage,e,n,i,r)}get nature(){return mm}get hasTextProperty(){return!1}async ready(){await super.ready();const{src:t}=this.state;if(!this._image&&t){const e=this.root?.app?.loadTracker;if(e){const n=new Promise((t,e)=>{this.prepare(()=>t(),t=>e(t))});e.track(`image:${t}`,"image",t,n)}else this.prepareIf(!0)}}prepare(t,e){const{src:n,crossOrigin:i}=this.state;if(n){this._image=new Image;try{i&&(this._image.crossOrigin=i),this._image.src=this.app.url(n)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){const t=this._image.width,e=this._image.height;this._offcanvas=oc.createCanvas(t,e);const n=this._offcanvas.getContext("2d");n.drawImage(this._image,0,0);const i=function(t,e,n){let i;try{i=t.getImageData(0,0,e,n)}catch(t){return Fi("Get Image Data Error: "+(t instanceof Error?t.message:String(t))),null}const r=i.data;for(let t=0;t<e*n*4;t+=4){const e=r[t],n=r[t+1],s=r[t+2],o=Math.floor((e+n+s)/3);i.data[t]=o,i.data[t+1]=o,i.data[t+2]=o}return i}(n,t,e);n.putImageData(i,0,0)}t(this)},this._image.onerror=t=>{this._image&&!this._image.currentSrc&&(this._image=null),e(t)}}else t(this)}get src(){return this.get("src")}set src(t){this.set("src",t)}onchange(t,e){(t.hasOwnProperty("src")||t.hasOwnProperty("isGray"))&&(this._offcanvas=null,this._image=null,this.prepareIf(t.src))}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("image/"))return void(this.src=e[n])}}oc.register("image-view",ym);class bm extends(Dg(lc(oc))){is3dish(){return!0}prerender(){}}var _m,vm,xm={},wm={},Mm={};function Sm(){if(vm)return wm;vm=1,Object.defineProperty(wm,"__esModule",{value:!0});var t=function(){if(_m)return Mm;_m=1,Object.defineProperty(Mm,"__esModule",{value:!0});var t=function(){function t(){}return t.bitsToNum=function(t){return t.reduce(function(t,e){return 2*t+e},0)},t.byteToBitArr=function(t){for(var e=[],n=7;n>=0;n--)e.push(!!(t&1<<n));return e},t.lzwDecode=function(t,e){for(var n,i,r=0,s=function(t){for(var n=0,i=0;i<t;i++)e.charCodeAt(r>>3)&1<<(7&r)&&(n|=1<<i),r++;return n},o=[],a=1<<t,c=a+1,l=t+1,h=[],d=function(){h=[],l=t+1;for(var e=0;e<a;e++)h[e]=[e];h[a]=[],h[c]=null};;)if(i=n,(n=s(l))!==a){if(n===c)break;if(n<h.length)i!==a&&h.push(h[i].concat(h[n][0]));else{if(n!==h.length)throw new Error("Invalid LZW code.");h.push(h[i].concat(h[i][0]))}o.push.apply(o,h[n]),h.length===1<<l&&l<12&&l++}else d();return o},t}();return Mm.SuperGifUtils=t,Mm}(),e=function(){function e(t,e){this.stream=t,this.handler=e}return e.prototype.parseCT=function(t){for(var e=[],n=0;n<t;n++)e.push(this.stream.readBytes(3));return e},e.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},e.prototype.parseHeader=function(){var e={};if(e.sig=this.stream.read(3),e.ver=this.stream.read(3),"GIF"!==e.sig)throw new Error("Not a GIF file.");e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.gctFlag=n.shift(),e.colorRes=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.sorted=n.shift(),e.gctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.bgColor=this.stream.readByte(),e.pixelAspectRatio=this.stream.readByte(),e.gctFlag&&(e.gct=this.parseCT(1<<e.gctSize+1)),this.handler.hdr&&this.handler.hdr(e)},e.prototype.parseExt=function(e){var n=this;switch(e.label=this.stream.readByte(),e.label){case 249:e.extType="gce",function(e){n.stream.readByte();var i=t.SuperGifUtils.byteToBitArr(n.stream.readByte());e.reserved=i.splice(0,3),e.disposalMethod=t.SuperGifUtils.bitsToNum(i.splice(0,3)),e.userInput=i.shift(),e.transparencyGiven=i.shift(),e.delayTime=n.stream.readUnsigned(),e.transparencyIndex=n.stream.readByte(),e.terminator=n.stream.readByte(),n.handler.gce&&n.handler.gce(e)}(e);break;case 254:e.extType="com",function(t){t.comment=n.readSubBlocks(),n.handler.com&&n.handler.com(t)}(e);break;case 1:e.extType="pte",function(t){n.stream.readByte(),t.ptHeader=n.stream.readBytes(12),t.ptData=n.readSubBlocks(),n.handler.pte&&n.handler.pte(t)}(e);break;case 255:e.extType="app",function(t){n.stream.readByte(),t.identifier=n.stream.read(8),t.authCode=n.stream.read(3),"NETSCAPE"===t.identifier?function(t){n.stream.readByte(),t.unknown=n.stream.readByte(),t.iterations=n.stream.readUnsigned(),t.terminator=n.stream.readByte(),n.handler.app&&n.handler.app.NETSCAPE&&n.handler.app.NETSCAPE(t)}(t):function(t){t.appData=n.readSubBlocks(),n.handler.app&&n.handler.app[t.identifier]&&n.handler.app[t.identifier](t)}(t)}(e);break;default:e.extType="unknown",function(t){t.data=n.readSubBlocks(),n.handler.unknown&&n.handler.unknown(t)}(e)}},e.prototype.parseImg=function(e){e.leftPos=this.stream.readUnsigned(),e.topPos=this.stream.readUnsigned(),e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.lctFlag=n.shift(),e.interlaced=n.shift(),e.sorted=n.shift(),e.reserved=n.splice(0,2),e.lctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.lctFlag&&(e.lct=this.parseCT(1<<e.lctSize+1)),e.lzwMinCodeSize=this.stream.readByte();var i=this.readSubBlocks();e.pixels=t.SuperGifUtils.lzwDecode(e.lzwMinCodeSize,i),e.interlaced&&(e.pixels=function(t,e){for(var n=new Array(t.length),i=t.length/e,r=function(i,r){var s=t.slice(r*e,(r+1)*e);n.splice.apply(n,[i*e,e].concat(s))},s=[0,4,2,1],o=[8,8,4,2],a=0,c=0;c<4;c++)for(var l=s[c];l<i;l+=o[c])r(l,a),a++;return n}(e.pixels,e.width)),this.handler.img&&this.handler.img(e)},e.prototype.parseBlock=function(){var t={};switch(t.sentinel=this.stream.readByte(),String.fromCharCode(t.sentinel)){case"!":t.type="ext",this.parseExt(t);break;case",":t.type="img",this.parseImg(t);break;case";":t.type="eof",this.handler.eof&&this.handler.eof(t);break;default:throw new Error("Unknown block: 0x"+t.sentinel.toString(16))}"eof"!==t.type&&setTimeout(this.parseBlock.bind(this),0)},e.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},e}();return wm.SuperGifParser=e,wm}var Am,km,Em={};var Cm=function(){if(km)return xm;km=1,Object.defineProperty(xm,"__esModule",{value:!0});var t=Sm(),e=function(){if(Am)return Em;Am=1,Object.defineProperty(Em,"__esModule",{value:!0});var t=function(){function t(t){this.data=t,this.position=0}return t.prototype.readByte=function(){if(this.position>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.position++]:255&this.data.charCodeAt(this.position++)},t.prototype.readBytes=function(t){for(var e=[],n=0;n<t;n++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",n=0;n<t;n++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();return Em.SuperGifStream=t,Em}(),n=function(){function n(t,e){var n=this;for(var i in this.gifImgElement=t,this.options={autoPlay:!0},this.loading=!1,this.ready=!1,this.transparency=null,this.delay=null,this.disposalMethod=null,this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,this.playing=!0,this.forward=!0,this.ctxScaled=!1,this.frames=[],this.frameOffsets=[],this.initialized=!1,this.currentFrameIndex=-1,this.iterationCount=0,this.stepping=!1,this.handler={hdr:this.withProgress(this.doHdr.bind(this)),gce:this.withProgress(this.doGCE.bind(this)),com:this.withProgress(this.doNothing.bind(this)),app:{NETSCAPE:this.withProgress(this.doNothing.bind(this))},img:this.withProgress(this.doImg.bind(this)),eof:function(){n.pushFrame(),n.canvas.width=n.hdr.width*n.getCanvasScale(),n.canvas.height=n.hdr.height*n.getCanvasScale(),n.playerInit(),n.loading=!1,n.ready=!0,n.loadCallback&&n.loadCallback(n.gifImgElement)}},e)this.options[i]=e[i];this.onEndListener=e.onEnd,this.loopDelay=e.loopDelay||0,this.overrideLoopMode=null!=e.loopMode?e.loopMode:"auto",this.drawWhileLoading=null==e.drawWhileLoading||e.drawWhileLoading}return n.prototype.init=function(){var t=this.gifImgElement.parentNode,e=document.createElement("div");this.canvas=document.createElement("canvas"),this.canvasContext=this.canvas.getContext("2d"),this.tmpCanvas=document.createElement("canvas"),e.className=this.options.enclosingClass||"super-gif",e.appendChild(this.canvas),t&&(t.insertBefore(e,this.gifImgElement),t.removeChild(this.gifImgElement)),this.initialized=!0},n.prototype.loadSetup=function(t){return!this.loading&&(t&&(this.loadCallback=t),this.loading=!0,this.frames=[],this.clear(),this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,!0)},n.prototype.completeLoop=function(){this.onEndListener&&this.onEndListener(this.gifImgElement),this.iterationCount++,!1!==this.overrideLoopMode||this.iterationCount<0?this.doStep():(this.stepping=!1,this.playing=!1)},n.prototype.doStep=function(){if(this.stepping=this.playing,this.stepping){this.stepFrame(1);var t=10*this.frames[this.currentFrameIndex].delay;t||(t=100),0===this.getNextFrameNo()?(t+=this.loopDelay,setTimeout(this.completeLoop.bind(this),t)):setTimeout(this.doStep.bind(this),t)}},n.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},n.prototype.putFrame=function(){var t;this.currentFrameIndex=parseInt(this.currentFrameIndex.toString(),10),this.currentFrameIndex>this.frames.length-1&&(this.currentFrameIndex=0),this.currentFrameIndex<0&&(this.currentFrameIndex=0),t=this.frameOffsets[this.currentFrameIndex],this.tmpCanvas.getContext("2d").putImageData(this.frames[this.currentFrameIndex].data,t.x,t.y),this.canvasContext.globalCompositeOperation="copy",this.canvasContext.drawImage(this.tmpCanvas,0,0)},n.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},n.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},n.prototype.parseStream=function(e){try{new t.SuperGifParser(e,this.handler).parse()}catch(t){this.handleError("parse")}},n.prototype.setSizes=function(t,e){this.canvas.width=t*this.getCanvasScale(),this.canvas.height=e*this.getCanvasScale(),this.tmpCanvas.width=t,this.tmpCanvas.height=e,this.tmpCanvas.style.width=t+"px",this.tmpCanvas.style.height=e+"px",this.tmpCanvas.getContext("2d").setTransform(1,0,0,1,0,0)},n.prototype.drawError=function(){this.canvasContext.fillStyle="black",this.canvasContext.fillRect(0,0,this.hdr.width,this.hdr.height),this.canvasContext.strokeStyle="red",this.canvasContext.lineWidth=3,this.canvasContext.moveTo(0,0),this.canvasContext.lineTo(this.hdr.width,this.hdr.height),this.canvasContext.moveTo(0,this.hdr.height),this.canvasContext.lineTo(this.hdr.width,0),this.canvasContext.stroke()},n.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},n.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},n.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},n.prototype.pushFrame=function(){this.frame&&(this.frames.push({data:this.frame.getImageData(0,0,this.hdr.width,this.hdr.height),delay:this.delay}),this.frameOffsets.push({x:0,y:0}))},n.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var n=this.frames.length,i=t.lctFlag?t.lct:this.hdr.gct;n>0&&(3===this.lastDisposalMethod?null!==this.disposalRestoreFromIdx?this.frame.putImageData(frames[this.disposalRestoreFromIdx].data,0,0):this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height):this.disposalRestoreFromIdx=n-1,2===this.lastDisposalMethod&&this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height));var r=this.frame.getImageData(t.leftPos,t.topPos,t.width,t.height);t.pixels.forEach(function(t,n){t!==e.transparency&&(r.data[4*n+0]=i[t][0],r.data[4*n+1]=i[t][1],r.data[4*n+2]=i[t][2],r.data[4*n+3]=255)}),this.frame.putImageData(r,t.leftPos,t.topPos),this.ctxScaled||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.ctxScaled=!0),this.drawWhileLoading&&(this.canvasContext.drawImage(this.tmpCanvas,0,0),this.drawWhileLoading=this.options.autoPlay),this.lastImg=t},n.prototype.doNothing=function(){},n.prototype.withProgress=function(t){return function(e){t(e)}},n.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},n.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},n.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},n.prototype.play=function(){this.playing=!0,this.step()},n.prototype.pause=function(){this.playing=!1},n.prototype.isPlaying=function(){return this.playing},n.prototype.getCanvas=function(){return this.canvas},n.prototype.isLoading=function(){return this.loading},n.prototype.isReady=function(){return this.ready},n.prototype.isAutoPlay=function(){return this.options.autoPlay},n.prototype.getLength=function(){return this.frames.length},n.prototype.getCurrentFrame=function(){return this.currentFrameIndex},n.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},n.prototype.loadURL=function(t,n){var i=this;if(this.loadSetup(n)){var r=new XMLHttpRequest;r.open("GET",t,!0),"overrideMimeType"in r?r.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in r?r.responseType="arraybuffer":r.setRequestHeader("Accept-Charset","x-user-defined"),r.onloadstart=function(){i.initialized||i.init()},r.onload=function(){if(200===r.status){var t=r.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var n=new e.SuperGifStream(t);setTimeout(function(){i.parseStream(n)},0)}else i.handleError("xhr - response")},r.onerror=function(){i.handleError("xhr")},r.send()}},n.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},n}();return xm.SuperGif=n,xm}();const Tm={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 Pm extends bm{async oncreate_element(t){const{src:e,play:n}=this.state;this.onchangesrc(e),this.onchangeplay(n)}buildImg(){const t=this.element;if(!t)return document.createElement("img");t.replaceChildren();const e=document.createElement("img");return e.style.width="100%",e.style.height="100%",t.appendChild(e),e}onchange(t,e){super.onchange(t,e),"src"in t&&this.onchangesrc(t.src),"play"in t&&this.onchangeplay(t.play)}setElementProperties(t){}onchangeplay(t){const e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){const e=this.buildImg();t||(t="data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw=="),e.src=t,e.setAttribute("rel:animated_src",t),e.setAttribute("rel:auto_play",String(0)),this._superGif=new Cm.SuperGif(e,{autoPlay:!1}),this._superGif.init(),this.element&&Array.from(this.element.children).forEach(t=>{t.style.width="100%",t.style.height="100%"});const n=this._superGif.getCanvas();n.style.width="100%",n.style.height="100%",this._superGif.load(()=>{setTimeout(()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()},100)})}ondropfile(t,e){for(let n=0;n<t.length;n++)if(/\.gif$/.test(t[n].name))return void(this.src=e[n])}get src(){return this.getState("src")}set src(t){this.set("src",t)}get play(){return this.getState("play")}set play(t){this.setState("play",t)}get nature(){return Tm}get tagName(){return"div"}}oc.register("gif-view",Pm);const Dm={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 Om extends(lc(ac)){static get image(){return Om.IMAGE||(Om.IMAGE=new Image,Om.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5ZzAwBurHDk3WGeRY0bvYrGa1+rqNI22f7dS32ZnUK1GMr0eSK3mEc9dhKMxp+ZTo8kT2emOXS5LQ1kCxbJBocSd2k5PaIjMVzjWcdJPk9ooBnmzx1t5XbIxqBKpJ4NGTgzwKiGpK4do72gb+ZUMIYtCPm9WCPMsYTE5k2hq2ZvzujlCE1iRmwf3dvmRyKsT0T7b9I7HEPCpqCiqT2IIqaT1pI0noQZdlFC8l/PbYPAnRORT56VBEE6FXkb49agmByKhJ71BME6FsvEntUFQTdqekisUdlQWCXhovEHtUFAWbTapHYo8YgmFybO3vsUWcQYGmxSOxRbRAMprkisUfFQVKmrX18sxt7VB0ENjT1xir2qDxIwkFi3v89e+xRfxAMzfzzIfZ4hyAYDR9zwVuLPd4jCDrTwoLYGb5LEFi3/+E3rweR6urX20c/Fvls2Pvwm9mDSGIPhv8YPyGf3/eo9Ye7O8B2FIShAAooakEttex/rbODad5/yTHIAjqn505IQPv+Xz06dz+4VXORHEZcgAcB8updM8F6e25jBzwIkE07l+x8amMnPDp6nsNJ+BoZ7Q6F8egqAda9VEuRNlZjBzwYkMskdXR73okd8GBAJiKYjBcZKKqG9OiKDbgdfxJ5VhsBPDiQZhaouD3p4hfw4EAmwxisz3MSHwAPEmQ1TB1N+SmXWoAHC7JbZsWl/IxLLcCDBplNo3lrfMLsmwAPGmShAxX5/1vOEzjEz3iyfQ/hI36W4TctsUesOAifPdrQg8M++KYl95iCBkjI1r8634betBAPHZDTPFAmD3zLiHgogVTziMsahz0eIh5aIGHGRSJ2mFtHPR4iHhQIP2UvWGMf8wk74qEIEib7rLjPiBfxiAcCwp8V+Nae3uMdRhAPDIR/J5f/Q2DTcC+hIB7qIGEq3Ti9bx+sryMeAAgS70OK8G2kBD8L8QBAoLWU3g3vUVIc6D0txAMAsY+4jBWowXHO64gHBGKfYJ2T5qY1BxcL98BB+PQ+XiS9xxh9EQ8ChA6C5UXWIUoE9MBB8LVHQoS7ib8/dRn3sAcJ6bQRSdH96RDxIEH4QEX+AHF4LxHEAwUh12xyr1V8lwjiQYDYF8kuf1jluUQQDwrEvkhW8Wc6LhHUgwfhi4QPlHm7LRHawx4kpE191Dq8lgjhAYDQa1cftYrPEiE8OJDb40uqyzdQCA8WhAzL4G/PT4c3WrgHD2IfllGl53V37zsgHg5ApPNvVvq4Fn4spx4oiH1W3CwtEV+PDhEPJyBSkVX4aa7emkM83ICEKWpGM7wdvYCCeDgCEYpcwhLxczhEPFyBCEUWnRL5T6X59SBASBF+9l28TL5F7uEORCZyCUvEx+S7yT0cgoRVb9JaXLR1qUdfgksQ0fTbgmhFB20d8HAKEha14+F8f1sHPNyCiL6EqK+n20/rgIdjkFC0Ho1s6Gndvcc9ICkr/ey8/rHO6vp9KawL8DAFOV6l9Fyub7IbflsCag1qRfVsXWvxHjxIejU+BHZV6uvHD1XiEb++Bw8i+dNd+Wv0eCQmhcPhRPwUUt2DB5G1sfa1aeyzAuyJj9x2HjyIdKzIKw5SI14ieFtvo3kIQERj3lVhkUOnRD7AnjV5369QkAOJZeCH+Jh41xOLs73dQwAifY6dpxCCbjTDzLf1Bm1Y93tAIDOWXcLPvrHyr2hVoEAceEAgDQzB4jetk0/c2OXRHB48EJCpa4dgpYh2ETxtrshz7zx4ICCzfuTSDn8p/EOS9OTjwgMB+cABP3yWYuOPIofs33LigYCULlpZNXJppVU30Vf14kGAUCLijf1D71lN9FW9eFiA9KgZ8FPpPUsSnufGA+8hvAg2Kpz0nrX//qp+PIgpC3i6xJRITOye9fn1VT15ICCrVlQG5rywo0H8x965bVkNwmCYQ2kR6Gmb939WXV65dFnI/tPdjPBfO7XMN4EkTUJtqZp4sCJ1+8jwkhMu0KpMxFXFA8hlVfQSMxGH5mDK1VKV8QCyvTVtUiYyo7V358VStfGoAEFMhGYhEwloxZy9WKo2Hjwg5iSOvFDXeUYd33+PuVfHgwnEBWLocDJp+IIa2fyvperjwQRiXCKGosyXqoA+YfsIELuYu4HAt+msMknfDK4jfQJIzOZ2IPAQWJtFOhQKivR2IDZ6Awis7V0iLxqBI7uEZo19dakTogLSwKvf8yk8Jq6CGK0GKvWlatG7b7kkUU/Lo1gdXWn7/4E0j0qeJDpqN/ABqQcgJgdqURb4chjQktIugDS6wFFiz3JgaJj7AGJmholAe9YKhoZLJ0Ca6smjwJ4VwVN96gVIE5GM71kHaGKxGyAtRDaB2NBhLVmpHyANRKzDO28W7FS3HQFpaIWa8TrfCXQwegJSL5k+8M9UJ+pm9QTEnCIZrR0MDQeQ9ua0iCcYQaBTV0CqNXQW/yiyYG7W1heQanPaCkciBXuH1BkQJzHcDQxmpgGkPatl4WkbCXO/bW9AqlNg4H0PPMi6A1IxkQmOZ8D0ousNSMVEEuyreTAQ6Q7IRJeCX2YZQHhv6SrBOmpkM+YUzN0BqSRQCupmTeCP9wdkhiOREwtEzgGEsWcF9BhK9R8fQDiN7A8DiR0CKXQlj/q9IM8OgXjIzcKBlAHkD6FulgNzJwPIHwpo8mQAkX3LiPq9dKUMAQk9AqmcqmjuBAJCPQIpA4guIAsKJA0gnwNy3A4kDyBIHCEPxAwgf8gPILqA5AFEF5CxZX0lIHYc6rqADLf380BmFMgxgIzUyf8MJKLTRelKHgKy9wgkjfS7LiA0gKgC8vQn3HUA4RQ5LKPIAQciWbqIEg0YkLNDIHYUyqkCsmKN5vg3+W0AYTRATaPY+uu1IwS6UMGAlO6AFPjSCQMStaNh53cdcPG7Hx1Uupo+rx+Bltn1BuTAj5BptEV/bHAAwbnJMICwRmtUDOSEA8s4Rmtw3nITGD6TwUNoG0Ca7xi2YKSPj2eKXQFxQWKA2QbGMWEMMGseOb7C7T47uJS1JyAzVbTjqZdU3zbHzMXWS+qp4Fgn8Ahy/QCRGqQcwU1vGnN7fylboWn8Bzg//hyjxltvdcl45bwFfYKzFyBy11UU9BnjuoqfWizVlQXulpzBTNbaB5Aid+VRrkBFB630AMS9BC8FK2ggE7u/FGy1kvfcB9TKQufX5uUXNWl3EjvWCi4k/u9A3Ddq1CpTIQGe6VN1qd8ArcvDQNw3S41Kn6qQmOq5e7pRr+8fAYLiIJtFrrvYRMYL0q06vj8EZLXUriJzRY8H1xEagOCK7gkghRg6RQYO0I6aWPwIEAru80AiMWSdzAeuDXUKyr+WqpAID8hMHC1Ct8F4mUsQ6W8pJMICki0JHCBczAFdBl38G3VE6ErQhhWlih4LWrCSLpaqjggHiGe9mVjRY0YPoelyqcqIcIDEe97rqJFFH7FcLlUZEQ6Qg5plvZiBFNhtri1VFREGEC/Eg4nZoU5vqi1VFREGkIXDQ8xAIhzoT/WlKiLCAFIYPOQMxOPdjfWlKiLCADJRm3YGj+pDE2xktmmpaogwgMz8d8GrumZ4xzpbvinqISJ+hiTWm7wEqoJdI9JEV9JChAEkS3xCZzKecLcgN6YwlRBhAGmweTsblg6qKMM7Vmh321UQ4QAp1VfwhqVJIh+Wm03W0qV0EOEAybXtivkCmWrKeH2EZ/xBaSBCV2L9Re+LYSqJJIxDu1ew07U0EGEBcTtmHty4JuPtQhvLh1BAhK7Uvvq0GK484QZST0GvvFDqeSJ1IA0r2mfDljvqBoJ//rVsq7yZCA6kXgVkJ2f4ijIGMjOfMVsCBBORB2Jy+sM6ijNvaBUqmw/cStZ8EiKciHwp6Rp++88qmxXQeTUxDiJWJ9wSISvBicgXW+dypn1PqWTznlwgwdZdfiLHr5OELEAEASKvJFRE5JCPKbh8OxHdQKJU0crEzRXrJ/IEkFms6tGyrUw9kQeALFRXvK2iSzsRAAi6BLxM+60xdsqJAEBuXMAMxDLVp+gmAgC57/UT4qvVj3TVRCAgSAYL91aXtyNLzUQAIFhAiP8m0/NHOp+ILiBtPFKrs6bgSOcT0QTEB8nO3QR1yKslggKRf+m11UB0HOl8IlqAeCvauXuo8HnfIqIDyCw6G8XMcGiplMingMzCnbuHFp/3LSLPA4nUpqm5YkWNzwsQeQxIDsKjH5wVSU5qJPIJIIt4jjpqNBAekQeBfJOeHWS81FQoo4/I7UDcS3wUh0liTzLqiEgDqddx4ZHDrNZAACIAEMw88HPYWb0GAhABgEDmgf9Vb5oNBCByOxD3uqWYbCHVBgIQuRlIsbfwMEG5gQBE7gSyHMDsOayrxJvHBRC5B0hOxJH1nK4SlUE6QOR+IG6ju3iYQEqDdIDIzUDyZu/jMRHpS/OiRG4FkiPRfTw8kbrvIAJEACAIDpyHC1/GQHhEbgKSXwTyqIeEur6kixEBgABHOTr7YSX1MSFAhA0E307wUU76Y0KACAsI/tvCRzkF+iIuL0AEAYLbR2QOfvhKJ/obRESBxNt5rPSFXN4f7dyNdqMgEIbhAXWwJErT/e7/Wreb5HTT07QVgWSAeW5g7b4n8qOSUCRPEId4HP93SXp5dDNGRJFcQTxihSH+NW1Bb1cXKpIryJAwnG/zhl8ZcSP6jiKZghwRaaWLnP/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="),Om.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}async ready(){super.ready(),this._audio=new Audio;const{src:t="",loop:e=!1,started:n=!1}=this.state;if(t){const e=this.root?.app?.loadTracker;if(e){const n=new Promise((e,n)=>{this._audio.addEventListener("canplay",()=>e(),{once:!0}),this._audio.addEventListener("error",()=>n(new Error(`Audio load failed: ${t}`)),{once:!0})});e.track(`audio:${t}`,"audio",t,n)}}this._audio.addEventListener("canplay",()=>{this.started&&this._audio.play()}),this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(n)}render(t){const{left:e,top:n,width:i,height:r}=this.state;t.beginPath(),this.drawImage(t,Om.image,e,n,i,r)}get nature(){return Dm}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 Fi(t)}}onchangeStarted(t){const e=this._audio;t?4==e.readyState&&e.play():e.pause()}onchangeLoop(t){this._audio.loop=t}onchange(t,e){"src"in t&&this.onchangeSrc(t.src),"started"in t&&this.onchangeStarted(t.started),"loop"in t&&this.onchangeLoop(t.loop)}ondblclick(t){this.started=!this.started}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("audio/"))return void(this.src=e[n])}}oc.register("audio",Om);class zm extends(lc(oc)){is3dish(){return!0}}oc.register("text",zm);const Im=["refid","left","top","width","height","rotation","animation","zPos"];class Rm extends Lg{isGroup(){return!0}is3dish(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});const n=Im.reduce((e,n)=>(t.hasOwnProperty(n)&&(e[n]=t[n]),e),{});return super.set(n,void 0)}capture(t,e,n){const i=super.capture(t,e,n);if(i!==this)return i}set bounds(t){if(this.__MUTATING__)return void(super.bounds=t);const e=this.bounds,n=t.width/e.width,i=t.height/e.height;this.path=this.path.map(r=>({x:t.left+(r.x-e.left)*n,y:t.top+(r.y-e.top)*i})),this.components&&this.components.forEach(t=>{if(t.mutable)t.mutatePath(null,function(t){return t.map(function(t){return{x:t.x*n,y:t.y*i}})});else{const e=t.bounds,r=t.center,s={x:r.x*(1-n),y:r.y*(1-i)},o=e.width*(1-n),a=e.height*(1-i),c=-(s.x-o/2),l=-(s.y-a/2);t.bounds={left:e.left+c,top:e.top+l,width:e.width*n,height:e.height*i}}})}get focusible(){return!1}get bounds(){return super.bounds}get hasTextProperty(){return!1}isIdentifiable(){return!1}calculateBounds(){this.clearCache(),this.__MUTATING__=!0,this.mutateBounds(function(t){const e=oc.union(this.components.map(t=>t.bounds));return this.components.forEach(t=>{const n=t.bounds;t.bounds={left:n.left-e.left,top:n.top-e.top,width:n.width,height:n.height}}),{left:t.left+e.left,top:t.top+e.top,width:e.width,height:e.height}},this),this.__MUTATING__=!1,this.parent.isGroup()&&this.parent.calculateBounds?.()}render(t){}postrender(t){const{top:e,left:n}=this.state;t.translate(n,e),this.layout.drawables(this).forEach(e=>{e.draw(t)}),t.translate(-n,-e)}}oc.memoize(Rm.prototype,"bounds",!0),oc.register("group",Rm);const Lm={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 jm extends(lc(ac)){get ref(){const t=this.getState("ref");return t&&"string"==typeof t?this.root.findById?.(t):null}set ref(t){this.setState("ref",t)}get refScale(){const t=this.ref;if(!t)return{x:1,y:1};const e=t.bounds,n=this.bounds,i=n.width/e.width,r=n.height/e.height;return"both"===this.model.fit?{x:i,y:r}:{x:Math.min(i,r),y:Math.min(i,r)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){const e=this.ref.center,n=this.center,i=this.refScale;t.translate(n.x,n.y),t.scale(i.x,i.y),t.translate(-e.x,-e.y)}}postrender(t){if(this.ref)return this.ref.postrender(t);super.postrender(t)}render(t){if(this.ref)return this.ref.render(t);const{left:e,top:n,width:i,height:r}=this.bounds;t.beginPath(),t.rect(e,n,i,r)}get nature(){return Lm}get hasTextProperty(){return!1}}oc.memoize(jm.prototype,"ref",!1),oc.memoize(jm.prototype,"refScale",!1),oc.register("local-ref",jm);class Fm extends(Dg(fl)){render(t){}is3dish(){return!0}get layout(){return gc.get(this.get("layout"))||mc}}const Nm={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 Hm extends Fm{dispose(){this._releaseRef(),super.dispose()}get nature(){return Nm}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){const{mode:e="view",round:n=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=n+"px"}async ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();const t=this._element_bounds,{offsetWidth:e,offsetHeight:n}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:n},(!t||t.offsetWidth!=e||t.offsetHeight!=n)&&this.ref&&this.root.target_element){const{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();const{ref:t,fit:e="ratio"}=this.state;if(!t)return;const n=this.app.refProvider;if(n&&t){const i=(async()=>{this.__ref=await n.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data})();this.root?.app?.loadTracker?.track(`ref:${t}`,"ref-board",t,i);try{await i}catch(t){Fi(t)}}}get ref(){return this.__ref}set ref(t){this.setState("ref",t)}_releaseRef(){this.__ref&&this.__ref.release&&this.__ref.release(),delete this.__ref}onchange(t,e,n){super.onchange(t,e),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame(()=>{const{fit:t}=this.state;this.ref.fit(t)}),"data"in t&&this.ref&&requestAnimationFrame(()=>{this.ref.data=t.data})}}oc.register("global-ref",Hm);const Bm="center-middle",Ym={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",Bm,"right-middle","left-bottom","center-bottom","right-bottom","auto"]}},{type:"string",label:"title",name:"text"},{type:"data",label:"value",name:"value"},{type:"string",label:"container-ref",name:"containerRef",placeholder:"PopupContainer id (same board)"},{type:"textarea",label:"html-template",name:"htmlTemplate",property:{language:"html"}},{type:"string",label:"anchor-ref",name:"anchorRef",placeholder:"component id (3D-tracked anchor)"},{type:"select",label:"anchor-pin",name:"anchorPin",property:{options:[{display:"Top",value:"top"},{display:"Center",value:"center"},{display:"Bottom",value:"bottom"}]}},{type:"number",label:"anchor-offset-x",name:"anchorOffsetX"},{type:"number",label:"anchor-offset-y",name:"anchorOffsetY"},{type:"number",label:"anchor-offset-z",name:"anchorOffsetZ"},{type:"checkbox",label:"constant-size",name:"constantSize"},{type:"checkbox",label:"tether",name:"tether"},{type:"select",label:"off-screen",name:"offScreen",property:{options:[{display:"Hide",value:"hide"},{display:"Edge-pin",value:"edge-pin"},{display:"Keep last",value:"keep-last"}]}}],help:"scene/component/popup"};class Gm extends(lc(ac)){static get image(){return Gm._image||(Gm._image=new Image,Gm._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjAgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkM4QzQxNUMzMzBEMTFFQ0JEMzZDMDUwQUI4MEI3QTAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkM4QzQxNUQzMzBEMTFFQ0JEMzZDMDUwQUI4MEI3QTAiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpENjlENTQ3RjMzMDkxMUVDQkQzNkMwNTBBQjgwQjdBMCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpENjlENTQ4MDMzMDkxMUVDQkQzNkMwNTBBQjgwQjdBMCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PsiUYSQAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA51BMVEVHcEwzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzOguTm2AAAATHRSTlMARhB73r9B7YLrsqdE+0cq9Avzeg31eQx4aQ+Ks6aUd5DsYKixEX1w8vyT2VjoZ3YezY/cCEDvl+QTvRwJ0ifwK/5T/aw6+IuFuCImAcS6MQAAAeJJREFUWMPt2FlX2zAQhuHJYmOSFhIggbC0QNn3rS1dKXSH9///Hi58CJLxKIpEWi6YO8c5z4lG/nxGEXmu/1OVLGnhrFaSVQYg1SZetTTvUibqeFZ9QlfmvRWoV1VmCaCRzroXPpsuAjTV7gLUfPahBqD1OQMW/fazAWTKvQRI/ZgUSJR7U8CM/dHZ+/2VcatWdvdEZAaYUhiAwkerJXt0rnzXwdRKmHfDM0fHD5kxjTFyVLzVfvvirn7+cDJWjhy7c7XlYuwc6Urvu2tRhRypyhwAf1sKY+TIxfQA+H39q5wxc+RgVrcBduTmZTlj5khnDgH4IzKpMGaOVCbvyyvRGTNHGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Gm._image}async ready(){await super.ready(),this.show&&this.onchangeShow(!0)}render(t){const{left:e,top:n,width:i,height:r}=this.bounds;t.beginPath(),this.drawImage(t,Gm.image,e,n,i,r)}onchange(t,e){"value"in t?this.show?this.onchangeShow(!0):this.show=!0:"show"in t&&this.onchangeShow(this.show)}onchangeShow(t){if(this.app.isEditMode)return;(this.getState("board")||this.getState("containerRef")||this.getState("htmlTemplate"))&&(t?this.openPopup(this.value):this.hidePopup())}openPopup(t,e){if(this.app.isEditMode)return;const n=this.getState("anchorRef"),i=n&&this.rootModel?.findById?this.rootModel.findById(n):void 0;ou.show(this,this.getState("board"),{origin:this.getState("origin")||Bm,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,containerRef:this.getState("containerRef"),htmlTemplate:this.getState("htmlTemplate"),anchor:i,anchorPin:this.getState("anchorPin")||"top",anchorOffsetX:this.getState("anchorOffsetX")??0,anchorOffsetY:this.getState("anchorOffsetY")??0,anchorOffsetZ:this.getState("anchorOffsetZ")??0,constantSize:this.getState("constantSize")??!0,tether:this.getState("tether")??!1,offScreen:this.getState("offScreen")||"hide",...e})}hidePopup(){ou.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 Ym}}oc.register("popup",Gm);const Vm={mutable:!1,resizable:!0,rotatable:!1,properties:[{type:"layout",label:"layout",name:"layoutOption"},{type:"checkbox",label:"constant-size",name:"constantSize"},{type:"checkbox",label:"billboard",name:"billboard"},{type:"checkbox",label:"tether",name:"tether"},{type:"select",label:"off-screen",name:"offScreen",property:{options:[{display:"Hide",value:"hide"},{display:"Edge-pin",value:"edge-pin"},{display:"Keep last",value:"keep-last"}]}}],help:"scene/component/popup-container"};class Um extends Lg{get nature(){return Vm}isPopupContainer(){return!0}}oc.register("popup-container",Um);class $m extends oc{render(t){const{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),this.drawStroke(t,void 0)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let i=!1;return n.forEach((r,s)=>{const o=(s+n.length+1)%n.length,a=r.x,c=r.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(i=!i)}),i}}oc.register("path",$m);const Wm={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 Xm extends ac{is3dish(){return!0}contains(t,e){const{x1:n,y1:i,x2:r,y2:s,x3:o,y3:a}=this.state,c=[n,i,r,s,o,a];let l=!1;for(let n=0;n<c.length;n+=2){const i=(n+2)%c.length,r=c[n],s=c[n+1],o=c[i+1];s>e!=o>e&&t<(c[i]-r)*(e-s)/(o-s)+r&&(l=!l)}return l}get mutable(){return!0}get path(){const{x1:t,y1:e,x2:n,y2:i,x3:r,y3:s}=this.state;return[{x:t,y:e},{x:n,y:i},{x:r,y:s}]}set path(t){this.set({x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y,x3:t[2].x,y3:t[2].y})}get nature(){return Wm}}oc.memoize(Xm.prototype,"path",!1),oc.register("triangle",Xm);const qm={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"},Km={ondragmove:function(t,e,n){let{cx:i,rx:r}=n.model;r=Math.abs(r);let s=(n.fromParent(t.x,t.y).x-i)/r*100;s=s>=100||s<=-100?100:Math.abs(s),n.set({ratio:s})}};class Qm extends Zg{is3dish(){return!0}render(t){let{ratio:e=50,cx:n,cy:i,rx:r,ry:s,startAngle:o,endAngle:a,anticlockwise:c}=this.state;r=Math.abs(r),s=Math.abs(s),t.beginPath(),t.ellipse(n,i,r,s,0,o||0,a||2*Math.PI,c),t.moveTo(n+r/100*e,i),t.ellipse(n,i,r/100*e,s/100*e,0,o||0,a||2*Math.PI,!0)}contains(t,e){let{cx:n,cy:i,rx:r,ry:s,ratio:o}=this.state;r=Math.abs(r),s=Math.abs(s);const a=(t-n)/(2*r-.5),c=(e-i)/(2*s-.5),l=(t-n)/(r/100*o*2-.5),h=(e-i)/(s/100*o*2-.5);let d=!1;return a*a+c*c<.25&&l*l+h*h>.25&&(d=!d),d}get controls(){let{cx:t,cy:e,rx:n,ratio:i}=this.state;return n=Math.abs(n),[{x:t+n/100*i,y:e,handler:Km}]}get nature(){return qm}}oc.memoize(Qm.prototype,"controls",!1),oc.register("donut",Qm);const Zm={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"},Jm={ondragmove:function(t,e,n){const{cy:i,ry:r}=n.model;let s=(n.fromParent(t.x,t.y).y-i)/r*100+100;s>=100?s=100:s<=0&&(s=0),n.set({ratio:s})}};class ty extends Zg{is3dish(){return!0}render(t){const{ratio:e=30,wing:n=5,cx:i,cy:r,rx:s,ry:o}=this.state;if(n<3)return;const a=1.5707963267948966,c=2*Math.PI/n,l=s-e/100*s,h=o-e/100*o;t.save(),t.beginPath(),t.translate(i,r),t.moveTo(s*Math.cos(-a),o*Math.sin(-a)),t.lineTo((s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let e=1;e<n;e++)t.lineTo(s*Math.cos(c*e-a),o*Math.sin(c*e-a)),t.lineTo((s-l)*(Math.cos(c*(e+1)-a)+Math.cos(c*e-a))/2,(o-h)*(Math.sin(c*(e+1)-a)+Math.sin(c*e-a))/2);t.closePath(),t.restore()}get controls(){const{cx:t,cy:e,ry:n,ratio:i}=this.state;return[{x:t,y:e-n+n*(i/100),handler:Jm}]}get nature(){return Zm}}oc.memoize(ty.prototype,"controls",!1),oc.register("star",ty);const ey={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class ny extends(Lp(ac)){is3dish(){return!1}isDescendible(){return!1}render(t){const{cx:e,cy:n,anticlockwise:i}=this.state,r=this.app?.scale||1;t.beginPath(),t.scale(1/r,1/r),t.ellipse(e,n,Math.abs(ny.RADIUS),Math.abs(ny.RADIUS),0,0,2*Math.PI,i),t.scale(r,r),t.closePath()}get path(){const{cx:t,cy:e}=this.state;return[{x:t-ny.RADIUS,y:e-ny.RADIUS},{x:t+ny.RADIUS,y:e-ny.RADIUS},{x:t+ny.RADIUS,y:e+ny.RADIUS},{x:t-ny.RADIUS,y:e+ny.RADIUS}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:i}=this.state,r=(t-n)/(2*ny.RADIUS-.5),s=(e-i)/(2*ny.RADIUS-.5);return r*r+s*s<.25}outline(t){const{cx:e,cy:n}=this.state;return this.toScene(e,n)}get nature(){return ey}}ny.RADIUS=5,oc.memoize(ny.prototype,"path",!1),oc.register("node",ny);class iy extends md{getObject3dInstance(){return new w.Mesh}build(){super.build();const{width:t,height:e}=this.component.bounds,n=this.component.state.depth||.5*Math.min(t,e),i=.15*Math.min(t,e,n),r=new v.RoundedBoxGeometry(1,1,1,4,i/Math.min(t,e,n));r.scale(t,n,e),this.object3d.geometry=r,this.object3d.material=new w.MeshStandardMaterial({color:"#5090d0",transparent:!0,opacity:.35,roughness:.6,metalness:.1,side:w.FrontSide,depthWrite:!1}),this.object3d.visible=!!this.component.app?.isEditMode}updateAlpha(){const t=this.object3d.material;t&&(t.opacity=this.component.app?.isEditMode?.35:0)}updateHidden(){this.object3d.visible=!!this.component.app?.isEditMode&&!this.component.state.hidden}updateDimension(){const{width:t,height:e}=this.component.bounds,n=this.component.state.depth||.5*Math.min(t,e);this.object3d.geometry.computeBoundingBox();const i=this.object3d.geometry.boundingBox;if(i){const r=i.max.x-i.min.x,s=i.max.y-i.min.y,o=i.max.z-i.min.z;this.object3d.scale.set(t/r,n/s,e/o)}}updateFillStyle(){}updateStrokeStyle(){}updateText(){}clear(){return rd(this.object3d),super.clear()}}const ry="data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="#5090d0">\n <path d="M32 20a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm0 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12z"/>\n <path d="M55.4 27.2l-3.6-.6c-.4-1.2-.8-2.4-1.4-3.4l2.2-3c.6-.8.4-2-.2-2.6l-3-3c-.8-.6-1.8-.8-2.6-.2l-3 2.2c-1.2-.6-2.2-1-3.4-1.4l-.6-3.6c-.2-1-1-1.6-2-1.6h-4.2c-1 0-1.8.6-2 1.6l-.6 3.6c-1.2.4-2.4.8-3.4 1.4l-3-2.2c-.8-.6-2-.4-2.6.2l-3 3c-.6.8-.8 1.8-.2 2.6l2.2 3c-.6 1.2-1 2.2-1.4 3.4l-3.6.6c-1 .2-1.6 1-1.6 2v4.2c0 1 .6 1.8 1.6 2l3.6.6c.4 1.2.8 2.4 1.4 3.4l-2.2 3c-.6.8-.4 2 .2 2.6l3 3c.8.6 1.8.8 2.6.2l3-2.2c1.2.6 2.2 1 3.4 1.4l.6 3.6c.2 1 1 1.6 2 1.6h4.2c1 0 1.8-.6 2-1.6l.6-3.6c1.2-.4 2.4-.8 3.4-1.4l3 2.2c.8.6 2 .4 2.6-.2l3-3c.6-.8.8-1.8.2-2.6l-2.2-3c.6-1.2 1-2.2 1.4-3.4l3.6-.6c1-.2 1.6-1 1.6-2v-4.2c0-1-.6-1.8-1.6-2z"/>\n</svg>');class sy extends(lc(oc)){static get icon(){return sy._defaultIcon||(sy._defaultIcon=new Image,sy._defaultIcon.src=ry),sy._defaultIcon}get serviceName(){}get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new iy(this)}render(t){if(this.app?.isViewMode)return;const{left:e,top:n,width:i,height:r}=this.bounds,s=this.constructor.icon;t.beginPath(),t.globalAlpha=.6,this.drawImage(t,s,e,n,i,r),t.globalAlpha=1}added(t){super.added(t);const e=this.serviceName;e&&(this._registeredRoot=this.root,this._registeredRoot?.registerService?.(e,this))}removed(t){const e=this.serviceName;e&&this._registeredRoot&&(this._registeredRoot.unregisterService?.(e),this._registeredRoot=void 0),super.removed(t)}get controls(){return[]}}function oy(t){return class extends t{animOnValueChange(t,e=!1,n){if(t==this._lastValue)return;if(this.root?.app?.suppressAnimations)return this._lastValue=t,this._anim_alpha=0,void this.invalidate();let i;i=e?t-(Number(n)||0):t-(this._lastValue||0),this._lastValue=t,this._anim_alpha=-i,this.animate({step:t=>{this._anim_alpha=i*(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=Ss(this.getState("value"),this,void 0)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(ci(t)))}}}function ay(t){return class extends t{_convertDataFormat(t,e){let n;if("json"===e)n=JSON.parse(t);else n=t;return n}isDataSource(){return!0}}}function cy(t){var e;return(e=class extends t{is3dish(){return!0}get hasTextProperty(){return!1}get capturable(){return!1}render(t){}}).raycastTargetDefault=!1,e}const ly="$base_url",hy=[{type:"gltf-preset",label:"preset",name:"preset"},{type:"gltf-selector",label:"url",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:ly,defaultStorage:"3d-model",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0,category:"application"},observe:function(t){const e=this.parentNode?.querySelector("[name=gltfInfo]");e&&(e.src=t);const n=this.parentNode?.querySelector("[name=fillStyleTargets]");n&&(n.src=t);const i=this.parentNode?.querySelector("[name=playTargets]");i&&(i.src=t)}},{type:"gltf-info",label:"",name:"gltfInfo",readonly:!0,property:{action:(t,e)=>{t._ratioLocking=!0;try{t.set(e)}finally{t._ratioLocking=!1}}},editor:{fullwidth:!0}},{type:"gltf-fill-targets",label:"fill-targets",name:"fillStyleTargets",editor:{fullwidth:!0}},{type:"gltf-play-targets",label:"play-targets",name:"playTargets",editor:{fullwidth:!0}}];function dy(t){return class extends t{constructor(){super(...arguments),this._snapshotLoading=!1,this._ratioLocking=!1}is3dish(){return!0}get hasTextProperty(){return!1}get controls(){return[]}render(t){const{left:e,top:n,width:i,height:r}=this.bounds;t.beginPath();const s=this._topViewSnapshot;if(s)return void t.drawImage(s,e,n,i,r);this._ensureTopViewSnapshot(),t.rect(e,n,i,r),t.fillStyle="#f0f0f0",t.fill(),t.strokeStyle="#999",t.lineWidth=1,t.stroke();const o=this.getState("src"),a=o&&o.split("/").pop()?.replace(/\.[^.]+$/,"")||"GLTF",c=Math.max(10,.12*Math.min(i,r));t.fillStyle="#666",t.font=`${c}px sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillText(a,e+i/2,n+r/2,.9*i)}onchange(t,e){super.onchange?.(t,e),"src"in t&&(this._topViewSnapshot=void 0)}_ensureTopViewSnapshot(){if(this._snapshotLoading)return;const t=this.getState("src");if(!t)return;const e=xd.getTopViewCache(t);if(e)return this._topViewSnapshot=e,void this.invalidate();this._snapshotLoading=!0;const n=this.app.url(t);xd.loadGLTF(n).then(e=>{if(this._snapshotLoading=!1,this.getState("src")!==t)return;const n=xd.getTopViewCache(t);if(n)return this._topViewSnapshot=n,void this.invalidate();const i=xd.renderTopView(e.scene);xd.setTopViewCache(t,i),this._topViewSnapshot=i,this.invalidate()}).catch(()=>{this._snapshotLoading=!1})}buildRealObject(){return new xd(this)}get source(){return this.getState("src")}set source(t){this.setState("src",t)}get play(){return!1!==this.getState("play")}set play(t){this.setState("play",t)}get nodes(){return this.getState("nodes")}set nodes(t){this.setState("nodes",t)}get animations(){return this.getState("animations")}set animations(t){this.setState("animations",t)}get playTargets(){return this.getState("playTargets")}set playTargets(t){this.setState("playTargets",t)}get fillStyleTargets(){return this.getState("fillStyleTargets")}set fillStyleTargets(t){this.setState("fillStyleTargets",t)}get nodeNames(){const t=this.realObject;return t?.nodeNames??[]}get animationNames(){const t=this.realObject;return t?.animationNames??[]}set dimension(t){const{width:e=1,height:n=1,depth:i=1}=t;this.setState({width:e,height:n,depth:i}),this.realObject?.updateDimension()}_applyRatioLock(t){if(!("width"in t||"height"in t||"depth"in t))return t;const e=this.state.width||1,n=this.state.height||1,i=this.state.depth||1,r=hp([(t.width??e)/e,(t.height??n)/n,(t.depth??i)/i]);return r?{...t,width:Math.round(e*r),height:Math.round(n*r),depth:Math.round(i*r)}:t}set(t,e){if("string"==typeof t&&(t={[t]:e}),this.state?.ratioLock&&!this._ratioLocking){this._ratioLocking=!0;try{t=this._applyRatioLock(t)}finally{}}try{return super.set(t)}finally{this._ratioLocking=!1}}setState(t,e){if("string"==typeof t&&(t={[t]:e}),this.state?.ratioLock&&!this._ratioLocking){this._ratioLocking=!0;try{t=this._applyRatioLock(t)}finally{}}try{return super.setState(t)}finally{this._ratioLocking=!1}}}}function uy(t){return function(e){return Array.isArray(t)?t.forEach(t=>{oc.register(t,e)}):oc.register(t,e),e}}const py={x:0,y:0,z:0,w:1};function fy(t){const e=t/2;return{x:0,y:Math.sin(e),z:0,w:Math.cos(e)}}function gy(t,e){const n=t.rotation,i=e.rotation,r=e.position,s=n.w*r.x+n.y*r.z-n.z*r.y,o=n.w*r.y+n.z*r.x-n.x*r.z,a=n.w*r.z+n.x*r.y-n.y*r.x,c=-n.x*r.x-n.y*r.y-n.z*r.z,l=s*n.w+c*-n.x+o*-n.z-a*-n.y,h=o*n.w+c*-n.y+a*-n.x-s*-n.z,d=a*n.w+c*-n.z+s*-n.y-o*-n.x,u={x:n.w*i.x+n.x*i.w+n.y*i.z-n.z*i.y,y:n.w*i.y-n.x*i.z+n.y*i.w+n.z*i.x,z:n.w*i.z+n.x*i.y-n.y*i.x+n.z*i.w,w:n.w*i.w-n.x*i.x-n.y*i.y-n.z*i.z};return{position:{x:t.position.x+l,y:t.position.y+h,z:t.position.z+d},rotation:u}}const my={east:{axis:{x:1,y:0,z:0},yaw:0,idSuffix:"east"},west:{axis:{x:-1,y:0,z:0},yaw:Math.PI,idSuffix:"west"},south:{axis:{x:0,y:0,z:1},yaw:-Math.PI/2,idSuffix:"south"},north:{axis:{x:0,y:0,z:-1},yaw:Math.PI/2,idSuffix:"north"}};function yy(t){const{carrierWorld:e,width:n,depth:i,entryHeight:r,approachDistance:s,sides:o,toolType:a,tolerance:c,priority:l}=t,h=n/2,d=i/2;return o.map(t=>{const n=my[t],i="string"==typeof a?a:a[t]??"unknown",o={position:{x:n.axis.x*("east"===t||"west"===t?h:0),y:r,z:n.axis.z*("north"===t||"south"===t?d:0)},rotation:fy(n.yaw)},u={position:{x:o.position.x+n.axis.x*s,y:r,z:o.position.z+n.axis.z*s},rotation:fy(n.yaw)};return{id:`entry-${n.idSuffix}`,toolType:i,approach:gy(e,u),engage:gy(e,o),tolerance:c,priority:l}})}function by(t){const{carrierWorld:e,topY:n,approachDistance:i,toolType:r,tolerance:s,priority:o,id:a}=t,c={position:{x:0,y:n,z:0},rotation:{...py}};return{id:a??"top",toolType:r,approach:gy(e,{position:{x:0,y:n+i,z:0},rotation:{...py}}),engage:gy(e,c),tolerance:s,priority:o}}function _y(t,e){return t.filter(t=>t.toolType===e.toolType)}function vy(t,e){if(0===t.length)return null;const n=t.map(t=>{const n=t.approach.position.x-e.x,i=t.approach.position.y-e.y,r=t.approach.position.z-e.z;return{f:t,dist:Math.sqrt(n*n+i*i+r*r)}});return n.sort((t,e)=>{const n=t.f.priority??0,i=e.f.priority??0;return n!==i?n-i:t.dist-e.dist}),n[0].f}class xy{positionAt(t,e,n){return 0!==t?null:e.localPosition??{x:0,y:0,z:0}}capacity(t){return 1}}const wy=new xy;class My{constructor(t){this.owner=t}positionAt(t,e,n,i){if(0!==t)return null;const r=this.owner?.state?.width??0,s=this.owner?.state?.height??0,o=i?.state?.width??0,a=i?.state?.height??0;return{x:Math.max(0,(r-o)/2),y:Math.max(0,(s-a)/2),z:0}}capacity(t){return t.maxCount??1}}function Sy(t){return{id:t?.state?.id??t?.id??t?.refid,type:t?.state?.type??t?.type}}const Ay=new w.Euler,ky="_transferSlotId";function Ey(t){return class extends t{get slots(){return[]}get arrangementStrategy(){return wy}canReceive(t){const e=null!==this.findSlot(t);return zd.log({role:"target",contract:"canReceive",component:this,args:{carrier:Sy(t)},result:e}),e}findSlot(t){const e=this.slots;if(!e.length)return zd.log({role:"target",contract:"findSlot",component:this,args:{carrier:Sy(t)},result:null}),null;for(const n of e){if(n.allowedTypes?.length){const e=t?.state?.type??t?.type;if(!e||!n.allowedTypes.includes(e))continue}const e=n.maxCount??this.arrangementStrategy.capacity(n),i=this._countOccupied(n.id);if(!(i>=e))return zd.log({role:"target",contract:"findSlot",component:this,args:{carrier:Sy(t)},result:{slotId:n.id,occupied:i,max:e}}),n}return zd.log({role:"target",contract:"findSlot",component:this,args:{carrier:Sy(t)},result:null}),null}async receive(t,e={}){zd.log({role:"target",contract:"receive:enter",component:this,args:{carrier:Sy(t),options:e}});const n=this.findSlot(t);if(!n){zd.log({role:"target",contract:"receive:reject",component:this,args:{carrier:Sy(t)},result:{reason:"no-slot"}}),this.trigger("transfer-rejected",{type:"transfer-rejected",component:t,container:this,reason:"no-slot"});const e=new Error("receive rejected: no-slot");throw e.reason="no-slot",e}const i=this._countOccupied(n.id),r=this.arrangementStrategy.positionAt(i,n,i,t);zd.log({role:"target",contract:"arrangementStrategy.positionAt",component:this,args:{idx:i,slotId:n.id,occupantCount:i,carrier:Sy(t)},result:r}),t[ky]=n.id;const s=t._realObject;let o,a;s?.object3d&&(s.object3d.updateWorldMatrix(!0,!1),o=new w.Vector3,a=new w.Quaternion,s.object3d.getWorldPosition(o),s.object3d.getWorldQuaternion(a));const{animated:c=!1,duration:l,ease:h}=e;this.reparent?.(t,{animated:c,duration:l,ease:h}),!c&&t._realObject&&(t._realObject.suppressTransform=!1);{const e=this._realObject?.receivingSurfaceY??0,i={};if(r&&(i.left=r.x,i.top=r.y),0!==e)i.zPos=0;else if(n.localPosition&&Number.isFinite(n.localPosition.z)){const t=this._realObject?.geometricOffsetY??0;i.zPos=n.localPosition.z+t}const s=this.acceptanceRotation?.(t,n);zd.log({role:"target",contract:"acceptanceRotation",component:this,args:{carrier:Sy(t),slotId:n.id},result:s}),s&&(Ay.setFromQuaternion(new w.Quaternion(s.x,s.y,s.z,s.w),"XYZ"),i.rotationX=Ay.x,i.rotation=-Ay.y,i.rotationY=Ay.z);const o=this.normalizePose?.(t,n);"function"==typeof this.normalizePose&&zd.log({role:"target",contract:"normalizePose",component:this,args:{carrier:Sy(t),slotId:n.id},result:o}),o&&Object.assign(i,o),Object.keys(i).length&&(t.setState?.(i),zd.log({role:"target",contract:"receive:setState",component:this,args:{carrier:Sy(t),keys:Object.keys(i)}}))}this.trigger("transfer-received",{type:"transfer-received",component:t,container:this,slotId:n.id,preReceiveWorldPos:o,preReceiveWorldQuat:a}),zd.log({role:"target",contract:"receive:done",component:this,args:{carrier:Sy(t),slotId:n.id}})}async dispatch(t,e,n={}){const i=new jd({source:this,target:e,carrier:t,options:n,physical:async()=>{delete t[ky]}}),r=await i.execute();"rolled-back"!==r.phase?this.trigger("transfer-dispatched",{type:"transfer-dispatched",component:t,container:this,target:e}):this.trigger("transfer-rejected",{type:"transfer-rejected",component:t,container:this,reason:r.rejectReason??"rejected"})}route(t){return null}resolveRoute(t,e){}rejectRoute(t,e="rejected"){this.trigger("transfer-rejected",{type:"transfer-rejected",component:t,container:this,reason:e})}acceptanceRotation(t,e){}canAccept(t){const e=(()=>{const e=this.slots;if(!e.length)return{ok:!1,reason:"no-slots-defined"};const n=this.findSlot(t);if(!n){const n=t?.state?.type??t?.type;for(const t of e)if(!t.allowedTypes?.length||!n||t.allowedTypes.includes(n))return{ok:!1,reason:"all-slots-full"};return{ok:!1,reason:"type-not-accepted"}}return{ok:!0,slot:n}})();return zd.log({role:"target",contract:"canAccept",component:this,args:{carrier:Sy(t)},result:e.ok?{ok:!0,slotId:e.slot.id}:{ok:!1,reason:e.reason}}),e}accept(t,e){return this.receive(t,e)}deliveryWorldRotation(t){const e=this.acceptanceRotation?.(t);if(!e)return;const n=this._realObject?.object3d;if(!n)return;n.updateWorldMatrix(!0,!1);const i=new w.Quaternion;n.getWorldQuaternion(i);const r=new w.Quaternion(e.x,e.y,e.z,e.w);return i.clone().multiply(r)}deliveryWorldPosition(t){const e=this._realObject,n=e?.object3d;if(!n)return;n.updateWorldMatrix(!0,!1);const i=new w.Vector3;n.getWorldPosition(i);const r=e.receivingSurfaceY;if("number"==typeof r&&0!==r){const t=r-(e.geometricOffsetY??0),s=new w.Vector3(0,t,0);return n.localToWorld(s),{x:i.x,y:s.y,z:i.z}}return{x:i.x,y:i.y,z:i.z}}attachPointFor(t){const e=t?.[ky];if(!e)return null;const n=this.slots.find(t=>t.id===e);return n?{position:n.localPosition??{x:0,y:0,z:0},rotation:n.localRotation??{x:0,y:0,z:0},slotId:n.id}:null}_countOccupied(t){const e=this.components;return e?e.filter(e=>e.parent===this&&e[ky]===t).length:0}}}function Cy(t){if(!t||"object"!=typeof t)return!1;const e=t;return"function"==typeof e.canReserveAtJoinPoint&&"function"==typeof e.reserveAtJoinPoint&&"function"==typeof e.commitReservation&&"function"==typeof e.releaseReservation&&e.carrierMap instanceof Map}function Ty(t){if(!t||"object"!=typeof t)return!1;const e=t;return"function"==typeof e.slotAt&&"function"==typeof e.findFreeSlot&&"function"==typeof e.findSlotsWithSKU&&"function"==typeof e.reservePut&&"function"==typeof e.reservePick&&"function"==typeof e.commitReservation&&"function"==typeof e.releaseReservation&&e.slots instanceof Map}function Py(t){return`${t.level}.${t.bay}.${t.depth}`}function Dy(t){const e=t.split(".");if(3!==e.length)return null;const[n,i,r]=e.map(t=>Number.parseInt(t,10));return Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(r)?{level:n,bay:i,depth:r}:null}let Oy=1;function zy(t,e){return t.startSimMs<e.endSimMs&&e.startSimMs<t.endSimMs}const Iy={resolveConflict:(t,e)=>t.priority!==e.priority?t.priority<e.priority?"b-yields":"a-yields":t.id<e.id?"b-yields":"a-yields"};class Ry{constructor(t=Iy){this._byResource=new Map,this._byReserver=new Map,this._listeners=new Set,this._conflictLog=[],this._maxConflictLog=1e3,this._yieldPolicy=t}add(t){const e={...t,id:"res-"+Oy++},n=(this._byResource.get(e.resource)??[]).filter(t=>zy(t.timeWindow,e.timeWindow));if(0===n.length)return this._insert(e),this._emit({kind:"added",reservation:e}),{ok:!0,reservation:e};const i=n.map(t=>{const n=this._yieldPolicy.resolveConflict(e,t);return{a:e,b:t,decision:n}}),r=i.every(t=>"b-yields"===t.decision);if(r){const i=n.slice();for(const t of i)this._remove(t),this._emit({kind:"evicted",reservation:t,by:e});return this._insert(e),this._emit({kind:"added",reservation:e}),this._appendConflictLog({simTime:e.timeWindow.startSimMs,resource:e.resource,proposed:t,existing:i,outcome:"preempted"}),{ok:"preempted",reservation:e,evicted:i}}return this._appendConflictLog({simTime:e.timeWindow.startSimMs,resource:e.resource,proposed:t,existing:n.slice(),outcome:"rejected"}),{ok:!1,conflicts:i}}conflictLog(){return[...this._conflictLog]}setMaxConflictLog(t){this._maxConflictLog=Math.max(1,t)}_appendConflictLog(t){this._conflictLog.push(t),this._conflictLog.length>this._maxConflictLog&&this._conflictLog.shift()}conflicts(t,e){return(this._byResource.get(t)??[]).filter(t=>zy(t.timeWindow,e))}release(t){this._remove(t)&&this._emit({kind:"released",reservation:t})}releaseAllOf(t){const e=(this._byReserver.get(t)??[]).slice();for(const t of e)this._remove(t),this._emit({kind:"released",reservation:t});return e}forResource(t){return[...this._byResource.get(t)??[]]}forReserver(t){return[...this._byReserver.get(t)??[]]}all(){const t=[];for(const e of this._byResource.values())t.push(...e);return t}clear(){this._byResource.clear(),this._byReserver.clear(),this._conflictLog.length=0}subscribe(t){return this._listeners.add(t),()=>{this._listeners.delete(t)}}_insert(t){let e=this._byResource.get(t.resource);e||(e=[],this._byResource.set(t.resource,e));const n=e.findIndex(e=>e.timeWindow.startSimMs>t.timeWindow.startSimMs);n<0?e.push(t):e.splice(n,0,t);let i=this._byReserver.get(t.reserverId);i||(i=[],this._byReserver.set(t.reserverId,i)),i.push(t)}_remove(t){const e=this._byResource.get(t.resource);if(!e)return!1;const n=e.findIndex(e=>e.id===t.id);if(n<0)return!1;e.splice(n,1),0===e.length&&this._byResource.delete(t.resource);const i=this._byReserver.get(t.reserverId);if(i){const e=i.findIndex(e=>e.id===t.id);e>=0&&i.splice(e,1),0===i.length&&this._byReserver.delete(t.reserverId)}return!0}_emit(t){this._listeners.forEach(e=>e(t))}}const Ly=new Ry;"undefined"!=typeof globalThis&&(globalThis.__THINGS_SCENE_RESERVATION_TABLE__=Ly);class jy{constructor(){this.nodes=new Map,this.edges=new Map,this.laneEndpoints=new Map}addNode(t){this.nodes.has(t.id)||(this.nodes.set(t.id,t),this.edges.set(t.id,[]))}addEdge(t){const e=this.edges.get(t.fromNode);if(!e)throw new Error(`NavGraph.addEdge: source node not found: ${t.fromNode}`);if(!this.nodes.has(t.toNode))throw new Error(`NavGraph.addEdge: target node not found: ${t.toNode}`);e.push(t)}edgesFrom(t){return this.edges.get(t)??[]}findNearestNode(t){let e=null,n=1/0;for(const i of this.nodes.values()){const r=Fy(i.position,t);r<n&&(n=r,e=i)}return e}}function Fy(t,e){const n=t.x-e.x,i=t.y-e.y,r=t.z-e.z;return n*n+i*i+r*r}function Ny(t,e){return Math.sqrt(Fy(t,e))}function Hy(t,e,n={}){const i=new jy,r=n.defaultSpeed??100;for(const e of t){const t=e.geometry.centerPoints;if(t.length<2)continue;const n=`${e.id}:start`,s=`${e.id}:end`;i.addNode({id:n,position:t[0],type:"lane-start"}),i.addNode({id:s,position:t[t.length-1],type:"lane-end"}),i.laneEndpoints.set(e.id,{startNodeId:n,endNodeId:s});let o=0;for(let e=1;e<t.length;e++)o+=Ny(t[e-1],t[e]);const a=o/(e.speedLimit??r)*1e3;i.addEdge({fromNode:n,toNode:s,resource:e.id,distance:o,durationMs:a,forward:!0}),"twoway"===e.direction&&i.addEdge({fromNode:s,toNode:n,resource:e.id,distance:o,durationMs:a,forward:!1})}for(const t of e){if(t.lanes.length<2)continue;const e=[];for(const n of t.lanes){const r=i.laneEndpoints.get(n);if(!r)continue;const s=i.nodes.get(r.startNodeId).position,o=i.nodes.get(r.endNodeId).position;let a=0,c=0,l=0;for(const e of t.lanes){if(e===n)continue;const t=i.laneEndpoints.get(e);if(!t)continue;const r=i.nodes.get(t.startNodeId).position,h=i.nodes.get(t.endNodeId).position;a+=Math.min(Fy(s,r),Fy(s,h)),c+=Math.min(Fy(o,r),Fy(o,h)),l++}if(0===l)continue;const h=a<c?r.startNodeId:r.endNodeId;e.push({laneId:n,nodeId:h,pos:i.nodes.get(h).position})}for(let n=0;n<e.length;n++)for(let r=0;r<e.length;r++){if(n===r)continue;const s=e[n],o=e[r],a=Ny(s.pos,o.pos);i.addEdge({fromNode:s.nodeId,toNode:o.nodeId,resource:t.id,distance:a,durationMs:t.crossingTimeMs,forward:!0})}}return i}function By(t,e,n,i={}){const r=t.nodes.get(e),s=t.nodes.get(n);if(!r||!s)return null;const o=i.speed?.max??100,a=e=>{const n=function(t,e){return Math.sqrt(function(t,e){const n=t.x-e.x,i=t.y-e.y,r=t.z-e.z;return n*n+i*i+r*r}(t,e))}(t.nodes.get(e).position,s.position);return n/o*1e3},c=new Map,l=new Set,h=new Set,d={nodeId:e,gScore:0,fScore:a(e)};c.set(e,d),l.add(e);const u=i.startSimMs??0,p=i.deadlineSimMs;for(;l.size>0;){let e=null,i=null;for(const t of l){const n=c.get(t);(!i||n.fScore<i.fScore||n.fScore===i.fScore&&t<e)&&(i=n,e=t)}if(!i||!e)return null;if(e===n){const t=[];let e=i,n=0;for(;e&&e.cameFromEdge;){const i=e.cameFromEdge,r=u+(e.gScore-i.durationMs);t.unshift({resource:i.resource,timeWindow:{startSimMs:r,endSimMs:r+i.durationMs},fromPos:i.fromPos,toPos:i.toPos}),n+=i.distance,e=c.get(i.fromNodeId)}const r=i.gScore;return void 0!==p&&u+r>p?null:{segments:t,totalDurationMs:r,totalDistance:n}}l.delete(e),h.add(e);for(const n of t.edgesFrom(e)){if(h.has(n.toNode))continue;const e=i.gScore+n.durationMs,r=c.get(n.toNode);if(!r||e<r.gScore){const i=t.nodes.get(n.fromNode),r=t.nodes.get(n.toNode),s={nodeId:n.toNode,gScore:e,fScore:e+a(n.toNode),cameFromEdge:{fromNodeId:n.fromNode,resource:n.resource,distance:n.distance,durationMs:n.durationMs,fromPos:i.position,toPos:r.position}};c.set(n.toNode,s),l.add(n.toNode)}}}return null}function Yy(t,e,n=0,i){return t.segments.map(t=>({resource:t.resource,timeWindow:t.timeWindow,reserverId:e,priority:n,metadata:i}))}const Gy={closed:!0,round:0,divisions:24};class Vy{constructor(t,e){this.points=t,this.closed=e;const n=[0];for(let e=1;e<t.length;e++){const i=t[e].x-t[e-1].x,r=t[e].y-t[e-1].y;n.push(n[e-1]+Math.sqrt(i*i+r*r))}this.cumulative=n,this.length=n[n.length-1]??0}sample(t){const e=this.length;if(0===this.points.length)return{x:0,y:0,theta:0};if(0===e)return{x:this.points[0].x,y:this.points[0].y,theta:0};let n=t;this.closed?n=(t%e+e)%e:n<0?n=0:n>e&&(n=e);const i=this.cumulative;let r=0,s=i.length-2;for(;r<s;){const t=r+s>>1;i[t+1]<=n?r=t+1:s=t}const o=i[r+1]-i[r],a=o>0?(n-i[r])/o:0,c=this.points[r],l=this.points[r+1],h=l.x-c.x,d=l.y-c.y;return{x:c.x+h*a,y:c.y+d*a,theta:0===h&&0===d?0:Math.atan2(d,h)}}}function Uy(t,e={}){const n={...Gy,...e},i=t.length;if(0===i)return new Vy([],n.closed);if(1===i)return new Vy([{x:t[0].x,y:t[0].y}],n.closed);const r=[],s=(t,e)=>{if(r.length>0){const n=r[r.length-1];if(Math.abs(n.x-t)<1e-9&&Math.abs(n.y-e)<1e-9)return}r.push({x:t,y:e})},o=(n.closed,i);for(let e=0;e<o;e++){const r=0===e?n.closed?i-1:-1:e-1,o=e===i-1?n.closed?0:-1:e+1,a=r>=0?t[r]:null,c=t[e],l=o>=0?t[o]:null;if(a&&a.x===c.x&&a.y===c.y)continue;const h=a&&l?Os(c,n.round):0;let d,u,p,f;if(a){const t=Math.sqrt((a.x-c.x)**2+(a.y-c.y)**2),e=0!==t?Math.atan2(a.x-c.x,a.y-c.y):0,n=Math.min(h,t/2);d=Math.sin(e)*n+c.x,u=Math.cos(e)*n+c.y}else d=c.x,u=c.y;if(l){const t=Math.sqrt((l.x-c.x)**2+(l.y-c.y)**2),e=0!==t?Math.atan2(l.x-c.x,l.y-c.y):0,n=Math.min(h,t/2);p=Math.sin(e)*n+c.x,f=Math.cos(e)*n+c.y}else p=c.x,f=c.y;if(s(d,u),h>0&&a&&l)for(let t=1;t<=n.divisions;t++){const e=t/n.divisions,i=1-e;s(i*i*d+2*i*e*c.x+e*e*p,i*i*u+2*i*e*c.y+e*e*f)}else d===p&&u===f||s(p,f);if(l&&Cs(c)){const t=Os(l,n.round),e=Math.sqrt((c.x-l.x)**2+(c.y-l.y)**2),i=0!==e?Math.atan2(c.x-l.x,c.y-l.y):0,r=Math.min(t,e/2),o=Ts({x:p,y:f},{x:Math.sin(i)*r+l.x,y:Math.cos(i)*r+l.y},c.bulge);if(o){let t=o.endAngle-o.startAngle;if(o.clockwise)for(;t>0;)t-=2*Math.PI;else for(;t<0;)t+=2*Math.PI;for(let e=1;e<=n.divisions;e++){const i=e/n.divisions,r=o.startAngle+t*i;s(o.cx+o.radius*Math.cos(r),o.cy+o.radius*Math.sin(r))}}}}if(n.closed&&r.length>0){const t=r[0],e=r[r.length-1];(Math.abs(e.x-t.x)>1e-9||Math.abs(e.y-t.y)>1e-9)&&r.push({x:t.x,y:t.y})}return new Vy(r,n.closed)}function $y(t,e){return Uy(t,e).length}const Wy=new w.Vector3,Xy=new w.Quaternion,qy=new w.Matrix4,Ky=new w.Vector3;class Qy{constructor(t,e){t instanceof w.Vector3?this.position=t.clone():this.position=t?new w.Vector3(t.x,t.y,t.z):new w.Vector3,e instanceof w.Quaternion?this.rotation=e.clone():this.rotation=e?new w.Quaternion(e.x,e.y,e.z,e.w):new w.Quaternion}compose(t){const e=Wy.copy(t.position).applyQuaternion(this.rotation).add(this.position),n=Xy.copy(this.rotation).multiply(t.rotation);return new Qy(e,n)}inverse(){const t=Xy.copy(this.rotation).invert(),e=Wy.copy(this.position).applyQuaternion(t).negate();return new Qy(e,t)}transformPoint(t){return t.clone().applyQuaternion(this.rotation).add(this.position)}transformPose(t){return this.compose(t)}toMatrix4(t){const e=t??new w.Matrix4;return e.compose(this.position,this.rotation,Ky.set(1,1,1)),e}static fromMatrix4(t){const e=new w.Vector3,n=new w.Quaternion,i=new w.Vector3;return t.decompose(e,n,i),new Qy(e,n)}static fromObject3D(t,e=!1){if(e){const e=new w.Vector3,n=new w.Quaternion,i=new w.Vector3;return qy.copy(t.matrixWorld).decompose(e,n,i),new Qy(e,n)}return new Qy(t.position,t.quaternion)}applyToObject3D(t){t.position.copy(this.position),t.quaternion.copy(this.rotation)}static identity(){return new Qy}equals(t,e=1e-9){if(Math.abs(this.position.x-t.position.x)>e)return!1;if(Math.abs(this.position.y-t.position.y)>e)return!1;if(Math.abs(this.position.z-t.position.z)>e)return!1;const n=this.rotation.x*t.rotation.x+this.rotation.y*t.rotation.y+this.rotation.z*t.rotation.z+this.rotation.w*t.rotation.w;return 1-Math.abs(n)<e}clone(){return new Qy(this.position,this.rotation)}toJSON(){return{position:{x:this.position.x,y:this.position.y,z:this.position.z},rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z,w:this.rotation.w}}}static fromJSON(t){return new Qy(t.position,t.rotation)}}const Zy=new w.Euler,Jy=new w.Vector3,tb=new w.Quaternion,eb=new w.Vector3;function nb(t){const e=t._realObject;if(e?.position&&e?.rotation){const t=e.position,n=e.rotation,i=(new w.Quaternion).setFromEuler(Zy.set(n.x,n.y,n.z,"XYZ"));return new Qy(new w.Vector3(t.x,t.y,t.z),i)}const n=t.center??{x:0,y:0},i=t.parent?.bounds??{width:0,height:0},r=("function"==typeof t.delta?t.delta():null)??{tx:0,ty:0},s=t.state??{},o=(n.x??0)+(r.tx??0)-(i.width??0)/2,a=(n.y??0)+(r.ty??0)-(i.height??0)/2,c=s.rotation??0,l=s.rotationX??0,h=s.rotationY??0,d=(new w.Quaternion).setFromEuler(Zy.set(l,-c,h,"XYZ"));return new Qy(new w.Vector3(o,0,a),d)}function ib(t){const e=t._realObject?.object3d;if(e)return e.updateWorldMatrix(!0,!1),e.matrixWorld.decompose(Jy,tb,eb),new Qy(Jy,tb);let n=nb(t),i=t.parent;for(;i&&!i.isRootModel?.();)n=nb(i).compose(n),i=i.parent;return n}function rb(t,e){const n=t.parent?.bounds??{width:0,height:0},i=("function"==typeof t.delta?t.delta():null)??{tx:0,ty:0,tz:0},r=t._realObject,s=e.position.x-(i.tx??0)+(n.width??0)/2,o=e.position.z-(i.ty??0)+(n.height??0)/2,a=t.bounds??{width:0,height:0},c={left:s-a.width/2,top:o-a.height/2};if(r){const n=r.syncZPosOffset??0,s=t.parent?._realObject,o=s?.geometricOffsetY??0,a=s?.receivingSurfaceY??0;c.zPos=e.position.y-(i.tz??0)-n+o-a}Zy.setFromQuaternion(e.rotation,"XYZ"),c.rotationX=Zy.x,c.rotation=-Zy.y,c.rotationY=Zy.z,"function"==typeof t.setState?t.setState(c):"function"==typeof t.set&&t.set(c)}function sb(t,e){const n=t.parent;if(!n||n.isRootModel?.())return void rb(t,e);rb(t,ib(n).inverse().compose(e))}function ob(t){return t?/forklift|agv|amr|oht|tugger|worker/i.test(t)?"mobile":/conveyor|sorter|induct|chute|belt/i.test(t)?"flow":/rack|shelf|stocker|cell/i.test(t)?"cell":/pallet|box|parcel|crate|drum|tray/i.test(t)?"atomic":/robot[-_]?arm|crane|lift/i.test(t)?"articulated":/spawn[-_]?point|sink[-_]?point/i.test(t)?"boundary":"":""}function ab(t){const e=[];let n=t.parent;for(;n&&!n.isRootModel?.();){const t=n.state?.id??n.constructor?.name;t&&e.unshift(t),n=n.parent}return e.join(" › ")}function cb(t,e=!0){const n=t.constructor?.name??t.state?.type??"Component",i={type:n,id:t.state?.id??`?${t._id??Math.random().toString(36).slice(2,7)}`,category:ob(n),parentId:t.parent?.state?.id,parentPath:ab(t)},r=t._realObject?.object3d;if(r){r.updateWorldMatrix?.(!0,!1);const t=r.matrixWorld?.elements;t&&(i.pose={position:{x:t[12],y:t[13],z:t[14]},rotation:{x:0,y:0,z:0,w:1}})}if(!0===t.isCarriable&&(i.isCarriable=!0),!0===t.isMover&&(i.isMover=!0),"function"!=typeof t.canReceive&&"function"!=typeof t.canAccept||(i.isHolder=!0),"function"==typeof t.pickupFrames)try{i.isPickable=t.pickupFrames().length>0}catch{i.isPickable=!1}if("string"==typeof t.toolType||"function"==typeof t.toolType?i.toolType="function"==typeof t.toolType?t.toolType():t.toolType:void 0!==t.toolType&&(i.toolType=String(t.toolType)),t.state&&"object"==typeof t.state){const e={};for(const[n,i]of Object.entries(t.state))"string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i&&null!==i||(e[n]=i);i.state=e}if(e){const e=t.components??[];i.childIds=e.map(t=>t.state?.id).filter(Boolean)}return i}function lb(t){function e(t,n){if(!t)return;n.push(cb(t));const i=t.components??[];for(const t of i)e(t,n)}function n(t,e){if(!e)return null;if(e.state?.id===t)return e;const i=e.components??[];for(const e of i){const i=n(t,e);if(i)return i}return null}return{version:"0.1.0",collectComponents(){const n=[];return e(t?.rootModel??t,n),n},getComponent(e){const i=n(e,t?.rootModel??t);if(!i)return null;const r={...cb(i)};if("function"==typeof i.pickupFrames)try{r.pickupFrames=i.pickupFrames()}catch{}if("object"==typeof i.slots)try{r.slots=Array.isArray(i.slots)?i.slots:"function"==typeof i.slots?i.slots():[]}catch{}if("function"==typeof i.acceptanceRotation)try{r.acceptanceWorldQuat=i.deliveryWorldRotation?.(null)??void 0}catch{}if("function"==typeof i.deliveryWorldPosition)try{r.deliveryWorldPosition=i.deliveryWorldPosition(null)}catch{}return r},simStatus(){let e=0;const n=[t?.rootModel??t];for(;n.length>0;){const t=n.pop();if(!t)continue;!0===t.isCarriable&&e++;const i=t.components??[];for(const t of i)n.push(t)}return{simTime:us.now,realTime:"undefined"!=typeof performance?performance.now():Date.now(),speed:us.speed,paused:us.isPaused,carrierCount:e}},transferLog:()=>({entries:Fd.toJSON(),stats:Fd.stats()}),reservations(){const t=[...Ly.all()],e={},n={};for(const i of t)(e[i.resource]??=[]).push(i),(n[i.reserverId]??=[]).push(i);for(const t of Object.values(e))t.sort((t,e)=>t.timeWindow.startSimMs-e.timeWindow.startSimMs);for(const t of Object.values(n))t.sort((t,e)=>t.timeWindow.startSimMs-e.timeWindow.startSimMs);return{simTime:us.now,all:t,byResource:e,byReserver:n}},conflicts(){const t=Ly.conflictLog(),e={},n={};let i=0,r=0;for(const s of t)e[s.resource]=(e[s.resource]??0)+1,n[s.proposed.reserverId]=(n[s.proposed.reserverId]??0)+1,"rejected"===s.outcome?i++:r++;return{simTime:us.now,log:[...t],total:t.length,rejected:i,preempted:r,byResource:e,byReserver:n}}}}function hb(t){const e=lb(t);return"undefined"!=typeof window&&(window.__SCENE_INSPECTOR__=e),e}let db=0;const ub=new FinalizationRegistry(()=>{db--});class pb{static get residents(){return db}static get residentsCount(){return db}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,db++,ub.register(this,db)}dispose(){if(this.disposer)for(const t in this.references)this.disposer(t,this.references[t]);this.references={},this.counters={}}get ids(){return Object.keys(this.references)}create(t){return new Promise((e,n)=>{this.creator?this.creator(t,n=>{n.release=()=>{this.disposer?.(t,n),delete n.release,Hi("RELEASED",t)},e(n)},n):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))})}add(t,e){const n=new Promise((n,i)=>{const r=this.references[t];if(r)r===e?i(Error("Reference ID and target duplicate")):e?i(Error("Reference ID duplicate")):n(r);else{const r=e=>{e.release=()=>{this.release(e)},this.references[t]=e,this.counters[t]=1,n(e)};if(e)r(e);else{if(!this.creator)return void i(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));this.creator(t,r,i)}}});return this.references[t]||(this.references[t]=n),n}async get(t,e=!1){let n=this.references[t];if(n){if(!(n instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,n}if(e)return n=await n,this.counters[t]++,n}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(const e in this.references){if(this.references[e]===t)return e}}release(t){const e=this._id(t);if(!e)return void Fi("No Referenced ID");const n=this.references[e];n&&(this.counters[e]--,0==this.counters[e]&&(this.disposer?.(e,n),delete this.references[e],delete this.counters[e],delete t.release,Hi("RELEASED",e)))}}const fb={},gb={};let mb=[];function yb(t){const e=t.target,n="SCRIPT"===e.tagName?fb:gb,i=e.src||e.href;n[i]=!0,mb.forEach((t,e)=>{if(!t)return;const{resolve:r,scripts:s,styles:o}=t;if(n===fb){const t=s.indexOf(i);t>-1&&t<s.length-1&&_b(s[t+1])}s.some(t=>!fb[t])||o?.some(t=>!gb[t])||(r(),mb[e]=null)}),mb=mb.filter(Boolean)}function bb(t){if("string"==typeof t)return;const e=t.target,n=e.src,i="SCRIPT"===e.tagName?fb:gb;mb.forEach((e,r)=>{if(!e)return;const{reject:s,scripts:o,styles:a}=e;(i===fb&&o.includes(n)||i===gb&&!!a?.includes(n))&&(s(t),mb[r]=null)}),mb=mb.filter(Boolean),delete i[n],document.head.removeChild(e)}function _b(t){fb[t]=!1;const e=document.createElement("script");e.onload=yb,e.onerror=bb,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class vb{static load(t,e){const n="string"==typeof t?[t]:t,i="string"==typeof e?[e]:e;return new Promise(function(t,e){if(n&&!Array.isArray(n)||i&&!Array.isArray(i))return void e(new Error("invalid sources for load"));let r,s=!0;if(i?.forEach(t=>{t in gb||function(t){gb[t]=!1;const e=document.createElement("link");e.onload=yb,e.onerror=bb,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),gb[t]||(s=!1)}),n&&n.length>0)for(const t of n)t in fb?fb[t]||(s=!1):r??=t;if(r)_b(r);else if(s)return void t();mb.push({resolve:t,reject:e,scripts:n,styles:i})})}}const xb="0.0.0";function wb(t){if(!(t>0))return 1;let e=0;if(!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function Mb(t){const{lineWidth:e=0}=t.state;let{width:n,height:i}=t.bounds;n+=e,i+=e;const r=wb(2*n),s=wb(2*i),o=Du(r,s),a=new w.CanvasTexture(o);return Sb(o,t,2),a.needsUpdate=!0,a.wrapS=w.RepeatWrapping,a.wrapT=w.RepeatWrapping,a.offset.set(0,1-2*i/s),a.repeat.set(2*n/r,2*i/s),a.magFilter=w.NearestFilter,a.minFilter=w.LinearFilter,a.colorSpace=w.SRGBColorSpace,a}function Sb(t,e,n){const{lineWidth:i=0}=e.state;let{left:r,top:s}=e.bounds;r-=i/2,s-=i/2;const o=t.getContext("2d");o.scale(n,n),o.translate(-r,-s),e.render(o),e.postrender(o)}function Ab(t,e,n=2){const i=t.getContext("2d");i&&(i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,t.width,t.height),Sb(t,e,n))}const kb=new Set(["cx","cy","cz","zPos","left","top","width","height","depth","lineWidth","rotationX","rotationY","rotation","scale","hidden","alpha","material3d","screenFixed"]);class Eb extends md{get syncZPosOffset(){return this.effectiveDepth}get geometricOffsetY(){return this.effectiveDepth}constructor(t){super(t),this._origInvalidate=t.invalidate.bind(t),t.invalidate=()=>{this._origInvalidate(),this._refreshTextureNow()}}getObject3dInstance(){return new w.Mesh}build(){super.build();const{width:t,height:e}=this.component.bounds;if(!t||!e)return;const n=Hh(this.component.state.material3d),i=new w.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const r=Mb(this.component),s=new w.MeshStandardMaterial({map:r});Gh(s,n),s.transparent=!0,this.object3d.material=s,this.object3d.castShadow=n.castShadow,this.object3d.receiveShadow=n.receiveShadow}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Kh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}_debouncedRebuild(){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=void 0,this._rebuildTexture()},100)}_rebuildTexture(){this.clear(),this.build(),this.updateTransform(),this.updateDimension(),this.updateHidden()}_refreshTextureNow(){const t=this.object3d.material,e=t?.map;if(!e)return;const n=e.source?.data;n&&(Ab(n,this.component,2),e.needsUpdate=!0)}updateFillStyle(){this._debouncedRebuild()}updateStrokeStyle(){this._debouncedRebuild()}updateText(){this._debouncedRebuild()}onchange(t,e){super.onchange(t,e);for(const e of Object.keys(t))if(!kb.has(e)){this._debouncedRebuild();break}}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=Hh(this.component.state.material3d);Gh(t,e),t.transparent=!0,this.object3d.castShadow=e.castShadow,this.object3d.receiveShadow=e.receiveShadow}clear(){return this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),rd(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),this._origInvalidate&&(this.component.invalidate=this._origInvalidate,this._origInvalidate=void 0),super.dispose()}}class Cb extends md{getObject3dInstance(){return new w.Mesh}build(){super.build(),this.buildGeometry(),this.buildMaterial()}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Kh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=md.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(Qh(t)):e.opacity=0)}updateStrokeStyle(){const t=this.object3d.getObjectByName("__edgeLines__");t&&(this.object3d.remove(t),rd(t));const{strokeStyle:e}=this.component.state;if(!e||"transparent"===e||"none"===e)return;const n=this.object3d.geometry;if(!n?.getAttribute("position"))return;const i=new w.EdgesGeometry(n),r=new w.LineBasicMaterial({color:e}),s=new w.LineSegments(i,r);s.name="__edgeLines__",this.object3d.add(s)}updateDimension(){const{width:t,height:e}=this.component.bounds,{depth:n=1}=this.component.state;if(!this.object3d)return;this.object3d.geometry.computeBoundingBox();const i=this.object3d.geometry.boundingBox;if(i){const r=i.max.x-i.min.x,s=i.max.y-i.min.y,o=i.max.z-i.min.z;this.object3d.scale.set(t/r,n/s,e/o)}}buildMaterial(){const t=Hh(this.component.state.material3d),e=new w.MeshStandardMaterial({transparent:!0});Gh(e,t),this.object3d.material=e}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;t&&Gh(t,Hh(this.component.state.material3d))}clear(){return rd(this.object3d),super.clear()}}function Tb(t,e,n,i){return[["bold",t],["italic",e],[n+"px",!0],[i,!0]].filter(t=>t[1]).map(t=>t[0]).join(" ")}function Pb(t){let e=0;if(!((t=Math.abs(t)||1)&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function Db(t,e,n){const{bold:i=!1,italic:r=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",textAlign:c="center",textBaseline:l="middle",width:h=t.width,height:d=t.height,offsetX:u=0,offsetY:p=0}=n||{},f=t.getContext("2d");let g,m;f.imageSmoothingEnabled=!1,f.fillStyle=a,f.strokeStyle=a,f.font=Tb(i,r,o,s),"left"===c||"start"===c?(f.textAlign="left",g=u):"right"===c||"end"===c?(f.textAlign="right",g=u+h):(f.textAlign="center",g=u+h/2);const y=1.2*o,b=String(e).split("\n"),_=y*b.length;m="top"===l||"hanging"===l?p+.1*o:"bottom"===l||"alphabetic"===l?p+d-_+.1*o:p+(d-_)/2+.1*o,f.textBaseline="top";for(const t of b)f.fillText(t,g,m),m+=y}function Ob(t,e,n,i){const r=Pb(2*e),s=Pb(2*n),o=Du(r,s),a=o.getContext("2d"),{fillStyle:c}=i||{};if(c&&"object"==typeof c&&c.colorStops?.length){const t=sd(c,2*e,2*n);t&&a.drawImage(t,0,0)}a.scale(2,2),"string"==typeof c&&""!==c&&"transparent"!==c&&(a.fillStyle=c,a.fillRect(0,0,e,n)),Db(o,t,i);const l=new w.CanvasTexture(o);return l.needsUpdate=!0,l.wrapS=w.RepeatWrapping,l.wrapT=w.RepeatWrapping,l.offset.set(0,1-2*n/s),l.repeat.set(2*e/r,2*n/s),l.minFilter=w.LinearFilter,l.colorSpace=w.SRGBColorSpace,l}function zb(t,e,n,i,r,s,o){const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const t=2*n,c=2*i,l=Pb(t),h=Pb(c),d=Du(l,h),u=d.getContext("2d");if(s.color&&(u.fillStyle=s.color,u.fillRect(0,0,t,c)),s.fitPattern)u.drawImage(a,0,0,t,c);else{const e=2*(s.width||a.naturalWidth),n=2*(s.height||a.naturalHeight),i=2*(s.offsetX||0),r=2*(s.offsetY||0);let o=0,l=0;switch(s.align){case"center":o=(t-e)/2,l=(c-n)/2;break;case"left-top":break;case"left-bottom":l=c-n;break;case"right-top":o=t-e;break;case"right-bottom":o=t-e,l=c-n;break;case"left":l=(c-n)/2;break;case"right":o=t-e,l=(c-n)/2;break;case"top":o=(t-e)/2;break;case"bottom":o=(t-e)/2,l=c-n}const h=i+o,d=r+l;if(s.noRepeat)u.drawImage(a,0,0,a.naturalWidth,a.naturalHeight,h,d,e,n);else{u.save(),u.rect(0,0,t,c),u.clip();const i=h>0?h-Math.ceil(h/e)*e:h;for(let r=d>0?d-Math.ceil(d/n)*n:d;r<c;r+=n)for(let s=i;s<t;s+=e)u.drawImage(a,0,0,a.naturalWidth,a.naturalHeight,s,r,e,n);u.restore()}}e&&(u.scale(2,2),Db(d,e,r));const p=new w.CanvasTexture(d);p.needsUpdate=!0,p.wrapS=w.RepeatWrapping,p.wrapT=w.RepeatWrapping,p.offset.set(0,1-c/h),p.repeat.set(t/l,c/h),p.minFilter=w.LinearFilter,p.colorSpace=w.SRGBColorSpace,o(p)},a.onerror=()=>{const t=Ob(e,n,i,r);o(t)},a.src=t}function Ib(t,e){let{bold:n=!1,italic:i=!1,fontFamily:r="Serif",fontSize:s=10,lineHeight:o="normal"}=e||{};t=void 0===t||""==t?" ":String(t);const a=document.createElement("span");a.style.font=Tb(n,i,s,r),a.style.lineHeight=String(o),a.style.whiteSpace="pre",a.style.position="absolute",a.textContent=t,document.body.appendChild(a);const c=a.getBoundingClientRect();return document.body.removeChild(a),{width:c.width,height:c.height}}class Rb extends Cb{get zPriority(){return hd.DECAL}get syncZPosOffset(){return this.effectiveDepth}get geometricOffsetY(){return this.effectiveDepth}buildGeometry(){this.updateDimension()}updateStrokeStyle(){}updateFillStyle(){this.updateText()}updateDimension(){const{width:t,height:e}=this.component.state,n=Math.abs(t)||1,i=Math.abs(e)||1;this.object3d.geometry&&this.object3d.geometry.dispose();const r=new w.PlaneGeometry(n,i);r.rotateX(-Math.PI/2),this.object3d.geometry=r}updateText(){const t=this.object3d.material;if(!t)return;const{width:e,height:n,bold:i=!1,italic:r=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",textAlign:c="center",textBaseline:l="middle",fillStyle:h}=this.component.state,d=Math.abs(e)||1,u=Math.abs(n)||1,p=this.component.text,f=h&&"none"!==h?h:"transparent",g={bold:i,italic:r,fontFamily:s,fontSize:o,fontColor:a,textAlign:c,textBaseline:l,width:d,height:u,fillStyle:f};if("object"==typeof f&&"pattern"===f?.type&&f.image){return void zb(this.component.app.url(h.image),p,d,u,g,h,e=>{t.map&&t.map.dispose(),t.map=e,t.color.set(16777215),t.needsUpdate=!0})}const m=Ob(p,d,u,g);m?(t.map&&t.map.dispose(),t.map=m,t.color.set(16777215),m.needsUpdate=!0):"string"==typeof h&&(""!==h&&"transparent"!==h?t.color.set(Qh(h)):t.opacity=0)}updateAlpha(){const{alpha:t=1}=this.component.state,e=this.object3d.material;e.opacity=t,e.transparent=!0}}Bu("text",t=>new Rb(t));const Lb={input:"css3d",select:"css3d",textarea:"css3d",button:"css3d",iframe:"css3d",video:"css3d",label:"texture",table:"texture",progress:"texture"};function jb(t){const e=t.model?.type??"";return"texture"===(Lb[e]??"css3d")?new Eb(t):new Fu(t)}Bu("html-overlay-element",jb),Bu("html-overlay-container",jb);class Fb{setShape({extrudedShape:t,extrudedOptions:e}){this.extrudedShape=t,this.bb=new w.Box2,this.bb.setFromPoints(this.extrudedShape?.extractPoints(0).shape),this.extrudedOptions=e}generateTopUV(t,e,n,i,r){const s=e[3*n],o=e[3*n+1],a=e[3*i],c=e[3*i+1],l=e[3*r],h=e[3*r+1],d=this.bb,u=d.max.x-d.min.x,p=d.max.y-d.min.y;return[new w.Vector2((s-d.min.x)/u,1-(o-d.min.y)/p),new w.Vector2((a-d.min.x)/u,1-(c-d.min.y)/p),new w.Vector2((l-d.min.x)/u,1-(h-d.min.y)/p)]}generateSideWallUV(t,e,n,i,r,s){const o=e[3*n],a=e[3*n+1],c=e[3*n+2],l=e[3*i],h=e[3*i+1],d=e[3*i+2],u=e[3*r],p=e[3*r+1],f=e[3*r+2],g=e[3*s],m=e[3*s+1],y=e[3*s+2],b=this.extrudedOptions?.depth||100,_=this.bb,v=_.max.x-_.min.x,x=_.max.y-_.min.y;return Math.abs(a-h)<.01?[new w.Vector2(o/v,1-c/b),new w.Vector2(l/v,1-d/b),new w.Vector2(u/v,1-f/b),new w.Vector2(g/v,1-y/b)]:[new w.Vector2(a/x,1-c/b),new w.Vector2(h/x,1-d/b),new w.Vector2(p/x,1-f/b),new w.Vector2(m/x,1-y/b)]}}class Nb extends md{clear(){return this._mesh=void 0,super.clear()}get shape(){return null}get boundUVGenerator(){return this._boundUVGenerator||(this._boundUVGenerator=new Fb),this._boundUVGenerator}build(){super.build();const t=this.effectiveDepth,e=this.shape;if(!e)return;const n=this.boundUVGenerator;n&&n.setShape({extrudedShape:e,extrudedOptions:{depth:t}});const i=this.createGeometry(e),r=this.createMaterials();this._mesh=new w.Mesh(i,r),this._mesh.rotation.x=-Math.PI/2,this._mesh.rotation.y=-Math.PI,this._mesh.rotation.z=-Math.PI,this._mesh.castShadow=!0,this.object3d.add(this._mesh),this.updateFillStyle(),this.updateStrokeStyle()}createGeometry(t){const e=this.effectiveDepth,{lineWidth:n=0}=this.component.state,i={steps:1,depth:e,bevelEnabled:n>0,bevelThickness:0,bevelSize:n,bevelSegments:1,UVGenerator:this.boundUVGenerator},r=new w.ExtrudeGeometry(t,i);return r.center(),r}createMaterials(){const t=Hh(this.component.state.material3d),e=new w.MeshStandardMaterial;Gh(e,t);const n=new w.MeshStandardMaterial;return Gh(n,t),[e,n]}createTexture(){const{width:t,height:e}=this.component.bounds,n=Pb(t),i=Pb(e),r=Du(n,i);this.component.render(r.getContext("2d"));const s=new w.CanvasTexture(r);return s.needsUpdate=!0,s.wrapS=w.RepeatWrapping,s.wrapT=w.RepeatWrapping,s.offset.set(0,1-e/i),s.repeat.set(t/n,e/i),s.minFilter=w.LinearFilter,s}getMaterials(){if(!this._mesh)return;const t=this._mesh.material;return Array.isArray(t)?t:void 0}updateMaterial3d(){super.updateMaterial3d();const t=this.getMaterials();if(!t)return;const e=Hh(this.component.state.material3d);for(const n of t)Gh(n,e)}updateAlpha(){const{alpha:t=1,fillStyle:e,strokeStyle:n}=this.component.state,i=this.getMaterials();i&&(Kh(i[0],t,e),Kh(i[1],t,n))}updateStrokeStyle(){const t=this.getMaterials();if(!t)return;const{strokeStyle:e}=this.component.state;t[1].color.set(Qh(e))}updateFillStyle(){this._applyCapTexture()}updateText(){this._applyCapTexture()}_applyCapTexture(){const t=this.getMaterials();if(!t)return;const e=t[0],{fillStyle:n}=this.component.state,i=this.component.hasTextProperty?this.component.text:"";if(!i){const t=md.buildFillStyleTexture(this.component);return t?(e.map&&e.map.dispose(),e.map=t,e.color.set(16777215)):(e.map&&(e.map.dispose(),e.map=null),e.color.set(Qh(n))),void(e.needsUpdate=!0)}const{bold:r=!1,italic:s=!1,fontFamily:o="Serif",fontSize:a=10,fontColor:c="black",textAlign:l="center",textBaseline:h="middle",paddingTop:d=0,paddingLeft:u=0,paddingRight:p=0,paddingBottom:f=0}=this.component.state,{width:g,height:m}=this.component.bounds,y=Math.abs(g)||1,b=Math.abs(m)||1,_={bold:r,italic:s,fontFamily:o,fontSize:a,fontColor:c,textAlign:l,textBaseline:h,width:Math.max(y-u-p,0),height:Math.max(b-d-f,0),fillStyle:n,offsetX:u,offsetY:d};if("object"==typeof n&&"pattern"===n?.type&&n.image){return void zb(this.component.app.url(n.image),i,y,b,_,n,t=>{e.map&&e.map.dispose(),e.map=t,e.color.set(16777215),e.needsUpdate=!0})}e.map&&e.map.dispose();const v=Ob(i,y,b,_);e.map=v,e.color.set(16777215),e.needsUpdate=!0}updateDimension(){super.updateDimension()}onchange(t,e){if("path"in t&&this._mesh){const t=this._mesh.geometry,e=this.shape;if(e){const n=this.createGeometry(e);this._mesh.geometry=n,t.dispose()}}super.onchange(t,e)}}class Hb extends Nb{get shape(){const{cx:t=0,cy:e=0,rx:n=1,ry:i=1,startAngle:r=0,endAngle:s=2*Math.PI,anticlockwise:o=!1}=this.component.state,a=new w.EllipseCurve(t,e,Math.abs(n),Math.abs(i),r,s,o,0);return new w.Shape(a.getPoints(50))}}Bu("ellipse",t=>new Hb(t));class Bb extends Nb{get shape(){const{width:t,height:e,round:n=0}=this.component.state,i=cc(n,t,e);if(i>0){const n=i,r=new w.Path;return r.moveTo(n,0),r.lineTo(t-n,0),r.quadraticCurveTo(t,0,t,n),r.lineTo(t,e-n),r.quadraticCurveTo(t,e,t-n,e),r.lineTo(n,e),r.quadraticCurveTo(0,e,0,e-n),r.lineTo(0,n),r.quadraticCurveTo(0,0,n,0),new w.Shape(r.getPoints(12))}const r=new w.Shape;return r.moveTo(0,0),r.lineTo(t,0),r.lineTo(t,e),r.lineTo(0,e),r.lineTo(0,0),r}}function Yb(t,e={}){const n=e.round??0,i=e.divisions??24;if(!t||0===t.length)return new w.Shape;const r=t.some(t=>Cs(t)),s=n>0||t.some(t=>Os(t,0)>0);if(r||s){const e=new w.Path;for(let i=0;i<t.length;i++){const r=t[(i-1+t.length)%t.length],s=t[i],o=t[(i+1)%t.length];if(r.x===s.x&&r.y===s.y)continue;const a=Os(s,n);let c=Math.sqrt((r.x-s.x)**2+(r.y-s.y)**2),l=0!==c?Math.atan2(r.x-s.x,r.y-s.y):0;const h=Math.sin(l)*Math.min(a,c/2)+s.x,d=Math.cos(l)*Math.min(a,c/2)+s.y;c=Math.sqrt((o.x-s.x)**2+(o.y-s.y)**2),l=0!==c?Math.atan2(o.x-s.x,o.y-s.y):0;const u=Math.sin(l)*Math.min(a,c/2)+s.x,p=Math.cos(l)*Math.min(a,c/2)+s.y;if(0===i?e.moveTo(h,d):e.lineTo(h,d),a>0&&e.quadraticCurveTo(s.x,s.y,u,p),Cs(s)){const t=Os(o,n),i=Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2),r=0!==i?Math.atan2(s.x-o.x,s.y-o.y):0,a=Ts({x:u,y:p},{x:Math.sin(r)*Math.min(t,i/2)+o.x,y:Math.cos(r)*Math.min(t,i/2)+o.y},s.bulge);a&&e.absarc(a.cx,a.cy,a.radius,a.startAngle,a.endAngle,a.clockwise)}}return new w.Shape(e.getPoints(i))}const o=new w.Shape;for(let e=0;e<t.length;e++)0===e?o.moveTo(t[e].x,t[e].y):o.lineTo(t[e].x,t[e].y);return o}Bu("rect",t=>new Bb(t));class Gb extends Nb{get shape(){const{path:t=[],round:e=0}=this.component.state;return Yb(t,{round:e,divisions:24})}build(){Object.getPrototypeOf(Nb.prototype).build.call(this);const t=this.effectiveDepth,e=this.shape;if(!e)return;const n=this.boundUVGenerator,i=this.minMax;if(n&&void 0!==i.minX&&void 0!==i.maxX&&void 0!==i.minY&&void 0!==i.maxY){const e=new w.Shape;e.moveTo(i.minX,i.minY),e.lineTo(i.maxX,i.minY),e.lineTo(i.maxX,i.maxY),e.lineTo(i.minX,i.maxY),e.closePath(),n.setShape({extrudedShape:e,extrudedOptions:{depth:t}})}else n&&n.setShape({extrudedShape:e,extrudedOptions:{depth:t}});const r=this.createGeometry(e),s=this.createMaterials();this._mesh=new w.Mesh(r,s),this._mesh.rotation.x=-Math.PI/2,this._mesh.rotation.y=-Math.PI,this._mesh.rotation.z=-Math.PI,this._mesh.castShadow=!0,this.object3d.add(this._mesh),this.updateFillStyle(),this.updateStrokeStyle()}createGeometry(t){const e=this.effectiveDepth,{lineWidth:n=0}=this.component.state,i={steps:1,depth:e,bevelEnabled:n>0,bevelThickness:0,bevelSize:n,bevelSegments:1,UVGenerator:this.boundUVGenerator},r=new w.ExtrudeGeometry(t,i),s=this.minMax;if(void 0!==s.minX&&void 0!==s.maxX&&void 0!==s.minY&&void 0!==s.maxY){const t=(s.minX+s.maxX)/2,e=(s.minY+s.maxY)/2;r.translate(-t,-e,0),r.computeBoundingBox();const n=r.boundingBox;n&&r.translate(0,0,-(n.min.z+n.max.z)/2)}else r.center();return r}get minMax(){if(!this._minMax){const{path:t}=this.component.state;let e,n,i,r;t.forEach((t,s)=>{if(0==s)return e=i=t.x,void(n=r=t.y);e=Math.min(e,t.x),i=Math.max(i,t.x),n=Math.min(n,t.y),r=Math.max(r,t.y)}),this._minMax={minX:e,minY:n,maxX:i,maxY:r}}return this._minMax}}Bu("polygon",t=>new Gb(t));class Vb extends Nb{get shape(){const{cx:t=0,cy:e=0,rx:n=1,ry:i=1,ratio:r=50,startAngle:s=0,endAngle:o=2*Math.PI,anticlockwise:a=!1}=this.component.state,c=Math.abs(n),l=Math.abs(i),h=new w.EllipseCurve(t,e,c,l,s,o,a,0),d=new w.Shape(h.getPoints(50)),u=c/100*r,p=l/100*r;if(u>0&&p>0){const n=new w.EllipseCurve(t,e,u,p,s,o,a,0),i=new w.Path(n.getPoints(50));d.holes.push(i)}return d}}Bu("donut",t=>new Vb(t));class Ub extends Nb{get shape(){const{x1:t=0,y1:e=0,x2:n=0,y2:i=0,x3:r=0,y3:s=0,round:o=0}=this.component.state,a=[{x:t,y:e},{x:n,y:i},{x:r,y:s}];if(o>0){const t=new w.Path;for(let e=0;e<a.length;e++){const n=a[(e-1+a.length)%a.length],i=a[e],r=a[(e+1)%a.length];let s=Math.sqrt((n.x-i.x)**2+(n.y-i.y)**2),c=0!==s?Math.atan2(n.x-i.x,n.y-i.y):0;const l=Math.sin(c)*Math.min(o,s/2)+i.x,h=Math.cos(c)*Math.min(o,s/2)+i.y;s=Math.sqrt((r.x-i.x)**2+(r.y-i.y)**2),c=0!==s?Math.atan2(r.x-i.x,r.y-i.y):0;const d=Math.sin(c)*Math.min(o,s/2)+i.x,u=Math.cos(c)*Math.min(o,s/2)+i.y;0===e?t.moveTo(l,h):t.lineTo(l,h),t.quadraticCurveTo(i.x,i.y,d,u)}return new w.Shape(t.getPoints(12))}const c=new w.Shape;return c.moveTo(t,e),c.lineTo(n,i),c.lineTo(r,s),c.closePath(),c}}Bu("triangle",t=>new Ub(t));class $b extends Nb{get shape(){const{ratio:t=30,wing:e=5,cx:n=0,cy:i=0,rx:r=1,ry:s=1}=this.component.state;if(e<3)return null;const o=Math.PI/2,a=2*Math.PI/e,c=r-t/100*r,l=s-t/100*s,h=new w.Shape;h.moveTo(n+r*Math.cos(-o),i+s*Math.sin(-o)),h.lineTo(n+(r-c)*(Math.cos(a-o)+Math.cos(0-o))/2,i+(s-l)*(Math.sin(a-o)+Math.sin(0-o))/2);for(let t=1;t<e;t++)h.lineTo(n+r*Math.cos(a*t-o),i+s*Math.sin(a*t-o)),h.lineTo(n+(r-c)*(Math.cos(a*(t+1)-o)+Math.cos(a*t-o))/2,i+(s-l)*(Math.sin(a*(t+1)-o)+Math.sin(a*t-o))/2);return h.closePath(),h}}Bu("star",t=>new $b(t));const Wb={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/sphere"};class Xb extends Cb{buildGeometry(){const{rx:t=0,ry:e=0,rz:n}=this.component.state,i=n??t,r=new w.SphereGeometry(1,32,16);r.scale(t,i,e),this.object3d.geometry=r}updateDimension(){this.buildGeometry()}get effectiveDepth(){const{rx:t=0,rz:e}=this.component.state,n=e??t;return Math.max(2*n,1)}}t.Sphere=class extends Zg{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Xb(this)}get nature(){return Wb}},t.Sphere=_f([uy("sphere")],t.Sphere);class qb extends md{getObject3dInstance(){return new w.Sprite}build(){super.build(),this.buildMaterial()}get cz(){const{zPos:t=0}=this.component.state,{height:e}=this.component.bounds,{tz:n=0}=this.component.delta(),i=this.component.parent?._realObject;return t+n+e/2-(i?.geometricOffsetY??0)}get geometricOffsetY(){const{height:t=0}=this.component.bounds;return t/2}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Kh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=md.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(Qh(t)):e.opacity=0)}}class Kb extends qb{buildMaterial(){const t=this.object3d.material;t&&t.dispose(),this.object3d.material=new w.SpriteMaterial({map:Mb(this.component),alphaTest:.01,sizeAttenuation:!1})}get scale(){const{width:t,height:e}=this.component.bounds,n=this.threeContainer,{width:i=1,height:r=1}=n?.bounds??{},{scale:s=1}=this.component.state;return{x:s*t/i,y:s*e/r,z:s}}update(){this.build(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateAlpha(){this.update()}updateText(){this.update()}}const Qb={mutable:!1,resizable:!0,rotatable:!0,properties:[]};t.Sprite=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Kb(this)}get nature(){return Qb}},t.Sprite=_f([uy("sprite")],t.Sprite);const Zb={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cube"};class Jb extends Cb{buildGeometry(){const{width:t=0,height:e=0,depth:n=0}=this.component.state,i=new w.BoxGeometry(1,1,1);i.scale(t,n,e),this.object3d.geometry=i}}t.Cube=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new Jb(this)}get nature(){return Zb}},t.Cube=_f([uy("cube")],t.Cube);const t_={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cylinder"};class e_ extends Cb{buildGeometry(){const{rx:t=0,ry:e=0}=this.component.state,n=this.component.state.depth??1,i=new w.CylinderGeometry(1,1,1,25);i.scale(t||1,n||1,e||1),this.object3d.geometry=i}updateDimension(){this.buildGeometry()}}t.Cylinder=class extends Zg{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new e_(this)}get nature(){return t_}},t.Cylinder=_f([uy("cylinder")],t.Cylinder);const n_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"color",label:"box-color",name:"boxColor",property:"boxColor"}],help:"scene/component/banner"};class i_ extends md{get zPriority(){return hd.DECAL}build(){super.build();const{width:t=1,height:e=1,depth:n=1}=this.component.state;this.object3d.add(this.createCube(t,e,n));const i=this.createTextureBoard(t,n);i.position.set(0,0,.5*e+1),this.object3d.add(i)}createCube(t,e,n){const{boxColor:i="#ccaa76"}=this.component.state,r=Hh(this.component.state.material3d),s=new w.BoxGeometry(t,n,e),o=new w.MeshStandardMaterial({color:i,side:w.FrontSide});Gh(o,r);const a=new w.Mesh(s,o);return a.castShadow=r.castShadow,a.receiveShadow=r.receiveShadow,a}createTextureBoard(t,e){const n=Hh(this.component.state.material3d),{fillStyle:i="#ccaa76"}=this.component.state,r=md.buildFillStyleTexture(this.component),s=new w.MeshStandardMaterial(r?{map:r}:{color:i||"#ccaa76",side:w.FrontSide});Gh(s,n);const o=new w.PlaneGeometry(t,e,1,1),a=new w.Mesh(o,s);return a.castShadow=n.castShadow,a.receiveShadow=n.receiveShadow,a}updateMaterial3d(){super.updateMaterial3d();const t=Hh(this.component.state.material3d);this.object3d.traverse(e=>{if(e.isMesh){const n=e.material;n&&Gh(n,t),e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow}})}updateFillStyle(){this.update()}onchange(t,e){super.onchange(t,e),"boxColor"in t&&this.update()}}var r_;t.Banner=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}get nature(){return n_}buildRealObject(){return new i_(this)}},t.Banner=_f([uy("banner")],t.Banner);const s_={far:1e5,fov:80,near:1,zoom:1},o_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"near",name:"near"},{type:"number",label:"far",name:"far"},{type:"number",label:"fov",name:"fov"},{type:"number",label:"zoom",name:"zoom"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/camera"};class a_ extends md{getObject3dInstance(){return new w.Mesh}updateCamera(){const{near:t=s_.near,far:e=s_.far,fov:n=s_.fov,zoom:i=s_.zoom,showHelper:r}=this.component.state;this.camera.far=e,this.camera.fov=n,this.camera.near=t,this.camera.zoom=i,r?this.helper||(this.helper=new w.CameraHelper(this.camera),this.object3d.add(this.helper)):this.helper&&(this.object3d.remove(this.helper),delete this.helper)}build(){super.build();const{width:t=0,height:e=0,depth:n=0,fillStyle:i="lightgray"}=this.component.state;this.object3d.geometry=new w.BoxGeometry(t,n,e);const r=Hh(this.component.state.material3d),s=new w.MeshStandardMaterial({color:i});Gh(s,r),this.object3d.material=s,this.object3d.castShadow=r.castShadow,this.object3d.receiveShadow=r.receiveShadow,this.camera=new w.PerspectiveCamera,this.camera.position.set(0,0,0),this.object3d.add(this.camera),this.object3d.lookAt(0,0,0),this.updateCamera()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=Hh(this.component.state.material3d);Gh(t,e),this.object3d.castShadow=e.castShadow,this.object3d.receiveShadow=e.receiveShadow}}t.Camera=r_=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}static get image(){return r_._image||(r_._image=new Image,r_._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1IAAANSAQMAAABV6G1EAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEX6+voBAQGV71ZvAAAFO0lEQVR42u3dMZLkNBiGYakUKFRIqKOISxDvETiCTBEQcgQOQE7clyAi8REm7KDXIhgYoMa/7fbIX+2K9w022MCP/25Z28GW5RwRERERERERERERERERERERERERERERERERERERERERERERERHRl9mv7fdPn7879sf8Mcq3J3r5EJXaUy3Wddrcd6qNybx9F2/lZ63H+nVCa9Oe9elZa5ksa/dDbE+3fsm4v27C89bd+i6W3l+XdcnSWtuxyvPW+hqorbWb0Jr7Pl3m4tjfVMIZ625d6L5pxTPWw7rQY9P6pqu1dF8aq5d83cE3rXrGWluIxV6h53eotv4c1V3Ln7Nm66ZvvZf8SSues16sD2jubz2sC839fmvYiz7t//LJna27wsr7VjlnNWtPeHTfNlae2bZvnaTePUd+74fqV2LNxv6zdN8O3z9HSWhlc4F+dOvdsKbe2+F7q+zPddq6W2ts6r31vrN825/rtPWwvvcL5losy11uxQNz5U6fYT4w12mrWf80TUNZdetXal/LtwNW6WOFI1Y9bU3GVnfFXM9bneZKwrmKcK4qnKsK52q6uULTzRWFVjpkta/OykKrCq02puWFVhRaSWjlQa0itJrO8oNaQWgloZWFVhnUqjrLN50VBrWi0MpCqwitOqjVdFYQWlFopUGtLLSq0GpjWl5oRaGVBrWy0KpCq+ksP6gVhFYSWllolUGtqrNW/jvBZVYY1IpCKwutIrTqoFbTWUFoxUGtJLSK0KpCq41peaEVhVYa1MpCqwqtprP8oFYUWklo5UGtIrSazvJCKwxqRaGVhVYZ1Ko664ems34UWj8Nav0stBoWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhbW/9L6RWgp37WofIek8j2cyveLTkqrCq0itLLQSkJL+Q5k5budle/HVr73e/24gAHenZ6FlvK9+srzAoLQUp65oDy3QnoeRxFaWWgpz2pRnncThJbyzCDpuUtVaBWhlYWW8qwx5RlqynPovNBSnuUnPaOwCK0stJLQUp4BqjzbVHk+rFNaVWgVoZWFlvJc6Si0lGdzK88cV57bLj2PvgitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqxyyahcrH7JKFysJ54rCuYJwLi+cywnn+vdlLp+rCOfKwrnStXP95zLxiJX7WEFoeaHljO/xEqsaf9/FWqz1bM+VzloP655df2uxrnP9XPHKue7OeMDsuWInyx+Y67T1Yv0gs+cKvay6P5fvZZULrdnYFBbbcr2sdKF1MxbZFdZkLLItq3aay6/vJ102eusD2rJKl633nw/o3n+uxbrpLSv1svL6M95hQ3xYNz33t16sC21Zoc+28Xahm+u+Ic7WhbYs1+dRfrvQ5LpvHOaFNq3SZ8n/faEt6twDtli7wrJpxT6P1183/di0Ti36u3XT903Ld1qGrzf9smmdWhyTddNzf8t8UqdtK/dZGq8P2DZ1ZnHcrQ/osWO5PkvDuby7NE58Yctk7Qq3PSv3+bpc3F0aJ56wF+uLX9xu6eOb4es9z/vWc0vR3oZuByjnf2t/fP/54B/2WvvWEREREREREREREREREREREREREREREREREREREREREREREREREX2J/QlrTpqHD8xO1gAAAABJRU5ErkJggg=="),r_._image}render(t){const{left:e,top:n,width:i,height:r}=this.bounds;t.beginPath(),this.drawImage(t,r_.image,e,n,i,r)}buildRealObject(){return new a_(this)}get nature(){return o_}},t.Camera=r_=_f([uy("camera")],t.Camera);const c_={mutable:!1,resizable:!0,rotatable:!0,properties:[...hy],"value-property":"source",help:"scene/component/gltf-object"};t.GLTFObject=class extends(dy(lc(ac))){get nature(){return c_}},t.GLTFObject=_f([uy("gltf-object")],t.GLTFObject);const l_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"light-type",name:"lightType",property:{options:["","point","directional"]}},{type:"number",label:"intensity",name:"intensity"},{type:"number",label:"distance",name:"distance"},{type:"number",label:"decay",name:"decay"},{type:"checkbox",label:"cast-shadow",name:"castShadow"},{type:"number",label:"near",name:"near",placeholder:"0.5"},{type:"number",label:"far",name:"far",placeholder:"1000"},{type:"number",label:"fov",name:"fov",placeholder:"90"},{type:"number",label:"zoom",name:"zoom",placeholder:"1"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/light"};class h_ extends md{updatePointLight(){const{lightType:t="point",distance:e=0,intensity:n=10,decay:i=1,fillStyle:r="white",castShadow:s,near:o=.5,far:a=1e3,fov:c=90,zoom:l=1,showHelper:h}=this.component.state;if(this.object3d.color=new w.Color(r),"point"==t&&(this.object3d.distance=e,this.object3d.decay=i),this.object3d.intensity=n,this.object3d.castShadow=s,s){const t=this.object3d.shadow?.camera;t.far=a,t.near=o,t.fov=c,t.zoom=l}if(h){const t=this.object3d.shadow?.camera;this.helper||(this.helper=new w.CameraHelper(t),this.object3d.add(this.helper))}else this.helper&&(this.object3d.remove(this.helper),delete this.helper)}getObject3dInstance(){const{lightType:t="point"}=this.component.state;return"point"==t?new w.PointLight:new w.DirectionalLight}update(){this.clear(),this.build(),this.updateDimension(),this.updateHidden(),this.updatePointLight()}}t.PointLight=class extends Zg{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new h_(this)}get anchors(){return[]}get nature(){return l_}},t.PointLight=_f([uy("light")],t.PointLight);const d_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"}],help:"scene/component/wall"};class u_ extends Cb{buildGeometry(){const{width:t=0,height:e=0,depth:n=0}=this.component.state,i=new w.BoxGeometry(1,1,1);i.scale(t,n,e),this.object3d.geometry=i}}t.Wall=class extends(lc(ac)){get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new u_(this)}get nature(){return d_}},t.Wall=_f([uy("wall")],t.Wall);const p_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"},{type:"checkbox",label:"hide-in-2d-view",name:"hideIn2DView"},{type:"checkbox",label:"hide-in-3d-view",name:"hideIn3DView"}],help:"scene/component/floor-plate"};class f_ extends md{get zPriority(){return hd.FLOOR}updateHidden(){const t=this.component.state,e=!!this.component.app?.isViewMode;this.object3d.visible=!(t.hidden||e&&t.hideIn3DView)}clear(){return this._topTexture&&(this._topTexture.dispose(),this._topTexture=void 0),this._mesh=void 0,super.clear()}build(){super.build();const{width:t,height:e,depth:n=1}=this.component.state;if(!t||!e)return;const i=Math.abs(t),r=Math.abs(e),s=Math.max(n,.5),o=new w.BoxGeometry(i,s,r),a=this._buildTopMaterial(),c=this._buildSideMaterial(),l=[c,c,a,c,c,c];this._mesh=new w.Mesh(o,l),this._mesh.position.y=0,this._mesh.receiveShadow=!0,this._mesh.castShadow=!1,this.object3d.add(this._mesh)}_buildTopMaterial(){const{alpha:t=1,fillStyle:e}=this.component.state,n=Hh(this.component.state.material3d),i=md.buildFillStyleTexture(this.component);if(i){this._topTexture=i;const r=new w.MeshStandardMaterial({map:i,side:w.DoubleSide});return Kh(r,t,e),r.depthWrite=r.opacity>=.9,Gh(r,n),r}const r="string"==typeof e&&"none"!==e?Qh(e):"#e0e0e0",s=new w.MeshStandardMaterial({color:r,side:w.DoubleSide});return Kh(s,t,e),s.depthWrite=s.opacity>=.9,Gh(s,n),s}_buildSideMaterial(){const{strokeStyle:t,alpha:e=1}=this.component.state,n="string"==typeof t&&t?Qh(t):"#999999",i=Hh(this.component.state.material3d),r=new w.MeshStandardMaterial({color:n});return Gh(r,i),r.side=w.DoubleSide,Kh(r,.8*e,t),r.depthWrite=r.opacity>=.9,r}updateAlpha(){if(!this._mesh)return;const{alpha:t=1,fillStyle:e,strokeStyle:n}=this.component.state,i=this._mesh.material;for(let r=0;r<i.length;r++){const s=i[r];2===r?Kh(s,t,e):Kh(s,.8*t,n),s.depthWrite=s.opacity>=.9}}updateFillStyle(){if(!this._mesh)return;this._topTexture&&(this._topTexture.dispose(),this._topTexture=void 0);const t=this._mesh.material;t[2].dispose(),t[2]=this._buildTopMaterial()}updateStrokeStyle(){if(!this._mesh)return;const t=this._mesh.material,e=this._buildSideMaterial();for(let n=0;n<t.length;n++)2!==n&&(t[n].dispose(),t[n]=e)}}t.FloorPlate=class extends fl{get hasTextProperty(){return!1}is3dish(){return!0}buildRealObject(){return new f_(this)}get nature(){return p_}get hidden(){return!!this.getState("hideIn2DView")||super.hidden}},t.FloorPlate=_f([uy("floor-plate")],t.FloorPlate);function g_(t,e={}){const n=e.size??5,i=e.color??4500172,r=e.emissive??2245734,s=new w.SphereGeometry(n,16,12),o=new w.MeshStandardMaterial({color:i,emissive:r,emissiveIntensity:.15,metalness:.3,roughness:.4,transparent:!0,opacity:.35}),a=new w.Mesh(s,o);e.position&&a.position.set(e.position[0],e.position[1],e.position[2]),a.userData.alwaysRaycast=!0,a.scale.setScalar(1),a.visible=e.visible??!!t.app?.isEditMode;const c=()=>{o.emissiveIntensity=.9,o.opacity=.95,a.scale.setScalar(1.35),t.invalidate?.()},l=()=>{o.emissiveIntensity=.15,o.opacity=.35,a.scale.setScalar(1),t.invalidate?.()};return t.on("mouseenter",c),t.on("mouseleave",l),a.userData.dispose=()=>{t.off("mouseenter",c),t.off("mouseleave",l)},a}class m_ extends Cb{get zPriority(){return hd.DECAL}get syncZPosOffset(){return this.effectiveDepth}get geometricOffsetY(){return this.effectiveDepth}buildGeometry(){const{width:t,height:e}=this.component.state,n=Math.abs(t)||1,i=Math.abs(e)||1,r=new w.PlaneGeometry(n,i);r.rotateX(-Math.PI/2),this.object3d.geometry=r}updateDimension(){this.update()}build(){super.build();const{width:t,height:e}=this.component.state,n=Math.abs(t)||1,i=Math.abs(e)||1,r=Math.max(2,.04*Math.min(n,i));this.object3d.add(g_(this.component,{size:r,position:[n/2-r,r,-i/2+r]}))}}const y_={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/decal"};let b_=class extends(cy(lc(ac))){buildRealObject(){return new m_(this)}get nature(){return y_}};b_=_f([uy("decal")],b_);class __ extends md{getObject3dInstance(){return new w.Group}get allowedGizmoModes(){return this.component.isGroup?.()?["translate"]:null}}const v_="#dde2e8",x_="#9c9c9c",w_="#e8e8ec",M_=.35;function S_(t,e,n,i,r){if(!e.visible)return new w.MeshStandardMaterial({transparent:!0,opacity:0,depthWrite:!1});const s=e.alpha*n,o="wall"===i?v_:"floor"===i?x_:w_,a=new w.MeshStandardMaterial({metalness:0,roughness:"wall"===i?.6:.85,transparent:s<1,opacity:s,side:r?w.BackSide:w.DoubleSide});return function(t,e,n,i,r,s){if("string"==typeof n&&n&&"transparent"!==n)t.color.set(n);else{if(n&&"object"==typeof n){const i=!s,o=md.buildFillStyleTexture(e,n,{mirror:i,rotation:r});if(o)return t.map&&t.map.dispose(),t.map=o,void t.color.set("#ffffff")}t.color.set(i)}}(a,t,e.fillStyle,o,e.rotation,e.mirror),a}class A_ extends __{get zPriority(){return hd.BACKDROP}get position(){if(this.component.state.fitToBoard){return{x:0,y:super.position.y,z:0}}return super.position}build(){super.build();const t=this.component.state;let e=t.width,n=t.height;if(t.fitToBoard){const t=this.component.rootModel,i=t?.state;i&&Number.isFinite(i.width)&&Number.isFinite(i.height)&&(e=i.width,n=i.height)}const i=this.effectiveDepth||Math.min(e,n)||200,r=t.alpha??1,s=!1!==t.seeThrough,o={east:this._resolveFace("east",v_,!0,M_),west:this._resolveFace("west",v_,!0,M_),north:this._resolveFace("north",v_,!0,M_),south:this._resolveFace("south",v_,!0,M_),floor:this._resolveFace("floor",x_,!0,1),ceiling:this._resolveFace("ceiling",w_,!0,1)},a=[S_(this.component,o.east,r,"wall",s),S_(this.component,o.west,r,"wall",s),S_(this.component,o.ceiling,r,"ceiling",s),S_(this.component,o.floor,r,"floor",s),S_(this.component,o.south,r,"wall",s),S_(this.component,o.north,r,"wall",s)],c=new w.BoxGeometry(e,i,n),l=new w.Mesh(c,a);if(l.receiveShadow=!0,this.object3d.add(l),this.component.app?.isEditMode){const t=new w.LineBasicMaterial({color:4473941,transparent:!0,opacity:.7}),e=new w.LineSegments(new w.EdgesGeometry(c),t);this.object3d.add(e)}const h=.04*Math.min(e,n,i);this.object3d.add(g_(this.component,{size:h,position:[e/2,i/2+h,-n/2]}))}_resolveFace(t,e,n,i){const r=this.component.state,s=r.faces?.[t]??{},o=s.visible,a=s.alpha,c=s.rotation,l=90===c||180===c||270===c?c:0;return{fillStyle:s.fillStyle??e,visible:"boolean"==typeof o?o:n,alpha:"number"==typeof a&&Number.isFinite(a)?a:i,rotation:l,mirror:!0===s.mirror}}updateDimension(){}onchange(t,e){["alpha","width","height","depth","fitToBoard","faces","seeThrough"].some(e=>e in t)?this.update():super.onchange(t,e)}updateAlpha(){}}const k_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"checkbox",label:"fit-to-board",name:"fitToBoard"},{type:"checkbox",label:"see-through",name:"seeThrough"},{type:"backdrop-faces",label:"",name:"faces"}],help:"scene/component/backdrop"};let E_=class extends(cy(lc(ac))){buildRealObject(){return new A_(this)}get nature(){return k_}added(t){super.added?.(t),this.state.fitToBoard&&(this._syncFromRoot(!0),this._attachRootListener())}async ready(){await(super.ready?.()),this.state.fitToBoard&&this._syncFromRoot(!1)}removed(t){this._detachRootListener(),super.removed?.(t)}dispose(){this._detachRootListener(),super.dispose?.()}onchange(t,e){"fitToBoard"in t&&(t.fitToBoard?(this._syncFromRoot(!0),this._attachRootListener()):this._detachRootListener()),super.onchange?.(t,e)}_syncFromRoot(t=!1){const e=this.rootModel;if(!e||e===this)return;const n=e.state;if(!n)return;const i={},r=Number.isFinite(n.width)?n.width:this.state.width,s=Number.isFinite(n.height)?n.height:this.state.height;r!==this.state.width&&(i.width=r),s!==this.state.height&&(i.height=s);const o=Number.isFinite(n.left)?n.left:0,a=Number.isFinite(n.top)?n.top:0;if(o!==this.state.left&&(i.left=o),a!==this.state.top&&(i.top=a),t){const t=this.state.depth;if(!("number"==typeof t&&Number.isFinite(t)&&t>0)){const e=Math.min(r,s);e!==t&&(i.depth=e)}}Object.keys(i).length>0&&this.set(i)}_attachRootListener(){if(this._onRootChange)return;const t=this.rootModel;t&&t!==this&&(this._onRootChange=t=>{("width"in t||"height"in t||"left"in t||"top"in t)&&this._syncFromRoot()},t.on?.("change",this._onRootChange))}_detachRootListener(){if(!this._onRootChange)return;const t=this.rootModel;t?.off?.("change",this._onRootChange),this._onRootChange=void 0}};function C_(t,e){return"none"===t?0:t.endsWith("arrow")?1.5*e:0}function T_(t,e,n,i){const r=[];for(let s=1;s<=i;s++){const o=s/i,a=1-o;r.push(new w.Vector3(a*a*t.x+2*a*o*e.x+o*o*n.x,a*a*t.y+2*a*o*e.y+o*o*n.y,a*a*t.z+2*a*o*e.z+o*o*n.z))}return r}E_=_f([uy("backdrop")],E_);class P_ extends md{getObject3dInstance(){return new w.Group}get gizmoTransformable(){return!0}get syncZPosOffset(){return 0}get geometricOffsetY(){return 0}syncFromObject3D(){}applyDimensionFromGizmo(t){}build(){super.build(),this._buildLine()}get smoothedPath(){const t=this.worldPath;if(t.length<2)return t;const{round:e=0}=this.component.state;if(e<=0||t.length<3)return t;const n=[];n.push(t[0]);for(let i=1;i<t.length;i++){const r=t[i-1],s=t[i],o=t[i+1];if(!o){n.push(s);break}const a=r.x-s.x,c=r.y-s.y,l=r.z-s.z,h=Math.sqrt(a*a+c*c+l*l),d=Math.min(e,h/2),u=o.x-s.x,p=o.y-s.y,f=o.z-s.z,g=Math.sqrt(u*u+p*p+f*f),m=Math.min(e,g/2),y=h>0?new w.Vector3(s.x+a/h*d,s.y+c/h*d,s.z+l/h*d):s.clone(),b=g>0?new w.Vector3(s.x+u/g*m,s.y+p/g*m,s.z+f/g*m):s.clone();n.push(y),n.push(...T_(y,s,b,8))}return n}_buildLine(){const t=this.smoothedPath;if(t.length<2)return;const{strokeStyle:e,lineWidth:n=2,alpha:i=1,lineDash:r,begin:s="none",beginSize:o="size5",end:a="none",endSize:c="size5"}=this.component.state,l=Math.max(n,1),p="string"==typeof e&&"transparent"!==e?Qh(e):"#000000",f=new w.Color(p),g=this._getResolution(),m=s,y=a,b=C_(m,l),_=C_(y,l),v=t[0],x=t[t.length-1],M=(new w.Vector3).subVectors(t[1],v).normalize(),S=(new w.Vector3).subVectors(t[t.length-2],x).normalize(),A=[...t];b>0&&(A[0]=v.clone().add(M.clone().multiplyScalar(b))),_>0&&(A[A.length-1]=x.clone().add(S.clone().multiplyScalar(_)));const k=new u.LineGeometry;k.setPositions(A.flatMap(t=>[t.x,t.y,t.z]));const E=function(t,e){switch(t){case"round-dot":return{dashSize:e,gapSize:e};case"square-dot":return{dashSize:2*e,gapSize:e};case"dash":return{dashSize:4*e,gapSize:1.5*e};case"dash-dot":return{dashSize:4*e,gapSize:2*e};case"long-dash":return{dashSize:6*e,gapSize:3*e};case"long-dash-dot":return{dashSize:6*e,gapSize:2*e};case"long-dash-dot-dot":return{dashSize:6*e,gapSize:e};default:return null}}(r,l),C=new d.LineMaterial({color:f.getHex(),linewidth:l,worldUnits:!0,transparent:i<1,opacity:i,resolution:g,dashed:!!E,dashSize:E?.dashSize??1,gapSize:E?.gapSize??1,dashScale:1});if(this._line2=new h.Line2(k,C),this._line2.computeLineDistances(),this.object3d.add(this._line2),"none"!==m){const t=Iu(m,zu(o,l));if(t){const e=(new w.Quaternion).setFromUnitVectors(new w.Vector3(1,0,0),M.clone().negate());this._placeTip(t,v,e,f,i,g)}}if("none"!==y){const t=Iu(y,zu(c,l));if(t){const e=(new w.Quaternion).setFromUnitVectors(new w.Vector3(1,0,0),S.clone().negate());this._placeTip(t,x,e,f,i,g)}}}_placeTip(t,e,n,i,r,s){const o=t.mesh||t.line2||t.group;if(o){if(o.position.copy(e),o.setRotationFromQuaternion(n),t.mesh){const e=t.mesh.material;e.color.copy(i),e.transparent=r<1,e.opacity=r}else if(t.line2){const e=t.line2.material;e.color.copy(i),e.transparent=r<1,e.opacity=r,e.resolution.copy(s)}else t.group&&t.group.traverse(t=>{if(t.material){const e=t.material;e.color&&e.color.copy(i),e.transparent=r<1,e.opacity=r,e.resolution&&e.resolution.copy(s)}});this.object3d.add(o)}}_getResolution(){const t=this.threeContainer?.renderer3d;if(t){return t.getSize(new w.Vector2)}return new w.Vector2(window.innerWidth,window.innerHeight)}onGizmoDragEnd(t){const e=this._component,n=e.path;if(!n||n.length<2)return;const i=this.object3d,{width:r=0,height:s=0}=e.parent?.bounds??{},{x:o,y:a}=e.center,c=i.position,l=i.rotation,h=i.scale,d=this.position;if(Math.abs(c.x-d.x)<.001&&Math.abs(c.y-d.y)<.001&&Math.abs(c.z-d.z)<.001&&Math.abs(l.x)<.001&&Math.abs(l.y)<.001&&Math.abs(l.z)<.001&&Math.abs(h.x-1)<.001&&Math.abs(h.y-1)<.001&&Math.abs(h.z-1)<.001)return;const u=P_.computeBakedPath(n,{x:o,y:a},{width:r,height:s},i);this._suppressOnchange=!0,e.set({rotation:0,rotationX:0,rotationY:0,zPos:0}),e.mutatePath(null,()=>u),this._suppressOnchange=!1,this.update()}static computeBakedPath(t,e,n,i){const r=n.width,s=n.height,o=e.x,a=e.y;return i.updateMatrixWorld(!0),t.map(t=>{const e=new w.Vector3(t.x-o,t.z||0,t.y-a).applyMatrix4(i.matrixWorld),n={x:e.x+r/2,y:e.z+s/2};return Math.abs(e.y)>.001&&(n.z=e.y),n})}updateStrokeStyle(){this.updateDimension()}updateAlpha(){this.updateDimension()}updateDimension(){this.clear(),this.build()}onchange(t,e){("path"in t||"from"in t||"to"in t)&&(this.updateDimension(),this.updatePosition()),("round"in t||"lineDash"in t||"lineWidth"in t||"begin"in t||"end"in t||"beginSize"in t||"endSize"in t)&&this.updateDimension(),super.onchange(t,e)}clear(){for(;this.object3d.children.length>0;){const t=this.object3d.children[0];this.object3d.remove(t),rd(t)}return this._line2=void 0,super.clear()}}class D_ extends P_{get worldPath(){const t=this.component.path;if(!t||t.length<2)return[];const{x:e,y:n}=this.component.center,i=this.component,r=i.fromEnd?.component?._realObject?.object3d?.position?.y??0,s=i.toEnd?.component?._realObject?.object3d?.position?.y??0;return t.map((i,o)=>{const a=t.length>1?o/(t.length-1):0;return new w.Vector3(i.x-e,i.z||r+(s-r)*a,i.y-n)})}}Bu("line",t=>new D_(t));class O_ extends P_{get worldPath(){const t=this.component.path;if(!t||t.length<2)return[];const{x:e,y:n}=this.component.center;return t.map(t=>new w.Vector3(t.x-e,t.z||0,t.y-n))}}Bu("polyline",t=>new O_(t));class z_ extends P_{get worldPath(){const t=this.component.drawPath;if(!t||t.length<2)return[];const{x:e,y:n}=this.component.center,i=this.component,r=i.fromEnd?.component?._realObject?.object3d?.position?.y??0,s=i.toEnd?.component?._realObject?.object3d?.position?.y??0;return t.map((i,o)=>{const a=t.length>1?o/(t.length-1):0;return new w.Vector3(i.x-e,i.z||r+(s-r)*a,i.y-n)})}}Bu("ortholine",t=>new z_(t)),Bu("group",t=>new __(t));class I_ extends md{build(){super.build()}update(){}}const R_={far:1e5,fov:80,near:1,zoom:1};class L_ extends md{build(){super.build()}update(){super.update(),this.updateCamera()}getObject3dInstance(){return new w.PerspectiveCamera}updateCamera(){const{near:t=R_.near,far:e=R_.far,fov:n=R_.fov,zoom:i=R_.zoom}=this.component.state;this.object3d.far=e,this.object3d.fov=n,this.object3d.near=t,this.object3d.zoom=i}}class j_ extends Cb{buildGeometry(){const{width:t,height:e}=this.component.state.dimension;this.object3d.geometry=new w.PlaneGeometry(t,e)}buildMaterial(){this.object3d.material=new w.MeshStandardMaterial({opacity:0,side:w.DoubleSide,blending:w.NoBlending})}}class F_ extends md{getObject3dInstance(){return new w.Scene}dispose(){for(const t of this.object3d.children)rd(t);this._animationMixer&&(this._animationMixer.stopAllAction(),this._animationMixer.uncacheRoot(this.object3d),this._animationMixer=void 0),super.dispose()}clear(){return this._floor&&(this.object3d.remove(this._floor),this._floor.material instanceof Array?this._floor.material.forEach(t=>t.dispose()):this._floor.material.dispose(),this._floor.geometry.dispose(),delete this._floor),super.clear()}get floor(){return this._floor}set floor(t){this._floor&&(this.object3d.remove(this._floor),this._floor.clear(),delete this._floor),t&&(this._floor=t,this.object3d.add(t)),this.component.invalidate()}build(){super.build(),this.floor=Qu(this.component)}updateTransform(){}updateDimension(){}updatePosition(){}updateRotate(){}updateScale(){}updateAlpha(){}updateHidden(){}get animationMixer(){return this._animationMixer||(this._animationMixer=new w.AnimationMixer(this.object3d)),this._animationMixer}}const N_=new Set(["cx","cy","cz","zPos","left","top","width","height","depth","lineWidth","rotationX","rotationY","rotation","scale","hidden","alpha","material3d","screenFixed"]);class H_ extends md{get syncZPosOffset(){return this.effectiveDepth}get geometricOffsetY(){return this.effectiveDepth}constructor(t){super(t),this._origInvalidate=t.invalidate.bind(t),t.invalidate=()=>{this._origInvalidate(),this._refreshTextureNow()}}getObject3dInstance(){return new w.Mesh}build(){super.build();const{width:t,height:e}=this.component.bounds;if(!t||!e)return;const n=Hh(this.component.state.material3d),i=new w.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const r=Mb(this.component),s=new w.MeshStandardMaterial({map:r});Gh(s,n),s.transparent=!0,this.object3d.material=s,this.object3d.castShadow=n.castShadow,this.object3d.receiveShadow=n.receiveShadow}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;Kh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}get dimension(){const{width:t,height:e}=this.component.bounds;return{width:t||1,height:e||1,depth:1}}get scale(){const t=super.scale,{width:e,height:n}=this.dimension;return{x:t.x*e,y:t.y,z:t.z*n}}updateDimension(){this.updateTransform()}_debouncedRebuild(){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=void 0,this.update()},100)}_refreshTextureNow(){const t=this.object3d.material,e=t?.map;if(!e)return;const n=e.source?.data;n&&(Ab(n,this.component,2),e.needsUpdate=!0)}update(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}onchange(t,e){super.onchange(t,e);for(const e of Object.keys(t))if(!N_.has(e)){this._debouncedRebuild();break}}updateFillStyle(){this._debouncedRebuild()}updateStrokeStyle(){this._debouncedRebuild()}updateText(){this._debouncedRebuild()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=Hh(this.component.state.material3d);Gh(t,e),t.transparent=!0,this.object3d.castShadow=e.castShadow,this.object3d.receiveShadow=e.receiveShadow}clear(){return this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),rd(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),this._origInvalidate&&(this.component.invalidate=this._origInvalidate,this._origInvalidate=void 0),super.dispose()}}const B_={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"precision",name:"precision",property:{options:[{display:"High",value:"highp"},{display:"Medium",value:"mediump"},{display:"Low",value:"lowp"}]}},{type:"checkbox",label:"anti-alias",name:"antialias",property:"antialias"},{type:"checkbox",label:"3dmode",name:"threed",property:"threed"},{type:"checkbox",label:"auto-rotate",name:"autoRotate",property:"autoRotate"},{type:"checkbox",label:"debug",name:"debug",property:"debug"}],help:"scene/component/three-container"};var Y_;t.ThreeContainer=class extends Lg{constructor(){super(...arguments),this._capability=new Mp}get sceneManager(){return this._capability.sceneManager}get cameraManager(){return this._capability.cameraManager}get rendererManager(){return this._capability.rendererManager}get lightManager(){return this._capability.lightManager}get controlsManager(){return this._capability.controlsManager}get eventManager(){return this._capability.eventManager}containable(t){return!0}is3dContainer(){return!0}getLightingConfig(){return{hemisphere:{skyColor:16777215,groundColor:14540253,intensity:1},directional:{color:16777215,intensity:1.2,attachToCamera:!0,castShadow:!1}}}getCss3DSceneAttribute(){return"three-container:css3d-renderer"}init_scene3d(){this._capability.isInitialized&&this._capability.destroy(),this._capability.init(this,{lightingConfig:this.getLightingConfig(),css3DSceneAttribute:this.getCss3DSceneAttribute(),skipEnvironment:!0,skipPostprocessing:!0,skipShadowMap:!0}),this._capability.buildOverlays(),this._capability.resize(),this.onchangeData&&this.onchangeData(this.data,this.data)}destroy_scene3d(){this.stop(),this._capability.destroy()}stop(){}resize(){this._capability.resize()}get scene3d(){return this._capability.isInitialized||this.init_scene3d(),this._capability.scene3d}get renderer3d(){return this._capability.renderer3d}get mixer(){return this._capability.mixer}get css3DScene(){return this._capability.css3DScene}get css3DRenderer(){return this._capability.css3DRenderer}render_threed(){this._capability.renderThreeD()}get _parentIs3dMode(){return!!this.rootModel?.is3dMode}render(t){this._parentIs3dMode||(this.app.isViewMode&&this.setState("threed",!0),!this.state.threed||this._capability.noSupportWebgl?super.render(t):this._capability.camera&&this._capability.renderCSS3D())}postrender(t){if(this._parentIs3dMode)return;const{left:e,top:n,debug:i,threed:r}=this.state;let{width:s,height:o}=this.bounds;if(s=Math.floor(s),o=Math.floor(o),r){if(this._capability.isInitialized||this.init_scene3d(),this._capability.noSupportWebgl)return void this._capability.showWebglNoSupportText(t,this.state.width,this.state.height);if(!this._capability.renderer3d)return;this._capability.renderThreeD();const r=this._capability.domElement;if(!r||!r.width||!r.height)return;t.drawImage(r,0,0,r.width,r.height,e,n,s,o),i&&this._capability.showDebugFPS(t)}else super.postrender(t)}dispose(){this._capability.dispose(),super.dispose()}get layout(){return gc.get("three")}get nature(){return B_}getObjectByRaycast(){return this._capability.getObjectByRaycast()}getObjectsByRaycast(){return this._capability.getObjectsByRaycast()}onchange(t,e){(t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&this._capability.destroy(),this._capability.onchange(t)}onmousedown(t){this._capability.onMouseDown(t)}onmouseup(t){this._capability.onMouseUp(t)}onmousemove(t){this._capability.onMouseMove(t)}onmouseleave(t){this._capability.onMouseLeave(t)}onwheel(t){this._capability.onWheel(t)&&this.invalidate()}ondblclick(t){this._capability.onDblClick(t)&&this.invalidate()}ondragstart(t){this._capability.onDragStart(t)}ondragmove(t){this._capability.onDragMove(t)&&this.invalidate()}ondragend(t){this._capability.onDragEnd(t)&&this.invalidate()}ontouchstart(t){this._capability.onTouchStart(t)}onpan(t){this._capability.onPan(t)&&this.invalidate()}ontouchend(t){this._capability.onTouchEnd(t)}onkeydown(t){this._capability.onKeyDown(t)}onpinch(t){this._capability.onPinch(t)&&this.invalidate()}ondoubletap(){this._capability.onDoubleTap(),this.invalidate()}},t.ThreeContainer=_f([uy("3d-container")],t.ThreeContainer),Yu(t=>new Eb(t)),t.Model=void 0,(Y_=t.Model||(t.Model={})).compile=Qc,Y_.duplicate=Zc,Y_.select=za,Y_.match=Pa,Mi.registerResidents(()=>({componentResidentsCount:oc.residentsCount,sceneResidentsCount:Bd.residentsCount,referenceMapResidentsCount:pb.residentsCount,sceneResidents:oc.residents}));var G_=Object.freeze({__proto__:null,AbsoluteLayout:yc,Animation:ia,AudioPlayer:Om,BULGE_EPSILON:Es,get Banner(){return t.Banner},Banner3D:i_,BoxSelectionManager:yp,COMMON_PLACEHOLDER_PROPERTIES:tm,CORE_PLACEHOLDER_TYPES:rm,get Camera(){return t.Camera},Camera3D:a_,CameraBookmarkManager:mp,CameraManager:ep,CardLayout:_c,CenteringSlotStrategy:My,Component:oc,Connectable:Lp,Container:Lg,ContainerAbstract:fl,ContainerCapacity:Ey,ControlsManager:sp,get Cube(){return t.Cube},Cube3D:Jb,get Cylinder(){return t.Cylinder},Cylinder3D:e_,DEFAULT:Tr,DEFAULT_PLACEMENT:cd,DPPX:kr,DataLagTracker:_l,DataSource:ay,Donut:Qm,DonutExtrude:Vb,Ellipse:Zg,EllipseExtrude:Hb,EventManager3D:op,EventMap:$c,FPS:Tu,FixedSlotStrategy:xy,get FloorPlate(){return t.FloorPlate},GESTURES:Er,get GLTFObject(){return t.GLTFObject},GLTF_BASE_URL_ALIAS:ly,GenericObject:im,GifView:Pm,GizmoManager:cp,GizmoOperationManager:dp,GlobalRef:Hm,GltfComponent:dy,Group:Rm,HTMLAbsoluteLayout:mc,HTMLOverlayContainer:Fm,HTMLOverlayElement:bm,ImageView:ym,InfoWindow:pc,InteractionManager:up,KEYEVENTS:Cr,Layer:au,Layout:gc,LightManager:ip,LightObject:h_,Line:Kg,Line3D:D_,LinearHorizontalLayout:xc,LinearVerticalLayout:Mc,LoadTracker:xl,LoadingOverlay:Xh,LocalRef:jm,MATERIAL_PRESETS:Nh,MAX_UNDO_SIZE:30,MODE_ADD:3,MODE_EDIT:1,MODE_PASTE_DATABIND:5,MODE_PASTE_STYLE:4,MODE_SHIFT:2,MODE_VIEW:0,get Model(){return t.Model},MoveHandle:ul,NOTHING:Sr,NavGraph:jy,Node:ny,OrthoLine:gm,OrthoLine3D:z_,PIXEL_RATIO:Pu,PLACEHOLDER_THEMES:Jg,Path:$m,PlacementManager:pp,get PointLight(){return t.PointLight},Polygon:cm,PolygonContainer:hm,PolygonExtrude:Gb,PolygonPathPolyline:Vy,Polyline:pm,Polyline3D:O_,Popup:Gm,PopupContainer:Um,Pose6DOF:Qy,RealObject:md,RealObjectCamera:L_,RealObjectDomElement:Fu,RealObjectDomTexture:Eb,RealObjectDummy:I_,RealObjectExternalModel:yd,RealObjectExtrude:Nb,RealObjectGLTF:xd,RealObjectGroup:__,RealObjectLine:P_,RealObjectMesh:Cb,RealObjectPlane:j_,RealObjectPlane2D:H_,RealObjectScene:F_,RealObjectService:iy,RealObjectSprite:qb,RealObjectSprite2D:Kb,RealObjectText:Rb,Rect:Np,RectExtrude:Bb,RectPath:lc,ReferenceMap:pb,RendererManager:np,ReservationTable:Ry,RootContainer:yl,Ruler:Bp,SCALE_MIN:qh,SCENE_MODE:Ar,Scene:Bd,SceneManager:tp,ScenePopup:ou,SceneSearchEngine:Md,ScriptLoader:vb,SearchOverlay:Ad,ServiceComponent:sy,Shape:ac,get Sphere(){return t.Sphere},Sphere3D:Xb,get Sprite(){return t.Sprite},Star:ty,StarExtrude:$b,TRANSFER_SLOT_KEY:ky,TableLayout:Sc,Text:zm,ThreeCapability:Mp,get ThreeContainer(){return t.ThreeContainer},ThreeDOnly:cy,Tracker:Ed,Transfer:jd,TransitionEffect:hl,Triangle:Xm,TriangleExtrude:Ub,UNIT_DIMENSION:Zh,UNIT_ROTATE:ed,UNIT_SCALE:Jh,UNIT_TRANSLATE:td,ValueHolder:oy,VertexGizmoManager:wp,get Wall(){return t.Wall},Wall3D:u_,Z_PRIORITY:hd,addressKey:Py,animate:na,applyAlpha:Kh,applyMaterial3dProps:Gh,applyZPriorityToMaterials:ud,buildArrow3D:Lu,buildContractInspector:lb,buildNavGraph:Hy,buildShapeFromPolygonPath:Yb,buildTether:Qd,bulgeFromDrag:Ds,bulgeHandlePosition:Ps,chooseNearestPickupFrame:vy,clearTether:Jd,compile:sa,computeArcParams:Ts,cornerHandlePosition:zs,cornerRadiusFromDrag:Is,create:Gd,createCanvas:Du,createCanvasTexture:Mb,createFloor:Qu,createRealObjectFor:Gu,createSelectionHandle3D:g_,debug:Hi,delta:ta,disposeObject3D:rd,disposeTether:tu,drawTextTexture:Db,effectiveCornerRadius:Os,error:Fi,filterByToolType:_y,flattenPolygonPath:Uy,fontStyle:Tb,frameClock:fs,getPose:nb,getWorldPose:ib,globalSimClock:us,gltfNatureProperties:hy,hasArc:Cs,initFontFamilyWatcher:Dr,inspector:Vh,installContractInspector:hb,isCarrierLine:Cy,isGenericPlaceholder:sm,isStateDriven:ld,isStorageRack:Ty,metrics:Mi,opaqueColor:Qh,parseAddressKey:Dy,planPathAStar:By,planToReservations:Yy,polygonOffsetForPriority:dd,polygonPathLength:$y,projectToScreen:Wd,quatFromYaw:fy,receiptToJSON:Rd,recommendsLogarithmicDepthForSky:Ju,rectangularFootprintFrames:yy,registerDefaultRealObjectFactory:Yu,registerRealObjectFactory:Bu,renderCanvasTexture:Sb,renderPlaceholder:em,reservationTable:Ly,resolveAnchorWorldPosition:Kd,resolveMaterial3d:Hh,sceneComponent:uy,setPose:rb,setWorldPose:sb,standardYieldPolicy:Iy,stopFPSMeasure:Cu,textBounds:Ib,textTexture:Ob,toThreeSide:Yh,topApproachFrame:by,transferLog:Fd,transferTracer:zd,uniformZ:Rs,updateDefaultFontFamily:Pr,updateTether:Zd,version:xb,warn:Ni});const V_=globalThis;"undefined"==typeof globalThis||V_.scene||(V_.scene=G_),t.AbsoluteLayout=yc,t.Animation=ia,t.AudioPlayer=Om,t.BULGE_EPSILON=Es,t.Banner3D=i_,t.BoxSelectionManager=yp,t.COMMON_PLACEHOLDER_PROPERTIES=tm,t.CORE_PLACEHOLDER_TYPES=rm,t.Camera3D=a_,t.CameraBookmarkManager=mp,t.CameraManager=ep,t.CardLayout=_c,t.CenteringSlotStrategy=My,t.Component=oc,t.Connectable=Lp,t.Container=Lg,t.ContainerAbstract=fl,t.ContainerCapacity=Ey,t.ControlsManager=sp,t.Cube3D=Jb,t.Cylinder3D=e_,t.DEFAULT=Tr,t.DEFAULT_PLACEMENT=cd,t.DPPX=kr,t.DataLagTracker=_l,t.DataSource=ay,t.Donut=Qm,t.DonutExtrude=Vb,t.Ellipse=Zg,t.EllipseExtrude=Hb,t.EventManager3D=op,t.EventMap=$c,t.FPS=Tu,t.FixedSlotStrategy=xy,t.GESTURES=Er,t.GLTF_BASE_URL_ALIAS=ly,t.GenericObject=im,t.GifView=Pm,t.GizmoManager=cp,t.GizmoOperationManager=dp,t.GlobalRef=Hm,t.GltfComponent=dy,t.Group=Rm,t.HTMLAbsoluteLayout=mc,t.HTMLOverlayContainer=Fm,t.HTMLOverlayElement=bm,t.ImageView=ym,t.InfoWindow=pc,t.InteractionManager=up,t.KEYEVENTS=Cr,t.Layer=au,t.Layout=gc,t.LightManager=ip,t.LightObject=h_,t.Line=Kg,t.Line3D=D_,t.LinearHorizontalLayout=xc,t.LinearVerticalLayout=Mc,t.LoadTracker=xl,t.LoadingOverlay=Xh,t.LocalRef=jm,t.MATERIAL_PRESETS=Nh,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.MoveHandle=ul,t.NOTHING=Sr,t.NavGraph=jy,t.Node=ny,t.OrthoLine=gm,t.OrthoLine3D=z_,t.PIXEL_RATIO=Pu,t.PLACEHOLDER_THEMES=Jg,t.Path=$m,t.PlacementManager=pp,t.Polygon=cm,t.PolygonContainer=hm,t.PolygonExtrude=Gb,t.PolygonPathPolyline=Vy,t.Polyline=pm,t.Polyline3D=O_,t.Popup=Gm,t.PopupContainer=Um,t.Pose6DOF=Qy,t.RealObject=md,t.RealObjectCamera=L_,t.RealObjectDomElement=Fu,t.RealObjectDomTexture=Eb,t.RealObjectDummy=I_,t.RealObjectExternalModel=yd,t.RealObjectExtrude=Nb,t.RealObjectGLTF=xd,t.RealObjectGroup=__,t.RealObjectLine=P_,t.RealObjectMesh=Cb,t.RealObjectPlane=j_,t.RealObjectPlane2D=H_,t.RealObjectScene=F_,t.RealObjectService=iy,t.RealObjectSprite=qb,t.RealObjectSprite2D=Kb,t.RealObjectText=Rb,t.Rect=Np,t.RectExtrude=Bb,t.RectPath=lc,t.ReferenceMap=pb,t.RendererManager=np,t.ReservationTable=Ry,t.RootContainer=yl,t.Ruler=Bp,t.SCALE_MIN=qh,t.SCENE_MODE=Ar,t.Scene=Bd,t.SceneManager=tp,t.ScenePopup=ou,t.SceneSearchEngine=Md,t.ScriptLoader=vb,t.SearchOverlay=Ad,t.ServiceComponent=sy,t.Shape=ac,t.Sphere3D=Xb,t.Star=ty,t.StarExtrude=$b,t.TRANSFER_SLOT_KEY=ky,t.TableLayout=Sc,t.Text=zm,t.ThreeCapability=Mp,t.ThreeDOnly=cy,t.Tracker=Ed,t.Transfer=jd,t.TransitionEffect=hl,t.Triangle=Xm,t.TriangleExtrude=Ub,t.UNIT_DIMENSION=Zh,t.UNIT_ROTATE=ed,t.UNIT_SCALE=Jh,t.UNIT_TRANSLATE=td,t.ValueHolder=oy,t.VertexGizmoManager=wp,t.Wall3D=u_,t.Z_PRIORITY=hd,t.addressKey=Py,t.animate=na,t.applyAlpha=Kh,t.applyMaterial3dProps=Gh,t.applyZPriorityToMaterials=ud,t.buildArrow3D=Lu,t.buildContractInspector=lb,t.buildNavGraph=Hy,t.buildShapeFromPolygonPath=Yb,t.buildTether=Qd,t.bulgeFromDrag=Ds,t.bulgeHandlePosition=Ps,t.chooseNearestPickupFrame=vy,t.clearTether=Jd,t.compile=sa,t.computeArcParams=Ts,t.cornerHandlePosition=zs,t.cornerRadiusFromDrag=Is,t.create=Gd,t.createCanvas=Du,t.createCanvasTexture=Mb,t.createFloor=Qu,t.createRealObjectFor=Gu,t.createSelectionHandle3D=g_,t.debug=Hi,t.delta=ta,t.disposeObject3D=rd,t.disposeTether=tu,t.drawTextTexture=Db,t.effectiveCornerRadius=Os,t.error=Fi,t.filterByToolType=_y,t.flattenPolygonPath=Uy,t.fontStyle=Tb,t.frameClock=fs,t.getPose=nb,t.getWorldPose=ib,t.globalSimClock=us,t.gltfNatureProperties=hy,t.hasArc=Cs,t.initFontFamilyWatcher=Dr,t.inspector=Vh,t.installContractInspector=hb,t.isCarrierLine=Cy,t.isGenericPlaceholder=sm,t.isStateDriven=ld,t.isStorageRack=Ty,t.metrics=Mi,t.opaqueColor=Qh,t.parseAddressKey=Dy,t.planPathAStar=By,t.planToReservations=Yy,t.polygonOffsetForPriority=dd,t.polygonPathLength=$y,t.projectToScreen=Wd,t.quatFromYaw=fy,t.receiptToJSON=Rd,t.recommendsLogarithmicDepthForSky=Ju,t.rectangularFootprintFrames=yy,t.registerDefaultRealObjectFactory=Yu,t.registerRealObjectFactory=Bu,t.renderCanvasTexture=Sb,t.renderPlaceholder=em,t.reservationTable=Ly,t.resolveAnchorWorldPosition=Kd,t.resolveMaterial3d=Hh,t.sceneComponent=uy,t.setPose=rb,t.setWorldPose=sb,t.standardYieldPolicy=Iy,t.stopFPSMeasure=Cu,t.textBounds=Ib,t.textTexture=Ob,t.toThreeSide=Yh,t.topApproachFrame=by,t.transferLog=Fd,t.transferTracer=zd,t.uniformZ=Rs,t.updateDefaultFontFamily=Pr,t.updateTether=Zd,t.version=xb,t.warn=Ni});
73
73
  //# sourceMappingURL=things-scene-min.js.map