diff --git "a/static/_app/immutable/components/pages/_page.svelte-2433f49d.js" "b/static/_app/immutable/components/pages/_page.svelte-2433f49d.js" deleted file mode 100644--- "a/static/_app/immutable/components/pages/_page.svelte-2433f49d.js" +++ /dev/null @@ -1,9 +0,0 @@ -import{S as qe,i as Ge,s as Je,k as Q,H as Ht,a as ae,q as Ee,l as ee,m as j,I as Vt,h as N,c as le,r as ke,n as x,b as se,F as D,u as wn,A as ge,v as Oe,w as Ie,x as Se,f as X,t as q,y as Pe,G as ue,o as Qt,J as ne,K as bn,L as ct,M as Cr,N as Wn,O as qi,P as Gi,Q as Ji,R as ji,T as Wi,g as Xe,d as Ye,U as Zi,e as Ne,V as Qi,W as eo,X as to}from"../../chunks/index-78e14b76.js";import{w as Me}from"../../chunks/index-307410f3.js";var no={value:()=>{}};function Cn(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Dt.prototype=Cn.prototype={constructor:Dt,on:function(e,t){var n=this._,r=ro(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Qn.hasOwnProperty(t)?{space:Qn[t],local:e}:e}function oo(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===En&&t.documentElement.namespaceURI===En?t.createElement(e):t.createElementNS(n,e)}}function so(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Mr(e){var t=en(e);return(t.local?so:oo)(t)}function ao(){}function Mn(e){return e==null?ao:function(){return this.querySelector(e)}}function lo(e){typeof e!="function"&&(e=Mn(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=m&&(m=B+1);!(z=V[m])&&++m=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Co(e){e||(e=Mo);function t(d,_){return d&&_?e(d.__data__,_.__data__):!d-!_}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function Uo(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Do(){return Array.from(this)}function $o(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Jo:typeof t=="function"?Wo:jo)(e,t,n==null?"":n)):ht(this.node(),e)}function ht(e,t){return e.style.getPropertyValue(t)||Fr(e).getComputedStyle(e,null).getPropertyValue(t)}function Qo(e){return function(){delete this[e]}}function es(e,t){return function(){this[e]=t}}function ts(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ns(e,t){return arguments.length>1?this.each((t==null?Qo:typeof t=="function"?ts:es)(e,t)):this.node()[e]}function Kr(e){return e.trim().split(/^|\s+/)}function Un(e){return e.classList||new Hr(e)}function Hr(e){this._node=e,this._names=Kr(e.getAttribute("class")||"")}Hr.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Vr(e,t){for(var n=Un(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function As(e){return function(){var t=this.__on;if(!!t){for(var n=0,r=-1,i=t.length,o;n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Lt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Lt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Hs.exec(e))?new pe(t[1],t[2],t[3],1):(t=Vs.exec(e))?new pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Bs.exec(e))?Lt(t[1],t[2],t[3],t[4]):(t=Xs.exec(e))?Lt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ys.exec(e))?sr(t[1],t[2]/100,t[3]/100,1):(t=qs.exec(e))?sr(t[1],t[2]/100,t[3]/100,t[4]):er.hasOwnProperty(e)?rr(er[e]):e==="transparent"?new pe(NaN,NaN,NaN,0):null}function rr(e){return new pe(e>>16&255,e>>8&255,e&255,1)}function Lt(e,t,n,r){return r<=0&&(e=t=n=NaN),new pe(e,t,n,r)}function js(e){return e instanceof Tt||(e=Ot(e)),e?(e=e.rgb(),new pe(e.r,e.g,e.b,e.opacity)):new pe}function On(e,t,n,r){return arguments.length===1?js(e):new pe(e,t,n,r==null?1:r)}function pe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Dn(pe,On,qr(Tt,{brighter(e){return e=e==null?Xt:Math.pow(Xt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kt:Math.pow(kt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pe(nt(this.r),nt(this.g),nt(this.b),Yt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ir,formatHex:ir,formatHex8:Ws,formatRgb:or,toString:or}));function ir(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}`}function Ws(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}${tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function or(){const e=Yt(this.opacity);return`${e===1?"rgb(":"rgba("}${nt(this.r)}, ${nt(this.g)}, ${nt(this.b)}${e===1?")":`, ${e})`}`}function Yt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tt(e){return e=nt(e),(e<16?"0":"")+e.toString(16)}function sr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new xe(e,t,n,r)}function Gr(e){if(e instanceof xe)return new xe(e.h,e.s,e.l,e.opacity);if(e instanceof Tt||(e=Ot(e)),!e)return new xe;if(e instanceof xe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new xe(s,a,l,e.opacity)}function Zs(e,t,n,r){return arguments.length===1?Gr(e):new xe(e,t,n,r==null?1:r)}function xe(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Dn(xe,Zs,qr(Tt,{brighter(e){return e=e==null?Xt:Math.pow(Xt,e),new xe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kt:Math.pow(kt,e),new xe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new pe(fn(e>=240?e-240:e+120,i,r),fn(e,i,r),fn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new xe(ar(this.h),Rt(this.s),Rt(this.l),Yt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Yt(this.opacity);return`${e===1?"hsl(":"hsla("}${ar(this.h)}, ${Rt(this.s)*100}%, ${Rt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ar(e){return e=(e||0)%360,e<0?e+360:e}function Rt(e){return Math.max(0,Math.min(1,e||0))}function fn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Jr=e=>()=>e;function Qs(e,t){return function(n){return e+n*t}}function ea(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function ta(e){return(e=+e)==1?jr:function(t,n){return n-t?ea(t,n,e):Jr(isNaN(t)?n:t)}}function jr(e,t){var n=t-e;return n?Qs(e,n):Jr(isNaN(e)?t:e)}const lr=function e(t){var n=ta(t);function r(i,o){var s=n((i=On(i)).r,(o=On(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),c=jr(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return r.gamma=e,r}(1);function He(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var In=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hn=new RegExp(In.source,"g");function na(e){return function(){return e}}function ra(e){return function(t){return e(t)+""}}function ia(e,t){var n=In.lastIndex=hn.lastIndex=0,r,i,o,s=-1,a=[],l=[];for(e=e+"",t=t+"";(r=In.exec(e))&&(i=hn.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:He(r,i)})),n=hn.lastIndex;return n180?u+=360:u-c>180&&(c+=360),_.push({i:d.push(i(d)+"rotate(",null,r)-2,x:He(c,u)})):u&&d.push(i(d)+"rotate("+u+r)}function a(c,u,d,_){c!==u?_.push({i:d.push(i(d)+"skewX(",null,r)-2,x:He(c,u)}):u&&d.push(i(d)+"skewX("+u+r)}function l(c,u,d,_,v,L){if(c!==d||u!==_){var U=v.push(i(v)+"scale(",null,",",null,")");L.push({i:U-4,x:He(c,d)},{i:U-2,x:He(u,_)})}else(d!==1||_!==1)&&v.push(i(v)+"scale("+d+","+_+")")}return function(c,u){var d=[],_=[];return c=e(c),u=e(u),o(c.translateX,c.translateY,u.translateX,u.translateY,d,_),s(c.rotate,u.rotate,d,_),a(c.skewX,u.skewX,d,_),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,_),c=u=null,function(v){for(var L=-1,U=_.length,V;++L=0&&e._call.call(void 0,t),e=e._next;--dt}function fr(){ot=(Gt=It.now())+tn,dt=vt=0;try{pa()}finally{dt=0,ma(),ot=0}}function _a(){var e=It.now(),t=e-Gt;t>Qr&&(tn-=t,Gt=e)}function ma(){for(var e,t=qt,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qt=n);yt=e,Pn(r)}function Pn(e){if(!dt){vt&&(vt=clearTimeout(vt));var t=e-ot;t>24?(e<1/0&&(vt=setTimeout(fr,e-It.now()-tn)),mt&&(mt=clearInterval(mt))):(mt||(Gt=It.now(),mt=setInterval(_a,Qr)),dt=1,ei(fr))}}function hr(e,t,n){var r=new Jt;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var ga=Cn("start","end","cancel","interrupt"),va=[],ni=0,dr=1,Tn=2,$t=3,pr=4,An=5,zt=6;function nn(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ya(e,n,{name:t,index:r,group:i,on:ga,tween:va,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:ni})}function zn(e,t){var n=Te(e,t);if(n.state>ni)throw new Error("too late; already scheduled");return n}function Ue(e,t){var n=Te(e,t);if(n.state>$t)throw new Error("too late; already running");return n}function Te(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ya(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=ti(o,0,n.time);function o(c){n.state=dr,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,d,_,v;if(n.state!==dr)return l();for(u in r)if(v=r[u],v.name===n.name){if(v.state===$t)return hr(s);v.state===pr?(v.state=zt,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete r[u]):+uTn&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Ja(e,t,n){var r,i,o=Ga(t)?zn:Ue;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function ja(e,t){var n=this._id;return arguments.length<2?Te(this.node(),n).on.on(e):this.each(Ja(n,e,t))}function Wa(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Za(){return this.on("end.remove",Wa(this._id))}function Qa(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Mn(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s()=>e;function xl(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ze(e,t,n){this.k=e,this.x=t,this.y=n}ze.prototype={constructor:ze,scale:function(e){return e===1?this:new ze(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ze(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Kn=new ze(1,0,0);ze.prototype;function dn(e){e.stopImmediatePropagation()}function gt(e){e.preventDefault(),e.stopImmediatePropagation()}function Ol(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Il(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function _r(){return this.__zoom||Kn}function Sl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Pl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tl(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Al(){var e=Ol,t=Il,n=Tl,r=Sl,i=Pl,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=ha,c=Cn("start","zoom","end"),u,d,_,v=500,L=150,U=0,V=10;function b(h){h.property("__zoom",_r).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",G).on("dblclick.zoom",he).filter(i).on("touchstart.zoom",k).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",fe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(h,E,g,I){var M=h.selection?h.selection():h;M.property("__zoom",_r),h!==M?z(h,E,g,I):M.interrupt().each(function(){T(this,arguments).event(I).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},b.scaleBy=function(h,E,g,I){b.scaleTo(h,function(){var M=this.__zoom.k,$=typeof E=="function"?E.apply(this,arguments):E;return M*$},g,I)},b.scaleTo=function(h,E,g,I){b.transform(h,function(){var M=t.apply(this,arguments),$=this.__zoom,C=g==null?F(M):typeof g=="function"?g.apply(this,arguments):g,Y=$.invert(C),W=typeof E=="function"?E.apply(this,arguments):E;return n(m(B($,W),C,Y),M,s)},g,I)},b.translateBy=function(h,E,g,I){b.transform(h,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof g=="function"?g.apply(this,arguments):g),t.apply(this,arguments),s)},null,I)},b.translateTo=function(h,E,g,I,M){b.transform(h,function(){var $=t.apply(this,arguments),C=this.__zoom,Y=I==null?F($):typeof I=="function"?I.apply(this,arguments):I;return n(Kn.translate(Y[0],Y[1]).scale(C.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof g=="function"?-g.apply(this,arguments):-g),$,s)},I,M)};function B(h,E){return E=Math.max(o[0],Math.min(o[1],E)),E===h.k?h:new ze(E,h.x,h.y)}function m(h,E,g){var I=E[0]-g[0]*h.k,M=E[1]-g[1]*h.k;return I===h.x&&M===h.y?h:new ze(h.k,I,M)}function F(h){return[(+h[0][0]+ +h[1][0])/2,(+h[0][1]+ +h[1][1])/2]}function z(h,E,g,I){h.on("start.zoom",function(){T(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(I).end()}).tween("zoom",function(){var M=this,$=arguments,C=T(M,$).event(I),Y=t.apply(M,$),W=g==null?F(Y):typeof g=="function"?g.apply(M,$):g,de=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),ie=M.__zoom,_e=typeof E=="function"?E.apply(M,$):E,ye=l(ie.invert(W).concat(de/ie.k),_e.invert(W).concat(de/_e.k));return function(me){if(me===1)me=_e;else{var oe=ye(me),_t=de/oe[2];me=new ze(_t,W[0]-oe[0]*_t,W[1]-oe[1]*_t)}C.zoom(null,me)}})}function T(h,E,g){return!g&&h.__zooming||new A(h,E)}function A(h,E){this.that=h,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(h,E),this.taps=0}A.prototype={event:function(h){return h&&(this.sourceEvent=h),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(h,E){return this.mouse&&h!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&h!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&h!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(h){var E=Ve(this.that).datum();c.call(h,this.that,new xl(h,{sourceEvent:this.sourceEvent,target:b,type:h,transform:this.that.__zoom,dispatch:c}),E)}};function O(h,...E){if(!e.apply(this,arguments))return;var g=T(this,E).event(h),I=this.__zoom,M=Math.max(o[0],Math.min(o[1],I.k*Math.pow(2,r.apply(this,arguments)))),$=Qe(h);if(g.wheel)(g.mouse[0][0]!==$[0]||g.mouse[0][1]!==$[1])&&(g.mouse[1]=I.invert(g.mouse[0]=$)),clearTimeout(g.wheel);else{if(I.k===M)return;g.mouse=[$,I.invert($)],Ft(this),g.start()}gt(h),g.wheel=setTimeout(C,L),g.zoom("mouse",n(m(B(I,M),g.mouse[0],g.mouse[1]),g.extent,s));function C(){g.wheel=null,g.end()}}function G(h,...E){if(_||!e.apply(this,arguments))return;var g=h.currentTarget,I=T(this,E,!0).event(h),M=Ve(h.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",de,!0),$=Qe(h,g),C=h.clientX,Y=h.clientY;zs(h.view),dn(h),I.mouse=[$,this.__zoom.invert($)],Ft(this),I.start();function W(ie){if(gt(ie),!I.moved){var _e=ie.clientX-C,ye=ie.clientY-Y;I.moved=_e*_e+ye*ye>U}I.event(ie).zoom("mouse",n(m(I.that.__zoom,I.mouse[0]=Qe(ie,g),I.mouse[1]),I.extent,s))}function de(ie){M.on("mousemove.zoom mouseup.zoom",null),Fs(ie.view,I.moved),gt(ie),I.event(ie).end()}}function he(h,...E){if(!!e.apply(this,arguments)){var g=this.__zoom,I=Qe(h.changedTouches?h.changedTouches[0]:h,this),M=g.invert(I),$=g.k*(h.shiftKey?.5:2),C=n(m(B(g,$),I,M),t.apply(this,E),s);gt(h),a>0?Ve(this).transition().duration(a).call(z,C,I,h):Ve(this).call(b.transform,C,I,h)}}function k(h,...E){if(!!e.apply(this,arguments)){var g=h.touches,I=g.length,M=T(this,E,h.changedTouches.length===I).event(h),$,C,Y,W;for(dn(h),C=0;C{rt.update(i=>r)}),n=e.subscribe("others",r=>{St.update(i=>r)});return rt.set=r=>(e.updatePresence(r),r),()=>{t(),n()}}async function Rl(e){try{const{root:t}=await e.getStorage(),n=t.get("imagesList");jt.set(n),e.subscribe(n,()=>{jt.update(r=>n)})}catch(t){console.log(t)}}const Nl="PROD",Cl="wss://spaces.huggingface.tech/huggingface-projects/sd-color-palette-generator/queue/join",Ml="https://hf.space/embed/huggingface-projects/sd-color-palette-generator/uploads";var Ul=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ae={},R={};Object.defineProperty(R,"__esModule",{value:!0});var Dl=Object.defineProperty,$l=Object.defineProperties,zl=Object.getOwnPropertyDescriptors,Wt=Object.getOwnPropertySymbols,si=Object.prototype.hasOwnProperty,ai=Object.prototype.propertyIsEnumerable,gr=(e,t,n)=>t in e?Dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,At=(e,t)=>{for(var n in t||(t={}))si.call(t,n)&&gr(e,n,t[n]);if(Wt)for(var n of Wt(t))ai.call(t,n)&&gr(e,n,t[n]);return e},rn=(e,t)=>$l(e,zl(t)),Fl=(e,t)=>{var n={};for(var r in e)si.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wt)for(var r of Wt(e))t.indexOf(r)<0&&ai.call(e,r)&&(n[r]=e[r]);return n},Kl=(e,t,n)=>new Promise((r,i)=>{var o=l=>{try{a(n.next(l))}catch(c){i(c)}},s=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,s);a((n=n.apply(e,t)).next())});function Hl(e,t=e){}function Vl(e,t,n=t){}function Bl(e){}function Xl(e,t){}function Be(e,t){throw new Error(t)}function K(e,t="Expected value to be non-nullable"){return e}var li=(e=>(e[e.UPDATE_PRESENCE=100]="UPDATE_PRESENCE",e[e.BROADCAST_EVENT=103]="BROADCAST_EVENT",e[e.FETCH_STORAGE=200]="FETCH_STORAGE",e[e.UPDATE_STORAGE=201]="UPDATE_STORAGE",e))(li||{}),ci=(e=>(e[e.INIT=0]="INIT",e[e.SET_PARENT_KEY=1]="SET_PARENT_KEY",e[e.CREATE_LIST=2]="CREATE_LIST",e[e.UPDATE_OBJECT=3]="UPDATE_OBJECT",e[e.CREATE_OBJECT=4]="CREATE_OBJECT",e[e.DELETE_CRDT=5]="DELETE_CRDT",e[e.DELETE_OBJECT_KEY=6]="DELETE_OBJECT_KEY",e[e.CREATE_MAP=7]="CREATE_MAP",e[e.CREATE_REGISTER=8]="CREATE_REGISTER",e))(ci||{}),ui=(e=>(e[e.OBJECT=0]="OBJECT",e[e.LIST=1]="LIST",e[e.MAP=2]="MAP",e[e.REGISTER=3]="REGISTER",e))(ui||{});function Yl(e){return e.type===0&&!fi(e)}function fi(e){return e.parentId!==void 0&&e.parentKey!==void 0}var hi=(e=>(e[e.UPDATE_PRESENCE=100]="UPDATE_PRESENCE",e[e.USER_JOINED=101]="USER_JOINED",e[e.USER_LEFT=102]="USER_LEFT",e[e.BROADCASTED_EVENT=103]="BROADCASTED_EVENT",e[e.ROOM_STATE=104]="ROOM_STATE",e[e.INITIAL_STORAGE_STATE=200]="INITIAL_STORAGE_STATE",e[e.UPDATE_STORAGE=201]="UPDATE_STORAGE",e))(hi||{});function ql(e){return e==="my-presence"||e==="others"||e==="event"||e==="error"||e==="connection"||e==="history"}var di=(e=>(e[e.CLOSE_ABNORMAL=1006]="CLOSE_ABNORMAL",e[e.INVALID_MESSAGE_FORMAT=4e3]="INVALID_MESSAGE_FORMAT",e[e.NOT_ALLOWED=4001]="NOT_ALLOWED",e[e.MAX_NUMBER_OF_MESSAGES_PER_SECONDS=4002]="MAX_NUMBER_OF_MESSAGES_PER_SECONDS",e[e.MAX_NUMBER_OF_CONCURRENT_CONNECTIONS=4003]="MAX_NUMBER_OF_CONCURRENT_CONNECTIONS",e[e.MAX_NUMBER_OF_MESSAGES_PER_DAY_PER_APP=4004]="MAX_NUMBER_OF_MESSAGES_PER_DAY_PER_APP",e[e.MAX_NUMBER_OF_CONCURRENT_CONNECTIONS_PER_ROOM=4005]="MAX_NUMBER_OF_CONCURRENT_CONNECTIONS_PER_ROOM",e[e.CLOSE_WITHOUT_RETRY=4999]="CLOSE_WITHOUT_RETRY",e))(di||{}),st=32,Hn=126;function Re(e,t){return e!==void 0&&t!==void 0?Zt(pi(pt(e),pt(t))):e!==void 0?Jl(e):t!==void 0?Gl(t):Zt([st+1])}function Gl(e){const t=[],n=pt(e);for(let r=0;ro)throw new Error(`Impossible to generate position between ${e} and ${t}`);if(i===o){r.push(i),n++;continue}if(o-i===1){r.push(i),r.push(...pi(e.slice(n+1),[]));break}const s=o+i>>1;r.push(s);break}return r}function pt(e){const t=[];for(let n=0;nv.parentId===this._id);_&&this._propToLastUpdate.set(l,K(_.opId)),t.push(...d)}else i[l]=c,this._propToLastUpdate.set(l,r);this._map.set(l,c),this.invalidate(),s[l]={type:"update"}}Object.keys(o.data).length!==0&&n.unshift(o),Object.keys(i).length!==0&&t.unshift({opId:r,id:this._id,type:3,data:i});const a=new Map;a.set(this._id,{node:this,type:"LiveObject",updates:s}),this._pool.dispatch(t,n,a)}toImmutable(){return super.toImmutable()}_toImmutable(){const e={};for(const[t,n]of this._map)e[t]=Kt(n)?n.toImmutable():n;return e}},Vn=e=>e;function jl(e){return e.filter(t=>t!=null)}function Wl(e){const t=At({},e);return Object.keys(e).forEach(n=>{const r=n;t[r]===void 0&&delete t[r]}),t}function wt(e){return ft(mi(e))}function mi(e){switch(e.type){case 8:return e.data;case 4:return new We(e.data);case 7:return new je;case 2:return new Ze;default:return Be(e,"Unknown creation Op")}}function gi(e,t){return e===t?!0:e.parent.type==="HasParent"?gi(e.parent.node,t):!1}function vi([e,t],n,r){switch(t.type){case 0:return We._deserialize([e,t],n,r);case 1:return Ze._deserialize([e,t],n,r);case 2:return je._deserialize([e,t],n,r);case 3:return Ke._deserialize([e,t],n,r);default:throw new Error("Unexpected CRDT type")}}function Zl([e,t],n,r){switch(t.type){case 0:return We._deserialize([e,t],n,r);case 1:return Ze._deserialize([e,t],n,r);case 2:return je._deserialize([e,t],n,r);case 3:return t.data;default:throw new Error("Unexpected CRDT type")}}function Kt(e){return yi(e)||Ql(e)||wi(e)}function ce(e){return Kt(e)||ec(e)}function yi(e){return e instanceof Ze}function Ql(e){return e instanceof je}function wi(e){return e instanceof We}function ec(e){return e instanceof Ke}function it(e){return e instanceof Ke?e.data:e instanceof Ze||e instanceof je||e instanceof We?e:Be(e,"Unknown AbstractCrdt")}function ft(e){return e instanceof We||e instanceof je||e instanceof Ze?e:new Ke(e)}function tc(e,t){const n=[];return e.forEach((r,i)=>{t.get(i)||n.push({type:5,id:i})}),t.forEach((r,i)=>{const o=e.get(i);if(o)r.type===0&&(o.type!==0||JSON.stringify(r.data)!==JSON.stringify(o.data))&&n.push({type:3,id:i,data:r.data}),r.parentKey!==o.parentKey&&n.push({type:1,id:i,parentKey:K(r.parentKey,"Parent key must not be missing")});else switch(r.type){case 3:n.push({type:8,id:i,parentId:r.parentId,parentKey:r.parentKey,data:r.data});break;case 1:n.push({type:2,id:i,parentId:r.parentId,parentKey:r.parentKey});break;case 0:n.push(r.parentId?{type:4,id:i,parentId:r.parentId,parentKey:r.parentKey,data:r.data}:{type:4,id:i,data:r.data});break;case 2:n.push({type:7,id:i,parentId:r.parentId,parentKey:r.parentKey});break}}),n}function nc(e,t){const n=e.updates;for(const[r,i]of Ei(t.updates))n[r]=i;return rn(At({},t),{updates:n})}function rc(e,t){const n=e.updates;for(const[r,i]of Ei(t.updates))n[r]=i;return rn(At({},t),{updates:n})}function ic(e,t){const n=e.updates;return rn(At({},t),{updates:n.concat(t.updates)})}function oc(e,t){return e?e.type==="LiveObject"&&t.type==="LiveObject"?nc(e,t):e.type==="LiveMap"&&t.type==="LiveMap"?rc(e,t):e.type==="LiveList"&&t.type==="LiveList"?ic(e,t):t:t}function br(e){const t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||Bn(e)}function Bn(e){return e!==null&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"}function bi(e,t=""){if(!br)return{path:t||"root",value:e};if(typeof e!="object"||e===null)return!1;for(const[n,r]of Object.entries(e)){const i=t?t+"."+n:n;if(!br(r))return{path:i,value:r};if(typeof r=="object"){const o=bi(r,i);if(o)return o}}return!1}function sc(e){const t={};for(const[n,r]of e)t[n]=r;return t}function Ei(e){return Object.entries(e)}function ki(e){try{return JSON.parse(e)}catch{return}}function xi(e){try{const t=e.replace(/-/g,"+").replace(/_/g,"/");return decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""))}catch{return atob(e)}}function ac(e,t){return _i(e._getParentKeyOrThrow(),t._getParentKeyOrThrow())}var Ze=class extends on{constructor(e=[]){super(),this._items=[],this._implicitlyDeletedItems=new WeakSet,this._unacknowledgedSets=new Map;let t;for(let n=0;nt._getParentKeyOrThrow()===e)}_attach(e,t){super._attach(e,t);for(const n of this._items)n._attach(t.generateId(),t)}_detach(){super._detach();for(const e of this._items)e._detach()}_applySetRemote(e){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const{id:t,parentKey:n}=e,r=wt(e);r._attach(t,this._pool),r._setParentLink(this,n);const i=e.deletedId,o=this._indexOfPosition(n);if(o!==-1){const s=this._items[o];if(s._id===i)return s._detach(),this._items[o]=r,{modified:J(this,[lt(o,r)]),reverse:[]};{this._implicitlyDeletedItems.add(s),this._items[o]=r;const a=[lt(o,r)],l=this._detachItemAssociatedToSetOperation(e.deletedId);return l&&a.push(l),{modified:J(this,a),reverse:[]}}}else{const s=[],a=this._detachItemAssociatedToSetOperation(e.deletedId);return a&&s.push(a),this._insertAndSort(r),s.push(Le(this._indexOfPosition(n),r)),{reverse:[],modified:J(this,s)}}}_applySetAck(e){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const t=[],n=this._detachItemAssociatedToSetOperation(e.deletedId);n&&t.push(n);const r=this._unacknowledgedSets.get(e.parentKey);if(r!==void 0){if(r!==e.opId)return t.length===0?{modified:!1}:{modified:J(this,t),reverse:[]};this._unacknowledgedSets.delete(e.parentKey)}const i=this._indexOfPosition(e.parentKey),o=this._items.find(s=>s._id===e.id);if(o!==void 0){if(o._parentKey===e.parentKey)return{modified:t.length>0?J(this,t):!1,reverse:[]};i!==-1&&(this._implicitlyDeletedItems.add(this._items[i]),this._items.splice(i,1),t.push(Mt(i)));const s=this._items.indexOf(o);o._setParentLink(this,e.parentKey),this._sortItems();const a=this._items.indexOf(o);return a!==s&&t.push(et(s,a,o)),{modified:t.length>0?J(this,t):!1,reverse:[]}}else{const s=this._pool.getNode(e.id);if(s&&this._implicitlyDeletedItems.has(s)){s._setParentLink(this,e.parentKey),this._implicitlyDeletedItems.delete(s),this._insertAndSort(s);const a=this._items.indexOf(s);return{modified:J(this,[i===-1?Le(a,s):lt(a,s),...t]),reverse:[]}}else{i!==-1&&this._items.splice(i,1);const{newItem:a,newIndex:l}=this._createAttachItemAndSort(e,e.parentKey);return{modified:J(this,[i===-1?Le(l,a):lt(l,a),...t]),reverse:[]}}}}_detachItemAssociatedToSetOperation(e){if(e===void 0||this._pool===void 0)return null;const t=this._pool.getNode(e);if(t===void 0)return null;const n=this._detachChild(t);return n.modified===!1?null:n.modified.updates[0]}_applyRemoteInsert(e){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const t=e.parentKey,n=this._indexOfPosition(t);n!==-1&&this._shiftItemPosition(n,t);const{newItem:r,newIndex:i}=this._createAttachItemAndSort(e,t);return{modified:J(this,[Le(i,r)]),reverse:[]}}_applyInsertAck(e){const t=this._items.find(i=>i._id===e.id),n=e.parentKey,r=this._indexOfPosition(n);if(t){if(t._parentKey===n)return{modified:!1};{const i=this._items.indexOf(t);r!==-1&&this._shiftItemPosition(r,n),t._setParentLink(this,n),this._sortItems();const o=this._indexOfPosition(n);return o===i?{modified:!1}:{modified:J(this,[et(i,o,t)]),reverse:[]}}}else{const i=K(this._pool).getNode(e.id);if(i&&this._implicitlyDeletedItems.has(i)){i._setParentLink(this,n),this._implicitlyDeletedItems.delete(i),this._insertAndSort(i);const o=this._indexOfPosition(n);return{modified:J(this,[Le(o,i)]),reverse:[]}}else{r!==-1&&this._shiftItemPosition(r,n);const{newItem:o,newIndex:s}=this._createAttachItemAndSort(e,n);return{modified:J(this,[Le(s,o)]),reverse:[]}}}}_applyInsertUndoRedo(e){var t;const{id:n,parentKey:r}=e,i=wt(e);if(((t=this._pool)==null?void 0:t.getNode(n))!==void 0)return{modified:!1};i._attach(n,K(this._pool)),i._setParentLink(this,r);const o=this._indexOfPosition(r);let s=r;if(o!==-1){const l=this._items[o]?this._items[o]._getParentKeyOrThrow():void 0,c=this._items[o+1]?this._items[o+1]._getParentKeyOrThrow():void 0;s=Re(l,c),i._setParentLink(this,s)}this._insertAndSort(i);const a=this._indexOfPosition(s);return{modified:J(this,[Le(a,i)]),reverse:[{type:5,id:n}]}}_applySetUndoRedo(e){var t;const{id:n,parentKey:r}=e,i=wt(e);if(((t=this._pool)==null?void 0:t.getNode(n))!==void 0)return{modified:!1};this._unacknowledgedSets.set(r,K(e.opId));const o=this._indexOfPosition(r);i._attach(n,K(this._pool)),i._setParentLink(this,r);const s=r;if(o!==-1){const a=this._items[o];a._detach(),this._items[o]=i;const l=a._toOps(K(this._id),r,this._pool);pn(l,e.id);const c=[lt(o,i)],u=this._detachItemAssociatedToSetOperation(e.deletedId);return u&&c.push(u),{modified:J(this,c),reverse:l}}else{this._insertAndSort(i),this._detachItemAssociatedToSetOperation(e.deletedId);const a=this._indexOfPosition(s);return{reverse:[{type:5,id:n}],modified:J(this,[Le(a,i)])}}}_attachChild(e,t){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");let n;return e.intent==="set"?t===1?n=this._applySetRemote(e):t===2?n=this._applySetAck(e):n=this._applySetUndoRedo(e):t===1?n=this._applyRemoteInsert(e):t===2?n=this._applyInsertAck(e):n=this._applyInsertUndoRedo(e),n.modified!==!1&&this.invalidate(),n}_detachChild(e){if(e){const t=K(e._parentKey),n=e._toOps(K(this._id),t,this._pool),r=this._items.indexOf(e);return r===-1?{modified:!1}:(this._items.splice(r,1),this.invalidate(),e._detach(),{modified:J(this,[Mt(r)]),reverse:n})}return{modified:!1}}_applySetChildKeyRemote(e,t){var n;if(this._implicitlyDeletedItems.has(t)){this._implicitlyDeletedItems.delete(t),t._setParentLink(this,e),this._insertAndSort(t);const o=this._items.indexOf(t);return{modified:J(this,[Le(o,t)]),reverse:[]}}const r=t._parentKey;if(e===r)return{modified:!1};const i=this._indexOfPosition(e);if(i===-1){const o=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const s=this._items.indexOf(t);return s===o?{modified:!1}:{modified:J(this,[et(o,s,t)]),reverse:[]}}else{this._items[i]._setParentLink(this,Re(e,(n=this._items[i+1])==null?void 0:n._getParentKeyOrThrow()));const o=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const s=this._items.indexOf(t);return s===o?{modified:!1}:{modified:J(this,[et(o,s,t)]),reverse:[]}}}_applySetChildKeyAck(e,t){var n,r;const i=K(t._parentKey);if(this._implicitlyDeletedItems.has(t)){const o=this._indexOfPosition(e);return this._implicitlyDeletedItems.delete(t),o!==-1&&this._items[o]._setParentLink(this,Re(e,(n=this._items[o+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._insertAndSort(t),{modified:!1}}else{if(e===i)return{modified:!1};const o=this._items.indexOf(t),s=this._indexOfPosition(e);s!==-1&&this._items[s]._setParentLink(this,Re(e,(r=this._items[s+1])==null?void 0:r._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const a=this._items.indexOf(t);return o===a?{modified:!1}:{modified:J(this,[et(o,a,t)]),reverse:[]}}}_applySetChildKeyUndoRedo(e,t){var n;const r=K(t._parentKey),i=this._items.indexOf(t),o=this._indexOfPosition(e);o!==-1&&this._items[o]._setParentLink(this,Re(e,(n=this._items[o+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const s=this._items.indexOf(t);return i===s?{modified:!1}:{modified:J(this,[et(i,s,t)]),reverse:[{type:1,id:K(t._id),parentKey:r}]}}_setChildKey(e,t,n){return n===1?this._applySetChildKeyRemote(e,t):n===2?this._applySetChildKeyAck(e,t):this._applySetChildKeyUndoRedo(e,t)}_apply(e,t){return super._apply(e,t)}_serialize(){if(this.parent.type!=="HasParent")throw new Error("Cannot serialize LiveList if parent is missing");return{type:1,parentId:K(this.parent.node._id,"Parent node expected to have ID"),parentKey:this.parent.key}}get length(){return this._items.length}push(e){return this.insert(e,this.length)}insert(e,t){if(t<0||t>this._items.length)throw new Error(`Cannot insert list item at index "${t}". index should be between 0 and ${this._items.length}`);const n=this._items[t-1]?this._items[t-1]._getParentKeyOrThrow():void 0,r=this._items[t]?this._items[t]._getParentKeyOrThrow():void 0,i=Re(n,r),o=ft(e);if(o._setParentLink(this,i),this._insertAndSort(o),this._pool&&this._id){const s=this._pool.generateId();o._attach(s,this._pool),this._pool.dispatch(o._toOps(this._id,i,this._pool),[{type:5,id:s}],new Map([[this._id,J(this,[Le(t,o)])]]))}}move(e,t){if(t<0)throw new Error("targetIndex cannot be less than 0");if(t>=this._items.length)throw new Error("targetIndex cannot be greater or equal than the list length");if(e<0)throw new Error("index cannot be less than 0");if(e>=this._items.length)throw new Error("index cannot be greater or equal than the list length");let n=null,r=null;e=this._items.length)throw new Error(`Cannot delete list item at index "${e}". index should be between 0 and ${this._items.length-1}`);const t=this._items[e];if(t._detach(),this._items.splice(e,1),this.invalidate(),this._pool){const n=t._id;if(n){const r=new Map;r.set(K(this._id),J(this,[Mt(e)])),this._pool.dispatch([{id:n,opId:this._pool.generateOpId(),type:5}],t._toOps(K(this._id),t._getParentKeyOrThrow()),r)}}}clear(){if(this._pool){const e=[],t=[],n=[];for(const i of this._items){i._detach();const o=i._id;o&&(e.push({type:5,id:o,opId:this._pool.generateOpId()}),t.push(...i._toOps(K(this._id),i._getParentKeyOrThrow())),n.push(Mt(0)))}this._items=[],this.invalidate();const r=new Map;r.set(K(this._id),J(this,n)),this._pool.dispatch(e,t,r)}else{for(const e of this._items)e._detach();this._items=[],this.invalidate()}}set(e,t){if(e<0||e>=this._items.length)throw new Error(`Cannot set list item at index "${e}". index should be between 0 and ${this._items.length-1}`);const n=this._items[e],r=n._getParentKeyOrThrow(),i=n._id;n._detach();const o=ft(t);if(o._setParentLink(this,r),this._items[e]=o,this.invalidate(),this._pool&&this._id){const s=this._pool.generateId();o._attach(s,this._pool);const a=new Map;a.set(this._id,J(this,[lt(e,o)]));const l=o._toOps(this._id,r,this._pool);pn(l,i),this._unacknowledgedSets.set(r,K(l[0].opId));const c=n._toOps(this._id,r,void 0);pn(c,s),this._pool.dispatch(l,c,a)}}toArray(){return this._items.map(e=>it(e))}every(e){return this.toArray().every(e)}filter(e){return this.toArray().filter(e)}find(e){return this.toArray().find(e)}findIndex(e){return this.toArray().findIndex(e)}forEach(e){return this.toArray().forEach(e)}get(e){if(!(e<0||e>=this._items.length))return it(this._items[e])}indexOf(e,t){return this.toArray().indexOf(e,t)}lastIndexOf(e,t){return this.toArray().lastIndexOf(e,t)}map(e){return this._items.map((t,n)=>e(it(t),n))}some(e){return this.toArray().some(e)}[Symbol.iterator](){return new lc(this._items)}_createAttachItemAndSort(e,t){const n=wt(e);n._attach(e.id,K(this._pool)),n._setParentLink(this,t),this._insertAndSort(n);const r=this._indexOfPosition(t);return{newItem:n,newIndex:r}}_shiftItemPosition(e,t){var n;const r=Re(t,this._items.length>e+1?(n=this._items[e+1])==null?void 0:n._getParentKeyOrThrow():void 0);this._items[e]._setParentLink(this,r)}toImmutable(){return super.toImmutable()}_toImmutable(){return this._items.map(t=>t.toImmutable())}},lc=class{constructor(e){this._innerIterator=e[Symbol.iterator]()}[Symbol.iterator](){return this}next(){const e=this._innerIterator.next();return e.done?{done:!0,value:void 0}:{value:it(e.value)}}};function J(e,t){return{node:e,type:"LiveList",updates:t}}function lt(e,t){return{index:e,type:"set",item:t instanceof Ke?t.data:t}}function Mt(e){return{index:e,type:"delete"}}function Le(e,t){return{index:e,type:"insert",item:t instanceof Ke?t.data:t}}function et(e,t,n){return{index:t,type:"move",previousIndex:e,item:n instanceof Ke?n.data:n}}function pn(e,t){if(e.length===0)throw new Error("Internal error. Serialized LiveStructure should have at least 1 operation");const n=e[0];n.intent="set",n.deletedId=t}var cc=["websocket:presence","websocket:storage","room:read","room:write","rooms:read","rooms:write"];function uc(e){if(!Bn(e))return!1;const{iat:t,exp:n}=e;return typeof t=="number"&&typeof n=="number"}function fc(e){const t=Date.now()/1e3;return t>e.exp-300||ttypeof t=="string")}function Ii(e){return typeof e.appId=="string"&&e.roomId===void 0&&Oi(e.scopes)}function Xn(e){return typeof e.appId=="string"&&typeof e.roomId=="string"&&typeof e.actor=="number"&&(e.id===void 0||typeof e.id=="string")&&Oi(e.scopes)&&(e.maxConnectionsPerRoom===void 0||typeof e.maxConnectionsPerRoom=="number")}function dc(e){return Ii(e)||Xn(e)}function pc(e){const t=e.split(".");if(t.length!==3)throw new Error("Authentication error: invalid JWT token");const n=ki(xi(t[1]));if(n&&uc(n))return n;throw new Error("Authentication error: missing JWT metadata")}function _c(e){const t=pc(e);if(t&&Xn(t))return Fl(t,["maxConnections"]);throw new Error("Authentication error: we expected a room token but did not get one. Hint: if you are using a callback, ensure the room is passed when creating the token. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientCallback")}function mc(e){return Object.defineProperty(e,"count",{value:e.length,enumerable:!1}),Object.defineProperty(e,"toArray",{value:()=>e,enumerable:!1}),Vn(e)}function Si(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Pi(e){return Array.isArray(e)}function gc(e){return!Si(e)&&!Pi(e)}R.__spreadValues=At;R.__spreadProps=rn;R.__async=Kl;R.deprecate=Hl;R.deprecateIf=Vl;R.throwUsageError=Bl;R.errorIf=Xl;R.assertNever=Be;R.nn=K;R.ClientMsgCode=li;R.OpCode=ci;R.CrdtType=ui;R.isRootCrdt=Yl;R.isChildCrdt=fi;R.ServerMsgCode=hi;R.isRoomEventName=ql;R.WebsocketCloseCodes=di;R.LiveRegister=Ke;R.makePosition=Re;R.comparePosition=_i;R.LiveList=Ze;R.LiveMap=je;R.LiveObject=We;R.freeze=Vn;R.compact=jl;R.compactObject=Wl;R.isSameNodeOrChildOf=gi;R.isLiveNode=ce;R.isLiveList=yi;R.isLiveObject=wi;R.getTreesDiffOperations=tc;R.mergeStorageUpdates=oc;R.isPlainObject=Bn;R.findNonSerializableValue=bi;R.tryParseJson=ki;R.b64decode=xi;R.isTokenExpired=fc;R.isScope=hc;R.isAppOnlyAuthToken=Ii;R.isRoomAuthToken=Xn;R.isAuthToken=dc;R.parseRoomAuthToken=_c;R.asArrayWithLegacyMethods=mc;R.isJsonScalar=Si;R.isJsonArray=Pi;R.isJsonObject=gc;Object.defineProperty(Ae,"__esModule",{value:!0});var P=R;function $e(){const e=new Set,t=new Set;function n(s){return t.add(s),()=>t.delete(s)}function r(s){return e.add(s),()=>e.delete(s)}function i(s){e.forEach(a=>a(s)),e.clear(),t.forEach(a=>a(s))}function o(){e.clear(),t.clear()}return{notify:i,subscribe:n,subscribeOnce:r,clear:o,observable:{subscribe:n,subscribeOnce:r}}}function Ti(e,t){let n=!1;const r=P.__spreadValues.call(void 0,{},e);return Object.keys(t).forEach(i=>{const o=i,s=t[o];r[o]!==s&&(s===void 0?delete r[o]:r[o]=s,n=!0)}),n?r:e}var sn=class{constructor(){this._ev=$e()}get didInvalidate(){return this._ev.observable}invalidate(){this._cache!==void 0&&(this._cache=void 0,this._ev.notify())}get current(){var e;return(e=this._cache)!=null?e:this._cache=this._toImmutable()}},vc=class extends sn{constructor(e){super(),this._me=P.freeze.call(void 0,P.compactObject.call(void 0,e))}_toImmutable(){return this._me}patch(e){const t=this._me,n=Ti(t,e);t!==n&&(this._me=P.freeze.call(void 0,n),this.invalidate())}};function yc(e,t){return P.freeze.call(void 0,P.compactObject.call(void 0,P.__spreadProps.call(void 0,P.__spreadValues.call(void 0,{},e),{presence:t})))}var wc=class extends sn{constructor(){super(),this._connections={},this._presences={},this._users={}}_toImmutable(){const e=P.compact.call(void 0,Object.keys(this._presences).map(t=>this.getUser(Number(t))));return P.asArrayWithLegacyMethods.call(void 0,e)}clearOthers(){this._connections={},this._presences={},this._users={},this.invalidate()}_getUser(e){const t=this._connections[e],n=this._presences[e];if(t!==void 0&&n!==void 0)return yc(t,n)}getUser(e){const t=this._users[e];if(t)return t;const n=this._getUser(e);if(n)return this._users[e]=n,n}_invalidateUser(e){this._users[e]!==void 0&&delete this._users[e],this.invalidate()}setConnection(e,t,n){this._connections[e]=P.freeze.call(void 0,{connectionId:e,id:t,info:n}),this._presences[e]!==void 0&&this._invalidateUser(e)}removeConnection(e){delete this._connections[e],delete this._presences[e],this._invalidateUser(e)}setOther(e,t){this._presences[e]=P.freeze.call(void 0,P.compactObject.call(void 0,t)),this._connections[e]!==void 0&&this._invalidateUser(e)}patchOther(e,t){const n=this._presences[e];if(n===void 0)return;const r=Ti(n,t);n!==r&&(this._presences[e]=P.freeze.call(void 0,r),this._invalidateUser(e))}},bc=class extends sn{constructor(e){super(),this._value=P.freeze.call(void 0,P.compactObject.call(void 0,e))}_toImmutable(){return this._value}set(e){this._value=P.freeze.call(void 0,e),this.invalidate()}},Ec=class extends sn{constructor(e,t){super(),this._refs=e,this._refs.forEach(n=>{n.didInvalidate.subscribe(()=>this.invalidate())}),this._transform=t}_toImmutable(){return this._transform(this._refs[0].current,this._refs[1].current)}},_n=[250,500,1e3,2e3,4e3,8e3,1e4],mn=[2e3,3e4,6e4,3e5],kc=3e4,xc=2e3;function Oc(e){let t=0;return()=>`${e}:${t++}`}function gn(e){return e.state==="open"||e.state==="connecting"}function Ic(e,t,n){const r={roomId:t.roomId,getNode:f=>e.nodes.get(f),addNode:(f,p)=>void e.nodes.set(f,p),deleteNode:f=>void e.nodes.delete(f),generateId:()=>`${L()}:${e.clock++}`,generateOpId:()=>`${L()}:${e.opClock++}`,dispatch(f,p,y){const w=e.activeBatch;w?(w.ops.push(...f),y.forEach((S,re)=>{w.updates.storageUpdates.set(re,P.mergeStorageUpdates.call(void 0,w.updates.storageUpdates.get(re),S))}),w.reverseOps.push(...p)):(_(p),e.redoStack=[],qn(f),v({storageUpdates:y}))}},i={customEvent:$e(),me:$e(),others:$e(),error:$e(),connection:$e(),storage:$e(),history:$e(),storageDidLoad:$e()},o=n||{authenticate(f,p){const y=e.token,w=y!==null&&P.parseRoomAuthToken.call(void 0,y);if(w&&!P.isTokenExpired.call(void 0,w)){const S=p(y);A(w,S)}else return f(t.roomId).then(({token:S})=>{if(e.connection.current.state!=="authenticating")return;const re=P.parseRoomAuthToken.call(void 0,S),te=p(S);A(re,te),e.token=S}).catch(S=>O())},send(f){if(e.socket===null)throw new Error("Can't send message if socket is null");e.socket.send(JSON.stringify(f))},delayFlush(f){return setTimeout(oe,f)},startHeartbeatInterval(){return setInterval(ie,kc)},schedulePongTimeout(){return setTimeout(_e,xc)},scheduleReconnect(f){return setTimeout(z,f)}},s=new Ec([e.connection,e.me],(f,p)=>gn(f)?{connectionId:f.id,id:f.userId,info:f.userInfo,presence:p}:null);function a(f){if(f.items.length===0)throw new Error("Internal error: cannot load storage without items");e.root?c(f.items):e.root=u(f.items);for(const p in e.initialStorage)e.root.get(p)===void 0&&e.root.set(p,e.initialStorage[p])}function l(f){const p=new Map;let y=null;for(const[w,S]of f)if(P.isRootCrdt.call(void 0,S))y=[w,S];else{const re=[w,S],te=p.get(S.parentId);te!==void 0?te.push(re):p.set(S.parentId,[re])}if(y===null)throw new Error("Root can't be null");return[y,p]}function c(f){if(!e.root)return;const p=new Map;e.nodes.forEach((S,re)=>{p.set(re,S._serialize())});const y=P.getTreesDiffOperations.call(void 0,p,new Map(f)),w=U(y,!1);v(w.updates)}function u(f){const[p,y]=l(f);return P.LiveObject._deserialize(p,y,r)}function d(f){e.undoStack.length>=50&&e.undoStack.shift(),e.undoStack.push(f),h()}function _(f){e.pausedHistory!==null?e.pausedHistory.unshift(...f):d(f)}function v({storageUpdates:f=new Map,presence:p=!1,others:y=[]}){if(y.length>0){const w=e.others.current;for(const S of y)i.others.notify({others:w,event:S})}if(p&&i.me.notify(e.me.current),f.size>0){const w=Array.from(f.values());i.storage.notify(w)}}function L(){const f=e.connection.current;if(gn(f))return f.id;if(e.lastConnectionId!==null)return e.lastConnectionId;throw new Error("Internal. Tried to get connection id but connection was never open")}function U(f,p){const y={reverse:[],updates:{storageUpdates:new Map,presence:!1}},w=new Set;for(const S of f)if(S.type==="presence"){const re={type:"presence",data:{}};for(const te in S.data)re.data[te]=e.me.current[te];if(e.me.patch(S.data),e.buffer.me===null)e.buffer.me={type:"partial",data:S.data};else for(const te in S.data)e.buffer.me.data[te]=S.data[te];y.reverse.unshift(re),y.updates.presence=!0}else{let re;S.opId||(S.opId=r.generateOpId()),p?re=0:re=e.offlineOperations.delete(P.nn.call(void 0,S.opId))?2:1;const te=V(S,re);if(te.modified){const un=te.modified.node.parent.type==="HasParent"?P.nn.call(void 0,te.modified.node.parent.node._id,"Expected parent node to have an ID"):void 0;(!un||!w.has(un))&&(y.updates.storageUpdates.set(P.nn.call(void 0,te.modified.node._id),P.mergeStorageUpdates.call(void 0,y.updates.storageUpdates.get(P.nn.call(void 0,te.modified.node._id)),te.modified)),y.reverse.unshift(...te.reverse)),(S.type===2||S.type===7||S.type===4)&&w.add(P.nn.call(void 0,te.modified.node._id))}}return y}function V(f,p){switch(f.type){case 6:case 3:case 5:{const y=e.nodes.get(f.id);return y===void 0?{modified:!1}:y._apply(f,p===0)}case 1:{const y=e.nodes.get(f.id);return y===void 0?{modified:!1}:y.parent.type==="HasParent"&&P.isLiveList.call(void 0,y.parent.node)?y.parent.node._setChildKey(f.parentKey,y,p):{modified:!1}}case 4:case 2:case 7:case 8:{if(f.parentId===void 0)return{modified:!1};const y=e.nodes.get(f.parentId);return y===void 0?{modified:!1}:y._attachChild(f,p)}}}function b(f,p){return i.storage.subscribe(y=>{const w=y.filter(S=>P.isSameNodeOrChildOf.call(void 0,S.node,f));w.length>0&&p(w)})}function B(f,p){return i.storage.subscribe(y=>{for(const w of y)w.node._id===f._id&&p(w.node)})}function m(f,p,y){if(typeof f=="string"&&P.isRoomEventName.call(void 0,f)){if(typeof p!="function")throw new Error("Second argument must be a callback function");const w=p;switch(f){case"event":return i.customEvent.subscribe(w);case"my-presence":return i.me.subscribe(w);case"others":{const S=w;return i.others.subscribe(({others:re,event:te})=>S(re,te))}case"error":return i.error.subscribe(w);case"connection":return i.connection.subscribe(w);case"storage":return i.storage.subscribe(w);case"history":return i.history.subscribe(w);default:return P.assertNever.call(void 0,f,"Unknown event")}}if(p===void 0||typeof f=="function")if(typeof f=="function"){const w=f;return i.storage.subscribe(w)}else throw new Error("Please specify a listener callback");if(P.isLiveNode.call(void 0,f)){const w=f;return y!=null&&y.isDeep?b(w,p):B(w,p)}throw new Error(`"${f}" is not a valid event name`)}function F(){return e.connection.current.state}function z(){var f,p,y,w;if(e.connection.current.state!=="closed"&&e.connection.current.state!=="unavailable")return null;const S=Lc(t.authentication,(p=(f=t.polyfills)==null?void 0:f.fetch)!=null?p:t.fetchPolyfill),re=Ac(t.liveblocksServer,(w=(y=t.polyfills)==null?void 0:y.WebSocket)!=null?w:t.WebSocketPolyfill);C({state:"authenticating"}),o.authenticate(S,re)}function T(f,p){const y={};e.buffer.me===null&&(e.buffer.me={type:"partial",data:{}});for(const w in f){const S=f[w];S!==void 0&&(e.buffer.me.data[w]=S,y[w]=e.me.current[w])}e.me.patch(f),e.activeBatch?(p!=null&&p.addToHistory&&e.activeBatch.reverseOps.push({type:"presence",data:y}),e.activeBatch.updates.presence=!0):(oe(),p!=null&&p.addToHistory&&_([{type:"presence",data:y}]),v({presence:!0}))}function A(f,p){p.addEventListener("message",M),p.addEventListener("open",de),p.addEventListener("close",$),p.addEventListener("error",W),C({state:"connecting",id:f.actor,userInfo:f.info,userId:f.id}),e.idFactory=Oc(f.actor),e.socket=p}function O(f){e.token=null,C({state:"unavailable"}),e.numberOfRetry++,e.timeoutHandles.reconnect=o.scheduleReconnect(Y())}function G(f){f==="visible"&&e.connection.current.state==="open"&&ie()}function he(f){if(f.targetActor!==void 0){const y=e.others.getUser(f.actor);e.others.setOther(f.actor,f.data);const w=e.others.getUser(f.actor);if(y===void 0&&w!==void 0)return{type:"enter",user:w}}else e.others.patchOther(f.actor,f.data);const p=e.others.getUser(f.actor);if(p)return{type:"update",updates:f.data,user:p}}function k(f){const p=e.others.getUser(f.actor);return p?(e.others.removeConnection(f.actor),{type:"leave",user:p}):null}function H(f){for(const p in f.users){const y=f.users[p],w=Number(p);e.others.setConnection(w,y.id,y.info)}return{type:"reset"}}function fe(){e.connection.current.state==="unavailable"&&ye()}function h(){i.history.notify({canUndo:Jn(),canRedo:jn()})}function E(f){e.others.setConnection(f.actor,f.id,f.info),e.buffer.messages.push({type:100,data:e.me.current,targetActor:f.actor}),oe();const p=e.others.getUser(f.actor);return p?{type:"enter",user:p}:void 0}function g(f){return P.isJsonObject.call(void 0,f)?f:null}function I(f){const p=P.tryParseJson.call(void 0,f);return p===void 0?null:P.isJsonArray.call(void 0,p)?P.compact.call(void 0,p.map(y=>g(y))):P.compact.call(void 0,[g(p)])}function M(f){if(f.data==="pong"){clearTimeout(e.timeoutHandles.pongTimeout);return}const p=I(f.data);if(p===null||p.length===0)return;const y={storageUpdates:new Map,others:[]};for(const w of p)switch(w.type){case 101:{const S=E(w);S&&y.others.push(S);break}case 100:{const S=he(w);S&&y.others.push(S);break}case 103:{i.customEvent.notify({connectionId:w.actor,event:w.event});break}case 102:{const S=k(w);S&&y.others.push(S);break}case 104:{y.others.push(H(w));break}case 200:{const S=new Map(e.offlineOperations);a(w),me(S),cn==null||cn(),i.storageDidLoad.notify();break}case 201:{U(w.ops,!1).updates.storageUpdates.forEach((re,te)=>{y.storageUpdates.set(te,P.mergeStorageUpdates.call(void 0,y.storageUpdates.get(te),re))});break}}v(y)}function $(f){if(e.socket=null,clearTimeout(e.timeoutHandles.pongTimeout),clearInterval(e.intervalHandles.heartbeat),e.timeoutHandles.flush&&clearTimeout(e.timeoutHandles.flush),clearTimeout(e.timeoutHandles.reconnect),e.others.clearOthers(),v({others:[{type:"reset"}]}),f.code>=4e3&&f.code<=4100){C({state:"failed"});const p=new Tc(f.reason,f.code);i.error.notify(p);const y=Y(!0);e.numberOfRetry++,C({state:"unavailable"}),e.timeoutHandles.reconnect=o.scheduleReconnect(y)}else if(f.code===4999)C({state:"closed"});else{const p=Y();e.numberOfRetry++,C({state:"unavailable"}),e.timeoutHandles.reconnect=o.scheduleReconnect(p)}}function C(f){e.connection.set(f),i.connection.notify(f.state)}function Y(f=!1){return f?mn[e.numberOfRetry0&&f.forEach(w=>{e.offlineOperations.set(P.nn.call(void 0,w.opId),w)}),e.socket===null||e.socket.readyState!==e.socket.OPEN){e.buffer.storageOperations=[];return}const p=Date.now();if(p-e.lastFlushTime>t.throttleDelay){const w=_t(e);if(w.length===0)return;o.send(w),e.buffer={messages:[],storageOperations:[],me:null},e.lastFlushTime=p}else e.timeoutHandles.flush!==null&&clearTimeout(e.timeoutHandles.flush),e.timeoutHandles.flush=o.delayFlush(t.throttleDelay-(p-e.lastFlushTime))}function _t(f){const p=[];f.buffer.me&&p.push(f.buffer.me.type==="full"?{type:100,targetActor:-1,data:f.buffer.me.data}:{type:100,data:f.buffer.me.data});for(const y of f.buffer.messages)p.push(y);return f.buffer.storageOperations.length>0&&p.push({type:201,ops:f.buffer.storageOperations}),p}function Ci(){e.socket&&(e.socket.removeEventListener("open",de),e.socket.removeEventListener("message",M),e.socket.removeEventListener("close",$),e.socket.removeEventListener("error",W),e.socket.close(),e.socket=null),C({state:"closed"}),e.timeoutHandles.flush&&clearTimeout(e.timeoutHandles.flush),clearTimeout(e.timeoutHandles.reconnect),clearTimeout(e.timeoutHandles.pongTimeout),clearInterval(e.intervalHandles.heartbeat),e.others.clearOthers(),v({others:[{type:"reset"}]}),Object.values(i).forEach(f=>f.clear())}function Mi(){return e.me.current}function Ui(){return e.others.current}function Di(f,p={shouldQueueEventIfNotReady:!1}){e.socket===null&&!p.shouldQueueEventIfNotReady||(e.buffer.messages.push({type:103,event:f}),oe())}function qn(f){e.buffer.storageOperations.push(...f),oe()}let ln=null,cn=null;function Gn(){return ln===null&&(e.buffer.messages.push({type:200}),oe(),ln=new Promise(f=>cn=f)),ln}function $i(){const f=e.root;return f!==void 0?f:(Gn(),null)}function zi(){return P.__async.call(void 0,this,null,function*(){return e.root?Promise.resolve({root:e.root}):(yield Gn(),{root:P.nn.call(void 0,e.root)})})}function Fi(){if(e.activeBatch)throw new Error("undo is not allowed during a batch");const f=e.undoStack.pop();if(f===void 0)return;e.pausedHistory=null;const p=U(f,!0);v(p.updates),e.redoStack.push(p.reverse),h();for(const y of f)y.type!=="presence"&&e.buffer.storageOperations.push(y);oe()}function Jn(){return e.undoStack.length>0}function Ki(){if(e.activeBatch)throw new Error("redo is not allowed during a batch");const f=e.redoStack.pop();if(f===void 0)return;e.pausedHistory=null;const p=U(f,!0);v(p.updates),e.undoStack.push(p.reverse),h();for(const y of f)y.type!=="presence"&&e.buffer.storageOperations.push(y);oe()}function jn(){return e.redoStack.length>0}function Hi(f){if(e.activeBatch)return f();e.activeBatch={ops:[],updates:{storageUpdates:new Map,presence:!1,others:[]},reverseOps:[]};try{return f()}finally{const p=e.activeBatch;e.activeBatch=null,p.reverseOps.length>0&&_(p.reverseOps),p.ops.length>0&&(e.redoStack=[]),p.ops.length>0&&qn(p.ops),v(p.updates),oe()}}function Vi(){e.pausedHistory=[]}function Bi(){const f=e.pausedHistory;e.pausedHistory=null,f!==null&&f.length>0&&d(f)}function Xi(){e.socket&&(e.socket=null)}function Yi(f){$(f)}return{onClose:$,onMessage:M,authenticationSuccess:A,heartbeat:ie,onNavigatorOnline:fe,simulateSocketClose:Xi,simulateSendCloseEvent:Yi,onVisibilityChange:G,getUndoStack:()=>e.undoStack,getItemsCount:()=>e.nodes.size,connect:z,disconnect:Ci,subscribe:m,updatePresence:T,broadcastEvent:Di,batch:Hi,undo:Fi,redo:Ki,canUndo:Jn,canRedo:jn,pauseHistory:Vi,resumeHistory:Bi,getStorage:zi,getStorageSnapshot:$i,events:{customEvent:i.customEvent.observable,others:i.others.observable,me:i.me.observable,error:i.error.observable,connection:i.connection.observable,storage:i.storage.observable,history:i.history.observable,storageDidLoad:i.storageDidLoad.observable},getConnectionState:F,isSelfAware:()=>gn(e.connection.current),getSelf:()=>s.current,getPresence:Mi,getOthers:Ui}}function Sc(e,t){const n=new wc,r=new bc({state:"closed"});return{token:null,lastConnectionId:null,socket:null,numberOfRetry:0,lastFlushTime:0,timeoutHandles:{flush:null,reconnect:0,pongTimeout:0},buffer:{me:{type:"full",data:e},messages:[],storageOperations:[]},intervalHandles:{heartbeat:0},connection:r,me:new vc(e),others:n,initialStorage:t,idFactory:null,clock:0,opClock:0,nodes:new Map,root:void 0,undoStack:[],redoStack:[],pausedHistory:null,activeBatch:null,offlineOperations:new Map}}function Pc(e,t){const{initialPresence:n,initialStorage:r}=e,i=Sc(typeof n=="function"?n(t.roomId):n,typeof r=="function"?r(t.roomId):r),o=Ic(i,t),s={id:t.roomId,getConnectionState:o.getConnectionState,isSelfAware:o.isSelfAware,getSelf:o.getSelf,subscribe:o.subscribe,getPresence:o.getPresence,updatePresence:o.updatePresence,getOthers:o.getOthers,broadcastEvent:o.broadcastEvent,getStorage:o.getStorage,getStorageSnapshot:o.getStorageSnapshot,events:o.events,batch:o.batch,history:{undo:o.undo,redo:o.redo,canUndo:o.canUndo,canRedo:o.canRedo,pause:o.pauseHistory,resume:o.resumeHistory},__INTERNAL_DO_NOT_USE:{simulateCloseWebsocket:o.simulateSocketClose,simulateSendCloseEvent:o.simulateSendCloseEvent}};return{connect:o.connect,disconnect:o.disconnect,onNavigatorOnline:o.onNavigatorOnline,onVisibilityChange:o.onVisibilityChange,room:s}}var Tc=class extends Error{constructor(e,t){super(e),this.code=t}};function Ac(e,t){if(typeof window>"u"&&t===void 0)throw new Error("To use Liveblocks client in a non-dom environment, you need to provide a WebSocket polyfill.");const n=t||WebSocket;return r=>new n(`${e}/?token=${r}&version=0.18.2`)}function Lc(e,t){if(e.type==="public"){if(typeof window>"u"&&t===void 0)throw new Error("To use Liveblocks client in a non-dom environment with a publicApiKey, you need to provide a fetch polyfill.");return n=>Er(t||fetch,e.url,{room:n,publicApiKey:e.publicApiKey})}if(e.type==="private"){if(typeof window>"u"&&t===void 0)throw new Error("To use Liveblocks client in a non-dom environment with a url as auth endpoint, you need to provide a fetch polyfill.");return n=>Er(t||fetch,e.url,{room:n})}if(e.type==="custom")return n=>P.__async.call(void 0,this,null,function*(){const r=yield e.callback(n);if(!r||!r.token)throw new Error('Authentication error. We expect the authentication callback to return a token, but it does not. Hint: the return value should look like: { token: "..." }');return r});throw new Error("Internal error. Unexpected authentication type")}function Er(e,t,n){return P.__async.call(void 0,this,null,function*(){const r=yield e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new vn(`Expected a status 200 but got ${r.status} when doing a POST request on "${t}"`);let i;try{i=yield r.json()}catch(s){throw new vn(`Expected a JSON response when doing a POST request on "${t}". ${s}`)}if(!P.isPlainObject.call(void 0,i)||typeof i.token!="string")throw new vn(`Expected a JSON response of the form \`{ token: "..." }\` when doing a POST request on "${t}", but got ${JSON.stringify(i)}`);const{token:o}=i;return{token:o}})}var vn=class extends Error{constructor(e){super(e)}};function Rc(e){const t=e,n=Nc(e),r=new Map;function i(a){const l=r.get(a);return l?l.room:null}function o(a,l){var c,u;let d=r.get(a);if(d)return d.room;if(P.deprecateIf.call(void 0,l.initialPresence===null||l.initialPresence===void 0,"Please provide an initial presence value for the current user when entering the room."),d=Pc({initialPresence:(c=l.initialPresence)!=null?c:{},initialStorage:l.initialStorage},{roomId:a,throttleDelay:n,polyfills:t.polyfills,WebSocketPolyfill:t.WebSocketPolyfill,fetchPolyfill:t.fetchPolyfill,liveblocksServer:(t==null?void 0:t.liveblocksServer)||"wss://api.liveblocks.io/v6",authentication:Cc(t,a)}),r.set(a,d),!l.DO_NOT_USE_withoutConnecting){if(typeof atob>"u"){if(((u=t.polyfills)==null?void 0:u.atob)===void 0)throw new Error("You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill");Ul.atob=t.polyfills.atob}d.connect()}return d.room}function s(a){const l=r.get(a);l&&(l.disconnect(),r.delete(a))}return typeof window<"u"&&typeof window.addEventListener<"u"&&window.addEventListener("online",()=>{for(const[,a]of r)a.onNavigatorOnline()}),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{for(const[,a]of r)a.onVisibilityChange(document.visibilityState)}),{getRoom:i,enter:o,leave:s}}function Nc(e){if(e.throttle===void 0)return 100;if(typeof e.throttle!="number"||e.throttle<80||e.throttle>1e3)throw new Error("throttle should be a number between 80 and 1000.");return e.throttle}function Cc(e,t){const{publicApiKey:n,authEndpoint:r}=e;if(r!==void 0&&n!==void 0)throw new Error("You cannot use both publicApiKey and authEndpoint. Please use either publicApiKey or authEndpoint, but not both. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClient");if(typeof n=="string"){if(n.startsWith("sk_"))throw new Error("Invalid publicApiKey. You are using the secret key which is not supported. Please use the public key instead. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientPublicKey");if(!n.startsWith("pk_"))throw new Error("Invalid key. Please use the public key format: pk_. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientPublicKey");return{type:"public",publicApiKey:n,url:Mc(e,t)}}if(typeof r=="string")return{type:"private",url:r};if(typeof r=="function")return{type:"custom",callback:r};throw r!==void 0?new Error("authEndpoint must be a string or a function. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientAuthEndpoint"):new Error("Invalid Liveblocks client options. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClient")}function Mc(e,t){return e.publicAuthorizeEndpoint?e.publicAuthorizeEndpoint.replace("{roomId}",t):`https://api.liveblocks.io/v2/rooms/${encodeURIComponent(t)}/public/authorize`}function Uc(e,t){if(e.length!==t.length)return!1;for(let n=0;nObject.prototype.hasOwnProperty.call(t,r)&&Object.is(e[r],t[r]))}function $c(e,t){if(Object.is(e,t))return!0;const n=Array.isArray(e),r=Array.isArray(t);return n||r?!n||!r?!1:Uc(e,t):Dc(e,t)}Ae.LiveList=P.LiveList;Ae.LiveMap=P.LiveMap;Ae.LiveObject=P.LiveObject;Ae.createClient=Rc;Ae.shallow=$c;const zc=Ae.LiveList;Ae.LiveMap;Ae.LiveObject;const Fc=Ae.createClient;Ae.shallow;function Kc(e){let t,n,r,i,o,s,a,l;return{c(){t=Q("div"),n=Ht("svg"),r=Ht("path"),i=ae(),o=Q("div"),s=Ee(e[2]),this.h()},l(c){t=ee(c,"DIV",{class:!0,style:!0});var u=j(t);n=Vt(u,"svg",{class:!0,width:!0,viewBox:!0,fill:!0,xmlns:!0});var d=j(n);r=Vt(d,"path",{d:!0,fill:!0}),j(r).forEach(N),d.forEach(N),i=le(u),o=ee(u,"DIV",{class:!0,style:!0});var _=j(o);s=ke(_,e[2]),_.forEach(N),u.forEach(N),this.h()},h(){x(r,"d","M0.91603 0.916054L7.09131 14.9234L8.89871 8.89873L14.9234 7.09133L0.91603 0.916054Z"),x(r,"fill","#FFB800"),x(n,"class","block z-0 col-span-2 row-span-2"),x(n,"width","40"),x(n,"viewBox","0 0 15 15"),x(n,"fill","currentColor"),x(n,"xmlns","http://www.w3.org/2000/svg"),x(o,"class","absolute right-0 text-4xl col-start-2 row-start-2"),x(o,"style",a=`text-shadow: 0px 5px 5px ${e[1]}`),x(t,"class","cursor svelte-14ka0w3"),x(t,"style",l=`transform: translateX(${e[3].x}px) translateY(${e[3].y}px) scale(${e[0].k});`)},m(c,u){se(c,t,u),D(t,n),D(n,r),D(t,i),D(t,o),D(o,s)},p(c,[u]){u&4&&wn(s,c[2]),u&2&&a!==(a=`text-shadow: 0px 5px 5px ${c[1]}`)&&x(o,"style",a),u&9&&l!==(l=`transform: translateX(${c[3].x}px) translateY(${c[3].y}px) scale(${c[0].k});`)&&x(t,"style",l)},i:ge,o:ge,d(c){c&&N(t)}}}function Hc(e,t,n){let r,{transform:i}=t,{color:o=""}=t,{emoji:s=""}=t,{position:a={x:0,y:0}}=t;return e.$$set=l=>{"transform"in l&&n(0,i=l.transform),"color"in l&&n(1,o=l.color),"emoji"in l&&n(2,s=l.emoji),"position"in l&&n(4,a=l.position)},e.$$.update=()=>{e.$$.dirty&17&&n(3,r={x:i.applyX(a.x),y:i.applyY(a.y)})},[i,o,s,r,a]}class Ai extends qe{constructor(t){super(),Ge(this,t,Hc,Kc,Je,{transform:0,color:1,emoji:2,position:4})}}function Vc(e){let t,n;return{c(){t=Ht("svg"),n=Ht("path"),this.h()},l(r){t=Vt(r,"svg",{xmlns:!0,fill:!0,width:!0,viewBox:!0,class:!0});var i=j(t);n=Vt(i,"path",{fill:!0,d:!0}),j(n).forEach(N),i.forEach(N),this.h()},h(){x(n,"fill","currentColor"),x(n,"d","M20 12a8 8 0 0 1-8 8v4a12 12 0 0 0 12-12h-4Zm-2-5.3a8 8 0 0 1 2 5.3h4c0-3-1.1-5.8-3-8l-3 2.7Z"),x(t,"xmlns","http://www.w3.org/2000/svg"),x(t,"fill","none"),x(t,"width","50"),x(t,"viewBox","0 0 24 24"),x(t,"class","animate-spin max-w-[1rem] inline-block")},m(r,i){se(r,t,i),D(t,n)},p:ge,i:ge,o:ge,d(r){r&&N(t)}}}class Bc extends qe{constructor(t){super(),Ge(this,t,null,Vc,Je,{})}}function Xc(e){let t,n,r,i,o,s,a,l,c,u;return n=new Bc({}),{c(){t=Q("div"),Oe(n.$$.fragment),r=ae(),i=Q("h2"),o=Ee("Click to paint"),s=ae(),a=Q("div"),l=Ee("A cat on grass"),this.h()},l(d){t=ee(d,"DIV",{class:!0,style:!0});var _=j(t);Ie(n.$$.fragment,_),r=le(_),i=ee(_,"H2",{class:!0});var v=j(i);o=ke(v,"Click to paint"),v.forEach(N),s=le(_),a=ee(_,"DIV",{class:!0});var L=j(a);l=ke(L,"A cat on grass"),L.forEach(N),_.forEach(N),this.h()},h(){x(i,"class","text-lg"),x(a,"class","absolute bottom-0 font-bold"),x(t,"class","frame z-0 flex relative svelte-er2v6n"),x(t,"style",c=`transform: translateX(${e[2].x}px) translateY(${e[2].y}px) scale(${e[0].k}); - background-image: linear-gradient(${e[1]}, rgba(255,255,255,0)); - color: ${e[1]}; - `)},m(d,_){se(d,t,_),Se(n,t,null),D(t,r),D(t,i),D(i,o),D(t,s),D(t,a),D(a,l),u=!0},p(d,[_]){(!u||_&7&&c!==(c=`transform: translateX(${d[2].x}px) translateY(${d[2].y}px) scale(${d[0].k}); - background-image: linear-gradient(${d[1]}, rgba(255,255,255,0)); - color: ${d[1]}; - `))&&x(t,"style",c)},i(d){u||(X(n.$$.fragment,d),u=!0)},o(d){q(n.$$.fragment,d),u=!1},d(d){d&&N(t),Pe(n)}}}function Yc(e,t,n){let r,{transform:i}=t,{color:o=""}=t,{position:s={x:0,y:0}}=t;return e.$$set=a=>{"transform"in a&&n(0,i=a.transform),"color"in a&&n(1,o=a.color),"position"in a&&n(3,s=a.position)},e.$$.update=()=>{e.$$.dirty&9&&n(2,r={x:i.applyX(s.x),y:i.applyY(s.y)})},[i,o,r,s]}class an extends qe{constructor(t){super(),Ge(this,t,Yc,Xc,Je,{transform:0,color:1,position:3})}}function qc(e){let t,n;return{c(){t=Q("div"),n=Q("canvas"),this.h()},l(r){t=ee(r,"DIV",{class:!0});var i=j(t);n=ee(i,"CANVAS",{width:!0,height:!0,class:!0}),j(n).forEach(N),i.forEach(N),this.h()},h(){x(n,"width",e[3]),x(n,"height",e[2]),x(n,"class","absolute top-0 left-0 svelte-6dcxg7"),x(t,"class","absolute top-0 left-0 right-0 bottom-0 overflow-hidden z-0")},m(r,i){se(r,t,i),D(t,n),e[5](n),e[6](t)},p:ge,i:ge,o:ge,d(r){r&&N(t),e[5](null),e[6](null)}}}const Ut=10;function Gc(e,t,n){let r,i,o,s,a;ue(e,rt,m=>n(8,r=m)),ue(e,Nn,m=>n(9,i=m)),ue(e,Ln,m=>n(10,o=m)),ue(e,Et,m=>n(11,s=m)),ue(e,jt,m=>n(4,a=m));const l=512*5,c=512*5;let{value:u}=t,d,_;Qt(()=>{const m=c/d.clientWidth,F=Al().scaleExtent([1/m/1.5,1]).translateExtent([[-c*.1,-l*.1],[c*1.1,l*1.1]]).tapDistance(10).on("zoom",L);Ve(u.parentElement).call(F).on("dblclick.zoom",()=>(ne(Et,s=!0,s),ne(Ln,o=r.cursor,o),console.log("clicked",o),null)).on("pointermove",U).on("pointerleave",V),_=u.getContext("2d"),_.strokeStyle="blue",_.lineWidth=10,_.strokeRect(0,0,c,l)});function v(m){const F=[...m.toImmutable()].sort((z,T)=>z.date-T.date);Promise.all(F.map(({imgURL:z,position:T})=>new Promise(A=>{const O=new Image;O.crossOrigin="anonymous",O.onload=()=>{A({img:O,position:T})};const G=z.split("/");O.src=`${Ml}/${G.slice(3).join("/")}`}))).then(z=>{z.forEach(({img:T,position:A})=>{_.drawImage(T,A.x,A.y,T.width,T.height)})})}function L(m){const F=ne(Nn,i=m.transform,i);n(0,u.style.transform=`translate(${F.x}px, ${F.y}px) scale(${F.k})`,u)}function U(m){m.preventDefault();const F=Math.round(i.invertX(m.layerX)/Ut)*Ut,z=Math.round(i.invertY(m.layerY)/Ut)*Ut;ne(rt,r={cursor:{x:F,y:z}},r)}function V(){ne(rt,r={cursor:null},r)}function b(m){bn[m?"unshift":"push"](()=>{u=m,n(0,u)})}function B(m){bn[m?"unshift":"push"](()=>{d=m,n(1,d)})}return e.$$set=m=>{"value"in m&&n(0,u=m.value)},e.$$.update=()=>{e.$$.dirty&16&&a&&v(a)},[u,d,l,c,a,b,B]}class Jc extends qe{constructor(t){super(),Ge(this,t,Gc,qc,Je,{value:0})}}function jc(e){let t,n,r,i,o,s,a,l,c,u,d,_,v,L,U,V,b,B,m,F,z,T;return{c(){t=Q("div"),n=Q("div"),r=Q("input"),i=ae(),o=Q("label"),s=Ee("Show Frames"),a=ae(),l=Q("div"),c=Q("input"),u=ae(),d=Q("label"),_=Ee("Text2Image"),v=ae(),L=Q("button"),U=Ee("Add Prompt"),V=ae(),b=Q("button"),B=Q("span"),m=Ee("+"),F=Ee(` - Paint`),this.h()},l(A){t=ee(A,"DIV",{class:!0});var O=j(t);n=ee(O,"DIV",{class:!0});var G=j(n);r=ee(G,"INPUT",{id:!0,type:!0,class:!0}),i=le(G),o=ee(G,"LABEL",{for:!0,class:!0});var he=j(o);s=ke(he,"Show Frames"),he.forEach(N),G.forEach(N),a=le(O),l=ee(O,"DIV",{class:!0});var k=j(l);c=ee(k,"INPUT",{id:!0,type:!0,class:!0}),u=le(k),d=ee(k,"LABEL",{for:!0,class:!0});var H=j(d);_=ke(H,"Text2Image"),H.forEach(N),k.forEach(N),v=le(O),L=ee(O,"BUTTON",{class:!0,title:!0});var fe=j(L);U=ke(fe,"Add Prompt"),fe.forEach(N),V=le(O),b=ee(O,"BUTTON",{class:!0,title:!0});var h=j(b);B=ee(h,"SPAN",{class:!0});var E=j(B);m=ke(E,"+"),E.forEach(N),F=ke(h,` - Paint`),h.forEach(N),O.forEach(N),this.h()},h(){x(r,"id","showframes"),x(r,"type","checkbox"),x(r,"class","w-4 h-4 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 cursor-pointer"),x(o,"for","showframes"),x(o,"class","text-black dark:text-white cursor-pointer ml-2"),x(n,"class","flex items-center"),x(c,"id","txt2img"),x(c,"type","checkbox"),x(c,"class","w-4 h-4 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 cursor-pointer"),x(d,"for","txt2img"),x(d,"class","text-black dark:text-white cursor-pointer ml-2"),x(l,"class","flex items-center"),x(L,"class","button svelte-3z1a8v"),x(L,"title","Add Prompt"),x(B,"class","rounded-sm h-5 w-5 m-1 flex justify-center items-center border-2 border-dashed border-violet-700 mr-2"),x(b,"class","button-paint bg-violet-100 text-violet-900 svelte-3z1a8v"),x(b,"title","New Paint Frame"),x(t,"class","grid grid-cols-4 gap-3 text-sm w-max mx-auto")},m(A,O){se(A,t,O),D(t,n),D(n,r),r.checked=e[0],D(n,i),D(n,o),D(o,s),D(t,a),D(t,l),D(l,c),c.checked=e[1],D(l,u),D(l,d),D(d,_),D(t,v),D(t,L),D(L,U),D(t,V),D(t,b),D(b,B),D(B,m),D(b,F),z||(T=[ct(r,"change",e[2]),ct(c,"change",e[3])],z=!0)},p(A,[O]){O&1&&(r.checked=A[0]),O&2&&(c.checked=A[1])},i:ge,o:ge,d(A){A&&N(t),z=!1,Cr(T)}}}function Wc(e,t,n){let r,i;ue(e,Rn,a=>n(0,r=a)),ue(e,mr,a=>n(1,i=a));function o(){r=this.checked,Rn.set(r)}function s(){i=this.checked,mr.set(i)}return[r,i,o,s]}class Zc extends qe{constructor(t){super(),Ge(this,t,Wc,jc,Je,{})}}function Qc(e){let t,n,r,i;return{c(){t=Q("form"),n=Q("input"),this.h()},l(o){t=ee(o,"FORM",{class:!0});var s=j(t);n=ee(s,"INPUT",{class:!0,placeholder:!0,title:!0,type:!0,name:!0}),s.forEach(N),this.h()},h(){x(n,"class","input svelte-4r5yqh"),x(n,"placeholder","Type a prompt..."),x(n,"title","Input prompt to generate image and obtain palette"),x(n,"type","text"),x(n,"name","prompt"),x(t,"class","fixed w-screen top-0 left-0 bottom-0 right-0 max-h-screen z-50 flex items-center justify-center bg-black bg-opacity-80 px-3")},m(o,s){se(o,t,s),D(t,n),Wn(n,e[0]),r||(i=[ct(n,"click",qi(e[2])),ct(n,"input",e[3]),ct(t,"submit",Gi(e[4])),ct(t,"click",e[5])],r=!0)},p(o,[s]){s&1&&n.value!==o[0]&&Wn(n,o[0])},i:ge,o:ge,d(o){o&&N(t),r=!1,Cr(i)}}}function eu(e,t,n){const r=Ji();let i;const o=u=>{u.key==="Escape"&&r("close")};Qt(()=>(window.addEventListener("keyup",o),()=>{window.removeEventListener("keyup",o)}));function s(u){ji.call(this,e,u)}function a(){i=this.value,n(0,i)}return[i,r,s,a,()=>r("prompt",{prompt:i}),()=>r("close")]}class tu extends qe{constructor(t){super(),Ge(this,t,eu,Qc,Je,{})}}var Li={},Ri={},Yn={exports:{}},Z=String,Ni=function(){return{isColorSupported:!1,reset:Z,bold:Z,dim:Z,italic:Z,underline:Z,inverse:Z,hidden:Z,strikethrough:Z,black:Z,red:Z,green:Z,yellow:Z,blue:Z,magenta:Z,cyan:Z,white:Z,gray:Z,bgBlack:Z,bgRed:Z,bgGreen:Z,bgYellow:Z,bgBlue:Z,bgMagenta:Z,bgCyan:Z,bgWhite:Z}};Yn.exports=Ni();Yn.exports.createColors=Ni;(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(l,c){for(var u in c)Object.defineProperty(l,u,{enumerable:!0,get:c[u]})}t(e,{dim:()=>s,default:()=>a});const n=r(Yn.exports);function r(l){return l&&l.__esModule?l:{default:l}}let i=new Set;function o(l,c,u){typeof process<"u"&&process.env.JEST_WORKER_ID||u&&i.has(u)||(u&&i.add(u),console.warn(""),c.forEach(d=>console.warn(l,"-",d)))}function s(l){return n.default.dim(l)}const a={info(l,c){o(n.default.bold(n.default.cyan("info")),...Array.isArray(l)?[l]:[c,l])},warn(l,c){o(n.default.bold(n.default.yellow("warn")),...Array.isArray(l)?[l]:[c,l])},risk(l,c){o(n.default.bold(n.default.magenta("risk")),...Array.isArray(l)?[l]:[c,l])}}})(Ri);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:()=>i});const t=n(Ri);function n(o){return o&&o.__esModule?o:{default:o}}function r({version:o,from:s,to:a}){t.default.warn(`${s}-color-renamed`,[`As of Tailwind CSS ${o}, \`${s}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const i={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337"},get lightBlue(){return r({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return r({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return r({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return r({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return r({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(Li);let yn=Li;var nu=(yn.__esModule?yn:{default:yn}).default;const be=Object.values(nu).filter(e=>typeof e=="object").map(e=>e[200]).slice(0,18),bt=["\u{1F436}","\u{1F431}","\u{1F42D}","\u{1F439}","\u{1F430}","\u{1F98A}","\u{1F43B}","\u{1F43C}","\u{1F428}","\u{1F42F}","\u{1F981}","\u{1F42E}","\u{1F432}","\u{1F31A}","\u{1F31D}","\u{1F31E}","\u{1F31B}","\u{1F31C}"];function ru(e){return new Promise(t=>{const n=new Image;n.onload=async()=>{const r=n.width,i=n.height,o=document.createElement("canvas");o.width=r,o.height=i,o.getContext("2d").drawImage(n,0,0,r,i);const a=await new Promise(l=>o.toBlob(l,"image/jpeg",.95));t(a)},n.src=e})}async function iu(e,t){const n=ou(t),r="https://huggingface.co/uploads",o=`color-palette-${crypto.randomUUID().split("-")[0]}-${n}.jpeg`,s=new File([e],o,{type:"image/jpeg"});console.log("uploading image",s);const l=await(await fetch(r,{method:"POST",headers:{"Content-Type":s.type,"X-Requested-With":"XMLHttpRequest"},body:s})).text();return console.log("uploaded images",l),l}function ou(e){return e?e.toString().toLowerCase().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,""):""}function kr(e,t,n){const r=e.slice();return r[17]=t[n].connectionId,r[18]=t[n].presence,r}function xr(e,t,n){const r=e.slice();return r[21]=t[n],r[23]=n,r}function Or(e){let t,n;return t=new tu({}),t.$on("prompt",e[11]),t.$on("close",e[10]),{c(){Oe(t.$$.fragment)},l(r){Ie(t.$$.fragment,r)},m(r,i){Se(t,r,i),n=!0},p:ge,i(r){n||(X(t.$$.fragment,r),n=!0)},o(r){q(t.$$.fragment,r),n=!1},d(r){Pe(t,r)}}}function Ir(e){let t,n,r=e[4],i=[];for(let s=0;sq(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;sa[17];for(let a=0;a{o=null}),Ye())},i(a){i||(X(o),i=!0)},o(a){q(o),i=!1},d(a){a&&N(n),o&&o.d(a),a&&N(r)}}}function au(e){var he;let t,n,r,i,o,s,a,l,c,u,d,_,v,L,U,V,b,B,m=e[5]&&Or(e);function F(k){e[13](k)}let z={};e[0]!==void 0&&(z.value=e[0]),l=new Jc({props:z}),bn.push(()=>Wi(l,"value",F));let T=e[4]&&e[6]&&Ir(e),A=e[3]&&Pr(e),O=((he=e[8])==null?void 0:he.cursor)&&Tr(e),G=St&&su(e);return b=new Zc({}),{c(){t=Q("div"),n=Ee(e[1]),r=ae(),i=Ee(e[2]),o=ae(),m&&m.c(),s=ae(),a=Q("div"),Oe(l.$$.fragment),u=ae(),d=Q("main"),T&&T.c(),_=ae(),A&&A.c(),v=ae(),O&&O.c(),L=ae(),G&&G.c(),U=ae(),V=Q("div"),Oe(b.$$.fragment),this.h()},l(k){t=ee(k,"DIV",{class:!0});var H=j(t);n=ke(H,e[1]),r=le(H),i=ke(H,e[2]),H.forEach(N),o=le(k),m&&m.l(k),s=le(k),a=ee(k,"DIV",{class:!0});var fe=j(a);Ie(l.$$.fragment,fe),u=le(fe),d=ee(fe,"MAIN",{class:!0});var h=j(d);T&&T.l(h),_=le(h),A&&A.l(h),v=le(h),O&&O.l(h),L=le(h),G&&G.l(h),h.forEach(N),fe.forEach(N),U=le(k),V=ee(k,"DIV",{class:!0});var E=j(V);Ie(b.$$.fragment,E),E.forEach(N),this.h()},h(){x(t,"class","text touch-none pointer-events-none"),x(d,"class","z-10 relative"),x(a,"class","fixed top-0 left-0 z-0 w-screen h-screen"),x(V,"class","fixed bottom-0 left-0 right-0 z-10 my-2")},m(k,H){se(k,t,H),D(t,n),D(t,r),D(t,i),se(k,o,H),m&&m.m(k,H),se(k,s,H),se(k,a,H),Se(l,a,null),D(a,u),D(a,d),T&&T.m(d,null),D(d,_),A&&A.m(d,null),D(d,v),O&&O.m(d,null),D(d,L),G&&G.m(d,null),se(k,U,H),se(k,V,H),Se(b,V,null),B=!0},p(k,[H]){var h;(!B||H&2)&&wn(n,k[1]),(!B||H&4)&&wn(i,k[2]),k[5]?m?(m.p(k,H),H&32&&X(m,1)):(m=Or(k),m.c(),X(m,1),m.m(s.parentNode,s)):m&&(Xe(),q(m,1,1,()=>{m=null}),Ye());const fe={};!c&&H&1&&(c=!0,fe.value=k[0],Zi(()=>c=!1)),l.$set(fe),k[4]&&k[6]?T?(T.p(k,H),H&80&&X(T,1)):(T=Ir(k),T.c(),X(T,1),T.m(d,_)):T&&(Xe(),q(T,1,1,()=>{T=null}),Ye()),k[3]?A?(A.p(k,H),H&8&&X(A,1)):(A=Pr(k),A.c(),X(A,1),A.m(d,v)):A&&(Xe(),q(A,1,1,()=>{A=null}),Ye()),(h=k[8])!=null&&h.cursor?O?(O.p(k,H),H&256&&X(O,1)):(O=Tr(k),O.c(),X(O,1),O.m(d,L)):O&&(Xe(),q(O,1,1,()=>{O=null}),Ye()),St&&G.p(k,H)},i(k){B||(X(m),X(l.$$.fragment,k),X(T),X(A),X(O),X(G),X(b.$$.fragment,k),B=!0)},o(k){q(m),q(l.$$.fragment,k),q(T),q(A),q(O),q(G),q(b.$$.fragment,k),B=!1},d(k){k&&N(t),k&&N(o),m&&m.d(k),k&&N(s),k&&N(a),Pe(l),T&&T.d(),A&&A.d(),O&&O.d(),G&&G.d(),k&&N(U),k&&N(V),Pe(b)}}}function lu(e,t,n){let r,i,o,s,a,l,c,u,d;ue(e,we,m=>n(1,r=m)),ue(e,at,m=>n(2,i=m)),ue(e,Ln,m=>n(3,o=m)),ue(e,jt,m=>n(4,s=m)),ue(e,Et,m=>n(5,a=m)),ue(e,Rn,m=>n(6,l=m)),ue(e,Nn,m=>n(7,c=m)),ue(e,rt,m=>n(8,u=m)),ue(e,St,m=>n(9,d=m));let{room:_}=t,v;Qt(()=>{});async function L(m){ne(Et,a=!1,a)}async function U(m){const F=m.detail.prompt,z=await b(F);ne(Et,a=!1,a),console.log("prompt",F,z)}function V(m){const F=document.createElement("canvas");F.width=512,F.height=512;const z=F.getContext("2d");return z.save(),z.clearRect(0,0,512,512),z.globalCompositeOperation="source-over",z.drawImage(v,m.x,m.y,512,512,0,0,512,512),z.restore(),F.toDataURL("image/png")}async function b(m){if(!m||i==!0)return;ne(we,r="Pending",r),ne(at,i=!0,i);const F=crypto.randomUUID(),z={fn_index:0,data:[V(o),m,.75,7.5,30,"patchmatch"],session_hash:F};console.log("payload",z);const T=new WebSocket(Cl);T.onclose=A=>{A.wasClean||(ne(we,r="Error",r),ne(at,i=!1,i))},T.onmessage=async function(A){try{const O=JSON.parse(A.data);switch(ne(we,r="",r),O.msg){case"send_data":ne(we,r="Sending Data",r),T.send(JSON.stringify(z));break;case"queue_full":ne(we,r="Queue full",r),T.close(),ne(at,i=!1,i);return;case"estimation":const{msg:G,rank:he,queue_size:k}=O;ne(we,r=`On queue ${he}/${k}`,r);break;case"process_generating":ne(we,r=O.success?"Generating":"Error",r);break;case"process_completed":try{const H=O.output.data[0],fe=O.output.data[1],h=await ru(H),E=await iu(h,m);s.push({prompt:m,imgURL:E,position:o,date:new Date().getTime()}),console.log(E),ne(we,r=O.success?"Complete":"Error",r)}catch(H){ne(we,r=H.message,r)}T.close(),ne(at,i=!1,i);return;case"process_starts":ne(we,r="Processing",r);break}}catch(O){console.error(O),ne(at,i=!1,i),ne(we,r="Error",r)}}}function B(m){v=m,n(0,v)}return e.$$set=m=>{"room"in m&&n(12,_=m.room)},[v,r,i,o,s,a,l,c,u,d,L,U,_,B]}class cu extends qe{constructor(t){super(),Ge(this,t,lu,au,Je,{room:12})}}function Rr(e){let t,n;return t=new cu({props:{room:e[0]}}),{c(){Oe(t.$$.fragment)},l(r){Ie(t.$$.fragment,r)},m(r,i){Se(t,r,i),n=!0},p(r,i){const o={};i&1&&(o.room=r[0]),t.$set(o)},i(r){n||(X(t.$$.fragment,r),n=!0)},o(r){q(t.$$.fragment,r),n=!1},d(r){Pe(t,r)}}}function uu(e){let t,n,r,i,o,s,a=e[0]&&Rr(e);return{c(){t=Q("div"),n=Q("h1"),r=Ee("Stable Diffussion Outpainting Multiplayer"),i=ae(),a&&a.c(),o=Ne(),this.h()},l(l){t=ee(l,"DIV",{class:!0});var c=j(t);n=ee(c,"H1",{class:!0});var u=j(n);r=ke(u,"Stable Diffussion Outpainting Multiplayer"),u.forEach(N),c.forEach(N),i=le(l),a&&a.l(l),o=Ne(),this.h()},h(){x(n,"class","text-lg md:text-3xl font-bold leading-normal"),x(t,"class","max-w-screen-md mx-auto p-5 relative pointer-events-none touch-none z-10")},m(l,c){se(l,t,c),D(t,n),D(n,r),se(l,i,c),a&&a.m(l,c),se(l,o,c),s=!0},p(l,[c]){l[0]?a?(a.p(l,c),c&1&&X(a,1)):(a=Rr(l),a.c(),X(a,1),a.m(o.parentNode,o)):a&&(Xe(),q(a,1,1,()=>{a=null}),Ye())},i(l){s||(X(a),s=!0)},o(l){q(a),s=!1},d(l){l&&N(t),l&&N(i),a&&a.d(l),l&&N(o)}}}let Nr="multiplayer-SD";function fu(e,t,n){console.log("PUBLIC_DEV_MODE",Nl),console.log("/embed/huggingface-projects/color-palette-generator-sd");let i,o;return Qt(()=>{i=Fc({publicApiKey:"pk_test_JlUZGH3kQmhmZQiqU2l8eIi5"}),n(0,o=i.enter(Nr,{initialPresence:{cursor:null},initialStorage:{imagesList:new zc}})),o.subscribe("error",a=>{console.error("error",a)});const s=Ll(o);return Rl(o),()=>{i&&o&&(i.leave(Nr),s())}}),[o]}class pu extends qe{constructor(t){super(),Ge(this,t,fu,uu,Je,{})}}export{pu as default};