diff --git "a/static/_app/immutable/chunks/About-10c589ef.js" "b/static/_app/immutable/chunks/About-10c589ef.js" new file mode 100644--- /dev/null +++ "b/static/_app/immutable/chunks/About-10c589ef.js" @@ -0,0 +1,21 @@ +import{S as Ee,i as xe,s as ke,C as qn,D as Gn,E as Qn,F as er,f as J,t as W,J as ci,K as fi,L as mn,M as q,N as G,m as O,h as w,n as f,b as re,G as g,B as pe,k as U,w as _e,l as H,x as ge,y as ve,z as ye,a as ie,q as ee,c as se,r as te,g as Me,d as Re,u as tt,O as Ne,H as Ce,P as tr,o as zt,Q as hi,R as dt,I as Ae,T as Ls,U as Un,V as nr,W as Ts,e as vt,X as Ns,Y as Ms}from"./index-fecbaf1e.js";import{w as Xe}from"./singletons-21a4dac5.js";import{p as Rs}from"./stores-507d8cd4.js";var $s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ds(e){var t=e.default;if(typeof t=="function"){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var ze={},K={};Object.defineProperty(K,"__esModule",{value:!0});var Us=Object.defineProperty,Hs=Object.defineProperties,zs=Object.getOwnPropertyDescriptors,on=Object.getOwnPropertySymbols,di=Object.prototype.hasOwnProperty,pi=Object.prototype.propertyIsEnumerable,br=(e,t,n)=>t in e?Us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nt=(e,t)=>{for(var n in t||(t={}))di.call(t,n)&&br(e,n,t[n]);if(on)for(var n of on(t))pi.call(t,n)&&br(e,n,t[n]);return e},It=(e,t)=>Hs(e,zs(t)),Vs=(e,t)=>{var n={};for(var r in e)di.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&on)for(var r of on(e))t.indexOf(r)<0&&pi.call(e,r)&&(n[r]=e[r]);return n},rr=(e,t,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(u){i(u)}},o=l=>{try{a(n.throw(l))}catch(u){i(u)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(e,t)).next())});function Qe(e,t){throw new Error(t)}function Q(e,t="Expected value to be non-nullable"){return e}var mi=(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))(mi||{}),_i=(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))(_i||{}),gi=(e=>(e[e.OBJECT=0]="OBJECT",e[e.LIST=1]="LIST",e[e.MAP=2]="MAP",e[e.REGISTER=3]="REGISTER",e))(gi||{});function vi(e){return e.type===0&&!yi(e)}function yi(e){return e.parentId!==void 0&&e.parentKey!==void 0}var wi=(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))(wi||{});function Bs(e){return e==="my-presence"||e==="others"||e==="event"||e==="error"||e==="connection"||e==="history"}var bi=(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))(bi||{});function Er(e,t){return Object.freeze({type:"HasParent",node:e,key:t})}var xr=Object.freeze({type:"NoParent"});function kr(e){return Object.freeze({type:"Orphaned",oldKey:e})}var _n=class{constructor(){this._parent=xr}_getParentKeyOrThrow(){switch(this.parent.type){case"HasParent":return this.parent.key;case"NoParent":throw new Error("Parent key is missing");case"Orphaned":return this.parent.oldKey;default:return Qe(this.parent,"Unknown state")}}get _pool(){return this.__pool}get roomId(){return this.__pool?this.__pool.roomId:null}get _id(){return this.__id}get parent(){return this._parent}get _parentNode(){switch(this.parent.type){case"HasParent":return this.parent.node;case"NoParent":return null;case"Orphaned":return null;default:return Qe(this.parent,"Unknown state")}}get _parentKey(){switch(this.parent.type){case"HasParent":return this.parent.key;case"NoParent":return null;case"Orphaned":return this.parent.oldKey;default:return Qe(this.parent,"Unknown state")}}_apply(e,t){switch(e.type){case 5:return this.parent.type==="HasParent"?this.parent.node._detachChild(this):{modified:!1}}return{modified:!1}}_setParentLink(e,t){switch(this.parent.type){case"HasParent":if(this.parent.node!==e)throw new Error("Cannot set parent: node already has a parent");this._parent=Er(e,t);return;case"Orphaned":case"NoParent":{this._parent=Er(e,t);return}default:return Qe(this.parent,"Unknown state")}}_attach(e,t){if(this.__id||this.__pool)throw new Error("Cannot attach node: already attached");t.addNode(e,this),this.__id=e,this.__pool=t}_detach(){switch(this.__pool&&this.__id&&this.__pool.deleteNode(this.__id),this.parent.type){case"HasParent":{this._parent=kr(this.parent.key);break}case"NoParent":{this._parent=xr;break}case"Orphaned":{this._parent=kr(this.parent.oldKey);break}default:Qe(this.parent,"Unknown state")}this.__pool=void 0}invalidate(){this._cachedImmutable!==void 0&&(this._cachedImmutable=void 0,this.parent.type==="HasParent"&&this.parent.node.invalidate())}toImmutable(){return this._cachedImmutable===void 0&&(this._cachedImmutable=this._toImmutable()),this._cachedImmutable}},st=class extends _n{constructor(e){super(),this._data=e}get data(){return this._data}static _deserialize([e,t],n,r){const i=new st(t.data);return i._attach(e,r),i}_toOps(e,t,n){if(this._id===void 0)throw new Error("Cannot serialize register if parentId or parentKey is undefined");return[{type:8,opId:n==null?void 0:n.generateOpId(),id:this._id,parentId:e,parentKey:t,data:this.data}]}_serialize(){if(this.parent.type!=="HasParent")throw new Error("Cannot serialize LiveRegister if parent is missing");return{type:3,parentId:Q(this.parent.node._id,"Parent node expected to have ID"),parentKey:this.parent.key,data:this.data}}_attachChild(e){throw new Error("Method not implemented.")}_detachChild(e){throw new Error("Method not implemented.")}_apply(e,t){return super._apply(e,t)}_toImmutable(){return this._data}},pt=32,ir=126;function Fe(e,t){return e!==void 0&&t!==void 0?an(Ei(Et(e),Et(t))):e!==void 0?Fs(e):t!==void 0?Ks(t):an([pt+1])}function Ks(e){const t=[],n=Et(e);for(let r=0;rs)throw new Error(`Impossible to generate position between ${e} and ${t}`);if(i===s){r.push(i),n++;continue}if(s-i===1){r.push(i),r.push(...Ei(e.slice(n+1),[]));break}const o=s+i>>1;r.push(o);break}return r}function Et(e){const 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=Lt(e);r._attach(t,this._pool),r._setParentLink(this,n);const i=e.deletedId,s=this._indexOfPosition(n);if(s!==-1){const o=this._items[s];if(o._id===i)return o._detach(),this._items[s]=r,{modified:ue(this,[gt(s,r)]),reverse:[]};{this._implicitlyDeletedItems.add(o),this._items[s]=r;const a=[gt(s,r)],l=this._detachItemAssociatedToSetOperation(e.deletedId);return l&&a.push(l),{modified:ue(this,a),reverse:[]}}}else{const o=[],a=this._detachItemAssociatedToSetOperation(e.deletedId);return a&&o.push(a),this._insertAndSort(r),o.push(Ke(this._indexOfPosition(n),r)),{reverse:[],modified:ue(this,o)}}}_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:ue(this,t),reverse:[]};this._unacknowledgedSets.delete(e.parentKey)}const i=this._indexOfPosition(e.parentKey),s=this._items.find(o=>o._id===e.id);if(s!==void 0){if(s._parentKey===e.parentKey)return{modified:t.length>0?ue(this,t):!1,reverse:[]};i!==-1&&(this._implicitlyDeletedItems.add(this._items[i]),this._items.splice(i,1),t.push(Ft(i)));const o=this._items.indexOf(s);s._setParentLink(this,e.parentKey),this._sortItems();const a=this._items.indexOf(s);return a!==o&&t.push(lt(o,a,s)),{modified:t.length>0?ue(this,t):!1,reverse:[]}}else{const o=this._pool.getNode(e.id);if(o&&this._implicitlyDeletedItems.has(o)){o._setParentLink(this,e.parentKey),this._implicitlyDeletedItems.delete(o),this._insertAndSort(o);const a=this._items.indexOf(o);return{modified:ue(this,[i===-1?Ke(a,o):gt(a,o),...t]),reverse:[]}}else{i!==-1&&this._items.splice(i,1);const{newItem:a,newIndex:l}=this._createAttachItemAndSort(e,e.parentKey);return{modified:ue(this,[i===-1?Ke(l,a):gt(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:ue(this,[Ke(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 s=this._indexOfPosition(n);return s===i?{modified:!1}:{modified:ue(this,[lt(i,s,t)]),reverse:[]}}}else{const i=Q(this._pool).getNode(e.id);if(i&&this._implicitlyDeletedItems.has(i)){i._setParentLink(this,n),this._implicitlyDeletedItems.delete(i),this._insertAndSort(i);const s=this._indexOfPosition(n);return{modified:ue(this,[Ke(s,i)]),reverse:[]}}else{r!==-1&&this._shiftItemPosition(r,n);const{newItem:s,newIndex:o}=this._createAttachItemAndSort(e,n);return{modified:ue(this,[Ke(o,s)]),reverse:[]}}}}_applyInsertUndoRedo(e){var t,n,r;const{id:i,parentKey:s}=e,o=Lt(e);if(((t=this._pool)==null?void 0:t.getNode(i))!==void 0)return{modified:!1};o._attach(i,Q(this._pool)),o._setParentLink(this,s);const a=this._indexOfPosition(s);let l=s;if(a!==-1){const c=(n=this._items[a])==null?void 0:n._getParentKeyOrThrow(),h=(r=this._items[a+1])==null?void 0:r._getParentKeyOrThrow();l=Fe(c,h),o._setParentLink(this,l)}this._insertAndSort(o);const u=this._indexOfPosition(l);return{modified:ue(this,[Ke(u,o)]),reverse:[{type:5,id:i}]}}_applySetUndoRedo(e){var t;const{id:n,parentKey:r}=e,i=Lt(e);if(((t=this._pool)==null?void 0:t.getNode(n))!==void 0)return{modified:!1};this._unacknowledgedSets.set(r,Q(e.opId));const s=this._indexOfPosition(r);i._attach(n,Q(this._pool)),i._setParentLink(this,r);const o=r;if(s!==-1){const a=this._items[s];a._detach(),this._items[s]=i;const l=a._toOps(Q(this._id),r,this._pool);Sn(l,e.id);const u=[gt(s,i)],c=this._detachItemAssociatedToSetOperation(e.deletedId);return c&&u.push(c),{modified:ue(this,u),reverse:l}}else{this._insertAndSort(i),this._detachItemAssociatedToSetOperation(e.deletedId);const a=this._indexOfPosition(o);return{reverse:[{type:5,id:n}],modified:ue(this,[Ke(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=Q(e._parentKey),n=e._toOps(Q(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:ue(this,[Ft(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 s=this._items.indexOf(t);return{modified:ue(this,[Ke(s,t)]),reverse:[]}}const r=t._parentKey;if(e===r)return{modified:!1};const i=this._indexOfPosition(e);if(i===-1){const s=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const o=this._items.indexOf(t);return o===s?{modified:!1}:{modified:ue(this,[lt(s,o,t)]),reverse:[]}}else{this._items[i]._setParentLink(this,Fe(e,(n=this._items[i+1])==null?void 0:n._getParentKeyOrThrow()));const s=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const o=this._items.indexOf(t);return o===s?{modified:!1}:{modified:ue(this,[lt(s,o,t)]),reverse:[]}}}_applySetChildKeyAck(e,t){var n,r;const i=Q(t._parentKey);if(this._implicitlyDeletedItems.has(t)){const s=this._indexOfPosition(e);return this._implicitlyDeletedItems.delete(t),s!==-1&&this._items[s]._setParentLink(this,Fe(e,(n=this._items[s+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._insertAndSort(t),{modified:!1}}else{if(e===i)return{modified:!1};const s=this._items.indexOf(t),o=this._indexOfPosition(e);o!==-1&&this._items[o]._setParentLink(this,Fe(e,(r=this._items[o+1])==null?void 0:r._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const a=this._items.indexOf(t);return s===a?{modified:!1}:{modified:ue(this,[lt(s,a,t)]),reverse:[]}}}_applySetChildKeyUndoRedo(e,t){var n;const r=Q(t._parentKey),i=this._items.indexOf(t),s=this._indexOfPosition(e);s!==-1&&this._items[s]._setParentLink(this,Fe(e,(n=this._items[s+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const o=this._items.indexOf(t);return i===o?{modified:!1}:{modified:ue(this,[lt(i,o,t)]),reverse:[{type:1,id:Q(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:Q(this.parent.node._id,"Parent node expected to have ID"),parentKey:this.parent.key}}get length(){return this._items.length}push(e){var t;return(t=this._pool)==null||t.assertStorageIsWritable(),this.insert(e,this.length)}insert(e,t){var n;if((n=this._pool)==null||n.assertStorageIsWritable(),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 r=this._items[t-1]?this._items[t-1]._getParentKeyOrThrow():void 0,i=this._items[t]?this._items[t]._getParentKeyOrThrow():void 0,s=Fe(r,i),o=yt(e);if(o._setParentLink(this,s),this._insertAndSort(o),this._pool&&this._id){const a=this._pool.generateId();o._attach(a,this._pool),this._pool.dispatch(o._toOps(this._id,s,this._pool),[{type:5,id:a}],new Map([[this._id,ue(this,[Ke(t,o)])]]))}}move(e,t){var n;if((n=this._pool)==null||n.assertStorageIsWritable(),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 r=null,i=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 n=this._items[e];if(n._detach(),this._items.splice(e,1),this.invalidate(),this._pool){const r=n._id;if(r){const i=new Map;i.set(Q(this._id),ue(this,[Ft(e)])),this._pool.dispatch([{id:r,opId:this._pool.generateOpId(),type:5}],n._toOps(Q(this._id),n._getParentKeyOrThrow()),i)}}}clear(){var e;if((e=this._pool)==null||e.assertStorageIsWritable(),this._pool){const t=[],n=[],r=[];for(const s of this._items){s._detach();const o=s._id;o&&(t.push({type:5,id:o,opId:this._pool.generateOpId()}),n.push(...s._toOps(Q(this._id),s._getParentKeyOrThrow())),r.push(Ft(0)))}this._items=[],this.invalidate();const i=new Map;i.set(Q(this._id),ue(this,r)),this._pool.dispatch(t,n,i)}else{for(const t of this._items)t._detach();this._items=[],this.invalidate()}}set(e,t){var n;if((n=this._pool)==null||n.assertStorageIsWritable(),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 r=this._items[e],i=r._getParentKeyOrThrow(),s=r._id;r._detach();const o=yt(t);if(o._setParentLink(this,i),this._items[e]=o,this.invalidate(),this._pool&&this._id){const a=this._pool.generateId();o._attach(a,this._pool);const l=new Map;l.set(this._id,ue(this,[gt(e,o)]));const u=o._toOps(this._id,i,this._pool);Sn(u,s),this._unacknowledgedSets.set(i,Q(u[0].opId));const c=r._toOps(this._id,i,void 0);Sn(c,a),this._pool.dispatch(u,c,l)}}toArray(){return this._items.map(e=>ct(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 ct(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(ct(t),n))}some(e){return this.toArray().some(e)}[Symbol.iterator](){return new Xs(this._items)}_createAttachItemAndSort(e,t){const n=Lt(e);n._attach(e.id,Q(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=Fe(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())}},Xs=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:ct(e.value)}}};function ue(e,t){return{node:e,type:"LiveList",updates:t}}function gt(e,t){return{index:e,type:"set",item:t instanceof st?t.data:t}}function Ft(e){return{index:e,type:"delete"}}function Ke(e,t){return{index:e,type:"insert",item:t instanceof st?t.data:t}}function lt(e,t,n){return{index:t,type:"move",previousIndex:e,item:n instanceof st?n.data:n}}function Sn(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 ot=class extends _n{constructor(e){if(super(),this.unacknowledgedSet=new Map,e){const t=[];for(const n of e){const r=yt(n[1]);r._setParentLink(this,n[0]),t.push([n[0],r])}this._map=new Map(t)}else this._map=new Map}_toOps(e,t,n){if(this._id===void 0)throw new Error("Cannot serialize item is not attached");const r=[],i={id:this._id,opId:n==null?void 0:n.generateOpId(),type:7,parentId:e,parentKey:t};r.push(i);for(const[s,o]of this._map)r.push(...o._toOps(this._id,s,n));return r}static _deserialize([e,t],n,r){const i=new ot;i._attach(e,r);const s=n.get(e);if(s===void 0)return i;for(const[o,a]of s){const l=Oi([o,a],n,r);l._setParentLink(i,a.parentKey),i._map.set(a.parentKey,l),i.invalidate()}return i}_attach(e,t){super._attach(e,t);for(const[n,r]of this._map)Ie(r)&&r._attach(t.generateId(),t)}_attachChild(e,t){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const{id:n,parentKey:r,opId:i}=e,s=r,o=Lt(e);if(this._pool.getNode(n)!==void 0)return{modified:!1};if(t===2){const u=this.unacknowledgedSet.get(s);if(u===i)return this.unacknowledgedSet.delete(s),{modified:!1};if(u!==void 0)return{modified:!1}}else t===1&&this.unacknowledgedSet.delete(s);const a=this._map.get(s);let l;if(a){const u=Q(this._id);l=a._toOps(u,s),a._detach()}else l=[{type:5,id:n}];return o._setParentLink(this,s),o._attach(n,this._pool),this._map.set(s,o),this.invalidate(),{modified:{node:this,type:"LiveMap",updates:{[s]:{type:"update"}}},reverse:l}}_detach(){super._detach();for(const e of this._map.values())e._detach()}_detachChild(e){const t=Q(this._id),n=Q(e._parentKey),r=e._toOps(t,n,this._pool);for(const[s,o]of this._map)o===e&&(this._map.delete(s),this.invalidate());return e._detach(),{modified:{node:this,type:"LiveMap",updates:{[n]:{type:"delete"}}},reverse:r}}_serialize(){if(this.parent.type!=="HasParent")throw new Error("Cannot serialize LiveMap if parent is missing");return{type:2,parentId:Q(this.parent.node._id,"Parent node expected to have ID"),parentKey:this.parent.key}}get(e){const t=this._map.get(e);if(t!==void 0)return ct(t)}set(e,t){var n;(n=this._pool)==null||n.assertStorageIsWritable();const r=this._map.get(e);r&&r._detach();const i=yt(t);if(i._setParentLink(this,e),this._map.set(e,i),this.invalidate(),this._pool&&this._id){const s=this._pool.generateId();i._attach(s,this._pool);const o=new Map;o.set(this._id,{node:this,type:"LiveMap",updates:{[e]:{type:"update"}}});const a=i._toOps(this._id,e,this._pool);this.unacknowledgedSet.set(e,Q(a[0].opId)),this._pool.dispatch(i._toOps(this._id,e,this._pool),r?r._toOps(this._id,e):[{type:5,id:s}],o)}}get size(){return this._map.size}has(e){return this._map.has(e)}delete(e){var t;(t=this._pool)==null||t.assertStorageIsWritable();const n=this._map.get(e);if(n===void 0)return!1;if(n._detach(),this._map.delete(e),this.invalidate(),this._pool&&n._id){const r=Q(this._id),i=new Map;i.set(r,{node:this,type:"LiveMap",updates:{[e]:{type:"delete"}}}),this._pool.dispatch([{type:5,id:n._id,opId:this._pool.generateOpId()}],n._toOps(r,e),i)}return!0}entries(){const e=this._map.entries();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return{done:!0,value:void 0};const r=t.value[0],i=ct(t.value[1]);return{value:[r,i]}}}}[Symbol.iterator](){return this.entries()}keys(){return this._map.keys()}values(){const e=this._map.values();return{[Symbol.iterator](){return this},next(){const t=e.next();return t.done?{done:!0,value:void 0}:{value:ct(t.value)}}}}forEach(e){for(const t of this)e(t[1],t[0],this)}toImmutable(){return super.toImmutable()}_toImmutable(){const e=new Map;for(const[t,n]of this._map)e.set(t,n.toImmutable());return He(e)}},Ve=class extends _n{constructor(e={}){super(),this._propToLastUpdate=new Map;for(const t in e){const n=e[t];n!==void 0&&Ie(n)&&n._setParentLink(this,t)}this._map=new Map(Object.entries(e))}_toOps(e,t,n){if(this._id===void 0)throw new Error("Cannot serialize item is not attached");const r=n==null?void 0:n.generateOpId(),i=[],s=e!==void 0&&t!==void 0?{type:4,id:this._id,opId:r,parentId:e,parentKey:t,data:{}}:{type:4,id:this._id,opId:r,data:{}};i.push(s);for(const[o,a]of this._map)Ie(a)?i.push(...a._toOps(this._id,o,n)):s.data[o]=a;return i}static _deserialize([e,t],n,r){const i=new Ve(t.data);return i._attach(e,r),this._deserializeChildren(i,n,r)}static _deserializeChildren(e,t,n){const r=t.get(Q(e._id));if(r===void 0)return e;for(const[i,s]of r){const o=Ys([i,s],t,n);Qt(o)&&o._setParentLink(e,s.parentKey),e._map.set(s.parentKey,o),e.invalidate()}return e}_attach(e,t){super._attach(e,t);for(const[n,r]of this._map)Ie(r)&&r._attach(t.generateId(),t)}_attachChild(e,t){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const{id:n,opId:r,parentKey:i}=e,s=ki(e);if(this._pool.getNode(n)!==void 0)return this._propToLastUpdate.get(i)===r&&this._propToLastUpdate.delete(i),{modified:!1};if(t===0)this._propToLastUpdate.set(i,Q(r));else if(this._propToLastUpdate.get(i)!==void 0)return this._propToLastUpdate.get(i)===r?(this._propToLastUpdate.delete(i),{modified:!1}):{modified:!1};const o=Q(this._id),a=this._map.get(i);let l;return Ie(a)?(l=a._toOps(o,i),a._detach()):a===void 0?l=[{type:6,id:o,key:i}]:l=[{type:3,id:o,data:{[i]:a}}],this._map.set(i,s),this.invalidate(),Qt(s)&&(s._setParentLink(this,i),s._attach(n,this._pool)),{reverse:l,modified:{node:this,type:"LiveObject",updates:{[i]:{type:"update"}}}}}_detachChild(e){if(e){const t=Q(this._id),n=Q(e._parentKey),r=e._toOps(t,n,this._pool);for(const[s,o]of this._map)o===e&&(this._map.delete(s),this.invalidate());return e._detach(),{modified:{node:this,type:"LiveObject",updates:{[n]:{type:"delete"}}},reverse:r}}return{modified:!1}}_detach(){super._detach();for(const e of this._map.values())Ie(e)&&e._detach()}_apply(e,t){return e.type===3?this._applyUpdate(e,t):e.type===6?this._applyDeleteObjectKey(e):super._apply(e,t)}_serialize(){const e={};for(const[t,n]of this._map)Ie(n)||(e[t]=n);return this.parent.type==="HasParent"&&this.parent.node._id?{type:0,parentId:this.parent.node._id,parentKey:this.parent.key,data:e}:{type:0,data:e}}_applyUpdate(e,t){let n=!1;const r=Q(this._id),i=[],s={type:3,id:r,data:{}};i.push(s);for(const a in e.data){const l=this._map.get(a);Ie(l)?(i.push(...l._toOps(r,a)),l._detach()):l!==void 0?s.data[a]=l:l===void 0&&i.push({type:6,id:r,key:a})}const o={};for(const a in e.data){const l=e.data[a];if(l===void 0)continue;if(t)this._propToLastUpdate.set(a,Q(e.opId));else if(this._propToLastUpdate.get(a)===void 0)n=!0;else if(this._propToLastUpdate.get(a)===e.opId){this._propToLastUpdate.delete(a);continue}else continue;const u=this._map.get(a);Ie(u)&&u._detach(),n=!0,o[a]={type:"update"},this._map.set(a,l),this.invalidate()}return Object.keys(s.data).length!==0&&i.unshift(s),n?{modified:{node:this,type:"LiveObject",updates:o},reverse:i}:{modified:!1}}_applyDeleteObjectKey(e){const t=e.key;if(this._map.has(t)===!1)return{modified:!1};if(this._propToLastUpdate.get(t)!==void 0)return{modified:!1};const n=this._map.get(t),r=Q(this._id);let i=[];return Ie(n)?(i=n._toOps(r,e.key),n._detach()):n!==void 0&&(i=[{type:3,id:r,data:{[t]:n}}]),this._map.delete(t),this.invalidate(),{modified:{node:this,type:"LiveObject",updates:{[e.key]:{type:"delete"}}},reverse:i}}toObject(){return eo(this._map)}set(e,t){var n;(n=this._pool)==null||n.assertStorageIsWritable(),this.update({[e]:t})}get(e){return this._map.get(e)}delete(e){var t;(t=this._pool)==null||t.assertStorageIsWritable();const n=e,r=this._map.get(n);if(r===void 0)return;if(this._pool===void 0||this._id===void 0){Ie(r)&&r._detach(),this._map.delete(n),this.invalidate();return}let i;Ie(r)?(r._detach(),i=r._toOps(this._id,n)):i=[{type:3,data:{[n]:r},id:this._id}],this._map.delete(n),this.invalidate();const s=new Map;s.set(this._id,{node:this,type:"LiveObject",updates:{[e]:{type:"delete"}}}),this._pool.dispatch([{type:6,key:n,id:this._id,opId:this._pool.generateOpId()}],i,s)}update(e){var t;if((t=this._pool)==null||t.assertStorageIsWritable(),this._pool===void 0||this._id===void 0){for(const u in e){const c=e[u];if(c===void 0)continue;const h=this._map.get(u);Ie(h)&&h._detach(),Ie(c)&&c._setParentLink(this,u),this._map.set(u,c),this.invalidate()}return}const n=[],r=[],i=this._pool.generateOpId(),s={},o={id:this._id,type:3,data:{}},a={};for(const u in e){const c=e[u];if(c===void 0)continue;const h=this._map.get(u);if(Ie(h)?(r.push(...h._toOps(this._id,u)),h._detach()):h===void 0?r.push({type:6,id:this._id,key:u}):o.data[u]=h,Ie(c)){c._setParentLink(this,u),c._attach(this._pool.generateId(),this._pool);const d=c._toOps(this._id,u,this._pool),p=d.find(x=>x.parentId===this._id);p&&this._propToLastUpdate.set(u,Q(p.opId)),n.push(...d)}else s[u]=c,this._propToLastUpdate.set(u,i);this._map.set(u,c),this.invalidate(),a[u]={type:"update"}}Object.keys(o.data).length!==0&&r.unshift(o),Object.keys(s).length!==0&&n.unshift({opId:i,id:this._id,type:3,data:s});const l=new Map;l.set(this._id,{node:this,type:"LiveObject",updates:a}),this._pool.dispatch(n,r,l)}toImmutable(){return super.toImmutable()}_toImmutable(){const e={};for(const[t,n]of this._map)e[t]=Qt(n)?n.toImmutable():n;return e}},He=e=>e;function Hn(e){return e.filter(t=>t!=null)}function gn(e){const t=nt({},e);return Object.keys(e).forEach(n=>{const r=n;t[r]===void 0&&delete t[r]}),t}function Lt(e){return yt(ki(e))}function ki(e){switch(e.type){case 8:return e.data;case 4:return new Ve(e.data);case 7:return new ot;case 2:return new Ye;default:return Qe(e,"Unknown creation Op")}}function Ii(e,t){return e===t?!0:e.parent.type==="HasParent"?Ii(e.parent.node,t):!1}function Oi([e,t],n,r){switch(t.type){case 0:return Ve._deserialize([e,t],n,r);case 1:return Ye._deserialize([e,t],n,r);case 2:return ot._deserialize([e,t],n,r);case 3:return st._deserialize([e,t],n,r);default:throw new Error("Unexpected CRDT type")}}function Ys([e,t],n,r){switch(t.type){case 0:return Ve._deserialize([e,t],n,r);case 1:return Ye._deserialize([e,t],n,r);case 2:return ot._deserialize([e,t],n,r);case 3:return t.data;default:throw new Error("Unexpected CRDT type")}}function Qt(e){return vn(e)||Js(e)||sr(e)}function Ie(e){return Qt(e)||Zs(e)}function vn(e){return e instanceof Ye}function Js(e){return e instanceof ot}function sr(e){return e instanceof Ve}function Zs(e){return e instanceof st}function ct(e){return e instanceof st?e.data:e instanceof Ye||e instanceof ot||e instanceof Ve?e:Qe(e,"Unknown AbstractCrdt")}function yt(e){return e instanceof Ve||e instanceof ot||e instanceof Ye?e:new st(e)}function Ws(e,t){const n=[];return e.forEach((r,i)=>{t.get(i)||n.push({type:5,id:i})}),t.forEach((r,i)=>{const s=e.get(i);if(s)r.type===0&&(s.type!==0||JSON.stringify(r.data)!==JSON.stringify(s.data))&&n.push({type:3,id:i,data:r.data}),r.parentKey!==s.parentKey&&n.push({type:1,id:i,parentKey:Q(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 qs(e,t){const n=e.updates;for(const[r,i]of Ai(t.updates))n[r]=i;return It(nt({},t),{updates:n})}function Gs(e,t){const n=e.updates;for(const[r,i]of Ai(t.updates))n[r]=i;return It(nt({},t),{updates:n})}function Qs(e,t){const n=e.updates;return It(nt({},t),{updates:n.concat(t.updates)})}function Pn(e,t){return e?e.type==="LiveObject"&&t.type==="LiveObject"?qs(e,t):e.type==="LiveMap"&&t.type==="LiveMap"?Gs(e,t):e.type==="LiveList"&&t.type==="LiveList"?Qs(e,t):t:t}function rt(e){return e!==null&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"}function eo(e){const t={};for(const[n,r]of e)t[n]=r;return t}function Ai(e){return Object.entries(e)}function or(e){try{return JSON.parse(e)}catch{return}}function Ci(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 to(e){if(!rt(e))return!1;const{iat:t,exp:n}=e;return typeof t=="number"&&typeof n=="number"}function no(e){const t=Date.now()/1e3;return t>e.exp-300||ttypeof t=="string")}function Pi(e){return typeof e.appId=="string"&&e.roomId===void 0&&Si(e.scopes)}function ar(e){return typeof e.appId=="string"&&typeof e.roomId=="string"&&typeof e.actor=="number"&&(e.id===void 0||typeof e.id=="string")&&Si(e.scopes)&&(e.maxConnectionsPerRoom===void 0||typeof e.maxConnectionsPerRoom=="number")}function ro(e){return Pi(e)||ar(e)}function io(e){const t=e.split(".");if(t.length!==3)throw new Error("Authentication error: invalid JWT token");const n=or(Ci(t[1]));if(n&&to(n))return n;throw new Error("Authentication error: missing JWT metadata")}function Ir(e){const t=io(e);if(t&&ar(t))return Vs(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 so(e,t=e){}function oo(e,t,n=t){}function ao(e){}function lo(e,t){}function qe(){const e=new Set,t=new Set;function n(o){return t.add(o),()=>t.delete(o)}function r(o){return e.add(o),()=>e.delete(o)}function i(o){e.forEach(a=>a(o)),e.clear(),t.forEach(a=>a(o))}function s(){e.clear(),t.clear()}return{notify:i,subscribe:n,subscribeOnce:r,clear:s,observable:{subscribe:n,subscribeOnce:r}}}function Li(e,t){let n=!1;const r=nt({},e);return Object.keys(t).forEach(i=>{const s=i,o=t[s];r[s]!==o&&(o===void 0?delete r[s]:r[s]=o,n=!0)}),n?r:e}var yn=class{constructor(){this._ev=qe()}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()}},uo=class extends yn{constructor(e){super(),this._me=He(gn(e))}_toImmutable(){return this._me}patch(e){const t=this._me,n=Li(t,e);t!==n&&(this._me=He(n),this.invalidate())}};function Ti(e){return Object.defineProperty(e,"count",{value:e.length,enumerable:!1}),Object.defineProperty(e,"toArray",{value:()=>e,enumerable:!1}),He(e)}function co(e,t){return He(gn(It(nt({},e),{presence:t})))}var fo=class extends yn{constructor(){super(),this._connections={},this._presences={},this._users={}}_toImmutable(){const e=Hn(Object.keys(this._presences).map(t=>this.getUser(Number(t))));return Ti(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 co(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,r){this._connections[e]=He({connectionId:e,id:t,info:n,isReadOnly:r}),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]=He(gn(t)),this._connections[e]!==void 0&&this._invalidateUser(e)}patchOther(e,t){const n=this._presences[e];if(n===void 0)return;const r=Li(n,t);n!==r&&(this._presences[e]=He(r),this._invalidateUser(e))}};function Ni(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function lr(e){return Array.isArray(e)}function Mi(e){return!Ni(e)&&!lr(e)}var ho=class extends yn{constructor(e){super(),this._value=He(gn(e))}_toImmutable(){return this._value}set(e){this._value=He(e),this.invalidate()}},po=class extends yn{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)}},Ln=[250,500,1e3,2e3,4e3,8e3,1e4],Tn=[2e3,3e4,6e4,3e5],mo=3e4,_o=2e3;function go(e){let t=0;return()=>`${e}:${t++}`}function jt(e){return e.state==="open"||e.state==="connecting"}function vo(e,t,n){var r;const i=m=>m(),s=(r=t.unstable_batchedUpdates)!=null?r:i,o={roomId:t.roomId,getNode:m=>e.nodes.get(m),addNode:(m,L)=>void e.nodes.set(m,L),deleteNode:m=>void e.nodes.delete(m),generateId:()=>`${_()}:${e.clock++}`,generateOpId:()=>`${_()}:${e.opClock++}`,dispatch(m,L,R){const B=e.activeBatch;B?(B.ops.push(...m),R.forEach((X,he)=>{B.updates.storageUpdates.set(he,Pn(B.updates.storageUpdates.get(he),X))}),B.reverseOps.push(...L)):s(()=>{E(L,i),e.redoStack=[],gr(m),b({storageUpdates:R},i)})},assertStorageIsWritable:()=>{if(jt(e.connection.current)&&e.connection.current.isReadOnly)throw new Error("Cannot write to storage with a read only user, please ensure the user has write permissions")}},a={customEvent:qe(),me:qe(),others:qe(),error:qe(),connection:qe(),storage:qe(),history:qe(),storageDidLoad:qe()},l=n||{authenticate(m,L){const R=e.token,B=R!==null&&Ir(R);if(B&&!no(B)){const X=L(R);j(B,X);return}else return m(t.roomId).then(({token:X})=>{if(e.connection.current.state!=="authenticating")return;const he=Ir(X),le=L(X);j(he,le),e.token=X}).catch(X=>ne())},send(m){if(e.socket===null)throw new Error("Can't send message if socket is null");e.socket.send(JSON.stringify(m))},delayFlush(m){return setTimeout($e,m)},startHeartbeatInterval(){return setInterval(Oe,mo)},schedulePongTimeout(){return setTimeout(Ze,_o)},scheduleReconnect(m){return setTimeout(F,m)}},u=new po([e.connection,e.me],(m,L)=>jt(m)?{connectionId:m.id,id:m.userId,info:m.userInfo,presence:L,isReadOnly:m.isReadOnly}:null);function c(m,L){if(m.items.length===0)throw new Error("Internal error: cannot load storage without items");e.root?d(m.items,L):e.root=p(m.items);for(const R in e.initialStorage)e.root.get(R)===void 0&&e.root.set(R,e.initialStorage[R])}function h(m){const L=new Map;let R=null;for(const[B,X]of m)if(vi(X))R=[B,X];else{const he=[B,X],le=L.get(X.parentId);le!==void 0?le.push(he):L.set(X.parentId,[he])}if(R===null)throw new Error("Root can't be null");return[R,L]}function d(m,L){if(!e.root)return;const R=new Map;e.nodes.forEach((he,le)=>{R.set(le,he._serialize())});const B=Ws(R,new Map(m)),X=k(B,!1);b(X.updates,L)}function p(m){const[L,R]=h(m);return Ve._deserialize(L,R,o)}function x(m,L){e.undoStack.length>=50&&e.undoStack.shift(),e.undoStack.push(m),M(L)}function E(m,L){e.pausedHistory!==null?e.pausedHistory.unshift(...m):x(m,L)}function b({storageUpdates:m=new Map,presence:L=!1,others:R=[]},B){B(()=>{if(R.length>0){const X=e.others.current;for(const he of R)a.others.notify({others:X,event:he})}if(L&&a.me.notify(e.me.current),m.size>0){const X=Array.from(m.values());a.storage.notify(X)}})}function _(){const m=e.connection.current;if(jt(m))return m.id;if(e.lastConnectionId!==null)return e.lastConnectionId;throw new Error("Internal. Tried to get connection id but connection was never open")}function k(m,L){const R={reverse:[],updates:{storageUpdates:new Map,presence:!1}},B=new Set;for(const X of m)if(X.type==="presence"){const he={type:"presence",data:{}};for(const le in X.data)he.data[le]=e.me.current[le];if(e.me.patch(X.data),e.buffer.me===null)e.buffer.me={type:"partial",data:X.data};else for(const le in X.data)e.buffer.me.data[le]=X.data[le];R.reverse.unshift(he),R.updates.presence=!0}else{let he;X.opId||(X.opId=o.generateOpId()),L?he=0:he=e.offlineOperations.delete(Q(X.opId))?2:1;const le=C(X,he);if(le.modified){const Cn=le.modified.node.parent.type==="HasParent"?Q(le.modified.node.parent.node._id,"Expected parent node to have an ID"):void 0;(!Cn||!B.has(Cn))&&(R.updates.storageUpdates.set(Q(le.modified.node._id),Pn(R.updates.storageUpdates.get(Q(le.modified.node._id)),le.modified)),R.reverse.unshift(...le.reverse)),(X.type===2||X.type===7||X.type===4)&&B.add(Q(le.modified.node._id))}}return R}function C(m,L){switch(m.type){case 6:case 3:case 5:{const R=e.nodes.get(m.id);return R===void 0?{modified:!1}:R._apply(m,L===0)}case 1:{const R=e.nodes.get(m.id);return R===void 0?{modified:!1}:R.parent.type==="HasParent"&&vn(R.parent.node)?R.parent.node._setChildKey(m.parentKey,R,L):{modified:!1}}case 4:case 2:case 7:case 8:{if(m.parentId===void 0)return{modified:!1};const R=e.nodes.get(m.parentId);return R===void 0?{modified:!1}:R._attachChild(m,L)}}}function y(m,L){return a.storage.subscribe(R=>{const B=R.filter(X=>Ii(X.node,m));B.length>0&&L(B)})}function $(m,L){return a.storage.subscribe(R=>{for(const B of R)B.node._id===m._id&&L(B.node)})}function S(m,L,R){if(typeof m=="string"&&Bs(m)){if(typeof L!="function")throw new Error("Second argument must be a callback function");const B=L;switch(m){case"event":return a.customEvent.subscribe(B);case"my-presence":return a.me.subscribe(B);case"others":{const X=B;return a.others.subscribe(({others:he,event:le})=>X(he,le))}case"error":return a.error.subscribe(B);case"connection":return a.connection.subscribe(B);case"storage":return a.storage.subscribe(B);case"history":return a.history.subscribe(B);default:return Qe(m,"Unknown event")}}if(L===void 0||typeof m=="function")if(typeof m=="function"){const B=m;return a.storage.subscribe(B)}else throw new Error("Please specify a listener callback");if(Ie(m)){const B=m;return R!=null&&R.isDeep?y(B,L):$(B,L)}throw new Error(`"${m}" is not a valid event name`)}function N(){return e.connection.current.state}function F(){var m,L,R,B;if(e.connection.current.state!=="closed"&&e.connection.current.state!=="unavailable")return;const X=xo(t.authentication,(L=(m=t.polyfills)==null?void 0:m.fetch)!=null?L:t.fetchPolyfill),he=Eo(t.liveblocksServer,(B=(R=t.polyfills)==null?void 0:R.WebSocket)!=null?B:t.WebSocketPolyfill);oe({state:"authenticating"},s),l.authenticate(X,he)}function T(m,L){const R={};e.buffer.me===null&&(e.buffer.me={type:"partial",data:{}});for(const B in m){const X=m[B];X!==void 0&&(e.buffer.me.data[B]=X,R[B]=e.me.current[B])}e.me.patch(m),e.activeBatch?(L!=null&&L.addToHistory&&e.activeBatch.reverseOps.push({type:"presence",data:R}),e.activeBatch.updates.presence=!0):($e(),s(()=>{L!=null&&L.addToHistory&&E([{type:"presence",data:R}],i),b({presence:!0},i)}))}function V(m){return m.includes("room:read")&&m.includes("room:presence:write")&&!m.includes("room:write")}function j(m,L){L.addEventListener("message",ae),L.addEventListener("open",be),L.addEventListener("close",ce),L.addEventListener("error",me),oe({state:"connecting",id:m.actor,userInfo:m.info,userId:m.id,isReadOnly:V(m.scopes)},s),e.idFactory=go(m.actor),e.socket=L}function ne(m){e.token=null,oe({state:"unavailable"},s),e.numberOfRetry++,e.timeoutHandles.reconnect=l.scheduleReconnect(we())}function Y(m){m==="visible"&&e.connection.current.state==="open"&&Oe()}function v(m){if(m.targetActor!==void 0){const R=e.others.getUser(m.actor);e.others.setOther(m.actor,m.data);const B=e.others.getUser(m.actor);if(R===void 0&&B!==void 0)return{type:"enter",user:B}}else e.others.patchOther(m.actor,m.data);const L=e.others.getUser(m.actor);if(L)return{type:"update",updates:m.data,user:L}}function I(m){const L=e.others.getUser(m.actor);return L?(e.others.removeConnection(m.actor),{type:"leave",user:L}):null}function A(m){for(const L in m.users){const R=m.users[L],B=Number(L);e.others.setConnection(B,R.id,R.info,V(R.scopes))}return{type:"reset"}}function P(){e.connection.current.state==="unavailable"&&Ot()}function M(m){m(()=>{a.history.notify({canUndo:yr(),canRedo:wr()})})}function D(m){e.others.setConnection(m.actor,m.id,m.info,V(m.scopes)),e.buffer.messages.push({type:100,data:e.me.current,targetActor:m.actor}),$e();const L=e.others.getUser(m.actor);return L?{type:"enter",user:L}:void 0}function z(m){return Mi(m)?m:null}function Z(m){const L=or(m);return L===void 0?null:lr(L)?Hn(L.map(R=>z(R))):Hn([z(L)])}function ae(m){if(m.data==="pong"){clearTimeout(e.timeoutHandles.pongTimeout);return}const L=Z(m.data);if(L===null||L.length===0)return;const R={storageUpdates:new Map,others:[]};s(()=>{for(const B of L)switch(B.type){case 101:{const X=D(B);X&&R.others.push(X);break}case 100:{const X=v(B);X&&R.others.push(X);break}case 103:{a.customEvent.notify({connectionId:B.actor,event:B.event});break}case 102:{const X=I(B);X&&R.others.push(X);break}case 104:{R.others.push(A(B));break}case 200:{const X=new Map(e.offlineOperations);c(B,i),At(X,i),An==null||An(),a.storageDidLoad.notify();break}case 201:{k(B.ops,!1).updates.storageUpdates.forEach((he,le)=>{R.storageUpdates.set(le,Pn(R.storageUpdates.get(le),he))});break}}b(R,i)})}function ce(m){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(),s(()=>{if(b({others:[{type:"reset"}]},i),m.code>=4e3&&m.code<=4100){oe({state:"failed"},i);const L=new bo(m.reason,m.code);a.error.notify(L);const R=we(!0);e.numberOfRetry++,oe({state:"unavailable"},i),e.timeoutHandles.reconnect=l.scheduleReconnect(R)}else if(m.code===4999)oe({state:"closed"},i);else{const L=we();e.numberOfRetry++,oe({state:"unavailable"},i),e.timeoutHandles.reconnect=l.scheduleReconnect(L)}})}function oe(m,L){e.connection.set(m),L(()=>{a.connection.notify(m.state)})}function we(m=!1){return m?Tn[e.numberOfRetry0&&m.forEach(B=>{e.offlineOperations.set(Q(B.opId),B)}),e.socket===null||e.socket.readyState!==e.socket.OPEN){e.buffer.storageOperations=[];return}const L=Date.now();if(L-e.lastFlushTime>t.throttleDelay){const B=gs(e);if(B.length===0)return;l.send(B),e.buffer={messages:[],storageOperations:[],me:null},e.lastFlushTime=L}else e.timeoutHandles.flush!==null&&clearTimeout(e.timeoutHandles.flush),e.timeoutHandles.flush=l.delayFlush(t.throttleDelay-(L-e.lastFlushTime))}function gs(m){const L=[];m.buffer.me&&L.push(m.buffer.me.type==="full"?{type:100,targetActor:-1,data:m.buffer.me.data}:{type:100,data:m.buffer.me.data});for(const R of m.buffer.messages)L.push(R);return m.buffer.storageOperations.length>0&&L.push({type:201,ops:m.buffer.storageOperations}),L}function vs(){e.socket&&(e.socket.removeEventListener("open",be),e.socket.removeEventListener("message",ae),e.socket.removeEventListener("close",ce),e.socket.removeEventListener("error",me),e.socket.close(),e.socket=null),s(()=>{oe({state:"closed"},i),e.timeoutHandles.flush&&clearTimeout(e.timeoutHandles.flush),clearTimeout(e.timeoutHandles.reconnect),clearTimeout(e.timeoutHandles.pongTimeout),clearInterval(e.intervalHandles.heartbeat),e.others.clearOthers(),b({others:[{type:"reset"}]},i),Object.values(a).forEach(m=>m.clear())})}function ys(){return e.me.current}function ws(){return e.others.current}function bs(m,L={shouldQueueEventIfNotReady:!1}){e.socket===null&&!L.shouldQueueEventIfNotReady||(e.buffer.messages.push({type:103,event:m}),$e())}function gr(m){e.buffer.storageOperations.push(...m),$e()}let On=null,An=null;function vr(){return On===null&&(e.buffer.messages.push({type:200}),$e(),On=new Promise(m=>An=m)),On}function Es(){const m=e.root;return m!==void 0?m:(vr(),null)}function xs(){return rr(this,null,function*(){return e.root?Promise.resolve({root:e.root}):(yield vr(),{root:Q(e.root)})})}function ks(){if(e.activeBatch)throw new Error("undo is not allowed during a batch");const m=e.undoStack.pop();if(m===void 0)return;e.pausedHistory=null;const L=k(m,!0);s(()=>{b(L.updates,i),e.redoStack.push(L.reverse),M(i)});for(const R of m)R.type!=="presence"&&e.buffer.storageOperations.push(R);$e()}function yr(){return e.undoStack.length>0}function Is(){if(e.activeBatch)throw new Error("redo is not allowed during a batch");const m=e.redoStack.pop();if(m===void 0)return;e.pausedHistory=null;const L=k(m,!0);s(()=>{b(L.updates,i),e.undoStack.push(L.reverse),M(i)});for(const R of m)R.type!=="presence"&&e.buffer.storageOperations.push(R);$e()}function wr(){return e.redoStack.length>0}function Os(m){if(e.activeBatch)return m();let L;return s(()=>{e.activeBatch={ops:[],updates:{storageUpdates:new Map,presence:!1,others:[]},reverseOps:[]};try{L=m()}finally{const R=e.activeBatch;e.activeBatch=null,R.reverseOps.length>0&&E(R.reverseOps,i),R.ops.length>0&&(e.redoStack=[]),R.ops.length>0&&gr(R.ops),b(R.updates,i),$e()}}),L}function As(){e.pausedHistory=[]}function Cs(){const m=e.pausedHistory;e.pausedHistory=null,m!==null&&m.length>0&&x(m,s)}function Ss(){e.socket&&(e.socket=null)}function Ps(m){ce(m)}return{onClose:ce,onMessage:ae,authenticationSuccess:j,heartbeat:Oe,onNavigatorOnline:P,simulateSocketClose:Ss,simulateSendCloseEvent:Ps,onVisibilityChange:Y,getUndoStack:()=>e.undoStack,getItemsCount:()=>e.nodes.size,connect:F,disconnect:vs,subscribe:S,updatePresence:T,broadcastEvent:bs,batch:Os,undo:ks,redo:Is,canUndo:yr,canRedo:wr,pauseHistory:As,resumeHistory:Cs,getStorage:xs,getStorageSnapshot:Es,events:{customEvent:a.customEvent.observable,others:a.others.observable,me:a.me.observable,error:a.error.observable,connection:a.connection.observable,storage:a.storage.observable,history:a.history.observable,storageDidLoad:a.storageDidLoad.observable},getConnectionState:N,isSelfAware:()=>jt(e.connection.current),getSelf:()=>u.current,getPresence:ys,getOthers:ws}}function yo(e,t){const n=new fo,r=new ho({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 uo(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 wo(e,t){const{initialPresence:n,initialStorage:r}=e,i=yo(typeof n=="function"?n(t.roomId):n,typeof r=="function"?r(t.roomId):r),s=vo(i,t),o={id:t.roomId,getConnectionState:s.getConnectionState,isSelfAware:s.isSelfAware,getSelf:s.getSelf,subscribe:s.subscribe,getPresence:s.getPresence,updatePresence:s.updatePresence,getOthers:s.getOthers,broadcastEvent:s.broadcastEvent,getStorage:s.getStorage,getStorageSnapshot:s.getStorageSnapshot,events:s.events,batch:s.batch,history:{undo:s.undo,redo:s.redo,canUndo:s.canUndo,canRedo:s.canRedo,pause:s.pauseHistory,resume:s.resumeHistory},__INTERNAL_DO_NOT_USE:{simulateCloseWebsocket:s.simulateSocketClose,simulateSendCloseEvent:s.simulateSendCloseEvent}};return{connect:s.connect,disconnect:s.disconnect,onNavigatorOnline:s.onNavigatorOnline,onVisibilityChange:s.onVisibilityChange,room:o}}var bo=class extends Error{constructor(e,t){super(e),this.code=t}};function Eo(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.5`)}function xo(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=>Or(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=>Or(t||fetch,e.url,{room:n})}if(e.type==="custom")return n=>rr(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 Or(e,t,n){return rr(this,null,function*(){const r=yield e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Nn(`Expected a status 200 but got ${r.status} when doing a POST request on "${t}"`);let i;try{i=yield r.json()}catch(o){throw new Nn(`Expected a JSON response when doing a POST request on "${t}". ${o}`)}if(!rt(i)||typeof i.token!="string")throw new Nn(`Expected a JSON response of the form \`{ token: "..." }\` when doing a POST request on "${t}", but got ${JSON.stringify(i)}`);const{token:s}=i;return{token:s}})}var Nn=class extends Error{constructor(e){super(e)}};function ko(e){const t=e,n=Io(e),r=new Map;function i(a){const l=r.get(a);return l?l.room:null}function s(a,l){var u,c;const h=l.shouldInitiallyConnect===void 0?!0:l.shouldInitiallyConnect;let d=r.get(a);if(d)return d.room;if(l.initialPresence===null||l.initialPresence,d=wo({initialPresence:(u=l.initialPresence)!=null?u:{},initialStorage:l.initialStorage},{roomId:a,throttleDelay:n,polyfills:t.polyfills,WebSocketPolyfill:t.WebSocketPolyfill,fetchPolyfill:t.fetchPolyfill,unstable_batchedUpdates:l==null?void 0:l.unstable_batchedUpdates,liveblocksServer:(t==null?void 0:t.liveblocksServer)||"wss://api.liveblocks.io/v6",authentication:Oo(t,a)}),r.set(a,d),h){if(typeof atob>"u"){if(((c=t.polyfills)==null?void 0:c.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");$s.atob=t.polyfills.atob}d.connect()}return d.room}function o(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:s,leave:o}}function Io(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 Oo(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:Ao(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 Ao(e,t){return e.publicAuthorizeEndpoint?e.publicAuthorizeEndpoint.replace("{roomId}",t):`https://api.liveblocks.io/v2/rooms/${encodeURIComponent(t)}/public/authorize`}function Ri(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=De(r))}return t}function Co(e){return Ri(e.toObject())}function So(e){const t={};for(const[n,r]of e.entries())t[n]=De(r);return t}function $i(e){return e.map(De)}function Po(e){return $i(e.toArray())}function De(e){return e instanceof Ve?Co(e):e instanceof Ye?Po(e):e instanceof ot?So(e):e instanceof st?e.data:Array.isArray(e)?$i(e):rt(e)?Ri(e):e}function ft(e){if(Array.isArray(e))return new Ye(e.map(ft));if(rt(e)){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=ft(r))}return new Ve(t)}else return e}function Lo(e,t,n){let r=0,i=t.length-1,s=n.length-1,o=t[0],a=n[0];e:{for(;o===a;){if(++r,r>i||r>s)break e;o=t[r],a=n[r]}for(o=t[i],a=n[s];o===a;){if(i--,s--,r>i||r>s)break e;o=t[i],a=n[s]}}if(r>i){if(r<=s)for(;r<=s;)e.insert(ft(n[r]),r),r++}else if(r>s){let l=r;for(;l<=i;)e.delete(r),l++}else{for(;r<=i&&r<=s;){o=t[r],a=n[r];const u=e.get(r);sr(u)&&rt(o)&&rt(a)?Ui(u,o,a):e.set(r,ft(a)),r++}for(;r<=s;)e.insert(ft(n[r]),r),r++;let l=r;for(;l<=i;)e.delete(r),l++}}function Di(e,t,n,r){const i=e.get(t);if(r===void 0)e.delete(t);else if(i===void 0)e.set(t,ft(r));else{if(n===r)return;vn(i)&&Array.isArray(n)&&Array.isArray(r)?Lo(i,n,r):sr(i)&&rt(n)&&rt(r)?Ui(i,n,r):e.set(t,ft(r))}}function Ui(e,t,n){const r={};for(const i in n)Di(e,i,t[i],n[i]);for(const i in t)n[i]===void 0&&e.delete(i);Object.keys(r).length>0&&e.update(r)}function To(e){const t=[];for(;e.parent.type==="HasParent";)vn(e.parent.node)?t.push(e.parent.node._indexOfPosition(e.parent.key)):t.push(e.parent.key),e=e.parent.node;return t}function No(e,t){return t.reduce((n,r)=>Mo(n,r),e)}function Mo(e,t){const n=To(t.node);return zn(e,n,t)}function zn(e,t,n){var r,i,s,o;const a=t.pop();if(a===void 0)switch(n.type){case"LiveObject":{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error("Internal: received update on LiveObject but state was not an object");const l=Object.assign({},e);for(const u in n.updates)if(((r=n.updates[u])==null?void 0:r.type)==="update"){const c=n.node.get(u);c!==void 0&&(l[u]=De(c))}else((i=n.updates[u])==null?void 0:i.type)==="delete"&&delete l[u];return l}case"LiveList":{if(!Array.isArray(e))throw new Error("Internal: received update on LiveList but state was not an array");let l=e.map(u=>u);for(const u of n.updates)u.type==="set"?l=l.map((c,h)=>h===u.index?De(u.item):c):u.type==="insert"?u.index===l.length?l.push(De(u.item)):l=[...l.slice(0,u.index),De(u.item),...l.slice(u.index)]:u.type==="delete"?l.splice(u.index,1):u.type==="move"&&(u.previousIndex>u.index?l=[...l.slice(0,u.index),De(u.item),...l.slice(u.index,u.previousIndex),...l.slice(u.previousIndex+1)]:l=[...l.slice(0,u.previousIndex),...l.slice(u.previousIndex+1,u.index+1),De(u.item),...l.slice(u.index+1)]);return l}case"LiveMap":{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error("Internal: received update on LiveMap but state was not an object");const l=Object.assign({},e);for(const u in n.updates)if(((s=n.updates[u])==null?void 0:s.type)==="update"){const c=n.node.get(u);c!==void 0&&(l[u]=De(c))}else((o=n.updates[u])==null?void 0:o.type)==="delete"&&delete l[u];return l}}if(Array.isArray(e)){const l=[...e];return l[a]=zn(e[a],t,n),l}else if(e!==null&&typeof e=="object"){const l=e[a];return l===void 0?e:It(nt({},e),{[a]:zn(l,t,n)})}else return e}function Ro(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 Do(e,t){if(Object.is(e,t))return!0;const n=Array.isArray(e),r=Array.isArray(t);return n||r?!n||!r?!1:Ro(e,t):$o(e,t)}K.ClientMsgCode=mi;K.CrdtType=gi;K.LiveList=Ye;K.LiveMap=ot;K.LiveObject=Ve;K.OpCode=_i;K.ServerMsgCode=wi;K.WebsocketCloseCodes=bi;K.asArrayWithLegacyMethods=Ti;K.assertNever=Qe;K.b64decode=Ci;K.comparePosition=xi;K.createClient=ko;K.deprecate=so;K.deprecateIf=oo;K.errorIf=lo;K.freeze=He;K.isAppOnlyAuthToken=Pi;K.isAuthToken=ro;K.isChildCrdt=yi;K.isJsonArray=lr;K.isJsonObject=Mi;K.isJsonScalar=Ni;K.isPlainObject=rt;K.isRoomAuthToken=ar;K.isRootCrdt=vi;K.legacy_patchImmutableObject=No;K.lsonToJson=De;K.makePosition=Fe;K.nn=Q;K.patchLiveObjectKey=Di;K.shallow=Do;K.throwUsageError=ao;K.tryParseJson=or;const Uo=K.ClientMsgCode,Ho=K.CrdtType,zo=K.LiveList,Vo=K.LiveMap,Bo=K.LiveObject,Ko=K.OpCode,Fo=K.ServerMsgCode,jo=K.WebsocketCloseCodes,Xo=K.asArrayWithLegacyMethods,Yo=K.assertNever,Jo=K.b64decode,Zo=K.comparePosition,Wo=K.createClient,qo=K.deprecate,Go=K.deprecateIf,Qo=K.errorIf,ea=K.freeze,ta=K.isAppOnlyAuthToken,na=K.isAuthToken,ra=K.isChildCrdt,ia=K.isJsonArray,sa=K.isJsonObject,oa=K.isJsonScalar,aa=K.isPlainObject,la=K.isRoomAuthToken,ua=K.isRootCrdt,ca=K.legacy_patchImmutableObject,fa=K.lsonToJson,ha=K.makePosition,da=K.nn,pa=K.patchLiveObjectKey,ma=K.shallow,_a=K.throwUsageError,ga=K.tryParseJson,va=Object.freeze(Object.defineProperty({__proto__:null,default:K,ClientMsgCode:Uo,CrdtType:Ho,LiveList:zo,LiveMap:Vo,LiveObject:Bo,OpCode:Ko,ServerMsgCode:Fo,WebsocketCloseCodes:jo,asArrayWithLegacyMethods:Xo,assertNever:Yo,b64decode:Jo,comparePosition:Zo,createClient:Wo,deprecate:qo,deprecateIf:Go,errorIf:Qo,freeze:ea,isAppOnlyAuthToken:ta,isAuthToken:na,isChildCrdt:ra,isJsonArray:ia,isJsonObject:sa,isJsonScalar:oa,isPlainObject:aa,isRoomAuthToken:la,isRootCrdt:ua,legacy_patchImmutableObject:ca,lsonToJson:fa,makePosition:ha,nn:da,patchLiveObjectKey:pa,shallow:ma,throwUsageError:_a,tryParseJson:ga},Symbol.toStringTag,{value:"Module"})),ya=Ds(va);Object.defineProperty(ze,"__esModule",{value:!0});var Vt=ya;ze.LiveList=Vt.LiveList;ze.LiveMap=Vt.LiveMap;ze.LiveObject=Vt.LiveObject;ze.createClient=Vt.createClient;ze.shallow=Vt.shallow;ze.LiveList;ze.LiveMap;const wa=ze.LiveObject,fh=ze.createClient;ze.shallow;const Hi=Symbol(),zi=Symbol();function ba(e){let t;const n=e[2].default,r=qn(n,e,e[1],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),t=!0},p(i,[s]){r&&r.p&&(!t||s&2)&&Gn(r,n,i,i[1],t?er(n,i[1],s,null):Qn(i[1]),null)},i(i){t||(J(r,i),t=!0)},o(i){W(r,i),t=!1},d(i){r&&r.d(i)}}}function Ea(e,t,n){let{$$slots:r={},$$scope:i}=t,{client:s}=t;if(!s)throw new Error("LiveblocksProvider requires a client");return ci(Hi,s),e.$$set=o=>{"client"in o&&n(0,s=o.client),"$$scope"in o&&n(1,i=o.$$scope)},[s,i,r]}class hh extends Ee{constructor(t){super(),xe(this,t,Ea,ba,ke,{client:0})}}function xa(e){let t;const n=e[3].default,r=qn(n,e,e[2],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),t=!0},p(i,[s]){r&&r.p&&(!t||s&4)&&Gn(r,n,i,i[2],t?er(n,i[2],s,null):Qn(i[2]),null)},i(i){t||(J(r,i),t=!0)},o(i){W(r,i),t=!1},d(i){r&&r.d(i)}}}function ka(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:s}=t,{defaultPresence:o=()=>({})}=t;if(!s)throw new Error("RoomProvider requires an id");const a=fi(Hi);if(a){const l=a.enter(s,o());ci(zi,l),mn(()=>{a.leave(s)})}return e.$$set=l=>{"id"in l&&n(0,s=l.id),"defaultPresence"in l&&n(1,o=l.defaultPresence),"$$scope"in l&&n(2,i=l.$$scope)},[s,o,i,r]}class dh extends Ee{constructor(t){super(),xe(this,t,ka,xa,ke,{id:0,defaultPresence:1})}}function Ia(e){let t,n,r;return{c(){t=q("svg"),n=q("path"),r=q("path"),this.h()},l(i){t=G(i,"svg",{class:!0,width:!0,height:!0,viewBox:!0,xmlns:!0});var s=O(t);n=G(s,"path",{d:!0,fill:!0}),O(n).forEach(w),r=G(s,"path",{"fill-rule":!0,"clip-rule":!0,d:!0,fill:!0,"fill-opacity":!0}),O(r).forEach(w),s.forEach(w),this.h()},h(){f(n,"d","M3.09022 1.77278C2.25499 1.40456 1.40358 2.25597 1.7718 3.0912L4.57875 9.45818C4.95365 10.3086 6.18455 10.2323 6.4516 9.34213L6.9637 7.63515C7.06029 7.31317 7.31219 7.06126 7.63417 6.96467L9.34117 6.45258C10.2313 6.18552 10.3076 4.95463 9.45722 4.57972L3.09022 1.77278Z"),f(n,"fill",e[1]),f(r,"fill-rule","evenodd"),f(r,"clip-rule","evenodd"),f(r,"d","M3.66305 9.86091L0.856101 3.49392C0.119663 1.82347 1.82248 0.120639 3.49294 0.857077L9.85994 3.66402C11.5607 4.41383 11.4082 6.87562 9.62784 7.40973L7.92085 7.92182L7.40875 9.62881C6.87465 11.4092 4.41286 11.5617 3.66305 9.86091ZM1.77113 3.09053C1.40291 2.2553 2.25432 1.40388 3.08955 1.7721L9.45654 4.57905C10.3069 4.95395 10.2307 6.18485 9.34049 6.4519L7.6335 6.964C7.31152 7.06059 7.05961 7.3125 6.96302 7.63448L6.45093 9.34146C6.18387 10.2316 4.95298 10.3079 4.57807 9.45751L1.77113 3.09053Z"),f(r,"fill",e[1]),f(r,"fill-opacity","0.2"),f(t,"class",e[0]),f(t,"width","1em"),f(t,"height","1em"),f(t,"viewBox","0 0 12 12"),f(t,"xmlns","http://www.w3.org/2000/svg")},m(i,s){re(i,t,s),g(t,n),g(t,r)},p(i,[s]){s&2&&f(n,"fill",i[1]),s&2&&f(r,"fill",i[1]),s&1&&f(t,"class",i[0])},i:pe,o:pe,d(i){i&&w(t)}}}function Oa(e,t,n){let{classList:r=""}=t,{fill:i=""}=t;return e.$$set=s=>{"classList"in s&&n(0,r=s.classList),"fill"in s&&n(1,i=s.fill)},[r,i]}class Aa extends Ee{constructor(t){super(),xe(this,t,Oa,Ia,ke,{classList:0,fill:1})}}function Ca(e){let t,n,r,i;return n=new Aa({props:{classList:"block z-0 col-span-2 row-span-2 text-8xl",fill:e[1]}}),{c(){t=U("div"),_e(n.$$.fragment),this.h()},l(s){t=H(s,"DIV",{class:!0,style:!0});var o=O(t);ge(n.$$.fragment,o),o.forEach(w),this.h()},h(){f(t,"class","cursor text-4xl svelte-14ka0w3"),f(t,"style",r=`transform: translateX(${e[2].x}px) translateY(${e[2].y}px) scale(${e[0].k});`)},m(s,o){re(s,t,o),ve(n,t,null),i=!0},p(s,[o]){const a={};o&2&&(a.fill=s[1]),n.$set(a),(!i||o&5&&r!==(r=`transform: translateX(${s[2].x}px) translateY(${s[2].y}px) scale(${s[0].k});`))&&f(t,"style",r)},i(s){i||(J(n.$$.fragment,s),i=!0)},o(s){W(n.$$.fragment,s),i=!1},d(s){s&&w(t),ye(n)}}}function Sa(e,t,n){let r,{transform:i}=t,{color:s=""}=t,{position:o={x:0,y:0}}=t;return e.$$set=a=>{"transform"in a&&n(0,i=a.transform),"color"in a&&n(1,s=a.color),"position"in a&&n(3,o=a.position)},e.$$.update=()=>{e.$$.dirty&9&&n(2,r={x:i.applyX(o.x),y:i.applyY(o.y)})},[i,s,r,o]}class Pa extends Ee{constructor(t){super(),xe(this,t,Sa,Ca,ke,{transform:0,color:1,position:3})}}function La(e){let t,n,r;return{c(){t=q("svg"),n=q("circle"),r=q("path"),this.h()},l(i){t=G(i,"svg",{class:!0,xmlns:!0,"xmlns:xlink":!0,"aria-hidden":!0,fill:!0,focusable:!0,role:!0,width:!0,height:!0,preserveAspectRatio:!0,viewBox:!0});var s=O(t);n=G(s,"circle",{class:!0,cx:!0,cy:!0,r:!0,stroke:!0,"stroke-width":!0}),O(n).forEach(w),r=G(s,"path",{fill:!0,d:!0}),O(r).forEach(w),s.forEach(w),this.h()},h(){f(n,"class","opacity-50"),f(n,"cx","12"),f(n,"cy","12"),f(n,"r","10"),f(n,"stroke","currentColor"),f(n,"stroke-width","4"),f(r,"fill","currentColor"),f(r,"d","M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"),f(t,"class",e[0]),f(t,"xmlns","http://www.w3.org/2000/svg"),f(t,"xmlns:xlink","http://www.w3.org/1999/xlink"),f(t,"aria-hidden","true"),f(t,"fill","none"),f(t,"focusable","false"),f(t,"role","img"),f(t,"width","1em"),f(t,"height","1em"),f(t,"preserveAspectRatio","xMidYMid meet"),f(t,"viewBox","0 0 24 24")},m(i,s){re(i,t,s),g(t,n),g(t,r)},p(i,[s]){s&1&&f(t,"class",i[0])},i:pe,o:pe,d(i){i&&w(t)}}}function Ta(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class Vi extends Ee{constructor(t){super(),xe(this,t,Ta,La,ke,{classList:0})}}const Xt=["#505669","#414AA6","#1C5B92","#216B44","#893301","#912728","#98184D","#743095","#5F4199","#8f3f94"],ln=20,mt={width:512*6,height:512*6},Ct=32,de=512;function Na(e){let t,n;return{c(){t=U("p"),n=ee("Someone is typing:"),this.h()},l(r){t=H(r,"P",{class:!0});var i=O(t);n=te(i,"Someone is typing:"),i.forEach(w),this.h()},h(){f(t,"class","text-4xl")},m(r,i){re(r,t,i),g(t,n)},i:pe,o:pe,d(r){r&&w(t)}}}function Ma(e){let t,n,r,i,s;return t=new Vi({props:{classList:"animate-spin text-4xl inline mr-2 mx-auto text-white mb-4"}}),{c(){_e(t.$$.fragment),n=ie(),r=U("p"),i=ee("Someone is painting:"),this.h()},l(o){ge(t.$$.fragment,o),n=se(o),r=H(o,"P",{class:!0});var a=O(r);i=te(a,"Someone is painting:"),a.forEach(w),this.h()},h(){f(r,"class","text-4xl")},m(o,a){ve(t,o,a),re(o,n,a),re(o,r,a),g(r,i),s=!0},i(o){s||(J(t.$$.fragment,o),s=!0)},o(o){W(t.$$.fragment,o),s=!1},d(o){ye(t,o),o&&w(n),o&&w(r)}}}function Ra(e){let t,n,r,i,s,o,a,l,u,c,h,d;const p=[Ma,Na],x=[];function E(b,_){return b[2]?0:1}return i=E(e),s=x[i]=p[i](e),{c(){t=U("div"),n=U("div"),r=U("div"),s.c(),o=ie(),a=U("span"),l=ee('"'),u=ee(e[1]),c=ee('"'),this.h()},l(b){t=H(b,"DIV",{class:!0,style:!0});var _=O(t);n=H(_,"DIV",{class:!0});var k=O(n);r=H(k,"DIV",{class:!0});var C=O(r);s.l(C),o=se(C),a=H(C,"SPAN",{class:!0});var y=O(a);l=te(y,'"'),u=te(y,e[1]),c=te(y,'"'),y.forEach(w),C.forEach(w),k.forEach(w),_.forEach(w),this.h()},h(){f(a,"class","italic font-normal"),f(r,"class","font-bold !text-4xl text-white rounded-2xl text-center p-10 line-clamp-4 flex"),f(n,"class","pointer-events-none touch-none"),f(t,"class","absolute top-0 left-0 border-8 border-dashed border-black flex items-center justify-center bg-black/60"),f(t,"style",h=`width: ${de}px; + height: ${de}px; + transform: translateX(${e[3].x}px) translateY(${e[3].y}px) scale(${e[0].k}); transform-origin: 0 0;`)},m(b,_){re(b,t,_),g(t,n),g(n,r),x[i].m(r,null),g(r,o),g(r,a),g(a,l),g(a,u),g(a,c),d=!0},p(b,[_]){let k=i;i=E(b),i!==k&&(Me(),W(x[k],1,1,()=>{x[k]=null}),Re(),s=x[i],s||(s=x[i]=p[i](b),s.c()),J(s,1),s.m(r,o)),(!d||_&2)&&tt(u,b[1]),(!d||_&9&&h!==(h=`width: ${de}px; + height: ${de}px; + transform: translateX(${b[3].x}px) translateY(${b[3].y}px) scale(${b[0].k}); transform-origin: 0 0;`))&&f(t,"style",h)},i(b){d||(J(s),d=!0)},o(b){W(s),d=!1},d(b){b&&w(t),x[i].d()}}}function $a(e,t,n){let r,{transform:i}=t,{position:s={x:0,y:0}}=t,{prompt:o=""}=t,{isLoading:a=!1}=t;return e.$$set=l=>{"transform"in l&&n(0,i=l.transform),"position"in l&&n(4,s=l.position),"prompt"in l&&n(1,o=l.prompt),"isLoading"in l&&n(2,a=l.isLoading)},e.$$.update=()=>{e.$$.dirty&17&&n(3,r={x:i.applyX(s.x),y:i.applyY(s.y)})},[i,o,a,r,s]}class Da extends Ee{constructor(t){super(),xe(this,t,$a,Ra,ke,{transform:0,position:4,prompt:1,isLoading:2})}}var Ua={value:()=>{}};function wn(){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}})}en.prototype=wn.prototype={constructor:en,on:function(e,t){var n=this._,r=Ha(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s0)for(var n=new Array(i),r=0,i,s;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Cr.hasOwnProperty(t)?{space:Cr[t],local:e}:e}function Va(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Vn&&t.documentElement.namespaceURI===Vn?t.createElement(e):t.createElementNS(n,e)}}function Ba(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bi(e){var t=bn(e);return(t.local?Ba:Va)(t)}function Ka(){}function ur(e){return e==null?Ka:function(){return this.querySelector(e)}}function Fa(e){typeof e!="function"&&(e=ur(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=C&&(C=k+1);!($=b[C])&&++C=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function ml(e){e||(e=_l);function t(h,d){return h&&d?e(h.__data__,d.__data__):!h-!d}for(var n=this._groups,r=n.length,i=new Array(r),s=0;st?1:e>=t?0:NaN}function gl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function vl(){return Array.from(this)}function yl(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Pl:typeof t=="function"?Tl:Ll)(e,t,n==null?"":n)):xt(this.node(),e)}function xt(e,t){return e.style.getPropertyValue(t)||Yi(e).getComputedStyle(e,null).getPropertyValue(t)}function Ml(e){return function(){delete this[e]}}function Rl(e,t){return function(){this[e]=t}}function $l(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Dl(e,t){return arguments.length>1?this.each((t==null?Ml:typeof t=="function"?$l:Rl)(e,t)):this.node()[e]}function Ji(e){return e.trim().split(/^|\s+/)}function cr(e){return e.classList||new Zi(e)}function Zi(e){this._node=e,this._names=Ji(e.getAttribute("class")||"")}Zi.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 Wi(e,t){for(var n=cr(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function fu(e){return function(){var t=this.__on;if(!!t){for(var n=0,r=-1,i=t.length,s;n()=>e;function Bn(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:o,y:a,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}Bn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function bu(e){return!e.ctrlKey&&!e.button}function Eu(){return this.parentNode}function xu(e,t){return t==null?{x:e.x,y:e.y}:t}function ku(){return navigator.maxTouchPoints||"ontouchstart"in this}function Sr(){var e=bu,t=Eu,n=xu,r=ku,i={},s=wn("start","drag","end"),o=0,a,l,u,c,h=0;function d(y){y.on("mousedown.drag",p).filter(r).on("touchstart.drag",b).on("touchmove.drag",_,wu).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(y,$){if(!(c||!e.call(this,y,$))){var S=C(this,t.call(this,y,$),y,$,"mouse");!S||(Te(y.view).on("mousemove.drag",x,Mt).on("mouseup.drag",E,Mt),es(y.view),Mn(y),u=!1,a=y.clientX,l=y.clientY,S("start",y))}}function x(y){if(wt(y),!u){var $=y.clientX-a,S=y.clientY-l;u=$*$+S*S>h}i.mouse("drag",y)}function E(y){Te(y.view).on("mousemove.drag mouseup.drag",null),ts(y.view,u),wt(y),i.mouse("end",y)}function b(y,$){if(!!e.call(this,y,$)){var S=y.changedTouches,N=t.call(this,y,$),F=S.length,T,V;for(T=0;T{const n=new Image;n.onload=async()=>{const r=n.width,i=n.height,s=document.createElement("canvas");s.width=r,s.height=i,s.getContext("2d").drawImage(n,0,0,r,i);const a=await new Promise(l=>s.toBlob(l,"image/jpeg",.95));t(a)},n.src=e})}async function Cu(e,t,n){const r=Pu(t),s=`color-palette-${crypto.randomUUID().split("-")[0]}-${r}-${n}.jpeg`,o=new File([e],s,{type:"image/jpeg"}),a=new FormData;return a.append("file",o),await(await fetch(ns+"/uploadfile",{method:"POST",body:a})).json()}const Su=mt.width-de;function Jt(e){const t=e%Ct{n(s)});return mn(()=>{i()}),{subscribe:t,update:r}}function Lu(){const e=En(),t=Xe(),n=e.subscribe("others",r=>{t.set(r)});return mn(n),t}function Tu(){const e=En(),t=Xe();async function n(){const{root:r}=await e.getStorage();t.set(r)}return n(),t}function rs(e,t){const n=En(),r=Tu(),i=Xe();let s=()=>{};const o=r.subscribe(a=>{!a||(a.get(e)||a.set(e,new wa(t)),i.set(a.get(e)),s(),s=n.subscribe(a.get(e),l=>{i.set(l)}))});return mn(o),i}function fr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function is(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Kt(){}var Rt=.7,cn=1/Rt,bt="\\s*([+-]?\\d+)\\s*",$t="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",je="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Nu=/^#([0-9a-f]{3,8})$/,Mu=new RegExp(`^rgb\\(${bt},${bt},${bt}\\)$`),Ru=new RegExp(`^rgb\\(${je},${je},${je}\\)$`),$u=new RegExp(`^rgba\\(${bt},${bt},${bt},${$t}\\)$`),Du=new RegExp(`^rgba\\(${je},${je},${je},${$t}\\)$`),Uu=new RegExp(`^hsl\\(${$t},${je},${je}\\)$`),Hu=new RegExp(`^hsla\\(${$t},${je},${je},${$t}\\)$`),Pr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};fr(Kt,Dt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Lr,formatHex:Lr,formatHex8:zu,formatHsl:Vu,formatRgb:Tr,toString:Tr});function Lr(){return this.rgb().formatHex()}function zu(){return this.rgb().formatHex8()}function Vu(){return ss(this).formatHsl()}function Tr(){return this.rgb().formatRgb()}function Dt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Nu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Nr(t):n===3?new Pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Zt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Zt(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=Mu.exec(e))?new Pe(t[1],t[2],t[3],1):(t=Ru.exec(e))?new Pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$u.exec(e))?Zt(t[1],t[2],t[3],t[4]):(t=Du.exec(e))?Zt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Uu.exec(e))?$r(t[1],t[2]/100,t[3]/100,1):(t=Hu.exec(e))?$r(t[1],t[2]/100,t[3]/100,t[4]):Pr.hasOwnProperty(e)?Nr(Pr[e]):e==="transparent"?new Pe(NaN,NaN,NaN,0):null}function Nr(e){return new Pe(e>>16&255,e>>8&255,e&255,1)}function Zt(e,t,n,r){return r<=0&&(e=t=n=NaN),new Pe(e,t,n,r)}function Bu(e){return e instanceof Kt||(e=Dt(e)),e?(e=e.rgb(),new Pe(e.r,e.g,e.b,e.opacity)):new Pe}function Kn(e,t,n,r){return arguments.length===1?Bu(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}fr(Pe,Kn,is(Kt,{brighter(e){return e=e==null?cn:Math.pow(cn,e),new Pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Rt:Math.pow(Rt,e),new Pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Pe(ht(this.r),ht(this.g),ht(this.b),fn(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:Mr,formatHex:Mr,formatHex8:Ku,formatRgb:Rr,toString:Rr}));function Mr(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}`}function Ku(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}${ut((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rr(){const e=fn(this.opacity);return`${e===1?"rgb(":"rgba("}${ht(this.r)}, ${ht(this.g)}, ${ht(this.b)}${e===1?")":`, ${e})`}`}function fn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ht(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ut(e){return e=ht(e),(e<16?"0":"")+e.toString(16)}function $r(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ue(e,t,n,r)}function ss(e){if(e instanceof Ue)return new Ue(e.h,e.s,e.l,e.opacity);if(e instanceof Kt||(e=Dt(e)),!e)return new Ue;if(e instanceof Ue)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(t===s?o=(n-r)/a+(n0&&l<1?0:o,new Ue(o,a,l,e.opacity)}function Fu(e,t,n,r){return arguments.length===1?ss(e):new Ue(e,t,n,r==null?1:r)}function Ue(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}fr(Ue,Fu,is(Kt,{brighter(e){return e=e==null?cn:Math.pow(cn,e),new Ue(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Rt:Math.pow(Rt,e),new Ue(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(Rn(e>=240?e-240:e+120,i,r),Rn(e,i,r),Rn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ue(Dr(this.h),Wt(this.s),Wt(this.l),fn(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=fn(this.opacity);return`${e===1?"hsl(":"hsla("}${Dr(this.h)}, ${Wt(this.s)*100}%, ${Wt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dr(e){return e=(e||0)%360,e<0?e+360:e}function Wt(e){return Math.max(0,Math.min(1,e||0))}function Rn(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 os=e=>()=>e;function ju(e,t){return function(n){return e+n*t}}function Xu(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 Yu(e){return(e=+e)==1?as:function(t,n){return n-t?Xu(t,n,e):os(isNaN(t)?n:t)}}function as(e,t){var n=t-e;return n?ju(e,n):os(isNaN(e)?t:e)}const Ur=function e(t){var n=Yu(t);function r(i,s){var o=n((i=Kn(i)).r,(s=Kn(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),u=as(i.opacity,s.opacity);return function(c){return i.r=o(c),i.g=a(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function at(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Fn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$n=new RegExp(Fn.source,"g");function Ju(e){return function(){return e}}function Zu(e){return function(t){return e(t)+""}}function Wu(e,t){var n=Fn.lastIndex=$n.lastIndex=0,r,i,s,o=-1,a=[],l=[];for(e=e+"",t=t+"";(r=Fn.exec(e))&&(i=$n.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:at(r,i)})),n=$n.lastIndex;return n180?c+=360:c-u>180&&(u+=360),d.push({i:h.push(i(h)+"rotate(",null,r)-2,x:at(u,c)})):c&&h.push(i(h)+"rotate("+c+r)}function a(u,c,h,d){u!==c?d.push({i:h.push(i(h)+"skewX(",null,r)-2,x:at(u,c)}):c&&h.push(i(h)+"skewX("+c+r)}function l(u,c,h,d,p,x){if(u!==h||c!==d){var E=p.push(i(p)+"scale(",null,",",null,")");x.push({i:E-4,x:at(u,h)},{i:E-2,x:at(c,d)})}else(h!==1||d!==1)&&p.push(i(p)+"scale("+h+","+d+")")}return function(u,c){var h=[],d=[];return u=e(u),c=e(c),s(u.translateX,u.translateY,c.translateX,c.translateY,h,d),o(u.rotate,c.rotate,h,d),a(u.skewX,c.skewX,h,d),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,h,d),u=c=null,function(p){for(var x=-1,E=d.length,b;++x=0&&e._call.call(void 0,t),e=e._next;--kt}function Vr(){_t=(dn=Ut.now())+kn,kt=Tt=0;try{oc()}finally{kt=0,lc(),_t=0}}function ac(){var e=Ut.now(),t=e-dn;t>cs&&(kn-=t,dn=e)}function lc(){for(var e,t=hn,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:hn=n);Nt=e,Xn(r)}function Xn(e){if(!kt){Tt&&(Tt=clearTimeout(Tt));var t=e-_t;t>24?(e<1/0&&(Tt=setTimeout(Vr,e-Ut.now()-kn)),St&&(St=clearInterval(St))):(St||(dn=Ut.now(),St=setInterval(ac,cs)),kt=1,fs(Vr))}}function Br(e,t,n){var r=new pn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var uc=wn("start","end","cancel","interrupt"),cc=[],ds=0,Kr=1,Yn=2,tn=3,Fr=4,Jn=5,nn=6;function In(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;fc(e,n,{name:t,index:r,group:i,on:uc,tween:cc,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:ds})}function dr(e,t){var n=Be(e,t);if(n.state>ds)throw new Error("too late; already scheduled");return n}function Je(e,t){var n=Be(e,t);if(n.state>tn)throw new Error("too late; already running");return n}function Be(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function fc(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=hs(s,0,n.time);function s(u){n.state=Kr,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var c,h,d,p;if(n.state!==Kr)return l();for(c in r)if(p=r[c],p.name===n.name){if(p.state===tn)return Br(o);p.state===Fr?(p.state=nn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[c]):+cYn&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Vc(e,t,n){var r,i,s=zc(t)?dr:Je;return function(){var o=s(this,e),a=o.on;a!==r&&(i=(r=a).copy()).on(t,n),o.on=i}}function Bc(e,t){var n=this._id;return arguments.length<2?Be(this.node(),n).on.on(e):this.each(Vc(n,e,t))}function Kc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Fc(){return this.on("end.remove",Kc(this._id))}function jc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ur(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o()=>e;function gf(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 et(e,t,n){this.k=e,this.x=t,this.y=n}et.prototype={constructor:et,scale:function(e){return e===1?this:new et(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new et(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 Ht=new et(1,0,0);et.prototype;function Dn(e){e.stopImmediatePropagation()}function Pt(e){e.preventDefault(),e.stopImmediatePropagation()}function vf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function yf(){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 jr(){return this.__zoom||Ht}function wf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ef(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function xf(){var e=vf,t=yf,n=Ef,r=wf,i=bf,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,l=ic,u=wn("start","zoom","end"),c,h,d,p=500,x=150,E=0,b=10;function _(v){v.property("__zoom",jr).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",V).filter(i).on("touchstart.zoom",j).on("touchmove.zoom",ne).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(v,I,A,P){var M=v.selection?v.selection():v;M.property("__zoom",jr),v!==M?$(v,I,A,P):M.interrupt().each(function(){S(this,arguments).event(P).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},_.scaleBy=function(v,I,A,P){_.scaleTo(v,function(){var M=this.__zoom.k,D=typeof I=="function"?I.apply(this,arguments):I;return M*D},A,P)},_.scaleTo=function(v,I,A,P){_.transform(v,function(){var M=t.apply(this,arguments),D=this.__zoom,z=A==null?y(M):typeof A=="function"?A.apply(this,arguments):A,Z=D.invert(z),ae=typeof I=="function"?I.apply(this,arguments):I;return n(C(k(D,ae),z,Z),M,o)},A,P)},_.translateBy=function(v,I,A,P){_.transform(v,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),o)},null,P)},_.translateTo=function(v,I,A,P,M){_.transform(v,function(){var D=t.apply(this,arguments),z=this.__zoom,Z=P==null?y(D):typeof P=="function"?P.apply(this,arguments):P;return n(Ht.translate(Z[0],Z[1]).scale(z.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof A=="function"?-A.apply(this,arguments):-A),D,o)},P,M)};function k(v,I){return I=Math.max(s[0],Math.min(s[1],I)),I===v.k?v:new et(I,v.x,v.y)}function C(v,I,A){var P=I[0]-A[0]*v.k,M=I[1]-A[1]*v.k;return P===v.x&&M===v.y?v:new et(v.k,P,M)}function y(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function $(v,I,A,P){v.on("start.zoom",function(){S(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(P).end()}).tween("zoom",function(){var M=this,D=arguments,z=S(M,D).event(P),Z=t.apply(M,D),ae=A==null?y(Z):typeof A=="function"?A.apply(M,D):A,ce=Math.max(Z[1][0]-Z[0][0],Z[1][1]-Z[0][1]),oe=M.__zoom,we=typeof I=="function"?I.apply(M,D):I,me=l(oe.invert(ae).concat(ce/oe.k),we.invert(ae).concat(ce/we.k));return function(be){if(be===1)be=we;else{var Oe=me(be),Ze=ce/Oe[2];be=new et(Ze,ae[0]-Oe[0]*Ze,ae[1]-Oe[1]*Ze)}z.zoom(null,be)}})}function S(v,I,A){return!A&&v.__zooming||new N(v,I)}function N(v,I){this.that=v,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,I),this.taps=0}N.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,I){return this.mouse&&v!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var I=Te(this.that).datum();u.call(v,this.that,new gf(v,{sourceEvent:this.sourceEvent,target:_,type:v,transform:this.that.__zoom,dispatch:u}),I)}};function F(v,...I){if(!e.apply(this,arguments))return;var A=S(this,I).event(v),P=this.__zoom,M=Math.max(s[0],Math.min(s[1],P.k*Math.pow(2,r.apply(this,arguments)))),D=Ge(v);if(A.wheel)(A.mouse[0][0]!==D[0]||A.mouse[0][1]!==D[1])&&(A.mouse[1]=P.invert(A.mouse[0]=D)),clearTimeout(A.wheel);else{if(P.k===M)return;A.mouse=[D,P.invert(D)],rn(this),A.start()}Pt(v),A.wheel=setTimeout(z,x),A.zoom("mouse",n(C(k(P,M),A.mouse[0],A.mouse[1]),A.extent,o));function z(){A.wheel=null,A.end()}}function T(v,...I){if(d||!e.apply(this,arguments))return;var A=v.currentTarget,P=S(this,I,!0).event(v),M=Te(v.view).on("mousemove.zoom",ae,!0).on("mouseup.zoom",ce,!0),D=Ge(v,A),z=v.clientX,Z=v.clientY;es(v.view),Dn(v),P.mouse=[D,this.__zoom.invert(D)],rn(this),P.start();function ae(oe){if(Pt(oe),!P.moved){var we=oe.clientX-z,me=oe.clientY-Z;P.moved=we*we+me*me>E}P.event(oe).zoom("mouse",n(C(P.that.__zoom,P.mouse[0]=Ge(oe,A),P.mouse[1]),P.extent,o))}function ce(oe){M.on("mousemove.zoom mouseup.zoom",null),ts(oe.view,P.moved),Pt(oe),P.event(oe).end()}}function V(v,...I){if(!!e.apply(this,arguments)){var A=this.__zoom,P=Ge(v.changedTouches?v.changedTouches[0]:v,this),M=A.invert(P),D=A.k*(v.shiftKey?.5:2),z=n(C(k(A,D),P,M),t.apply(this,I),o);Pt(v),a>0?Te(this).transition().duration(a).call($,z,P,v):Te(this).call(_.transform,z,P,v)}}function j(v,...I){if(!!e.apply(this,arguments)){var A=v.touches,P=A.length,M=S(this,I,v.changedTouches.length===P).event(v),D,z,Z,ae;for(Dn(v),z=0;z(e.ready="ready",e.loading="loading",e.prompting="prompting",e.processing="processing",e.dragging="dragging",e.masking="masking",e))(fe||{});function Jr(e){let t,n;return t=new Vi({props:{classList:"absolute inset-0 m-auto animate-spin text-6xl text-black"}}),{c(){_e(t.$$.fragment)},l(r){ge(t.$$.fragment,r)},m(r,i){ve(t,r,i),n=!0},i(r){n||(J(t.$$.fragment,r),n=!0)},o(r){W(t.$$.fragment,r),n=!1},d(r){ye(t,r)}}}function Zr(e){let t,n;return{c(){t=U("div"),this.h()},l(r){t=H(r,"DIV",{class:!0}),O(t).forEach(w),this.h()},h(){f(t,"class",n="absolute inset-0 bg-gradient-to-t "+(e[4]?"from-blue-700/40":"from-blue-700/90")+" to-blue-500/10")},m(r,i){re(r,t,i)},p(r,i){i&16&&n!==(n="absolute inset-0 bg-gradient-to-t "+(r[4]?"from-blue-700/40":"from-blue-700/90")+" to-blue-500/10")&&f(t,"class",n)},d(r){r&&w(t)}}}function Wr(e){let t,n,r;return{c(){t=U("div"),n=U("div"),r=ee(e[7]),this.h()},l(i){t=H(i,"DIV",{class:!0});var s=O(t);n=H(s,"DIV",{class:!0});var o=O(n);r=te(o,e[7]),o.forEach(w),s.forEach(w),this.h()},h(){f(n,"class","font-bold text-4xl text-[#387CFF] text-center px-2 line-clamp-4"),f(t,"class","pointer-events-none touch-none")},m(i,s){re(i,t,s),g(t,n),g(n,r)},p(i,s){s&128&&tt(r,i[7])},d(i){i&&w(t)}}}function kf(e){let t,n=e[1]?"\u{1F91A} Drag me":"\u{1F91A} Enable Drag",r;return{c(){t=U("span"),r=ee(n),this.h()},l(i){t=H(i,"SPAN",{class:!0});var s=O(t);r=te(s,n),s.forEach(w),this.h()},h(){f(t,"class","select-none")},m(i,s){re(i,t,s),g(t,r)},p(i,s){s&2&&n!==(n=i[1]?"\u{1F91A} Drag me":"\u{1F91A} Enable Drag")&&tt(r,n)},d(i){i&&w(t)}}}function If(e){let t,n,r,i,s,o=e[9]==="NFSW"&&qr();return{c(){t=U("div"),o&&o.c(),n=ie(),r=U("p"),i=ee(e[9]),s=ee("..."),this.h()},l(a){t=H(a,"DIV",{class:!0});var l=O(t);o&&o.l(l),n=se(l),r=H(l,"P",{});var u=O(r);i=te(u,e[9]),s=te(u,"..."),u.forEach(w),l.forEach(w),this.h()},h(){f(t,"class","")},m(a,l){re(a,t,l),o&&o.m(t,null),g(t,n),g(t,r),g(r,i),g(r,s)},p(a,l){a[9]==="NFSW"?o||(o=qr(),o.c(),o.m(t,n)):o&&(o.d(1),o=null),l&512&&tt(i,a[9])},d(a){a&&w(t),o&&o.d()}}}function qr(e){let t,n,r,i,s;return{c(){t=U("h2"),n=ee("NSFW Alert"),r=ie(),i=U("h3"),s=ee("Possible NSFW result detected, please try again"),this.h()},l(o){t=H(o,"H2",{class:!0});var a=O(t);n=te(a,"NSFW Alert"),a.forEach(w),r=se(o),i=H(o,"H3",{class:!0});var l=O(i);s=te(l,"Possible NSFW result detected, please try again"),l.forEach(w),this.h()},h(){f(t,"class","text-red-500 text-2xl font-bold"),f(i,"class","text-red-500 text-lg")},m(o,a){re(o,t,a),g(t,n),re(o,r,a),re(o,i,a),g(i,s)},d(o){o&&w(t),o&&w(r),o&&w(i)}}}function Gr(e){let t,n,r,i,s,o,a,l,u;return{c(){t=U("div"),n=U("button"),r=ee("\u{1F58D}"),i=ie(),s=U("button"),o=q("svg"),a=q("path"),this.h()},l(c){t=H(c,"DIV",{class:!0});var h=O(t);n=H(h,"BUTTON",{class:!0});var d=O(n);r=te(d,"\u{1F58D}"),d.forEach(w),i=se(h),s=H(h,"BUTTON",{class:!0});var p=O(s);o=G(p,"svg",{class:!0,width:!0,height:!0,viewBox:!0});var x=O(o);a=G(x,"path",{fill:!0,d:!0,color:!0}),O(a).forEach(w),x.forEach(w),p.forEach(w),h.forEach(w),this.h()},h(){f(n,"class","w-10 h-10 bg-blue-600 hover:saturate-150 shadow-2xl shadow-blue-500 rounded-lg flex items-center justify-center text-3xl"),f(a,"fill","currentColor"),f(a,"d","m65.453 10.826l-.053 5c3.073.034 6.144.549 9.059 1.52l1.58-4.744a34.758 34.758 0 0 0-10.586-1.776zm-5.365.352a35.131 35.131 0 0 0-10.26 3.119l2.17 4.506a30.166 30.166 0 0 1 8.799-2.674l-.71-4.951zm20.908 3.51l-2.283 4.447a30.131 30.131 0 0 1 7.447 5.394l3.522-3.549a35.101 35.101 0 0 0-8.686-6.293zM35 19.125c-19.3 0-35 15.7-35 35s15.7 35 35 35c8.934 0 17.087-3.374 23.275-8.904c.005 0 .01 0 .014.002c.065-.059.127-.121.191-.18l.125-.115a34.677 34.677 0 0 0 2.461-2.496c.083-.092.167-.183.248-.276c.399-.455.79-.919 1.165-1.394c-.482-.04-.961-.092-1.436-.155c-.318-.041-.632-.094-.947-.146c-.158-.026-.316-.046-.473-.074a29.93 29.93 0 0 1-1.383-.283a29.851 29.851 0 0 1-1.183-.301c-.065-.018-.13-.033-.194-.051C44.234 71.216 35 59.651 35 45.875a29.876 29.876 0 0 1 9.557-21.955c.162-.151.324-.302.49-.45c.249-.22.504-.436.76-.65c.158-.131.313-.266.474-.394c.415-.332.837-.656 1.27-.965a35.075 35.075 0 0 0-2.867-.965l-.03-.008c-.287-.082-.577-.155-.867-.23c-.215-.056-.43-.118-.646-.17c-.349-.084-.701-.155-1.053-.229c-.126-.026-.25-.057-.377-.082l-.002.002A34.83 34.83 0 0 0 35 19.125zm58.2 5.928l-4.028 2.967a30.012 30.012 0 0 1 4.252 8.15l4.736-1.606a34.98 34.98 0 0 0-4.96-9.511zm6.294 14.717l-4.924.87c.536 3.029.603 6.145.194 9.19l4.955.666c.48-3.562.4-7.19-.225-10.726zM93.8 54.338a30.198 30.198 0 0 1-3.936 8.314l4.143 2.801a35.162 35.162 0 0 0 4.586-9.695l-4.793-1.42zm-6.803 11.928a29.79 29.79 0 0 1-7.213 5.687l2.451 4.358a34.776 34.776 0 0 0 8.428-6.647l-3.666-3.398zm-11.394 7.638a30.155 30.155 0 0 1-9.002 1.887l.265 4.992a35.12 35.12 0 0 0 10.498-2.199l-1.761-4.68z"),f(a,"color","currentColor"),f(o,"class","text-white"),f(o,"width","1em"),f(o,"height","1em"),f(o,"viewBox","0 0 100 100"),f(s,"class","w-10 h-10 bg-blue-600 hover:saturate-150 shadow-2xl shadow-blue-500 rounded-lg flex items-center justify-center text-3xl"),f(t,"class","mx-4 flex flex-col gap-2")},m(c,h){re(c,t,h),g(t,n),g(n,r),g(t,i),g(t,s),g(s,o),g(o,a),l||(u=[Ne(n,"click",e[17]),Ne(s,"click",e[13])],l=!0)},p:pe,d(c){c&&w(t),l=!1,hi(u)}}}function Of(e){var A;let t,n,r,i,s,o,a,l,u,c,h,d,p,x,E,b,_,k,C,y,$,S,N,F,T=e[5]&&Jr(),V=((A=e[2])==null?void 0:A.status)!=="masking"&&Zr(e),j=e[7]&&Wr(e);function ne(P,M){return P[9]!==""?If:kf}let Y=ne(e),v=Y(e),I=!e[5]&&Gr(e);return{c(){t=U("div"),n=U("div"),r=U("div"),T&&T.c(),i=ie(),V&&V.c(),s=ie(),o=U("canvas"),l=ie(),u=U("div"),j&&j.c(),c=ie(),h=U("div"),d=U("div"),v.c(),x=ie(),E=U("div"),I&&I.c(),k=ie(),C=U("div"),this.h()},l(P){t=H(P,"DIV",{});var M=O(t);n=H(M,"DIV",{class:!0,style:!0});var D=O(n);r=H(D,"DIV",{class:!0,style:!0});var z=O(r);T&&T.l(z),i=se(z),V&&V.l(z),s=se(z),o=H(z,"CANVAS",{class:!0,width:!0,height:!0}),O(o).forEach(w),l=se(z),u=H(z,"DIV",{class:!0});var Z=O(u);j&&j.l(Z),Z.forEach(w),c=se(z),h=H(z,"DIV",{class:!0,style:!0});var ae=O(h);d=H(ae,"DIV",{class:!0});var ce=O(d);v.l(ce),ce.forEach(w),ae.forEach(w),x=se(z),E=H(z,"DIV",{class:!0,style:!0});var oe=O(E);I&&I.l(oe),oe.forEach(w),z.forEach(w),D.forEach(w),k=se(M),C=H(M,"DIV",{class:!0,style:!0}),O(C).forEach(w),M.forEach(w),this.h()},h(){f(o,"class",a=e[1]?"":"bg-white"),f(o,"width",de),f(o,"height",de),f(u,"class","pointer-events-none touch-none"),f(d,"class","pl-3 pr-5 py-1 bg-blue-700/90 text-white text-lg xl:text-2xl rounded-tr-xl font-medium tracking-wide cursor-pointer"),f(h,"class","absolute bottom-0 origin-bottom-left"),f(h,"style",p=`transform: scale(${Math.max(2.5-e[0].k,1)});`),f(E,"class","absolute left-full"),f(E,"style",b=`transform: scale(${Math.max(2.5-e[0].k,1)}); transform-origin: 0 0;`),f(r,"class","frame relative svelte-1wvt719"),f(r,"style",`width: ${de}px;height: ${de}px;`),f(n,"class","absolute top-0 left-0 pen"),f(n,"style",_=`transform: translateX(${e[6].x}px) translateY(${e[6].y}px) scale(${e[0].k}); transform-origin: 0 0;`),f(C,"class",y="absolute top-0 left-0 ring-8 hand "+(e[1]?"block cursor-move":"hidden cursor-pointer")),f(C,"style",$=`width: ${de}px;height: ${de}px;transform: translateX(${e[6].x}px) translateY(${e[6].y}px) scale(${e[0].k}); transform-origin: 0 0;`)},m(P,M){re(P,t,M),g(t,n),g(n,r),T&&T.m(r,null),g(r,i),V&&V.m(r,null),g(r,s),g(r,o),e[15](o),g(r,l),g(r,u),j&&j.m(u,null),g(r,c),g(r,h),g(h,d),v.m(d,null),g(r,x),g(r,E),I&&I.m(E,null),g(t,k),g(t,C),e[18](C),S=!0,N||(F=Ne(d,"click",e[16]),N=!0)},p(P,[M]){var D;P[5]?T?M&32&&J(T,1):(T=Jr(),T.c(),J(T,1),T.m(r,i)):T&&(Me(),W(T,1,1,()=>{T=null}),Re()),((D=P[2])==null?void 0:D.status)!=="masking"?V?V.p(P,M):(V=Zr(P),V.c(),V.m(r,s)):V&&(V.d(1),V=null),(!S||M&2&&a!==(a=P[1]?"":"bg-white"))&&f(o,"class",a),P[7]?j?j.p(P,M):(j=Wr(P),j.c(),j.m(u,null)):j&&(j.d(1),j=null),Y===(Y=ne(P))&&v?v.p(P,M):(v.d(1),v=Y(P),v&&(v.c(),v.m(d,null))),(!S||M&1&&p!==(p=`transform: scale(${Math.max(2.5-P[0].k,1)});`))&&f(h,"style",p),P[5]?I&&(I.d(1),I=null):I?I.p(P,M):(I=Gr(P),I.c(),I.m(E,null)),(!S||M&1&&b!==(b=`transform: scale(${Math.max(2.5-P[0].k,1)}); transform-origin: 0 0;`))&&f(E,"style",b),(!S||M&65&&_!==(_=`transform: translateX(${P[6].x}px) translateY(${P[6].y}px) scale(${P[0].k}); transform-origin: 0 0;`))&&f(n,"style",_),(!S||M&2&&y!==(y="absolute top-0 left-0 ring-8 hand "+(P[1]?"block cursor-move":"hidden cursor-pointer")))&&f(C,"class",y),(!S||M&65&&$!==($=`width: ${de}px;height: ${de}px;transform: translateX(${P[6].x}px) translateY(${P[6].y}px) scale(${P[0].k}); transform-origin: 0 0;`))&&f(C,"style",$)},i(P){S||(J(T),S=!0)},o(P){W(T),S=!1},d(P){P&&w(t),T&&T.d(),V&&V.d(),e[15](null),j&&j.d(),v.d(),I&&I.d(),e[18](null),N=!1,F()}}}function Af(e,t,n){let r,i,s,o,a,l,u;Ce(e,Wn,I=>n(8,o=I)),Ce(e,sn,I=>n(22,a=I)),Ce(e,Se,I=>n(9,u=I));const c=xn();Ce(e,c,I=>n(2,l=I));const h=tr();let{transform:d}=t,p,x={x:mt.width/2-de/2,y:mt.height/2-de/2},E,b=!0,_=!1,k=0,C=0;function y(I){p.save(),p.clearRect(0,0,de,de),p.globalCompositeOperation="source-over",p.drawImage(a,I.x,I.y,de,de,0,0,de,de),p.restore()}function $(I){p.save(),p.globalCompositeOperation="destination-out",p.beginPath(),p.moveTo(I.lastx,I.lasty),p.lineTo(I.x,I.y),p.lineWidth=50,p.lineCap="round",p.strokeStyle="black",p.stroke(),p.restore()}zt(()=>{p=o.getContext("2d"),Te(E).call(F()).call(S),Te(o).call(N()).call(S)});function S(I){function A(M){c.update({cursor:{x:d.invertX(M.clientX),y:d.invertY(M.clientY)}})}function P(){c.update({cursor:null})}return I.on("pointermove",A).on("pointerleave",P)}function N(){let I,A;function P(D){if(i)return;const z=D.x/d.k,Z=D.y/d.k;I=z,A=Z}function M(D){if(i)return;const z=D.x/d.k,Z=D.y/d.k;$({x:z,y:Z,lastx:I,lasty:A}),I=z,A=Z}return Sr().on("start",P).on("drag",M)}function F(){function I(M){if(i)return;const D=M.sourceEvent.target.getBoundingClientRect();typeof TouchEvent<"u"&&M.sourceEvent instanceof TouchEvent?(k=M.sourceEvent.targetTouches[0].pageX-D.left,C=M.sourceEvent.targetTouches[0].pageY-D.top):M.sourceEvent instanceof MouseEvent&&(k=M.sourceEvent.pageX-D.left,C=M.sourceEvent.pageY-D.top),n(4,_=!0)}function A(M){if(i)return;const D=Jt(d.invertX(M.x-k)),z=Jt(d.invertY(M.y-C));n(14,x={x:D,y:z}),c.update({cursor:{x:d.invertX(M.x),y:d.invertY(M.y)}}),y({x:D,y:z})}function P(M){if(i)return;n(4,_=!1);const D=Jt(d.invertX(M.x-k)),z=Jt(d.invertY(M.y-C));y({x:D,y:z}),c.update({frame:{x:D,y:z}})}return Sr().on("start",I).on("drag",A).on("end",P)}function T(){n(1,b=!0),c.update({status:fe.dragging})}function V(){n(1,b=!1),y(x),c.update({status:fe.masking})}function j(I){dt[I?"unshift":"push"](()=>{o=I,Wn.set(o)})}const ne=()=>T(),Y=()=>h("prompt");function v(I){dt[I?"unshift":"push"](()=>{E=I,n(3,E)})}return e.$$set=I=>{"transform"in I&&n(0,d=I.transform)},e.$$.update=()=>{e.$$.dirty&4&&n(7,r=l==null?void 0:l.currentPrompt),e.$$.dirty&4&&n(5,i=(l==null?void 0:l.status)===fe.loading||(l==null?void 0:l.status)===fe.prompting||!1),e.$$.dirty&6&&!b&&l.status===fe.loading&&n(1,b=!0),e.$$.dirty&16385&&n(6,s={x:d.applyX(x.x),y:d.applyY(x.y)})},[d,b,l,E,_,i,s,r,o,u,c,h,T,V,x,j,ne,Y,v]}class Cf extends Ee{constructor(t){super(),xe(this,t,Af,Of,ke,{transform:0})}}function Sf(e){let t,n,r,i;const s=e[8].default,o=qn(s,e,e[7],null);return{c(){t=U("div"),n=U("canvas"),r=ie(),o&&o.c(),this.h()},l(a){t=H(a,"DIV",{class:!0});var l=O(t);n=H(l,"CANVAS",{width:!0,height:!0,class:!0}),O(n).forEach(w),r=se(l),o&&o.l(l),l.forEach(w),this.h()},h(){f(n,"width",e[4]),f(n,"height",e[3]),f(n,"class","absolute top-0 left-0 bg-white shadow-2xl svelte-6dcxg7"),f(t,"class","absolute top-0 left-0 right-0 bottom-0 overflow-hidden z-0 bg-gray-200")},m(a,l){re(a,t,l),g(t,n),e[9](n),g(t,r),o&&o.m(t,null),e[10](t),i=!0},p(a,[l]){o&&o.p&&(!i||l&128)&&Gn(o,s,a,a[7],i?er(s,a[7],l,null):Qn(a[7]),null)},i(a){i||(J(o,a),i=!0)},o(a){W(o,a),i=!1},d(a){a&&w(t),e[9](null),o&&o.d(a),e[10](null)}}}function Pf(e,t,n){let r,i,s;Ce(e,Zn,N=>n(12,r=N)),Ce(e,sn,N=>n(1,i=N));let{$$slots:o={},$$scope:a}=t;const l=xn(),u=rs("promptImgStorage");Ce(e,u,N=>n(6,s=N));const c=mt.height,h=mt.width;let d,p;const x=new Set;function E(N){return N?Object.values(N).sort((T,V)=>T.date-V.date).filter(({id:T})=>!x.has(T)):[]}let b=[];zt(()=>{const F=(h+400)/(d.clientHeight>d.clientWidth?d.clientWidth:d.clientHeight),T=xf().scaleExtent([1/F/2,3]).translateExtent([[-200,-200],[h+200,c+200]]).tapDistance(10).on("zoom",k),V=Te(i.parentElement).call(T).call(T.transform,Ht).call(T.scaleTo,1/F).on("pointermove",C).on("pointerleave",y);p=i.getContext("2d");function j(){const ne=(h+400)/(d.clientHeight>d.clientWidth?d.clientWidth:d.clientHeight);V.call(T.transform,Ht),V.call(T.scaleTo,1/ne)}return window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}});function _(N){Promise.all(N.map(({imgURL:F,position:T,id:V})=>new Promise(j=>{const ne=new Image;ne.crossOrigin="anonymous",ne.onload=()=>{const Y={img:ne,position:T,id:V};p.drawImage(ne,T.x,T.y,ne.width,ne.height),j(Y)},ne.src=`${Ou}/${F}`}))).then(F=>{F.forEach(({img:T,position:V,id:j})=>{x.add(j),p.drawImage(T,V.x,V.y,T.width,T.height)})})}function k(N){const F=Ae(Zn,r=N.transform,r);Ae(sn,i.style.transform=`translate(${F.x}px, ${F.y}px) scale(${F.k})`,i)}function C(N){N.preventDefault();const F=r.invertX(N.clientX),T=r.invertY(N.clientY);l.update({cursor:{x:F,y:T}})}function y(){l.update({cursor:null})}function $(N){dt[N?"unshift":"push"](()=>{i=N,sn.set(i)})}function S(N){dt[N?"unshift":"push"](()=>{d=N,n(0,d)})}return e.$$set=N=>{"$$scope"in N&&n(7,a=N.$$scope)},e.$$.update=()=>{e.$$.dirty&64&&n(5,b=E(s==null?void 0:s.toObject())),e.$$.dirty&32&&b&&_(b)},[d,i,u,c,h,b,s,a,o,$,S]}class Lf extends Ee{constructor(t){super(),xe(this,t,Pf,Sf,ke,{})}}function Tf(e){let t,n,r;return{c(){t=q("svg"),n=q("rect"),r=q("rect"),this.h()},l(i){t=G(i,"svg",{class:!0,height:!0,viewBox:!0,fill:!0,xmlns:!0});var s=O(t);n=G(s,"rect",{x:!0,y:!0,width:!0,height:!0,rx:!0,stroke:!0}),O(n).forEach(w),r=G(s,"rect",{x:!0,y:!0,width:!0,height:!0,rx:!0,fill:!0,stroke:!0}),O(r).forEach(w),s.forEach(w),this.h()},h(){f(n,"x","1"),f(n,"y","1"),f(n,"width","7"),f(n,"height","7"),f(n,"rx","1"),f(n,"stroke","#2F6DCB"),f(r,"x","3.05566"),f(r,"y","3.05566"),f(r,"width","2.88889"),f(r,"height","2.88889"),f(r,"rx","0.5"),f(r,"fill","#2F6DCB"),f(r,"stroke","#2F6DCB"),f(t,"class",e[0]),f(t,"height","15"),f(t,"viewBox","0 0 9 9"),f(t,"fill","none"),f(t,"xmlns","http://www.w3.org/2000/svg")},m(i,s){re(i,t,s),g(t,n),g(t,r)},p(i,[s]){s&1&&f(t,"class",i[0])},i:pe,o:pe,d(i){i&&w(t)}}}function Nf(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class mr extends Ee{constructor(t){super(),xe(this,t,Nf,Tf,ke,{classList:0})}}function Mf(e){let t,n;return{c(){t=q("svg"),n=q("path"),this.h()},l(r){t=G(r,"svg",{class:!0,height:!0,viewBox:!0,fill:!0,xmlns:!0});var i=O(t);n=G(i,"path",{d:!0,fill:!0}),O(n).forEach(w),i.forEach(w),this.h()},h(){f(n,"d","M3.5 4.58599C3.74063 4.58599 3.94669 4.4961 4.11819 4.31633C4.2894 4.13687 4.375 3.92102 4.375 3.66879C4.375 3.41656 4.2894 3.20056 4.11819 3.02079C3.94669 2.84132 3.74063 2.75159 3.5 2.75159C3.25937 2.75159 3.05346 2.84132 2.88225 3.02079C2.71075 3.20056 2.625 3.41656 2.625 3.66879C2.625 3.92102 2.71075 4.13687 2.88225 4.31633C3.05346 4.4961 3.25937 4.58599 3.5 4.58599ZM3.5 7.95669C4.38958 7.10064 5.04948 6.32285 5.47969 5.62334C5.9099 4.92413 6.125 4.30318 6.125 3.76051C6.125 2.92739 5.87154 2.24515 5.36462 1.71378C4.858 1.18273 4.23646 0.917197 3.5 0.917197C2.76354 0.917197 2.14185 1.18273 1.63494 1.71378C1.12831 2.24515 0.875 2.92739 0.875 3.76051C0.875 4.30318 1.0901 4.92413 1.52031 5.62334C1.95052 6.32285 2.61042 7.10064 3.5 7.95669ZM3.5 9C3.44167 9 3.38333 8.98853 3.325 8.9656C3.26667 8.94267 3.21562 8.9121 3.17188 8.87389C2.10729 7.8879 1.3125 6.97269 0.7875 6.12825C0.2625 5.28352 0 4.49427 0 3.76051C0 2.61401 0.351896 1.70064 1.05569 1.02038C1.75919 0.340127 2.57396 0 3.5 0C4.42604 0 5.24081 0.340127 5.94431 1.02038C6.6481 1.70064 7 2.61401 7 3.76051C7 4.49427 6.7375 5.28352 6.2125 6.12825C5.6875 6.97269 4.89271 7.8879 3.82812 8.87389C3.78438 8.9121 3.73333 8.94267 3.675 8.9656C3.61667 8.98853 3.55833 9 3.5 9Z"),f(n,"fill","#338D4C"),f(t,"class",e[0]),f(t,"height","15"),f(t,"viewBox","0 0 7 9"),f(t,"fill","none"),f(t,"xmlns","http://www.w3.org/2000/svg")},m(r,i){re(r,t,i),g(t,n)},p(r,[i]){i&1&&f(t,"class",r[0])},i:pe,o:pe,d(r){r&&w(t)}}}function Rf(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class $f extends Ee{constructor(t){super(),xe(this,t,Rf,Mf,ke,{classList:0})}}function Df(e){let t,n,r,i;return{c(){t=q("svg"),n=q("path"),r=q("path"),i=q("path"),this.h()},l(s){t=G(s,"svg",{class:!0,height:!0,width:!0,viewBox:!0,fill:!0,xmlns:!0});var o=O(t);n=G(o,"path",{"fill-rule":!0,"clip-rule":!0,d:!0,fill:!0}),O(n).forEach(w),r=G(o,"path",{d:!0,fill:!0}),O(r).forEach(w),i=G(o,"path",{"fill-rule":!0,"clip-rule":!0,d:!0,fill:!0}),O(i).forEach(w),o.forEach(w),this.h()},h(){f(n,"fill-rule","evenodd"),f(n,"clip-rule","evenodd"),f(n,"d","M6.41113 3.73486C6.97158 4.11531 7.3643 4.63076 7.3643 5.31801V6.54526H8.59155C8.81654 6.54526 9.00063 6.36118 9.00063 6.13618V5.31801C9.00063 4.42621 7.5402 3.8985 6.41113 3.73486Z"),f(n,"fill","currentColor"),f(r,"d","M3.27305 3.27266C4.17677 3.27266 4.90938 2.54005 4.90938 1.63633C4.90938 0.732611 4.17677 0 3.27305 0C2.36933 0 1.63672 0.732611 1.63672 1.63633C1.63672 2.54005 2.36933 3.27266 3.27305 3.27266Z"),f(r,"fill","currentColor"),f(i,"fill-rule","evenodd"),f(i,"clip-rule","evenodd"),f(i,"d","M5.72716 3.27266C6.63124 3.27266 7.36349 2.54041 7.36349 1.63633C7.36349 0.732258 6.63124 0 5.72716 0C5.53489 0 5.3549 0.0409082 5.18308 0.0981798C5.53511 0.533533 5.72715 1.07646 5.72715 1.63633C5.72715 2.1962 5.53511 2.73913 5.18308 3.17448C5.3549 3.23176 5.53489 3.27266 5.72716 3.27266ZM3.27266 3.68175C2.18041 3.68175 0 4.22992 0 5.31808V6.13624C0 6.36124 0.184087 6.54533 0.409083 6.54533H6.13625C6.36124 6.54533 6.54533 6.36124 6.54533 6.13624V5.31808C6.54533 4.22992 4.36492 3.68175 3.27266 3.68175Z"),f(i,"fill","currentColor"),f(t,"class",e[0]),f(t,"height","1em"),f(t,"width","1em"),f(t,"viewBox","0 0 9 7"),f(t,"fill","none"),f(t,"xmlns","http://www.w3.org/2000/svg")},m(s,o){re(s,t,o),g(t,n),g(t,r),g(t,i)},p(s,[o]){o&1&&f(t,"class",s[0])},i:pe,o:pe,d(s){s&&w(t)}}}function Uf(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class _r extends Ee{constructor(t){super(),xe(this,t,Uf,Df,ke,{classList:0})}}function Qr(e,t,n){const r=e.slice();return r[14]=t[n],r}function ei(e){let t,n,r,i,s,o,a,l,u,c,h=!e[4]&&ti(e);const d=[zf,Hf],p=[];function x(E,b){return E[6]?0:1}return i=x(e),s=p[i]=d[i](e),{c(){t=U("div"),h&&h.c(),n=ie(),r=U("div"),s.c(),this.h()},l(E){t=H(E,"DIV",{class:!0,title:!0});var b=O(t);h&&h.l(b),n=se(b),r=H(b,"DIV",{class:!0});var _=O(r);s.l(_),_.forEach(w),b.forEach(w),this.h()},h(){f(r,"class",o=e[0]?"cursor-wait":"cursor-pointer"),f(t,"class",a="text-xs rounded md:text-smtext-gray-700 py-1 font-medium tracking-tight relative z-0 "+(e[0]?"opacity-50":"")),f(t,"title","Choose a different room")},m(E,b){re(E,t,b),h&&h.m(t,null),g(t,n),g(t,r),p[i].m(r,null),e[10](t),l=!0,u||(c=Ne(r,"click",e[9]),u=!0)},p(E,b){E[4]?h&&(Me(),W(h,1,1,()=>{h=null}),Re()):h?(h.p(E,b),b&16&&J(h,1)):(h=ti(E),h.c(),J(h,1),h.m(t,n));let _=i;i=x(E),i===_?p[i].p(E,b):(Me(),W(p[_],1,1,()=>{p[_]=null}),Re(),s=p[i],s?s.p(E,b):(s=p[i]=d[i](E),s.c()),J(s,1),s.m(r,null)),(!l||b&1&&o!==(o=E[0]?"cursor-wait":"cursor-pointer"))&&f(r,"class",o),(!l||b&1&&a!==(a="text-xs rounded md:text-smtext-gray-700 py-1 font-medium tracking-tight relative z-0 "+(E[0]?"opacity-50":"")))&&f(t,"class",a)},i(E){l||(J(h),J(s),l=!0)},o(E){W(h),W(s),l=!1},d(E){E&&w(t),h&&h.d(),p[i].d(),e[10](null),u=!1,c()}}}function ti(e){let t,n,r,i,s,o,a,l,u,c,h,d,p,x,E,b;i=new mr({}),u=new _r({});let _=e[1],k=[];for(let y=0;y<_.length;y+=1)k[y]=ri(Qr(e,_,y));const C=y=>W(k[y],1,1,()=>{k[y]=null});return{c(){t=U("div"),n=U("ul"),r=U("li"),_e(i.$$.fragment),s=ie(),o=U("span"),a=ee("room"),l=ie(),_e(u.$$.fragment),c=ie(),h=U("span"),d=ee("players"),p=ie();for(let y=0;y{S=null}),Re()),(!C||T&2)&&a!==(a=e[14].id+"")&&tt(l,a),(!C||T&2)&&p!==(p=e[14].users_count+"")&&tt(x,p),(!C||T&6&&_!==(_="grid-row gap-2 hover:bg-gray-300 "+(e[14].room_id===e[2]?"text-black":"")+" svelte-15fj2lr"))&&f(n,"class",_)},i(F){C||(J(S),C=!0)},o(F){W(S),C=!1},d(F){F&&w(t),S&&S.d(),y=!1,$()}}}function Hf(e){let t,n,r,i,s,o,a,l,u,c;return n=new mr({}),o=new _r({}),{c(){t=U("div"),_e(n.$$.fragment),r=ie(),i=U("span"),s=ee(`Loading... + `),_e(o.$$.fragment),a=ie(),l=U("span"),u=ee("... / ..."),this.h()},l(h){t=H(h,"DIV",{class:!0});var d=O(t);ge(n.$$.fragment,d),r=se(d),i=H(d,"SPAN",{});var p=O(i);s=te(p,`Loading... + `),ge(o.$$.fragment,p),a=se(p),l=H(p,"SPAN",{});var x=O(l);u=te(x,"... / ..."),x.forEach(w),p.forEach(w),d.forEach(w),this.h()},h(){f(t,"class","grid-row gap-2 svelte-15fj2lr")},m(h,d){re(h,t,d),ve(n,t,null),g(t,r),g(t,i),g(i,s),ve(o,i,null),g(i,a),g(i,l),g(l,u),c=!0},p:pe,i(h){c||(J(n.$$.fragment,h),J(o.$$.fragment,h),c=!0)},o(h){W(n.$$.fragment,h),W(o.$$.fragment,h),c=!1},d(h){h&&w(t),ye(n),ye(o)}}}function zf(e){var _,k;let t,n,r,i,s,o=((_=e[6])==null?void 0:_.id)+"",a,l,u,c,h,d=((k=e[6])==null?void 0:k.users_count)+"",p,x,E,b;return n=new mr({}),u=new _r({}),{c(){t=U("div"),_e(n.$$.fragment),r=ie(),i=U("span"),s=ee("room "),a=ee(o),l=ie(),_e(u.$$.fragment),c=ie(),h=U("span"),p=ee(d),x=ee(" / "),E=ee(ln),this.h()},l(C){t=H(C,"DIV",{class:!0});var y=O(t);ge(n.$$.fragment,y),r=se(y),i=H(y,"SPAN",{});var $=O(i);s=te($,"room "),a=te($,o),$.forEach(w),l=se(y),ge(u.$$.fragment,y),c=se(y),h=H(y,"SPAN",{});var S=O(h);p=te(S,d),x=te(S," / "),E=te(S,ln),S.forEach(w),y.forEach(w),this.h()},h(){f(t,"class","grid-row gap-2 svelte-15fj2lr")},m(C,y){re(C,t,y),ve(n,t,null),g(t,r),g(t,i),g(i,s),g(i,a),g(t,l),ve(u,t,null),g(t,c),g(t,h),g(h,p),g(h,x),g(h,E),b=!0},p(C,y){var $,S;(!b||y&64)&&o!==(o=(($=C[6])==null?void 0:$.id)+"")&&tt(a,o),(!b||y&64)&&d!==(d=((S=C[6])==null?void 0:S.users_count)+"")&&tt(p,d)},i(C){b||(J(n.$$.fragment,C),J(u.$$.fragment,C),b=!0)},o(C){W(n.$$.fragment,C),W(u.$$.fragment,C),b=!1},d(C){C&&w(t),ye(n),ye(u)}}}function Vf(e){let t,n,r=e[5]&&ei(e);return{c(){t=U("div"),r&&r.c(),this.h()},l(i){t=H(i,"DIV",{class:!0});var s=O(t);r&&r.l(s),s.forEach(w),this.h()},h(){f(t,"class","min-w-[25ch]")},m(i,s){re(i,t,s),r&&r.m(t,null),n=!0},p(i,[s]){i[5]?r?(r.p(i,s),s&32&&J(r,1)):(r=ei(i),r.c(),J(r,1),r.m(t,null)):r&&(Me(),W(r,1,1,()=>{r=null}),Re())},i(i){n||(J(r),n=!0)},o(i){W(r),n=!1},d(i){i&&w(t),r&&r.d()}}}function Bf(e,t,n){let r,i,s,o;Ce(e,Rs,_=>n(11,s=_)),Ce(e,Xr,_=>n(2,o=_));let{isLoading:a=!1}=t,l,u=[],c=!0;function h(_){l.contains(_.target)||n(4,c=!0)}zt(()=>{d(),window.addEventListener("pointerdown",h,!0);const _=setInterval(d,3e3);return()=>{window.removeEventListener("pointerdown",h,!0),clearInterval(_)}});async function d(){n(1,u=await fetch(ns+"/rooms").then(_=>_.json()))}function p(_){Ae(Xr,o=_.room_id,o),n(4,c=!0),s.url.searchParams.set("roomid",_.room_id),window.location.search=`?${s.url.searchParams.toString()}`}const x=_=>p(_),E=()=>a?null:n(4,c=!c);function b(_){dt[_?"unshift":"push"](()=>{l=_,n(3,l)})}return e.$$set=_=>{"isLoading"in _&&n(0,a=_.isLoading)},e.$$.update=()=>{e.$$.dirty&6&&n(6,r=u.find(_=>_.room_id===o)),e.$$.dirty&2&&n(5,i=u.length>0)},[a,u,o,l,c,i,r,p,x,E,b]}class Kf extends Ee{constructor(t){super(),xe(this,t,Bf,Vf,ke,{isLoading:0})}}function Ff(e){let t,n,r,i,s;return{c(){t=U("button"),n=U("span"),r=ee("About"),this.h()},l(o){t=H(o,"BUTTON",{title:!0,class:!0});var a=O(t);n=H(a,"SPAN",{});var l=O(n);r=te(l,"About"),l.forEach(w),a.forEach(w),this.h()},h(){f(t,"title","Prompt and Paint"),f(t,"class","underline w-[210px] text-sm")},m(o,a){re(o,t,a),g(t,n),g(n,r),i||(s=Ne(t,"click",e[0]),i=!0)},p:pe,i:pe,o:pe,d(o){o&&w(t),i=!1,s()}}}function jf(e){function t(n){nr.call(this,e,n)}return[t]}class Xf extends Ee{constructor(t){super(),xe(this,t,jf,Ff,ke,{})}}function Yf(e){let t,n,r,i,s,o,a,l,u;return n=new Xf({}),n.$on("click",e[3]),o=new Kf({props:{isLoading:e[0]}}),{c(){t=U("div"),_e(n.$$.fragment),r=ie(),i=U("button"),s=ee("\u{1F58D} Paint"),_e(o.$$.fragment),this.h()},l(c){t=H(c,"DIV",{class:!0});var h=O(t);ge(n.$$.fragment,h),r=se(h),i=H(h,"BUTTON",{class:!0});var d=O(i);s=te(d,"\u{1F58D} Paint"),d.forEach(w),ge(o.$$.fragment,h),h.forEach(w),this.h()},h(){f(i,"class","text-3xl bg-blue-600 text-white px-6 py-2 rounded-2xl ring ring-blue-500 font-semibold shadow-2xl self-center"),f(t,"class","flex items-center justify-between px-12")},m(c,h){re(c,t,h),ve(n,t,null),g(t,r),g(t,i),g(i,s),ve(o,t,null),a=!0,l||(u=Ne(i,"click",e[4]),l=!0)},p(c,[h]){const d={};h&1&&(d.isLoading=c[0]),o.$set(d)},i(c){a||(J(n.$$.fragment,c),J(o.$$.fragment,c),a=!0)},o(c){W(n.$$.fragment,c),W(o.$$.fragment,c),a=!1},d(c){c&&w(t),ye(n),ye(o),l=!1,u()}}}function Jf(e,t,n){let r;Ce(e,Yr,u=>n(1,r=u));const i=tr();let{isLoading:s=!1}=t;const o=u=>{u.key==="Enter"&&i("prompt")};zt(()=>(window.addEventListener("keyup",o),()=>{window.removeEventListener("keyup",o)}));const a=()=>Ae(Yr,r=!r,r),l=()=>i("prompt");return e.$$set=u=>{"isLoading"in u&&n(0,s=u.isLoading)},[s,r,i,a,l]}class Zf extends Ee{constructor(t){super(),xe(this,t,Jf,Yf,ke,{isLoading:0})}}function Wf(e){let t,n,r,i,s,o,a,l,u,c;return{c(){t=U("form"),n=U("div"),r=U("input"),i=ie(),s=U("button"),o=U("span"),a=ee("\u{1F58C}"),l=ee(" Paint"),this.h()},l(h){t=H(h,"FORM",{class:!0});var d=O(t);n=H(d,"DIV",{class:!0});var p=O(n);r=H(p,"INPUT",{class:!0,placeholder:!0,title:!0,type:!0,name:!0}),i=se(p),s=H(p,"BUTTON",{class:!0,type:!0});var x=O(s);o=H(x,"SPAN",{class:!0});var E=O(o);a=te(E,"\u{1F58C}"),E.forEach(w),l=te(x," Paint"),x.forEach(w),p.forEach(w),d.forEach(w),this.h()},h(){r.value=e[0],f(r,"class","flex-1 outline-none ring-0 border-none text-xl 2xl:text-2xl"),f(r,"placeholder","Describe your prompt"),f(r,"title","Input prompt to generate image and obtain palette"),f(r,"type","text"),f(r,"name","prompt"),f(o,"class","mr-2"),f(s,"class","font-bold bg-blue-700 text-white border-l-2 px-5 text-xl 2xl:text-2xl spacing tracking-wide"),f(s,"type","submit"),f(n,"class","flex bg-white itemx-center overflow-hidden rounded-lg w-full max-w-lg 2xl:max-w-xl"),f(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")},m(h,d){re(h,t,d),g(t,n),g(n,r),e[7](r),g(n,i),g(n,s),g(s,o),g(o,a),g(s,l),e[8](n),u||(c=[Ne(r,"click",Ts(e[6])),Ne(r,"input",e[4]),Ne(s,"click",Un(e[3])),Ne(t,"submit",Un(e[3]))],u=!0)},p(h,[d]){d&1&&r.value!==h[0]&&(r.value=h[0])},i:pe,o:pe,d(h){h&&w(t),e[7](null),e[8](null),u=!1,hi(c)}}}function qf(e,t,n){const r=tr();let{initPrompt:i=""}=t,s,o,a;const l=xn(),u=k=>{k.key==="Escape"&&(l.update({status:fe.ready}),r("close"))};zt(()=>(o.focus(),n(0,s=i),window.addEventListener("keyup",u),window.addEventListener("pointerdown",x,!0),()=>{window.removeEventListener("keyup",u),window.removeEventListener("pointerdown",x,!0)}));let c;function h(k){clearTimeout(c),c=setTimeout(()=>{n(0,s=k),l.update({currentPrompt:s,status:fe.prompting})},100)}function d(){s.trim()!==""&&(r("paint"),r("close"))}function p(k){const C=k.target;h(C.value)}function x(k){a.contains(k.target)||(l.update({status:fe.ready}),r("close"))}function E(k){nr.call(this,e,k)}function b(k){dt[k?"unshift":"push"](()=>{o=k,n(1,o)})}function _(k){dt[k?"unshift":"push"](()=>{a=k,n(2,a)})}return e.$$set=k=>{"initPrompt"in k&&n(5,i=k.initPrompt)},[s,o,a,d,p,i,E,b,_]}class Gf extends Ee{constructor(t){super(),xe(this,t,qf,Wf,ke,{initPrompt:5})}}let Qf=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");function ii(e,t,n){const r=e.slice();return r[16]=t[n].connectionId,r[17]=t[n].presence,r}function si(e){var r;let t,n;return t=new Gf({props:{initPrompt:(r=e[0])==null?void 0:r.currentPrompt}}),t.$on("paint",e[11]),t.$on("close",e[10]),{c(){_e(t.$$.fragment)},l(i){ge(t.$$.fragment,i)},m(i,s){ve(t,i,s),n=!0},p(i,s){var a;const o={};s&1&&(o.initPrompt=(a=i[0])==null?void 0:a.currentPrompt),t.$set(o)},i(i){n||(J(t.$$.fragment,i),n=!0)},o(i){W(t.$$.fragment,i),n=!1},d(i){ye(t,i)}}}function oi(e){let t=[],n=new Map,r,i,s=[...e[5]];const o=a=>a[16];for(let a=0;a{o=null}),Re()),(C=t[17])!=null&&C.cursor?a?(a.p(t,x),x&32&&J(a,1)):(a=li(t),a.c(),J(a,1),a.m(i.parentNode,i)):a&&(Me(),W(a,1,1,()=>{a=null}),Re())},i(p){s||(J(o),J(a),s=!0)},o(p){W(o),W(a),s=!1},d(p){p&&w(n),o&&o.d(p),p&&w(r),a&&a.d(p),p&&w(i)}}}function eh(e){let t,n,r,i,s,o,a,l,u,c,h,d,p,x,E=e[1]&&si(e);o=new Lf({}),u=new Cf({props:{transform:e[4]}}),u.$on("prompt",e[9]);let b=e[5]&&oi(e);return p=new Zf({props:{isLoading:e[2]}}),p.$on("prompt",e[9]),{c(){t=U("div"),n=ee(e[3]),r=ie(),E&&E.c(),i=ie(),s=U("div"),_e(o.$$.fragment),a=ie(),l=U("main"),_e(u.$$.fragment),c=ie(),b&&b.c(),h=ie(),d=U("div"),_e(p.$$.fragment),this.h()},l(_){t=H(_,"DIV",{class:!0});var k=O(t);n=te(k,e[3]),k.forEach(w),r=se(_),E&&E.l(_),i=se(_),s=H(_,"DIV",{class:!0});var C=O(s);ge(o.$$.fragment,C),a=se(C),l=H(C,"MAIN",{class:!0});var y=O(l);ge(u.$$.fragment,y),c=se(y),b&&b.l(y),y.forEach(w),C.forEach(w),h=se(_),d=H(_,"DIV",{class:!0});var $=O(d);ge(p.$$.fragment,$),$.forEach(w),this.h()},h(){f(t,"class","text touch-none pointer-events-none"),f(l,"class","z-10 relative"),f(s,"class","fixed top-0 left-0 z-0 w-screen h-screen"),f(d,"class","fixed bottom-32 left-0 right-0 z-10 my-2")},m(_,k){re(_,t,k),g(t,n),re(_,r,k),E&&E.m(_,k),re(_,i,k),re(_,s,k),ve(o,s,null),g(s,a),g(s,l),ve(u,l,null),g(l,c),b&&b.m(l,null),re(_,h,k),re(_,d,k),ve(p,d,null),x=!0},p(_,[k]){(!x||k&8)&&tt(n,_[3]),_[1]?E?(E.p(_,k),k&2&&J(E,1)):(E=si(_),E.c(),J(E,1),E.m(i.parentNode,i)):E&&(Me(),W(E,1,1,()=>{E=null}),Re());const C={};k&16&&(C.transform=_[4]),u.$set(C),_[5]?b?(b.p(_,k),k&32&&J(b,1)):(b=oi(_),b.c(),J(b,1),b.m(l,null)):b&&(Me(),W(b,1,1,()=>{b=null}),Re());const y={};k&4&&(y.isLoading=_[2]),p.$set(y)},i(_){x||(J(E),J(o.$$.fragment,_),J(u.$$.fragment,_),J(b),J(p.$$.fragment,_),x=!0)},o(_){W(E),W(o.$$.fragment,_),W(u.$$.fragment,_),W(b),W(p.$$.fragment,_),x=!1},d(_){_&&w(t),_&&w(r),E&&E.d(_),_&&w(i),_&&w(s),ye(o),ye(u),b&&b.d(),_&&w(h),_&&w(d),ye(p)}}}function th(e){return`${e.x}_${e.y}`}function nh(e,t,n){let r,i,s,o,a,l,u;Ce(e,Se,C=>n(3,i=C)),Ce(e,Wn,C=>n(13,o=C)),Ce(e,Zn,C=>n(4,l=C));const c=xn();Ce(e,c,C=>n(0,a=C));const h=Lu();Ce(e,h,C=>n(5,u=C));const d={cursor:null,frame:{x:mt.width/2-de/2,y:mt.height/2-de/2},status:fe.dragging,currentPrompt:""};c.update(d);const p=rs("promptImgStorage");Ce(e,p,C=>n(12,s=C));let x=!1;function E(){!r&&!x&&(n(1,x=!0),c.update({status:fe.prompting}))}function b(){n(1,x=!1)}function _(){k(),n(1,x=!1)}async function k(){if(r)return;Ae(Se,i="Pending",i);const C=a.currentPrompt,y=a.frame;console.log("Generating...",C,y),c.update({status:fe.loading});const $=crypto.randomUUID(),S=o.toDataURL("image/png"),N={fn_index:0,session_hash:$},F={data:[S,C,.75,7.5,35,"patchmatch"]},T=new WebSocket(Iu);T.onclose=V=>{V.wasClean||(Ae(Se,i="Error",i),c.update({status:fe.ready}))},T.onmessage=async function(V){try{const j=JSON.parse(V.data);switch(Ae(Se,i="",i),j.msg){case"send_hash":T.send(JSON.stringify(N));break;case"send_data":Ae(Se,i="Sending Data",i),T.send(JSON.stringify({...N,...F}));break;case"queue_full":Ae(Se,i="Queue full",i),T.close(),c.update({status:fe.ready});return;case"estimation":const{rank:ne,queue_size:Y}=j;Ae(Se,i=`On queue ${ne}/${Y}`,i);break;case"process_generating":Ae(Se,i=j.success?"Generating":"Error",i);break;case"process_completed":try{const v=j.output.data[0];if(j.output.data[1])throw new Error("NFSW");const A=th(y),P=await Au(v),M=await Cu(P,C,A),D={prompt:C,imgURL:M.filename,position:y,date:new Date().getTime(),id:Qf()};s.set(A,D),console.log(M),Ae(Se,i=j.success?"Complete":"Error",i),setTimeout(()=>{Ae(Se,i="",i)},2e3),c.update({status:fe.ready,currentPrompt:""})}catch(v){const I=v;Ae(Se,i=I==null?void 0:I.message,i),c.update({status:fe.ready})}T.close();return;case"process_starts":Ae(Se,i="Processing",i);break}}catch(j){console.error(j),Ae(Se,i="Error",i)}}}return e.$$.update=()=>{e.$$.dirty&1&&n(2,r=(a==null?void 0:a.status)===fe.loading||!1)},[a,x,r,i,l,u,c,h,p,E,b,_]}class ph extends Ee{constructor(t){super(),xe(this,t,nh,eh,ke,{})}}function rh(e){let t,n,r,i,s,o,a,l,u,c,h,d,p,x,E,b,_,k,C,y,$,S,N,F,T,V,j;return{c(){t=q("svg"),n=q("rect"),r=q("path"),i=q("path"),s=q("path"),o=q("path"),a=q("path"),l=q("path"),u=q("path"),c=q("path"),h=q("path"),d=q("path"),p=q("path"),x=q("path"),E=q("path"),b=q("path"),_=q("path"),k=q("path"),C=q("path"),y=q("path"),$=q("path"),S=q("path"),N=q("path"),F=q("defs"),T=q("radialGradient"),V=q("stop"),j=q("stop"),this.h()},l(ne){t=G(ne,"svg",{class:!0,width:!0,height:!0,viewBox:!0,fill:!0,xmlns:!0});var Y=O(t);n=G(Y,"rect",{opacity:!0,x:!0,y:!0,width:!0,height:!0,rx:!0,fill:!0,stroke:!0,"stroke-width":!0}),O(n).forEach(w),r=G(Y,"path",{d:!0,fill:!0}),O(r).forEach(w),i=G(Y,"path",{d:!0,fill:!0}),O(i).forEach(w),s=G(Y,"path",{d:!0,fill:!0}),O(s).forEach(w),o=G(Y,"path",{d:!0,fill:!0}),O(o).forEach(w),a=G(Y,"path",{d:!0,fill:!0}),O(a).forEach(w),l=G(Y,"path",{d:!0,fill:!0}),O(l).forEach(w),u=G(Y,"path",{d:!0,fill:!0}),O(u).forEach(w),c=G(Y,"path",{d:!0,fill:!0}),O(c).forEach(w),h=G(Y,"path",{d:!0,fill:!0}),O(h).forEach(w),d=G(Y,"path",{d:!0,fill:!0}),O(d).forEach(w),p=G(Y,"path",{d:!0,fill:!0}),O(p).forEach(w),x=G(Y,"path",{d:!0,fill:!0}),O(x).forEach(w),E=G(Y,"path",{d:!0,fill:!0}),O(E).forEach(w),b=G(Y,"path",{d:!0,fill:!0}),O(b).forEach(w),_=G(Y,"path",{d:!0,fill:!0}),O(_).forEach(w),k=G(Y,"path",{d:!0,fill:!0}),O(k).forEach(w),C=G(Y,"path",{d:!0,fill:!0}),O(C).forEach(w),y=G(Y,"path",{d:!0,fill:!0}),O(y).forEach(w),$=G(Y,"path",{d:!0,fill:!0}),O($).forEach(w),S=G(Y,"path",{d:!0,fill:!0}),O(S).forEach(w),N=G(Y,"path",{"fill-rule":!0,"clip-rule":!0,d:!0,fill:!0}),O(N).forEach(w),F=G(Y,"defs",{});var v=O(F);T=G(v,"radialGradient",{id:!0,cx:!0,cy:!0,r:!0,gradientUnits:!0,gradientTransform:!0});var I=O(T);V=G(I,"stop",{"stop-color":!0}),O(V).forEach(w),j=G(I,"stop",{offset:!0,"stop-color":!0}),O(j).forEach(w),I.forEach(w),v.forEach(w),Y.forEach(w),this.h()},h(){f(n,"opacity","0.5"),f(n,"x","0.25"),f(n,"y","0.25"),f(n,"width","122.5"),f(n,"height","43.5"),f(n,"rx","6.75"),f(n,"fill","#1F2937"),f(n,"stroke","#3A4C64"),f(n,"stroke-width","0.5"),f(r,"d","M44.9102 16.8569H45.8514V14.778H47.1691C48.364 14.778 49.1497 14.0577 49.1497 12.9528C49.1497 11.8397 48.364 11.1277 47.1691 11.1277H44.9102V16.8569ZM47.0954 11.9461C47.7666 11.9461 48.1921 12.3308 48.1921 12.9528C48.1921 13.5667 47.7584 13.9595 47.0872 13.9595H45.8514V11.9461H47.0954Z"),f(r,"fill","#A3BAD9"),f(i,"d","M51.5649 16.9059C52.8417 16.9059 53.701 16.0465 53.701 14.7615C53.701 13.4847 52.8417 12.6172 51.5649 12.6172C50.2881 12.6172 49.4287 13.4847 49.4287 14.7615C49.4287 16.0465 50.2881 16.9059 51.5649 16.9059ZM51.5649 16.1529C50.8201 16.1529 50.3372 15.5718 50.3372 14.7615C50.3372 13.9513 50.8201 13.3702 51.5649 13.3702C52.3097 13.3702 52.8007 13.9513 52.8007 14.7615C52.8007 15.5718 52.3097 16.1529 51.5649 16.1529Z"),f(i,"fill","#A3BAD9"),f(s,"d","M55.233 16.857H56.1906L57.1073 14.0088L57.9912 16.857H58.9406L60.332 12.6665H59.4317L58.4414 15.8748L57.5247 12.6665H56.7144L55.7568 15.8748L54.7992 12.6665H53.8662L55.233 16.857Z"),f(s,"fill","#A3BAD9"),f(o,"d","M62.6424 16.9059C63.6818 16.9059 64.3857 16.2757 64.533 15.449H63.6491C63.5263 15.9156 63.1335 16.1856 62.5933 16.1856C61.8976 16.1856 61.4475 15.7191 61.4229 15.0071V14.9498H64.5821C64.5985 14.8352 64.6067 14.7206 64.6067 14.6142C64.5821 13.3865 63.7719 12.6172 62.5605 12.6172C61.3247 12.6172 60.498 13.4766 60.498 14.7697C60.498 16.0547 61.3247 16.9059 62.6424 16.9059ZM61.4556 14.3032C61.5211 13.7057 62.004 13.3292 62.5687 13.3292C63.1826 13.3292 63.6164 13.6812 63.69 14.3032H61.4556Z"),f(o,"fill","#A3BAD9"),f(a,"d","M67.4411 12.6665C66.7536 12.6665 66.418 12.9448 66.2052 13.2967L66.107 12.6665H65.3213V16.857H66.2052V14.7536C66.2052 14.107 66.4589 13.4931 67.2447 13.4931H67.6375V12.6665H67.4411Z"),f(a,"fill","#A3BAD9"),f(l,"d","M69.9725 16.9059C71.0119 16.9059 71.7158 16.2757 71.8631 15.449H70.9792C70.8564 15.9156 70.4635 16.1856 69.9234 16.1856C69.2277 16.1856 68.7775 15.7191 68.753 15.0071V14.9498H71.9122C71.9286 14.8352 71.9368 14.7206 71.9368 14.6142C71.9122 13.3865 71.1019 12.6172 69.8906 12.6172C68.6548 12.6172 67.8281 13.4766 67.8281 14.7697C67.8281 16.0547 68.6548 16.9059 69.9725 16.9059ZM68.7857 14.3032C68.8512 13.7057 69.3341 13.3292 69.8988 13.3292C70.5127 13.3292 70.9464 13.6812 71.0201 14.3032H68.7857Z"),f(l,"fill","#A3BAD9"),f(u,"d","M75.8352 13.2475C75.5651 12.8792 75.1149 12.6173 74.4765 12.6173C73.3391 12.6173 72.4961 13.4685 72.4961 14.7616C72.4961 16.1039 73.3391 16.906 74.4765 16.906C75.1395 16.906 75.5733 16.5949 75.8433 16.2266L75.9497 16.8569H76.7191V11.1277H75.8352V13.2475ZM74.6238 16.1612C73.8875 16.1612 73.4046 15.5883 73.4046 14.7616C73.4046 13.9432 73.8875 13.3702 74.6238 13.3702C75.3605 13.3702 75.8433 13.9432 75.8433 14.778C75.8433 15.5883 75.3605 16.1612 74.6238 16.1612Z"),f(u,"fill","#A3BAD9"),f(c,"d","M81.9193 12.6173C81.2727 12.6173 80.839 12.9119 80.5607 13.2884V11.1277H79.6768V16.8569H80.4461L80.5525 16.2512C80.8144 16.6277 81.2646 16.906 81.9193 16.906C83.0652 16.906 83.9 16.0466 83.9 14.7616C83.9 13.4112 83.0652 12.6173 81.9193 12.6173ZM81.772 16.1612C81.0354 16.1612 80.5525 15.5801 80.5525 14.7534C80.5525 13.9432 81.0354 13.3702 81.772 13.3702C82.5086 13.3702 82.9997 13.9432 82.9997 14.7616C82.9997 15.5883 82.5086 16.1612 81.772 16.1612Z"),f(c,"fill","#A3BAD9"),f(h,"d","M85.6277 16.8815L85.4641 17.2908C85.3331 17.6345 85.2513 17.7164 84.9075 17.7164H84.2855V18.4939H85.2349C85.8487 18.4939 86.0288 18.1911 86.2907 17.5117L88.1895 12.6665H87.2483L86.1106 15.8503L84.9402 12.6665H83.999L85.6277 16.8815Z"),f(h,"fill","#A3BAD9"),f(d,"d","M45.1162 32.4821H47.2144V22.0654H45.1162V32.4821Z"),f(d,"fill","#A3BAD9"),f(p,"d","M49.7329 24.0148C50.4175 24.0148 50.9532 23.5088 50.9532 22.8392C50.9532 22.1546 50.4175 21.6487 49.7329 21.6487C49.0484 21.6487 48.5127 22.1546 48.5127 22.8392C48.5127 23.5088 49.0484 24.0148 49.7329 24.0148ZM48.6764 32.482H50.7895V24.8332H48.6764V32.482Z"),f(p,"fill","#A3BAD9"),f(x,"d","M54.2461 32.4823H56.8503L59.6033 24.8335H57.4009L55.5854 30.3394L53.7402 24.8335H51.4932L54.2461 32.4823Z"),f(x,"fill","#A3BAD9"),f(E,"d","M63.718 32.5713C65.7567 32.5713 67.0811 31.3808 67.3192 29.8927H65.2507C65.0722 30.607 64.4769 30.979 63.6287 30.979C62.5722 30.979 61.8728 30.3243 61.8281 29.2379V29.1338H67.3787C67.4234 28.8957 67.4382 28.6427 67.4382 28.4195C67.4085 26.1725 65.8609 24.7439 63.5692 24.7439C61.2031 24.7439 59.6406 26.2915 59.6406 28.6725C59.6406 31.0385 61.1734 32.5713 63.718 32.5713ZM61.8728 27.7647C61.9918 26.857 62.6763 26.3064 63.5841 26.3064C64.5365 26.3064 65.1763 26.8272 65.3251 27.7647H61.8728Z"),f(E,"fill","#A3BAD9"),f(b,"d","M72.9898 24.744C71.9332 24.744 71.1891 25.1904 70.6832 25.8005V22.0654H68.585V32.4821H70.4153L70.6237 31.4404C71.1148 32.0952 71.8737 32.5714 72.9749 32.5714C75.0434 32.5714 76.5315 31.0089 76.5315 28.6428C76.5315 26.2172 75.0434 24.744 72.9898 24.744ZM72.5136 30.8601C71.3678 30.8601 70.6534 29.9523 70.6534 28.6428C70.6534 27.3482 71.3678 26.4553 72.5136 26.4553C73.6594 26.4553 74.4035 27.3482 74.4035 28.6577C74.4035 29.9672 73.6594 30.8601 72.5136 30.8601Z"),f(b,"fill","#A3BAD9"),f(_,"d","M77.6973 32.4821H79.7955V22.0654H77.6973V32.4821Z"),f(_,"fill","#A3BAD9"),f(k,"d","M84.9927 32.5713C87.4332 32.5713 89.0254 31.0237 89.0254 28.6576C89.0254 26.3064 87.4332 24.7439 84.9927 24.7439C82.5522 24.7439 80.96 26.3064 80.96 28.6576C80.96 31.0088 82.5522 32.5713 84.9927 32.5713ZM84.9927 30.86C83.8171 30.86 83.1028 29.9522 83.1028 28.6576C83.1028 27.3629 83.8171 26.4552 84.9927 26.4552C86.1683 26.4552 86.8975 27.3629 86.8975 28.6576C86.8975 29.9522 86.1683 30.86 84.9927 30.86Z"),f(k,"fill","#A3BAD9"),f(C,"d","M93.7816 32.5713C95.865 32.5713 97.2489 31.4254 97.5465 29.5951H95.3441C95.1953 30.3689 94.6447 30.86 93.8263 30.86C92.7251 30.86 92.0257 29.9671 92.0257 28.6576C92.0257 27.3629 92.7251 26.4552 93.8263 26.4552C94.6447 26.4552 95.1655 26.9314 95.3441 27.6903H97.5316C97.234 25.8748 95.9394 24.7439 93.856 24.7439C91.4304 24.7439 89.8828 26.2915 89.8828 28.6576C89.8828 31.0683 91.356 32.5713 93.7816 32.5713Z"),f(C,"fill","#A3BAD9"),f(y,"d","M98.6514 32.4821H100.75V30.622L101.895 29.3869L103.83 32.4821H106.256L103.354 27.8392L106.107 24.8333H103.741L100.75 28.0773V22.0654H98.6514V32.4821Z"),f(y,"fill","#A3BAD9"),f($,"d","M106.188 29.9375C106.277 31.5744 107.72 32.5714 109.848 32.5714C111.902 32.5714 113.33 31.6042 113.33 30.0863C113.33 28.3601 111.872 27.9583 110.116 27.7798C109.015 27.6458 108.36 27.5863 108.36 27.006C108.36 26.5149 108.896 26.2173 109.714 26.2173C110.562 26.2173 111.143 26.5893 111.202 27.1994H113.211C113.107 25.6369 111.693 24.7292 109.64 24.7292C107.676 24.7143 106.351 25.7113 106.351 27.2292C106.351 28.8065 107.735 29.2083 109.521 29.4167C110.756 29.5804 111.277 29.625 111.277 30.25C111.277 30.7857 110.741 31.0685 109.863 31.0685C108.836 31.0685 108.256 30.6071 108.182 29.9375H106.188Z"),f($,"fill","#A3BAD9"),f(S,"d","M32.4824 8.67236H11.649C10.0053 8.67236 8.67285 10.0048 8.67285 11.6486V32.4819C8.67285 34.1256 10.0053 35.4581 11.649 35.4581H32.4824C34.1261 35.4581 35.4586 34.1256 35.4586 32.4819V11.6486C35.4586 10.0048 34.1261 8.67236 32.4824 8.67236Z"),f(S,"fill","url(#paint0_radial_253_107)"),f(N,"fill-rule","evenodd"),f(N,"clip-rule","evenodd"),f(N,"d","M24.8953 17.78H15.0332L17.8712 20.7599V24.875L24.8953 17.78ZM19.2193 26.294H29.0814L26.2434 23.3141V19.199L19.2193 26.294Z"),f(N,"fill","white"),f(V,"stop-color","#FF0099"),f(j,"offset","1"),f(j,"stop-color","#FF7A00"),f(T,"id","paint0_radial_253_107"),f(T,"cx","0"),f(T,"cy","0"),f(T,"r","1"),f(T,"gradientUnits","userSpaceOnUse"),f(T,"gradientTransform","translate(4.7524 1.97593) rotate(45.3703) scale(40.7748 35.4976)"),f(t,"class",e[0]),f(t,"width","123"),f(t,"height","44"),f(t,"viewBox","0 0 123 44"),f(t,"fill","none"),f(t,"xmlns","http://www.w3.org/2000/svg")},m(ne,Y){re(ne,t,Y),g(t,n),g(t,r),g(t,i),g(t,s),g(t,o),g(t,a),g(t,l),g(t,u),g(t,c),g(t,h),g(t,d),g(t,p),g(t,x),g(t,E),g(t,b),g(t,_),g(t,k),g(t,C),g(t,y),g(t,$),g(t,S),g(t,N),g(t,F),g(F,T),g(T,V),g(T,j)},p(ne,[Y]){Y&1&&f(t,"class",ne[0])},i:pe,o:pe,d(ne){ne&&w(t)}}}function ih(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class sh extends Ee{constructor(t){super(),xe(this,t,ih,rh,ke,{classList:0})}}function oh(e){let t,n,r,i,s,o,a,l,u,c,h,d,p,x,E,b,_,k,C,y,$,S,N,F,T,V,j,ne,Y,v,I,A,P,M;return v=new sh({props:{classList:"ml-2"}}),{c(){t=U("div"),n=U("div"),r=U("h2"),i=ee("Stable Difussion Multiplayer"),s=ie(),o=U("p"),a=ee("Hugging Face face GPU Spaces "),l=U("a"),u=ee("https://huggingface.co/docs/hub/spaces-gpus"),c=ee(` + Diffusers + `),h=U("a"),d=ee("https://huggingface.co/docs/diffusers/index"),p=ie(),x=U("p"),E=ee("Thanks to "),b=U("a"),_=ee("Lnyan"),k=ee(` + for the original outpaiting technique implemented on + `),C=U("a"),y=ee(`Stable Diffusion Infinity + `),$=ee("."),S=ie(),N=U("p"),F=ee(`Runwayml Inpaiting Stable Diffusion + `),T=U("a"),V=ee("https://github.com/runwayml/stable-diffusion"),j=ie(),ne=U("p"),Y=ee(`Multiplayer API by + `),_e(v.$$.fragment),this.h()},l(D){t=H(D,"DIV",{class:!0});var z=O(t);n=H(z,"DIV",{class:!0});var Z=O(n);r=H(Z,"H2",{class:!0});var ae=O(r);i=te(ae,"Stable Difussion Multiplayer"),ae.forEach(w),s=se(Z),o=H(Z,"P",{});var ce=O(o);a=te(ce,"Hugging Face face GPU Spaces "),l=H(ce,"A",{href:!0,class:!0});var oe=O(l);u=te(oe,"https://huggingface.co/docs/hub/spaces-gpus"),oe.forEach(w),c=te(ce,` + Diffusers + `),h=H(ce,"A",{href:!0,class:!0});var we=O(h);d=te(we,"https://huggingface.co/docs/diffusers/index"),we.forEach(w),ce.forEach(w),p=se(Z),x=H(Z,"P",{});var me=O(x);E=te(me,"Thanks to "),b=H(me,"A",{href:!0,target:!0,rel:!0,class:!0});var be=O(b);_=te(be,"Lnyan"),be.forEach(w),k=te(me,` + for the original outpaiting technique implemented on + `),C=H(me,"A",{href:!0,target:!0,rel:!0,class:!0});var Oe=O(C);y=te(Oe,`Stable Diffusion Infinity + `),Oe.forEach(w),$=te(me,"."),me.forEach(w),S=se(Z),N=H(Z,"P",{class:!0});var Ze=O(N);F=te(Ze,`Runwayml Inpaiting Stable Diffusion + `),T=H(Ze,"A",{href:!0,target:!0,rel:!0});var Ot=O(T);V=te(Ot,"https://github.com/runwayml/stable-diffusion"),Ot.forEach(w),Ze.forEach(w),j=se(Z),ne=H(Z,"P",{class:!0});var At=O(ne);Y=te(At,`Multiplayer API by + `),ge(v.$$.fragment,At),At.forEach(w),Z.forEach(w),z.forEach(w),this.h()},h(){f(r,"class","font-bold text-xl font-mono mb-8"),f(l,"href","https://huggingface.co/docs/hub/spaces-gpus"),f(l,"class","text-blue-400 hover:text-blue-600 underline"),f(h,"href","https://huggingface.co/docs/diffusers/index"),f(h,"class","text-blue-400 hover:text-blue-600 underline"),f(b,"href","https://twitter.com/lkwq007"),f(b,"target","_blank"),f(b,"rel","noopener noreferrer"),f(b,"class","text-blue-400 hover:text-blue-600 underline"),f(C,"href","https://github.com/lkwq007/stablediffusion-infinity"),f(C,"target","_blank"),f(C,"rel","noopener noreferrer"),f(C,"class","text-blue-400 hover:text-blue-600 underline"),f(T,"href","https://github.com/runwayml/stable-diffusion"),f(T,"target","_blank"),f(T,"rel","noopener noreferrer"),f(N,"class","mb-6"),f(ne,"class","text-base flex items-center"),f(n,"class","max-w-md"),f(t,"class",I="fixed "+e[0]+" w-screen top-0 left-0 bottom-0 right-0 max-h-screen z-50 items-center justify-center bg-black text-white bg-opacity-90 px-3 overflow-y-scroll")},m(D,z){re(D,t,z),g(t,n),g(n,r),g(r,i),g(n,s),g(n,o),g(o,a),g(o,l),g(l,u),g(o,c),g(o,h),g(h,d),g(n,p),g(n,x),g(x,E),g(x,b),g(b,_),g(x,k),g(x,C),g(C,y),g(x,$),g(n,S),g(n,N),g(N,F),g(N,T),g(T,V),g(n,j),g(n,ne),g(ne,Y),ve(v,ne,null),A=!0,P||(M=Ne(t,"click",e[1]),P=!0)},p(D,[z]){(!A||z&1&&I!==(I="fixed "+D[0]+" w-screen top-0 left-0 bottom-0 right-0 max-h-screen z-50 items-center justify-center bg-black text-white bg-opacity-90 px-3 overflow-y-scroll"))&&f(t,"class",I)},i(D){A||(J(v.$$.fragment,D),A=!0)},o(D){W(v.$$.fragment,D),A=!1},d(D){D&&w(t),ye(v),P=!1,M()}}}function ah(e,t,n){let{classList:r=""}=t;function i(s){nr.call(this,e,s)}return e.$$set=s=>{"classList"in s&&n(0,r=s.classList)},[r,i]}class mh extends Ee{constructor(t){super(),xe(this,t,ah,oh,ke,{classList:0})}}export{mh as A,hh as L,ln as M,ns as P,dh as R,ph as a,fh as c,Xr as s,Yr as t};