For now? I'm experimenting on an old concept.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Gitignore is NOT ignoring them bitches


Signed-off-by: MLC Bloeiman <mar@strawmelonjuice.com>

-10132
-21
server/priv/static/lumina_client.min.mjs
··· 1 - class I{withFields(Z){let Q=Object.keys(this).map((X)=>(X in Z)?Z[X]:this[X]);return new this.constructor(...Q)}}class C0{static fromArray(Z,Q){let X=Q||new A;for(let W=Z.length-1;W>=0;--W)X=new v0(Z[W],X);return X}[Symbol.iterator](){return new B9(this)}toArray(){return[...this]}atLeastLength(Z){let Q=this;while(Z-- >0&&Q)Q=Q.tail;return Q!==void 0}hasLength(Z){let Q=this;while(Z-- >0&&Q)Q=Q.tail;return Z===-1&&Q instanceof A}countLength(){let Z=this,Q=0;while(Z)Z=Z.tail,Q++;return Q-1}}function P(Z,Q){return new v0(Z,Q)}function K(Z,Q){return C0.fromArray(Z,Q)}class B9{#Z;constructor(Z){this.#Z=Z}next(){if(this.#Z instanceof A)return{done:!0};else{let{head:Z,tail:Q}=this.#Z;return this.#Z=Q,{value:Z,done:!1}}}}class A extends C0{}class v0 extends C0{constructor(Z,Q){super();this.head=Z,this.tail=Q}}class CZ{bitSize;byteSize;bitOffset;rawBuffer;constructor(Z,Q,X){if(!(Z instanceof Uint8Array))throw globalThis.Error("BitArray can only be constructed from a Uint8Array");if(this.bitSize=Q??Z.length*8,this.byteSize=Math.trunc((this.bitSize+7)/8),this.bitOffset=X??0,this.bitSize<0)throw globalThis.Error(`BitArray bit size is invalid: ${this.bitSize}`);if(this.bitOffset<0||this.bitOffset>7)throw globalThis.Error(`BitArray bit offset is invalid: ${this.bitOffset}`);if(Z.length!==Math.trunc((this.bitOffset+this.bitSize+7)/8))throw globalThis.Error("BitArray buffer length is invalid");this.rawBuffer=Z}byteAt(Z){if(Z<0||Z>=this.byteSize)return;return L8(this.rawBuffer,this.bitOffset,Z)}equals(Z){if(this.bitSize!==Z.bitSize)return!1;let Q=Math.trunc(this.bitSize/8);if(this.bitOffset===0&&Z.bitOffset===0){for(let W=0;W<Q;W++)if(this.rawBuffer[W]!==Z.rawBuffer[W])return!1;let X=this.bitSize%8;if(X){let W=8-X;if(this.rawBuffer[Q]>>W!==Z.rawBuffer[Q]>>W)return!1}}else{for(let W=0;W<Q;W++){let V=L8(this.rawBuffer,this.bitOffset,W),G=L8(Z.rawBuffer,Z.bitOffset,W);if(V!==G)return!1}let X=this.bitSize%8;if(X){let W=L8(this.rawBuffer,this.bitOffset,Q),V=L8(Z.rawBuffer,Z.bitOffset,Q),G=8-X;if(W>>G!==V>>G)return!1}}return!0}get buffer(){if(this.bitOffset!==0||this.bitSize%8!==0)throw new globalThis.Error("BitArray.buffer does not support unaligned bit arrays");return this.rawBuffer}get length(){if(this.bitOffset!==0||this.bitSize%8!==0)throw new globalThis.Error("BitArray.length does not support unaligned bit arrays");return this.rawBuffer.length}}function L8(Z,Q,X){if(Q===0)return Z[X]??0;else{let W=Z[X]<<Q&255,V=Z[X+1]>>8-Q;return W|V}}class PQ{constructor(Z){this.value=Z}}class mQ extends I{static isResult(Z){return Z instanceof mQ}}class B extends mQ{constructor(Z){super();this[0]=Z}isOk(){return!0}}class k extends mQ{constructor(Z){super();this[0]=Z}isOk(){return!1}}function I0(Z,Q){let X=[Z,Q];while(X.length){let W=X.pop(),V=X.pop();if(W===V)continue;if(!j9(W)||!j9(V))return!1;if(!vG(W,V)||kG(W,V)||fG(W,V)||yG(W,V)||bG(W,V)||hG(W,V)||gG(W,V))return!1;let J=Object.getPrototypeOf(W);if(J!==null&&typeof J.equals==="function")try{if(W.equals(V))continue;else return!1}catch{}let[Y,H]=xG(W),q=Y(W),U=Y(V);if(q.length!==U.length)return!1;for(let z of q)X.push(H(W,z),H(V,z))}return!0}function xG(Z){if(Z instanceof Map)return[(Q)=>Q.keys(),(Q,X)=>Q.get(X)];else{let Q=Z instanceof globalThis.Error?["message"]:[];return[(X)=>[...Q,...Object.keys(X)],(X,W)=>X[W]]}}function kG(Z,Q){return Z instanceof Date&&(Z>Q||Z<Q)}function fG(Z,Q){return!(Z instanceof CZ)&&Z.buffer instanceof ArrayBuffer&&Z.BYTES_PER_ELEMENT&&!(Z.byteLength===Q.byteLength&&Z.every((X,W)=>X===Q[W]))}function yG(Z,Q){return Array.isArray(Z)&&Z.length!==Q.length}function bG(Z,Q){return Z instanceof Map&&Z.size!==Q.size}function hG(Z,Q){return Z instanceof Set&&(Z.size!=Q.size||[...Z].some((X)=>!Q.has(X)))}function gG(Z,Q){return Z instanceof RegExp&&(Z.source!==Q.source||Z.flags!==Q.flags)}function j9(Z){return typeof Z==="object"&&Z!==null}function vG(Z,Q){if(typeof Z!=="object"&&typeof Q!=="object"&&(!Z||!Q))return!1;if([Promise,WeakSet,WeakMap,Function].some((W)=>Z instanceof W))return!1;return Z.constructor===Q.constructor}function uQ(Z,Q){if(Q===0)return 0;else return Z%Q}function cQ(Z,Q){return Math.trunc(pQ(Z,Q))}function pQ(Z,Q){if(Q===0)return 0;else return Z/Q}function c(Z,Q,X,W,V,G,J){let Y=new globalThis.Error(G);Y.gleam_error=Z,Y.file=Q,Y.module=X,Y.line=W,Y.function=V,Y.fn=V;for(let H in J)Y[H]=J[H];return Y}class P0 extends I{}class N0 extends I{}class jZ extends I{}class T extends I{constructor(Z){super();this[0]=Z}}class b extends I{}function VQ(Z){return!(Z instanceof b)}function nW(Z,Q){if(Z instanceof T){let X=Z[0];return new B(X)}else return new k(Q)}function wZ(Z,Q){if(Z instanceof T)return Z[0];else return Q}function AX(Z,Q){if(Z instanceof T){let X=Z[0];return new T(Q(X))}else return Z}function TX(Z,Q){if(Z instanceof T)return Z;else return Q}function qZ(Z,Q,X){return A9(Q,X,Z)}function R9(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W;else{let V=X.head;Z=X.tail,Q=P(V,W)}}}function _G(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return R9(W,K([]));else{let V=X.tail,G=X.head[0];Z=V,Q=P(G,W)}}}function rW(Z){return _G(GQ(Z),K([]))}function $G(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return R9(W,K([]));else{let V=X.tail,G=X.head[1];Z=V,Q=P(G,W)}}}function sW(Z){let Q=GQ(Z);return $G(Q,K([]))}function mG(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(W instanceof A)return V;else{let J=W.tail,Y=W.head[0],H=W.head[1];Z=J,Q=G(V,Y,H),X=G}}}function KQ(Z,Q,X){return mG(GQ(Z),Q,X)}function T9(Z,Q){return[Z,Q]}class _0 extends I{}class dQ extends I{}function cG(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W;else Z=X.tail,Q=W+1}}function rQ(Z){return cG(Z,0)}function nQ(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W;else{let V=X.head;Z=X.tail,Q=P(V,W)}}}function W0(Z){return nQ(Z,K([]))}function pG(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(W instanceof A)return W0(G);else{let{head:J,tail:Y}=W,H,q=V(J);if(q instanceof B){let z=q[0];H=P(z,G)}else H=G;let U=H;Z=Y,Q=V,X=U}}}function C9(Z,Q){return pG(Z,Q,K([]))}function dG(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(W instanceof A)return W0(G);else{let J=W.head;Z=W.tail,Q=V,X=P(V(J),G)}}}function w0(Z,Q){return dG(Z,Q,K([]))}function nG(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(V<=0)return W0(G);else if(W instanceof A)return W0(G);else{let Y=W.head;Z=W.tail,Q=V-1,X=P(Y,G)}}}function L9(Z,Q){return nG(Z,Q,K([]))}function rG(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W;else{let V=X.head;Z=X.tail,Q=P(V,W)}}}function S0(Z,Q){return rG(W0(Z),Q)}function OX(Z,Q){return P(Q,Z)}function sG(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W0(W);else{let V=X.head;Z=X.tail,Q=nQ(V,W)}}}function lW(Z){return sG(Z,K([]))}function k0(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(W instanceof A)return V;else{let J=W.head;Z=W.tail,Q=G(V,J),X=G}}}function w9(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return!0;else{let{head:V,tail:G}=X,J=W(V);if(J)Z=G,Q=W;else return J}}}function lG(Z,Q,X,W,V,G){while(!0){let J=Z,Y=Q,H=X,q=W,U=V,z=G,N=P(U,H);if(J instanceof A)if(q instanceof _0)return P(W0(N),z);else return P(N,z);else{let{head:R,tail:D}=J,w=Y(U,R);if(q instanceof _0)if(w instanceof P0)Z=D,Q=Y,X=N,W=q,V=R,G=z;else if(w instanceof N0)Z=D,Q=Y,X=N,W=q,V=R,G=z;else{let S;if(q instanceof _0)S=P(W0(N),z);else S=P(N,z);let x=S;if(D instanceof A)return P(K([R]),x);else{let{head:O,tail:E}=D,h,j=Y(R,O);if(j instanceof P0)h=new _0;else if(j instanceof N0)h=new _0;else h=new dQ;let f=h;Z=E,Q=Y,X=K([R]),W=f,V=O,G=x}}else if(w instanceof P0){let S;if(q instanceof _0)S=P(W0(N),z);else S=P(N,z);let x=S;if(D instanceof A)return P(K([R]),x);else{let{head:O,tail:E}=D,h,j=Y(R,O);if(j instanceof P0)h=new _0;else if(j instanceof N0)h=new _0;else h=new dQ;let f=h;Z=E,Q=Y,X=K([R]),W=f,V=O,G=x}}else if(w instanceof N0){let S;if(q instanceof _0)S=P(W0(N),z);else S=P(N,z);let x=S;if(D instanceof A)return P(K([R]),x);else{let{head:O,tail:E}=D,h,j=Y(R,O);if(j instanceof P0)h=new _0;else if(j instanceof N0)h=new _0;else h=new dQ;let f=h;Z=E,Q=Y,X=K([R]),W=f,V=O,G=x}}else Z=D,Q=Y,X=N,W=q,V=R,G=z}}}function iG(Z,Q,X,W){while(!0){let V=Z,G=Q,J=X,Y=W;if(V instanceof A)return nQ(G,Y);else if(G instanceof A)return nQ(V,Y);else{let{head:H,tail:q}=V,U=G.head,z=G.tail,N=J(H,U);if(N instanceof P0)Z=q,Q=G,X=J,W=P(H,Y);else if(N instanceof N0)Z=V,Q=z,X=J,W=P(U,Y);else Z=V,Q=z,X=J,W=P(U,Y)}}}function aG(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(W instanceof A)return W0(G);else{let J=W.tail;if(J instanceof A){let Y=W.head;return W0(P(W0(Y),G))}else{let Y=W.head,H=J.head,q=J.tail,U=iG(Y,H,V,K([]));Z=q,Q=V,X=P(U,G)}}}}function oG(Z,Q,X,W){while(!0){let V=Z,G=Q,J=X,Y=W;if(V instanceof A)return nQ(G,Y);else if(G instanceof A)return nQ(V,Y);else{let{head:H,tail:q}=V,U=G.head,z=G.tail,N=J(H,U);if(N instanceof P0)Z=V,Q=z,X=J,W=P(U,Y);else if(N instanceof N0)Z=q,Q=G,X=J,W=P(H,Y);else Z=q,Q=G,X=J,W=P(H,Y)}}}function tG(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(W instanceof A)return W0(G);else{let J=W.tail;if(J instanceof A){let Y=W.head;return W0(P(W0(Y),G))}else{let Y=W.head,H=J.head,q=J.tail,U=oG(Y,H,V,K([]));Z=q,Q=V,X=P(U,G)}}}}function eG(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(W instanceof A)return W;else if(V instanceof _0)if(W.tail instanceof A)return W.head;else Z=aG(W,G,K([])),Q=new dQ,X=G;else if(W.tail instanceof A){let Y=W.head;return W0(Y)}else Z=tG(W,G,K([])),Q=new _0,X=G}}function w8(Z,Q){if(Z instanceof A)return Z;else{let X=Z.tail;if(X instanceof A)return Z;else{let W=Z.head,V=X.head,G=X.tail,J,Y=Q(W,V);if(Y instanceof P0)J=new _0;else if(Y instanceof N0)J=new _0;else J=new dQ;let H=J,q=lG(G,Q,K([W]),H,V,K([]));return eG(q,new _0,Q)}}}function ZJ(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W;else{let V=X.head;Z=X.tail,Q=P(V[1],W)}}}function QJ(Z){return w8(Z,(Q,X)=>{return x9(Q[0],X[0])})}function E9(Z){let X=k0(Z,K([]),(V,G)=>{return P([x8(),G],V)}),W=QJ(X);return ZJ(W,K([]))}function NQ(Z){if(Z instanceof B)return!0;else return!1}function iW(Z,Q){if(Z instanceof B){let X=Z[0];return new B(Q(X))}else return Z}function aW(Z,Q){if(Z instanceof B)return Z;else{let X=Z[0];return new k(Q(X))}}function JQ(Z,Q){if(Z instanceof B){let X=Z[0];return Q(X)}else return Z}function oW(Z,Q){return JQ(Z,Q)}function DQ(Z,Q){if(Z instanceof B)return Z[0];else return Q}function f9(Z){return C9(Z,(Q)=>{return Q})}var y9=new WeakMap,Z6=new DataView(new ArrayBuffer(8)),Q6=0;function X6(Z){let Q=y9.get(Z);if(Q!==void 0)return Q;let X=Q6++;if(Q6===2147483647)Q6=0;return y9.set(Z,X),X}function W6(Z,Q){return Z^Q+2654435769+(Z<<6)+(Z>>2)|0}function K6(Z){let Q=0,X=Z.length;for(let W=0;W<X;W++)Q=Math.imul(31,Q)+Z.charCodeAt(W)|0;return Q}function h9(Z){Z6.setFloat64(0,Z);let Q=Z6.getInt32(0),X=Z6.getInt32(4);return Math.imul(73244475,Q>>16^Q)^X}function HJ(Z){return K6(Z.toString())}function qJ(Z){let Q=Object.getPrototypeOf(Z);if(Q!==null&&typeof Q.hashCode==="function")try{let W=Z.hashCode(Z);if(typeof W==="number")return W}catch{}if(Z instanceof Promise||Z instanceof WeakSet||Z instanceof WeakMap)return X6(Z);if(Z instanceof Date)return h9(Z.getTime());let X=0;if(Z instanceof ArrayBuffer)Z=new Uint8Array(Z);if(Array.isArray(Z)||Z instanceof Uint8Array)for(let W=0;W<Z.length;W++)X=Math.imul(31,X)+IZ(Z[W])|0;else if(Z instanceof Set)Z.forEach((W)=>{X=X+IZ(W)|0});else if(Z instanceof Map)Z.forEach((W,V)=>{X=X+W6(IZ(W),IZ(V))|0});else{let W=Object.keys(Z);for(let V=0;V<W.length;V++){let G=W[V],J=Z[G];X=X+W6(IZ(J),K6(G))|0}}return X}function IZ(Z){if(Z===null)return 1108378658;if(Z===void 0)return 1108378659;if(Z===!0)return 1108378657;if(Z===!1)return 1108378656;switch(typeof Z){case"number":return h9(Z);case"string":return K6(Z);case"bigint":return HJ(Z);case"object":return qJ(Z);case"symbol":return X6(Z);case"function":return X6(Z);default:return 0}}var xZ=5,G6=Math.pow(2,xZ),UJ=G6-1,MJ=G6/2,IJ=G6/4,e0=0,EZ=1,KZ=2,BQ=3,J6={type:KZ,bitmap:0,array:[]};function f8(Z,Q){return Z>>>Q&UJ}function EX(Z,Q){return 1<<f8(Z,Q)}function FJ(Z){return Z-=Z>>1&1431655765,Z=(Z&858993459)+(Z>>2&858993459),Z=Z+(Z>>4)&252645135,Z+=Z>>8,Z+=Z>>16,Z&127}function Y6(Z,Q){return FJ(Z&Q-1)}function FZ(Z,Q,X){let W=Z.length,V=Array(W);for(let G=0;G<W;++G)V[G]=Z[G];return V[Q]=X,V}function zJ(Z,Q,X){let W=Z.length,V=Array(W+1),G=0,J=0;while(G<Q)V[J++]=Z[G++];V[J++]=X;while(G<W)V[J++]=Z[G++];return V}function V6(Z,Q){let X=Z.length,W=Array(X-1),V=0,G=0;while(V<Q)W[G++]=Z[V++];++V;while(V<X)W[G++]=Z[V++];return W}function g9(Z,Q,X,W,V,G){let J=IZ(Q);if(J===W)return{type:BQ,hash:J,array:[{type:e0,k:Q,v:X},{type:e0,k:V,v:G}]};let Y={val:!1};return y8(H6(J6,Z,J,Q,X,Y),Z,W,V,G,Y)}function y8(Z,Q,X,W,V,G){switch(Z.type){case EZ:return PJ(Z,Q,X,W,V,G);case KZ:return H6(Z,Q,X,W,V,G);case BQ:return NJ(Z,Q,X,W,V,G)}}function PJ(Z,Q,X,W,V,G){let J=f8(X,Q),Y=Z.array[J];if(Y===void 0)return G.val=!0,{type:EZ,size:Z.size+1,array:FZ(Z.array,J,{type:e0,k:W,v:V})};if(Y.type===e0){if(I0(W,Y.k)){if(V===Y.v)return Z;return{type:EZ,size:Z.size,array:FZ(Z.array,J,{type:e0,k:W,v:V})}}return G.val=!0,{type:EZ,size:Z.size,array:FZ(Z.array,J,g9(Q+xZ,Y.k,Y.v,X,W,V))}}let H=y8(Y,Q+xZ,X,W,V,G);if(H===Y)return Z;return{type:EZ,size:Z.size,array:FZ(Z.array,J,H)}}function H6(Z,Q,X,W,V,G){let J=EX(X,Q),Y=Y6(Z.bitmap,J);if((Z.bitmap&J)!==0){let H=Z.array[Y];if(H.type!==e0){let U=y8(H,Q+xZ,X,W,V,G);if(U===H)return Z;return{type:KZ,bitmap:Z.bitmap,array:FZ(Z.array,Y,U)}}let q=H.k;if(I0(W,q)){if(V===H.v)return Z;return{type:KZ,bitmap:Z.bitmap,array:FZ(Z.array,Y,{type:e0,k:W,v:V})}}return G.val=!0,{type:KZ,bitmap:Z.bitmap,array:FZ(Z.array,Y,g9(Q+xZ,q,H.v,X,W,V))}}else{let H=Z.array.length;if(H>=MJ){let q=Array(32),U=f8(X,Q);q[U]=H6(J6,Q+xZ,X,W,V,G);let z=0,N=Z.bitmap;for(let R=0;R<32;R++){if((N&1)!==0){let D=Z.array[z++];q[R]=D}N=N>>>1}return{type:EZ,size:H+1,array:q}}else{let q=zJ(Z.array,Y,{type:e0,k:W,v:V});return G.val=!0,{type:KZ,bitmap:Z.bitmap|J,array:q}}}}function NJ(Z,Q,X,W,V,G){if(X===Z.hash){let J=q6(Z,W);if(J!==-1){if(Z.array[J].v===V)return Z;return{type:BQ,hash:X,array:FZ(Z.array,J,{type:e0,k:W,v:V})}}let Y=Z.array.length;return G.val=!0,{type:BQ,hash:X,array:FZ(Z.array,Y,{type:e0,k:W,v:V})}}return y8({type:KZ,bitmap:EX(Z.hash,Q),array:[Z]},Q,X,W,V,G)}function q6(Z,Q){let X=Z.array.length;for(let W=0;W<X;W++)if(I0(Q,Z.array[W].k))return W;return-1}function wX(Z,Q,X,W){switch(Z.type){case EZ:return DJ(Z,Q,X,W);case KZ:return jJ(Z,Q,X,W);case BQ:return BJ(Z,W)}}function DJ(Z,Q,X,W){let V=f8(X,Q),G=Z.array[V];if(G===void 0)return;if(G.type!==e0)return wX(G,Q+xZ,X,W);if(I0(W,G.k))return G;return}function jJ(Z,Q,X,W){let V=EX(X,Q);if((Z.bitmap&V)===0)return;let G=Y6(Z.bitmap,V),J=Z.array[G];if(J.type!==e0)return wX(J,Q+xZ,X,W);if(I0(W,J.k))return J;return}function BJ(Z,Q){let X=q6(Z,Q);if(X<0)return;return Z.array[X]}function U6(Z,Q,X,W){switch(Z.type){case EZ:return RJ(Z,Q,X,W);case KZ:return SJ(Z,Q,X,W);case BQ:return AJ(Z,W)}}function RJ(Z,Q,X,W){let V=f8(X,Q),G=Z.array[V];if(G===void 0)return Z;let J=void 0;if(G.type===e0){if(!I0(G.k,W))return Z}else if(J=U6(G,Q+xZ,X,W),J===G)return Z;if(J===void 0){if(Z.size<=IJ){let Y=Z.array,H=Array(Z.size-1),q=0,U=0,z=0;while(q<V){let N=Y[q];if(N!==void 0)H[U]=N,z|=1<<q,++U;++q}++q;while(q<Y.length){let N=Y[q];if(N!==void 0)H[U]=N,z|=1<<q,++U;++q}return{type:KZ,bitmap:z,array:H}}return{type:EZ,size:Z.size-1,array:FZ(Z.array,V,J)}}return{type:EZ,size:Z.size,array:FZ(Z.array,V,J)}}function SJ(Z,Q,X,W){let V=EX(X,Q);if((Z.bitmap&V)===0)return Z;let G=Y6(Z.bitmap,V),J=Z.array[G];if(J.type!==e0){let Y=U6(J,Q+xZ,X,W);if(Y===J)return Z;if(Y!==void 0)return{type:KZ,bitmap:Z.bitmap,array:FZ(Z.array,G,Y)};if(Z.bitmap===V)return;return{type:KZ,bitmap:Z.bitmap^V,array:V6(Z.array,G)}}if(I0(W,J.k)){if(Z.bitmap===V)return;return{type:KZ,bitmap:Z.bitmap^V,array:V6(Z.array,G)}}return Z}function AJ(Z,Q){let X=q6(Z,Q);if(X<0)return Z;if(Z.array.length===1)return;return{type:BQ,hash:Z.hash,array:V6(Z.array,X)}}function v9(Z,Q){if(Z===void 0)return;let X=Z.array,W=X.length;for(let V=0;V<W;V++){let G=X[V];if(G===void 0)continue;if(G.type===e0){Q(G.v,G.k);continue}v9(G,Q)}}class f0{static fromObject(Z){let Q=Object.keys(Z),X=f0.new();for(let W=0;W<Q.length;W++){let V=Q[W];X=X.set(V,Z[V])}return X}static fromMap(Z){let Q=f0.new();return Z.forEach((X,W)=>{Q=Q.set(W,X)}),Q}static new(){return new f0(void 0,0)}constructor(Z,Q){this.root=Z,this.size=Q}get(Z,Q){if(this.root===void 0)return Q;let X=wX(this.root,0,IZ(Z),Z);if(X===void 0)return Q;return X.v}set(Z,Q){let X={val:!1},W=this.root===void 0?J6:this.root,V=y8(W,0,IZ(Z),Z,Q,X);if(V===this.root)return this;return new f0(V,X.val?this.size+1:this.size)}delete(Z){if(this.root===void 0)return this;let Q=U6(this.root,0,IZ(Z),Z);if(Q===this.root)return this;if(Q===void 0)return f0.new();return new f0(Q,this.size-1)}has(Z){if(this.root===void 0)return!1;return wX(this.root,0,IZ(Z),Z)!==void 0}entries(){if(this.root===void 0)return[];let Z=[];return this.forEach((Q,X)=>Z.push([X,Q])),Z}forEach(Z){v9(this.root,Z)}hashCode(){let Z=0;return this.forEach((Q,X)=>{Z=Z+W6(IZ(Q),IZ(X))|0}),Z}equals(Z){if(!(Z instanceof f0)||this.size!==Z.size)return!1;try{return this.forEach((Q,X)=>{if(!I0(Z.get(X,!Q),Q))throw b9}),!0}catch(Q){if(Q===b9)return!1;throw Q}}}var b9=Symbol();var M6=void 0,_9={};function r(Z){return Z}function kX(Z){if(/^[-+]?(\d+)\.(\d+)([eE][-+]?\d+)?$/.test(Z))return new B(parseFloat(Z));else return new k(M6)}function V0(Z){return Z.toString()}function cZ(Z){let Q=Z.toString().replace("+","");if(Q.indexOf(".")>=0)return Q;else{let X=Q.indexOf("e");if(X>=0)return Q.slice(0,X)+".0"+Q.slice(X);else return Q+".0"}}function tW(Z,Q,X){if(typeof Z.replaceAll<"u")return Z.replaceAll(Q,X);return Z.replace(new RegExp(Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),X)}function CX(Z){let Q=m9(Z);if(Q)return C0.fromArray(Array.from(Q).map((X)=>X.segment));else return C0.fromArray(Z.match(/./gsu))}var $9=void 0;function m9(Z){if(globalThis.Intl&&Intl.Segmenter)return $9||=new Intl.Segmenter,$9.segment(Z)[Symbol.iterator]()}function u9(Z){let Q,X=m9(Z);if(X)Q=X.next().value?.segment;else Q=Z.match(/./su)?.[0];if(Q)return new B([Q,Z.slice(Q.length)]);else return new k(M6)}function RQ(Z){return[Z.charCodeAt(0)|0,Z.slice(1)]}function MZ(Z){return Z.toLowerCase()}function eW(Z,Q){return C0.fromArray(Z.split(Q))}function $0(Z,Q,X){return Z.slice(Q,Q+X)}function iQ(Z,Q){return Z.indexOf(Q)>=0}function fZ(Z,Q){return Z.startsWith(Q)}var c9=[" ","\t",` 2 - `,"\v","\f","\r","…","\u2028","\u2029"].join(""),OJ=new RegExp(`^[${c9}]*`),CJ=new RegExp(`[${c9}]*$`);function p9(Z){return Z.replace(OJ,"")}function d9(Z){return Z.replace(CJ,"")}function E8(Z){return Math.floor(Z)}function I6(Z){return Math.round(Z)}function SQ(Z){return Math.trunc(Z)}function x8(){let Z=Math.random();if(Z===1)return x8();return Z}function R0(){return f0.new()}function GQ(Z){return C0.fromArray(Z.entries())}function o0(Z,Q){let X=Z.get(Q,_9);if(X===_9)return new k(M6);return new B(X)}function A9(Z,Q,X){return X.set(Z,Q)}function uZ(Z){if(typeof Z==="string")return"String";else if(typeof Z==="boolean")return"Bool";else if(Z instanceof mQ)return"Result";else if(Z instanceof C0)return"List";else if(Z instanceof CZ)return"BitArray";else if(Z instanceof f0)return"Dict";else if(Number.isInteger(Z))return"Int";else if(Array.isArray(Z))return`Tuple of ${Z.length} elements`;else if(typeof Z==="number")return"Float";else if(Z===null)return"Null";else if(Z===void 0)return"Nil";else{let Q=typeof Z;return Q.charAt(0).toUpperCase()+Q.slice(1)}}function kZ(Z){let Q=typeof Z;if(Z===!0)return"True";if(Z===!1)return"False";if(Z===null)return"//js(null)";if(Z===void 0)return"Nil";if(Q==="string")return LJ(Z);if(Q==="bigint"||Number.isInteger(Z))return Z.toString();if(Q==="number")return cZ(Z);if(Array.isArray(Z))return`#(${Z.map(kZ).join(", ")})`;if(Z instanceof C0)return kJ(Z);if(Z instanceof PQ)return fJ(Z);if(Z instanceof CZ)return`<<${n9(Z,"")}>>`;if(Z instanceof I)return xJ(Z);if(Z instanceof f0)return wJ(Z);if(Z instanceof Set)return`//js(Set(${[...Z].map(kZ).join(", ")}))`;if(Z instanceof RegExp)return`//js(${Z})`;if(Z instanceof Date)return`//js(Date("${Z.toISOString()}"))`;if(Z instanceof Function){let X=[];for(let W of Array(Z.length).keys())X.push(String.fromCharCode(W+97));return`//fn(${X.join(", ")}) { ... }`}return EJ(Z)}function LJ(Z){let Q='"';for(let X=0;X<Z.length;X++){let W=Z[X];switch(W){case` 3 - `:Q+="\\n";break;case"\r":Q+="\\r";break;case"\t":Q+="\\t";break;case"\f":Q+="\\f";break;case"\\":Q+="\\\\";break;case'"':Q+="\\\"";break;default:if(W<" "||W>"~"&&W<" ")Q+="\\u{"+W.charCodeAt(0).toString(16).toUpperCase().padStart(4,"0")+"}";else Q+=W}}return Q+='"',Q}function wJ(Z){let Q="dict.from_list([",X=!0;return Z.forEach((W,V)=>{if(!X)Q=Q+", ";Q=Q+"#("+kZ(V)+", "+kZ(W)+")",X=!1}),Q+"])"}function EJ(Z){let Q=Object.getPrototypeOf(Z)?.constructor?.name||"Object",X=[];for(let G of Object.keys(Z))X.push(`${kZ(G)}: ${kZ(Z[G])}`);let W=X.length?" "+X.join(", ")+" ":"";return`//js(${Q==="Object"?"":Q+" "}{${W}})`}function xJ(Z){let Q=Object.keys(Z).map((X)=>{let W=kZ(Z[X]);return isNaN(parseInt(X))?`${X}: ${W}`:W}).join(", ");return Q?`${Z.constructor.name}(${Q})`:Z.constructor.name}function kJ(Z){return`[${Z.toArray().map(kZ).join(", ")}]`}function fJ(Z){return`//utfcodepoint(${String.fromCodePoint(Z.value)})`}function n9(Z,Q){if(Z.bitSize===0)return Q;for(let X=0;X<Z.byteSize-1;X++)Q+=Z.byteAt(X).toString(),Q+=", ";if(Z.byteSize*8===Z.bitSize)Q+=Z.byteAt(Z.byteSize-1).toString();else{let X=Z.bitSize%8;Q+=Z.byteAt(Z.byteSize-1)>>8-X,Q+=`:size(${X})`}return Q}function x9(Z,Q){if(Z===Q)return new N0;else if(Z<Q)return new P0;else return new jZ}function yJ(Z){return-1*Z}function sQ(Z){if(Z>=0)return I6(Z);else return 0-I6(yJ(Z))}function r9(Z,Q){if(Q===0)return new k(void 0);else{let X=uQ(Z,Q);if(X*Q<0)return new B(X+Q);else return new B(X)}}function zZ(Z,Q,X){let V=r(Z),G=tW(V,Q,X);return r(G)}function $J(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W;else{let V=X.head;Z=X.tail,Q=W+V}}}function fX(Z){return $J(Z,"")}function mJ(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(W instanceof A)return G;else{let J=W.head;Z=W.tail,Q=V,X=G+V+J}}}function aQ(Z,Q){if(Z instanceof A)return"";else{let{head:X,tail:W}=Z;return mJ(W,Q,X)}}function yX(Z){let X=p9(Z);return d9(X)}function bX(Z,Q){while(!0){let X=Z,W=Q;if(W>0){let G=u9(X);if(G instanceof B)Z=G[0][1],Q=W-1;else return X}else return X}}function b8(Z,Q){if(Q==="")return CX(Z);else{let W=r(Z),V=eW(W,Q);return w0(V,r)}}function h8(Z){let Q=kZ(Z);return r(Q)}function F6(Z,Q){if(Z instanceof f0||Z instanceof WeakMap||Z instanceof Map){let W={},V=Z.get(Q,W);if(V===W)return new B(new b);return new B(new T(V))}let X=Number.isInteger(Q);if(X&&Q>=0&&Q<8&&Z instanceof C0){let W=0;for(let V of Z){if(W===Q)return new B(new T(V));W++}return new k("Indexable")}if(X&&Array.isArray(Z)||Z&&typeof Z==="object"||Z&&Object.getPrototypeOf(Z)===Object.prototype){if(Q in Z)return new B(new T(Z[Q]));return new B(new b)}return new k(X?"Indexable":"Dict")}function i9(Z,Q,X,W,V){if(!(Z instanceof C0||Array.isArray(Z))){let J=new pZ("List",uZ(Z),V);return[V,C0.fromArray([J])]}let G=[];for(let J of Z){let Y=Q(J),[H,q]=Y;if(q instanceof v0){let[U,z]=X(Y,W.toString());return[V,z]}G.push(H),W++}return[C0.fromArray(G),V]}function a9(Z){if(Number.isInteger(Z))return new B(Z);return new k(0)}function o9(Z){if(typeof Z==="string")return new B(Z);return new k("")}function t9(Z){return Z===null||Z===void 0}class pZ extends I{constructor(Z,Q,X){super();this.expected=Z,this.found=Q,this.path=X}}class GZ extends I{constructor(Z){super();this.function=Z}}var z6=new GZ(pJ),hX=new GZ(nJ),oQ=new GZ(rJ);var e=new GZ(sJ);function dZ(Z,Q){let X=Q.function(Z),W,V;if(W=X[0],V=X[1],V instanceof A)return new B(W);else return new k(V)}function o(Z){return new GZ((Q)=>{return[Z,K([])]})}function pJ(Z){return[Z,K([])]}function tQ(Z,Q){return new GZ((X)=>{let W=Z.function(X),V,G;return V=W[0],G=W[1],[Q(V),G]})}function dJ(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(G instanceof A)return V;else{let{head:J,tail:Y}=G,H=J.function(W),q,U;if(q=H,U=H[1],U instanceof A)return q;else Z=W,Q=V,X=Y}}}function gX(Z,Q){return new GZ((X)=>{let W=Z.function(X),V,G;if(V=W,G=W[1],G instanceof A)return V;else return dJ(X,V,Q)})}function eQ(Z){return new GZ((Q)=>{if(t9(Q))return[new b,K([])];else{let W=Z.function(Q),V,G;return V=W[0],G=W[1],[new T(V),G]}})}function e9(Z,Q){return K([new pZ(Z,uZ(Q),K([]))])}function ZK(Z,Q,X){let W=X(Z);if(W instanceof B)return[W[0],K([])];else return[W[0],K([new pZ(Q,uZ(Z),K([]))])]}function nJ(Z){if(I0(r(!0),Z))return[!0,K([])];else if(I0(r(!1),Z))return[!1,K([])];else return[!1,e9("Bool",Z)]}function rJ(Z){return ZK(Z,"Int",a9)}function AQ(Z,Q){return new GZ((X)=>{return[Z,e9(Q,X)]})}function sJ(Z){return ZK(Z,"String",o9)}function Z8(Z){return new GZ((Q)=>{return i9(Q,Z.function,(X,W)=>{return g8(X,K([W]))},0,K([]))})}function g8(Z,Q){let X=gX(e,K([(()=>{return tQ(oQ,V0)})()])),W=w0(Q,(G)=>{let J=r(G),Y=dZ(J,X);if(Y instanceof B)return Y[0];else return"<"+uZ(J)+">"}),V=w0(Z[1],(G)=>{return new pZ(G.expected,G.found,S0(W,G.path))});return[Z[0],V]}function lJ(Z,Q,X,W,V){while(!0){let G=Z,J=Q,Y=X,H=W,q=V;if(G instanceof A){let U=Y(H);return g8(U,W0(J))}else{let{head:U,tail:z}=G,N=F6(H,U);if(N instanceof B){let R=N[0];if(R instanceof T){let D=R[0];Z=z,Q=P(U,J),X=Y,W=D,V=q}else return q(H,P(U,J))}else{let R=N[0],D=Y(H),w;w=D[0];let S=[w,K([new pZ(R,uZ(H),K([]))])];return g8(S,W0(J))}}}}function vX(Z,Q,X){return new GZ((W)=>{let V=lJ(Z,K([]),Q.function,W,(U,z)=>{let N=Q.function(U),R;R=N[0];let D=[R,K([new pZ("Field","Nothing",K([]))])];return g8(D,W0(z))}),G,J;G=V[0],J=V[1];let Y=X(G).function(W),H,q;return H=Y[0],q=Y[1],[H,S0(J,q)]})}function p(Z,Q,X){return vX(K([Z]),Q,X)}function P6(Z,Q,X,W){return new GZ((V)=>{let G,J,Y=F6(V,Z);if(Y instanceof B){let w=Y[0];if(w instanceof T){let S=w[0];J=X.function(S)}else J=[Q,K([])]}else{let w=Y[0];J=[Q,K([new pZ(w,uZ(V),K([]))])]}G=g8(J,K([Z]));let q=G,U,z;U=q[0],z=q[1];let N=W(U).function(V),R,D;return R=N[0],D=N[1],[R,S0(z,D)]})}function N6(Z){return JSON.stringify(Z)}function QK(Z){return Object.fromEntries(Z)}function TQ(Z){return Z}function XK(){return null}function WK(Z){try{let Q=JSON.parse(Z);return new B(Q)}catch(Q){return new k(iJ(Q,Z))}}function iJ(Z,Q){if(aJ(Z))return new D6;return oJ(Z,Q)}function aJ(Z){return/((unexpected (end|eof))|(end of data)|(unterminated string)|(json( parse error|\.parse)\: expected '(\:|\}|\])'))/i.test(Z.message)}function oJ(Z,Q){let X=[tJ,eJ,QY,ZY];for(let W of X){let V=W(Z,Q);if(V)return V}return new OQ("",0)}function tJ(Z){let X=/unexpected token '(.)', ".+" is not valid JSON/i.exec(Z.message);if(!X)return null;let W=_X(X[1]);return new OQ(W,-1)}function eJ(Z){let X=/unexpected token (.) in JSON at position (\d+)/i.exec(Z.message);if(!X)return null;let W=_X(X[1]),V=Number(X[2]);return new OQ(W,V)}function ZY(Z,Q){let W=/(unexpected character|expected .*) at line (\d+) column (\d+)/i.exec(Z.message);if(!W)return null;let V=Number(W[2]),G=Number(W[3]),J=XY(V,G,Q),Y=_X(Q[J]);return new OQ(Y,J)}function QY(Z){let X=/unexpected (identifier|token) "(.)"/i.exec(Z.message);if(!X)return null;let W=_X(X[2]);return new OQ(W,0)}function _X(Z){return"0x"+Z.charCodeAt(0).toString(16).toUpperCase()}function XY(Z,Q,X){if(Z===1)return Q-1;let W=1,V=0;return X.split("").find((G,J)=>{if(G===` 4 - `)W+=1;if(W===Z)return V=J+Q,!0;return!1}),V}class D6 extends I{}class OQ extends I{constructor(Z){super();this[0]=Z}}class VK extends I{constructor(Z){super();this[0]=Z}}function WY(Z,Q){return oW(WK(Z),(X)=>{let W=dZ(X,Q);return aW(W,(V)=>{return new VK(V)})})}function v8(Z,Q){return WY(Z,Q)}function m0(Z){return N6(Z)}function _(Z){return TQ(Z)}function j6(Z){return TQ(Z)}function _8(Z){return TQ(Z)}function B6(){return XK()}function D0(Z){return QK(Z)}function KK(Z){return!Z}function $X(Z){if(Z)return"True";else return"False"}function GK(Z,Q,X){if(Z)return Q;else return X()}function $8(Z,Q,X){if(Z)return Q();else return X()}class JK extends I{constructor(Z,Q){super();this.seconds=Z,this.nanoseconds=Q}}function S6(Z){return new JK(Z,0)}function YK(Z){let Q=r(Z.seconds),X=r(Z.nanoseconds);return Q+X/1e9}function qK(){let Z=Date.now(),Q=Z%1000,X=Q*1e6;return[(Z-Q)/1000,X]}function UK(){return new Date().getTimezoneOffset()*-60}class A6 extends I{constructor(Z,Q,X){super();this.year=Z,this.month=Q,this.day=X}}class T6 extends I{constructor(Z,Q,X,W){super();this.hours=Z,this.minutes=Q,this.seconds=X,this.nanoseconds=W}}class m8 extends I{}class u8 extends I{}class c8 extends I{}class p8 extends I{}class d8 extends I{}class n8 extends I{}class r8 extends I{}class s8 extends I{}class l8 extends I{}class i8 extends I{}class a8 extends I{}class O6 extends I{}function MK(){return S6(UK())}class mX extends I{constructor(Z,Q){super();this.seconds=Z,this.nanoseconds=Q}}function KY(Z){let Q=1e9,X=uQ(Z.nanoseconds,Q),W=Z.nanoseconds-X,V=Z.seconds+cQ(W,Q);if(X>=0)return new mX(V,X);else return new mX(V-1,Q+X)}function CQ(){let Z=qK(),Q,X;return Q=Z[0],X=Z[1],KY(new mX(Q,X))}function GY(Z){return sQ(YK(Z)/60)}function C6(Z,Q){let X=r9(Z,Q);if(X instanceof B)return X[0];else return 0}function FK(Z,Q){let X=pQ(r(Z),Q);return sQ(E8(X))}function JY(Z){let Q=FK(Z,1440)+719468,X;if(Q>=0)X=globalThis.Math.trunc(Q/146097);else X=globalThis.Math.trunc((Q-146096)/146097);let V=X,G=Q-V*146097,J=globalThis.Math.trunc((G-globalThis.Math.trunc(G/1460)+globalThis.Math.trunc(G/36524)-globalThis.Math.trunc(G/146096))/365),Y=J+V*400,H=G-(365*J+globalThis.Math.trunc(J/4)-globalThis.Math.trunc(J/100)),q=globalThis.Math.trunc((5*H+2)/153),U;if(q<10)U=q+3;else U=q-9;let N=U,R=H-globalThis.Math.trunc((153*q+2)/5)+1,D;if(N<=2)D=Y+1;else D=Y;return[D,N,R]}function YY(Z,Q){let X=Z.seconds+Q*60,W=C6(X,60),V=FK(X,60),G=globalThis.Math.trunc(C6(X,3600)/60),J=cQ(C6(X,86400),3600),Y=JY(V),H,q,U;return H=Y[0],q=Y[1],U=Y[2],[H,q,U,J,G,W]}function zK(Z,Q){let X=GY(Q),W=YY(Z,X),V,G,J,Y,H,q;V=W[0],G=W[1],J=W[2],Y=W[3],H=W[4],q=W[5];let U;if(G===1)U=new m8;else if(G===2)U=new u8;else if(G===3)U=new c8;else if(G===4)U=new p8;else if(G===5)U=new d8;else if(G===6)U=new n8;else if(G===7)U=new r8;else if(G===8)U=new s8;else if(G===9)U=new l8;else if(G===10)U=new i8;else if(G===11)U=new a8;else U=new O6;let z=U,N=Z.nanoseconds,R=new A6(V,z,J),D=new T6(Y,H,q,N);return[R,D]}function Q8(Z){let Q=r(Z.seconds),X=r(Z.nanoseconds);return Q+X/1e9}function yZ(Z){console.log(...pX(Z))}function uX(Z){console.info(...pX(Z))}function LQ(Z){console.error(...pX(Z))}function cX(Z){console.warn(...pX(Z))}function pX(Z){if(typeof process>"u"){let Q=[];Z.split("\x1B[0m").map((V)=>{if(V.includes("\x1B")&&!V.startsWith("\x1B"))V.replaceAll("\x1B","\r.\r\x1B").split("\r.\r").map((G)=>{Q.push(DK(G))});else Q.push(DK(V))});let X="",W='"‎'.repeat(24).split('"');for(let V in Q){let G=Q[V];X=`${X}%c${G.text}`,W[V]=G.style}return[X,...W]}else return[Z]}function DK(Z){if(Z.match(/\x1b\[38;2;(\d+);(\d+);(\d+)m(.+)/)){let Q=Z.match(/\x1b\[38;2;(\d+);(\d+);(\d+)m(.+)/),X=parseInt(Q[1]),W=parseInt(Q[2]),V=parseInt(Q[3]);return{text:Q[4],style:`color: rgb(${X}, ${W}, ${V})`}}else if(Z.match(/\x1b\[48;2;(\d+);(\d+);(\d+)m(.+)/)){let Q=Z.match(/\x1b\[48;2;(\d+);(\d+);(\d+)m(.+)/),X=parseInt(Q[1]),W=parseInt(Q[2]),V=parseInt(Q[3]);return{text:Q[4],style:`background-color: rgb(${X}, ${W}, ${V})`}}else return{text:Z,style:"color: inherit; background-color: inherit;"}}function L6(Z){let Q;if(globalThis.Deno)Q=Deno.env.get(Z);else if(globalThis.process)Q=process.env[Z];if(Q===void 0)return new k(void 0);else return new B(Q)}function w6(Z,Q,X,W){let V=()=>{return"\x1B[38;2;"+V0(Q)+";"+V0(X)+";"+V0(W)+"m"+Z+"\x1B[0m"},G=L6("NO_COLOR");if(G instanceof B)if(G[0]==="")return V();else return Z;else return V()}function E6(Z){return w6(Z,184,28,74)}function x6(Z){return w6(Z,16,227,227)}function u0(Z){return Z}class k6 extends I{constructor(Z){super();this.dict=Z}}var jY=void 0;function RK(){return new k6(R0())}function f6(Z,Q){let X=Z.dict,W=o0(X,Q);return NQ(W)}function SK(Z,Q){return new k6(qZ(Z.dict,Q,jY))}var BY=f0.new();function rX(){return BY}var RY=RK();function t8(){return RY}var BZ=globalThis?.document,sX="http://www.w3.org/1999/xhtml",lX=1,iX=3,e8=11,AK=!!globalThis.HTMLElement?.prototype?.moveBefore;var v=K([]),aX=new b;var SY=new jZ,AY=new P0,TY=new N0;function oX(Z,Q){if(Z.name===Q.name)return TY;else if(Z.name<Q.name)return AY;else return SY}class nZ extends I{constructor(Z,Q,X){super();this.kind=Z,this.name=Q,this.value=X}}class QX extends I{constructor(Z,Q,X){super();this.kind=Z,this.name=Q,this.value=X}}class s0 extends I{constructor(Z,Q,X,W,V,G,J,Y){super();this.kind=Z,this.name=Q,this.handler=X,this.include=W,this.prevent_default=V,this.stop_propagation=G,this.immediate=J,this.limit=Y}}class ZX extends I{constructor(Z){super();this.kind=Z}}class tX extends I{constructor(Z,Q){super();this.kind=Z,this.delay=Q}}class h6 extends I{constructor(Z,Q){super();this.kind=Z,this.delay=Q}}var g6=0,v6=1,_6=2,$6=1,m6=2;function xK(Z,Q){if(Z instanceof ZX)if(Q instanceof ZX)return!0;else return!1;else if(Z instanceof tX)if(Q instanceof tX){let X=Z.delay,W=Q.delay;if(X===W)return!0;else return!1}else return!1;else if(Q instanceof h6){let X=Z.delay,W=Q.delay;if(X===W)return!0;else return!1}else return!1}function wY(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W;else{let V=X.tail;if(V instanceof A){let G=X.head;Z=V,Q=P(G,W)}else{let G=X.head;if(G instanceof nZ){let J=V.head;if(J instanceof nZ){let Y=G.name;if(Y==="class")if(J.name==="class"){let q=V.tail,U=G.kind,z=G.value,N=J.value,R=z+" "+N,D=new nZ(U,"class",R);Z=P(D,q),Q=W}else{let q=G;Z=V,Q=P(q,W)}else if(Y==="style")if(J.name==="style"){let q=V.tail,U=G.kind,z=G.value,N=J.value,R=z+";"+N,D=new nZ(U,"style",R);Z=P(D,q),Q=W}else{let q=G;Z=V,Q=P(q,W)}else{let H=G;Z=V,Q=P(H,W)}}else{let Y=G;Z=V,Q=P(Y,W)}}else{let J=G;Z=V,Q=P(J,W)}}}}}function kK(Z){if(Z instanceof A)return Z;else if(Z.tail instanceof A)return Z;else{let W=w8(Z,(V,G)=>{return oX(G,V)});return wY(W,v)}}function fK(Z,Q){return new nZ(g6,Z,Q)}function yK(Z,Q){return new QX(v6,Z,Q)}function bK(Z,Q,X,W,V,G,J){return new s0(_6,Z,Q,X,W,V,G,J)}function F(Z,Q){return fK(Z,Q)}function hK(Z,Q){return yK(Z,Q)}function gK(Z,Q){if(Q)return F(Z,"");else return hK(Z,j6(!1))}function M(Z){return F("class",Z)}function W8(){return M("")}function V8(Z){return F("id",Z)}function eX(Z,Q){if(Z==="")return M("");else if(Q==="")return M("");else return F("style",Z+":"+Q+";")}function PZ(Z){return F("href",Z)}function u6(Z){return F("target",Z)}function ZW(Z){return F("alt",Z)}function K8(Z){return F("src",Z)}function vK(Z){return gK("checked",Z)}function _K(Z){return gK("disabled",Z)}function G8(Z){return F("for",Z)}function QW(Z){return F("name",Z)}function wQ(Z){return F("placeholder",Z)}function l0(Z){return F("type",Z)}function EQ(Z){return F("value",Z)}function $K(Z){return F("role",Z)}class WW extends I{constructor(Z,Q,X){super();this.synchronous=Z,this.before_paint=Q,this.after_paint=X}}var XW=new WW(K([]),K([]),K([]));function $(){return XW}function YQ(Z){return new WW(K([(X)=>{let W=X.dispatch;return Z(W)}]),XW.before_paint,XW.after_paint)}function XX(Z){return k0(Z,XW,(Q,X)=>{return new WW(k0(X.synchronous,Q.synchronous,OX),k0(X.before_paint,Q.before_paint,OX),k0(X.after_paint,Q.after_paint,OX))})}function YZ(){return null}function Y8(Z,Q){let X=Z?.get(Q);if(X!=null)return new B(X);else return new k(void 0)}function H8(Z,Q,X){return Z??=new Map,Z.set(Q,X),Z}function c6(Z,Q){return Z?.delete(Q),Z}class p6 extends I{}class d6 extends I{constructor(Z,Q){super();this.key=Z,this.parent=Q}}class mK extends I{constructor(Z,Q){super();this.index=Z,this.parent=Q}}var KW=new p6,n6=` 5 - `,r6="\t",s6="\f";function EY(Z,Q){while(!0){let X=Z,W=Q;if(W instanceof A)return!1;else{let{head:V,tail:G}=W,J=fZ(X,V);if(J)return J;else Z=X,Q=G}}}function HQ(Z,Q,X){if(X==="")return new mK(Q,Z);else return new d6(X,Z)}function uK(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof p6)if(W instanceof A)return"";else{let V=W.tail;return fX(V)}else if(X instanceof d6){let V=X.key;Z=X.parent,Q=P(r6,P(V,W))}else{let V=X.index;Z=X.parent,Q=P(n6,P(V0(V),W))}}}function xY(Z){return uK(Z,K([]))}function cK(Z,Q){if(Q instanceof A)return!1;else return EY(xY(Z),Q)}function l6(Z,Q){return uK(Z,K([s6,Q]))}class ZZ extends I{constructor(Z,Q,X,W,V,G){super();this.kind=Z,this.key=Q,this.mapper=X,this.children=W,this.keyed_children=V,this.children_count=G}}class RZ extends I{constructor(Z,Q,X,W,V,G,J,Y,H,q){super();this.kind=Z,this.key=Q,this.mapper=X,this.namespace=W,this.tag=V,this.attributes=G,this.children=J,this.keyed_children=Y,this.self_closing=H,this.void=q}}class SZ extends I{constructor(Z,Q,X,W){super();this.kind=Z,this.key=Q,this.mapper=X,this.content=W}}class q8 extends I{constructor(Z,Q,X,W,V,G,J){super();this.kind=Z,this.key=Q,this.mapper=X,this.namespace=W,this.tag=V,this.attributes=G,this.inner_html=J}}var i6=0,a6=1,o6=2,dK=3;function yY(Z,Q){if(Q==="")if(Z==="area")return!0;else if(Z==="base")return!0;else if(Z==="br")return!0;else if(Z==="col")return!0;else if(Z==="embed")return!0;else if(Z==="hr")return!0;else if(Z==="img")return!0;else if(Z==="input")return!0;else if(Z==="link")return!0;else if(Z==="meta")return!0;else if(Z==="param")return!0;else if(Z==="source")return!0;else if(Z==="track")return!0;else if(Z==="wbr")return!0;else return!1;else return!1}function A0(Z){if(Z instanceof ZZ)return 1+Z.children_count;else return 1}function nK(Z,Q,X,W,V){return new ZZ(i6,Z,Q,X,W,V)}function t6(Z,Q,X,W,V,G,J,Y,H){return new RZ(a6,Z,Q,X,W,kK(V),G,J,Y,H||yY(W,X))}function e6(Z,Q,X){return new SZ(o6,Z,Q,X)}function rK(Z,Q,X,W,V){while(!0){let G=Z,J=Q,Y=X,H=W,q=V;if(J instanceof A)return[W0(H),q];else{let U=J.head;if(U instanceof ZZ){let z=U;if(z.key===""){let N=J.tail,R=G+"::"+V0(Y),D=rK(R,z.children,0,v,YZ()),w,S;w=D[0],S=D[1];let x=new ZZ(z.kind,z.key,z.mapper,w,S,z.children_count),O=P(x,H),E=Y+1;Z=G,Q=N,X=E,W=O,V=q}else{let N=U;if(N.key!==""){let R=J.tail,D=G+"::"+N.key,w=GW(D,N),S=P(w,H),x=H8(q,D,w),O=Y+1;Z=G,Q=R,X=O,W=S,V=x}else{let R=U,D=J.tail,w=P(R,H),S=Y+1;Z=G,Q=D,X=S,W=w,V=q}}}else{let z=U;if(z.key!==""){let N=J.tail,R=G+"::"+z.key,D=GW(R,z),w=P(D,H),S=H8(q,R,D),x=Y+1;Z=G,Q=N,X=x,W=w,V=S}else{let N=U,R=J.tail,D=P(N,H),w=Y+1;Z=G,Q=R,X=w,W=D,V=q}}}}}function GW(Z,Q){if(Q instanceof ZZ){let X=Q.children,W=rK(Z,X,0,v,YZ()),V,G;return V=W[0],G=W[1],new ZZ(Q.kind,Z,Q.mapper,V,G,Q.children_count)}else if(Q instanceof RZ)return new RZ(Q.kind,Z,Q.mapper,Q.namespace,Q.tag,Q.attributes,Q.children,Q.keyed_children,Q.self_closing,Q.void);else if(Q instanceof SZ)return new SZ(Q.kind,Z,Q.mapper,Q.content);else return new q8(Q.kind,Z,Q.mapper,Q.namespace,Q.tag,Q.attributes,Q.inner_html)}class WX extends I{constructor(Z,Q,X,W){super();this.index=Z,this.removed=Q,this.changes=X,this.children=W}}class sK extends I{constructor(Z,Q){super();this.kind=Z,this.content=Q}}class lK extends I{constructor(Z,Q){super();this.kind=Z,this.inner_html=Q}}class iK extends I{constructor(Z,Q,X){super();this.kind=Z,this.added=Q,this.removed=X}}class aK extends I{constructor(Z,Q,X,W){super();this.kind=Z,this.key=Q,this.before=X,this.count=W}}class oK extends I{constructor(Z,Q,X){super();this.kind=Z,this.key=Q,this.count=X}}class tK extends I{constructor(Z,Q,X,W){super();this.kind=Z,this.from=Q,this.count=X,this.with=W}}class eK extends I{constructor(Z,Q,X){super();this.kind=Z,this.children=Q,this.before=X}}class Z7 extends I{constructor(Z,Q,X){super();this.kind=Z,this.from=Q,this.count=X}}var ZV=0,QV=1,XV=2,JW=3,WV=4,YW=5,HW=6,qW=7;function VV(Z,Q,X,W){return new WX(Z,Q,X,W)}function Q7(Z){return new sK(ZV,Z)}function X7(Z){return new lK(QV,Z)}function KV(Z,Q){return new iK(XV,Z,Q)}function W7(Z,Q,X){return new aK(JW,Z,Q,X)}function V7(Z,Q){return new oK(WV,Z,Q)}function xQ(Z,Q,X){return new tK(YW,Z,Q,X)}function GV(Z,Q){return new eK(HW,Z,Q)}function K7(Z,Q){return new Z7(qW,Z,Q)}class IW extends I{constructor(Z,Q){super();this.patch=Z,this.events=Q}}class Y7 extends I{constructor(Z,Q,X){super();this.added=Z,this.removed=Q,this.events=X}}function hY(Z,Q,X,W){if(X==="input"&&Q==="")return MW(Z,W);else if(X==="select"&&Q==="")return MW(Z,W);else if(X==="textarea"&&Q==="")return MW(Z,W);else return!1}function J7(Z,Q,X,W,V,G,J,Y){while(!0){let H=Z,q=Q,U=X,z=W,N=V,R=G,D=J,w=Y;if(N instanceof A)if(R instanceof A)return new Y7(D,w,z);else{let S=R.head;if(S instanceof s0){let x=S,O=R.tail,E=S.name,h=S.handler,j=P(x,D),f=I8(z,U,q,E,h);Z=H,Q=q,X=U,W=f,V=N,G=O,J=j,Y=w}else{let x=S,O=R.tail,E=P(x,D);Z=H,Q=q,X=U,W=z,V=N,G=O,J=E,Y=w}}else if(R instanceof A){let S=N.head;if(S instanceof s0){let x=S,O=N.tail,E=S.name,h=P(x,w),j=UW(z,q,E);Z=H,Q=q,X=U,W=j,V=O,G=R,J=D,Y=h}else{let x=S,O=N.tail,E=P(x,w);Z=H,Q=q,X=U,W=z,V=O,G=R,J=D,Y=E}}else{let{head:S,tail:x}=N,O=R.head,E=R.tail,h=oX(S,O);if(h instanceof P0)if(S instanceof s0){let j=S.name,f=P(S,w),y=UW(z,q,j);Z=H,Q=q,X=U,W=y,V=x,G=R,J=D,Y=f}else{let j=P(S,w);Z=H,Q=q,X=U,W=z,V=x,G=R,J=D,Y=j}else if(h instanceof N0)if(S instanceof nZ)if(O instanceof nZ){let j,f=O.name;if(f==="value")j=H||S.value!==O.value;else if(f==="checked")j=H||S.value!==O.value;else if(f==="selected")j=H||S.value!==O.value;else j=S.value!==O.value;let y=j,g;if(y)g=P(O,D);else g=D;let d=g;Z=H,Q=q,X=U,W=z,V=x,G=E,J=d,Y=w}else if(O instanceof s0){let{name:j,handler:f}=O,y=P(O,D),g=P(S,w),d=I8(z,U,q,j,f);Z=H,Q=q,X=U,W=d,V=x,G=E,J=y,Y=g}else{let j=P(O,D),f=P(S,w);Z=H,Q=q,X=U,W=z,V=x,G=E,J=j,Y=f}else if(S instanceof QX)if(O instanceof QX){let j,f=O.name;if(f==="scrollLeft")j=!0;else if(f==="scrollRight")j=!0;else if(f==="value")j=H||!I0(S.value,O.value);else if(f==="checked")j=H||!I0(S.value,O.value);else if(f==="selected")j=H||!I0(S.value,O.value);else j=!I0(S.value,O.value);let y=j,g;if(y)g=P(O,D);else g=D;let d=g;Z=H,Q=q,X=U,W=z,V=x,G=E,J=d,Y=w}else if(O instanceof s0){let{name:j,handler:f}=O,y=P(O,D),g=P(S,w),d=I8(z,U,q,j,f);Z=H,Q=q,X=U,W=d,V=x,G=E,J=y,Y=g}else{let j=P(O,D),f=P(S,w);Z=H,Q=q,X=U,W=z,V=x,G=E,J=j,Y=f}else if(O instanceof s0){let{name:j,handler:f}=O,y=S.prevent_default!==O.prevent_default||S.stop_propagation!==O.stop_propagation||S.immediate!==O.immediate||!xK(S.limit,O.limit),g;if(y)g=P(O,D);else g=D;let d=g,Z0=I8(z,U,q,j,f);Z=H,Q=q,X=U,W=Z0,V=x,G=E,J=d,Y=w}else{let j=S.name,f=P(O,D),y=P(S,w),g=UW(z,q,j);Z=H,Q=q,X=U,W=g,V=x,G=E,J=f,Y=y}else if(O instanceof s0){let{name:j,handler:f}=O,y=P(O,D),g=I8(z,U,q,j,f);Z=H,Q=q,X=U,W=g,V=N,G=E,J=y,Y=w}else{let j=P(O,D);Z=H,Q=q,X=U,W=z,V=N,G=E,J=j,Y=w}}}}function JV(Z,Q,X,W,V,G,J,Y,H,q,U,z,N,R){while(!0){let D=Z,w=Q,S=X,x=W,O=V,E=G,h=J,j=Y,f=H,y=q,g=U,d=z,Z0=N,L0=R;if(D instanceof A)if(S instanceof A)return new IW(new WX(f,h,g,d),L0);else{let c0=q7(L0,Z0,y,j,S),a0=GV(S,j-E),z0=P(a0,g);return new IW(new WX(f,h,z0,d),c0)}else if(S instanceof A){let{head:c0,tail:a0}=D,z0;if(c0.key===""||!f6(O,c0.key))z0=h+A0(c0);else z0=h;let s=z0,K0=rZ(L0,y,j,c0);Z=a0,Q=w,X=S,W=x,V=O,G=E,J=s,Y=j,H=f,q=y,U=g,z=d,N=Z0,R=K0}else{let c0=D.head,a0=S.head;if(c0.key!==a0.key){let z0=D.tail,B0=S.tail,s=Y8(w,a0.key),K0=Y8(x,c0.key),m=f6(O,c0.key);if(K0 instanceof B)if(s instanceof B)if(m)Z=z0,Q=w,X=S,W=x,V=O,G=E-A0(c0),J=h,Y=j,H=f,q=y,U=g,z=d,N=Z0,R=L0;else{let Q0=s[0],u=A0(a0),i=j-E,X0=W7(a0.key,i,u),a=P(X0,g),U0=SK(O,a0.key),q0=E+u;Z=P(Q0,D),Q=w,X=S,W=x,V=U0,G=q0,J=h,Y=j,H=f,q=y,U=a,z=d,N=Z0,R=L0}else{let Q0=j-E,u=A0(a0),i=sZ(L0,Z0,y,j,a0),X0=GV(K([a0]),Q0),a=P(X0,g);Z=D,Q=w,X=B0,W=x,V=O,G=E+u,J=h,Y=j+u,H=f,q=y,U=a,z=d,N=Z0,R=i}else if(s instanceof B){let Q0=A0(c0),u=E-Q0,i=rZ(L0,y,j,c0),X0=V7(c0.key,Q0),a=P(X0,g);Z=z0,Q=w,X=S,W=x,V=O,G=u,J=h,Y=j,H=f,q=y,U=a,z=d,N=Z0,R=i}else{let Q0=A0(c0),u=A0(a0),i=xQ(j-E,Q0,a0),X0,U0=rZ(L0,y,j,c0);X0=sZ(U0,Z0,y,j,a0);let q0=X0;Z=z0,Q=w,X=B0,W=x,V=O,G=E-Q0+u,J=h,Y=j+u,H=f,q=y,U=P(i,g),z=d,N=Z0,R=q0}}else{let z0=D.head;if(z0 instanceof ZZ){let B0=S.head;if(B0 instanceof ZZ){let s=z0,K0=D.tail,m=B0,Q0=S.tail,u=j+1,i=s.children_count,X0=m.children_count,a=qQ(Z0,m.mapper),U0=JV(s.children,s.keyed_children,m.children,m.keyed_children,t8(),E,0,u,-1,y,v,d,a,L0),q0;if(U0.patch.removed>0){let mZ=u+X0-E,XQ=K7(mZ,U0.patch.removed);q0=S0(U0.patch.changes,P(XQ,g))}else q0=S0(U0.patch.changes,g);let OZ=q0;Z=K0,Q=w,X=Q0,W=x,V=O,G=E+X0-i,J=h,Y=u+X0,H=f,q=y,U=OZ,z=U0.patch.children,N=Z0,R=U0.events}else{let s=z0,K0=D.tail,m=B0,Q0=S.tail,u=A0(s),i=A0(m),X0=xQ(j-E,u,m),a,q0=rZ(L0,y,j,s);a=sZ(q0,Z0,y,j,m);let p0=a;Z=K0,Q=w,X=Q0,W=x,V=O,G=E-u+i,J=h,Y=j+i,H=f,q=y,U=P(X0,g),z=d,N=Z0,R=p0}}else if(z0 instanceof RZ){let B0=S.head;if(B0 instanceof RZ){let s=z0,K0=B0;if(s.namespace===K0.namespace&&s.tag===K0.tag){let m=D.tail,Q0=S.tail,u=qQ(Z0,K0.mapper),i=HQ(y,j,K0.key),X0=hY(L0,K0.namespace,K0.tag,i),a=J7(X0,i,u,L0,s.attributes,K0.attributes,v,v),U0,q0,p0;U0=a.added,q0=a.removed,p0=a.events;let OZ;if(U0 instanceof A&&q0 instanceof A)OZ=v;else OZ=K([KV(U0,q0)]);let mZ=OZ,XQ=JV(s.children,s.keyed_children,K0.children,K0.keyed_children,t8(),0,0,0,j,i,mZ,v,u,p0),WQ,zQ=XQ.patch;if(zQ.changes instanceof A)if(zQ.children instanceof A)if(zQ.removed===0)WQ=d;else WQ=P(XQ.patch,d);else WQ=P(XQ.patch,d);else WQ=P(XQ.patch,d);let EG=WQ;Z=m,Q=w,X=Q0,W=x,V=O,G=E,J=h,Y=j+1,H=f,q=y,U=g,z=EG,N=Z0,R=XQ.events}else{let m=z0,Q0=D.tail,u=B0,i=S.tail,X0=A0(m),a=A0(u),U0=xQ(j-E,X0,u),q0,OZ=rZ(L0,y,j,m);q0=sZ(OZ,Z0,y,j,u);let mZ=q0;Z=Q0,Q=w,X=i,W=x,V=O,G=E-X0+a,J=h,Y=j+a,H=f,q=y,U=P(U0,g),z=d,N=Z0,R=mZ}}else{let s=z0,K0=D.tail,m=B0,Q0=S.tail,u=A0(s),i=A0(m),X0=xQ(j-E,u,m),a,q0=rZ(L0,y,j,s);a=sZ(q0,Z0,y,j,m);let p0=a;Z=K0,Q=w,X=Q0,W=x,V=O,G=E-u+i,J=h,Y=j+i,H=f,q=y,U=P(X0,g),z=d,N=Z0,R=p0}}else if(z0 instanceof SZ){let B0=S.head;if(B0 instanceof SZ){let s=z0,K0=B0;if(s.content===K0.content){let m=D.tail,Q0=S.tail;Z=m,Q=w,X=Q0,W=x,V=O,G=E,J=h,Y=j+1,H=f,q=y,U=g,z=d,N=Z0,R=L0}else{let m=D.tail,Q0=B0,u=S.tail,i=VV(j,0,K([Q7(Q0.content)]),v);Z=m,Q=w,X=u,W=x,V=O,G=E,J=h,Y=j+1,H=f,q=y,U=g,z=P(i,d),N=Z0,R=L0}}else{let s=z0,K0=D.tail,m=B0,Q0=S.tail,u=A0(s),i=A0(m),X0=xQ(j-E,u,m),a,q0=rZ(L0,y,j,s);a=sZ(q0,Z0,y,j,m);let p0=a;Z=K0,Q=w,X=Q0,W=x,V=O,G=E-u+i,J=h,Y=j+i,H=f,q=y,U=P(X0,g),z=d,N=Z0,R=p0}}else{let B0=S.head;if(B0 instanceof q8){let s=z0,K0=D.tail,m=B0,Q0=S.tail,u=qQ(Z0,m.mapper),i=HQ(y,j,m.key),X0=J7(!1,i,u,L0,s.attributes,m.attributes,v,v),a,U0,q0;a=X0.added,U0=X0.removed,q0=X0.events;let p0;if(a instanceof A&&U0 instanceof A)p0=v;else p0=K([KV(a,U0)]);let OZ=p0,mZ;if(s.inner_html===m.inner_html)mZ=OZ;else mZ=P(X7(m.inner_html),OZ);let WQ=mZ,zQ;if(WQ instanceof A)zQ=d;else zQ=P(VV(j,0,WQ,K([])),d);let D9=zQ;Z=K0,Q=w,X=Q0,W=x,V=O,G=E,J=h,Y=j+1,H=f,q=y,U=g,z=D9,N=Z0,R=q0}else{let s=z0,K0=D.tail,m=B0,Q0=S.tail,u=A0(s),i=A0(m),X0=xQ(j-E,u,m),a,q0=rZ(L0,y,j,s);a=sZ(q0,Z0,y,j,m);let p0=a;Z=K0,Q=w,X=Q0,W=x,V=O,G=E-u+i,J=h,Y=j+i,H=f,q=y,U=P(X0,g),z=d,N=Z0,R=p0}}}}}}function VX(Z,Q,X){return JV(K([Q]),YZ(),K([X]),YZ(),t8(),0,0,0,0,KW,v,v,u0,H7(Z))}class qV{offset=0;#Z=null;#Q=()=>{};#G=!1;constructor(Z,Q,{useServerEvents:X=!1}={}){this.#Z=Z,this.#Q=Q,this.#G=X}mount(Z){FW(this.#Z,this.#U(Z))}#K=[];push(Z){let Q=this.offset;if(Q)lZ(Z.changes,(X)=>{switch(X.kind){case HW:case JW:X.before=(X.before|0)+Q;break;case qW:case YW:X.from=(X.from|0)+Q;break}}),lZ(Z.children,(X)=>{X.index=(X.index|0)+Q});this.#K.push({node:this.#Z,patch:Z}),this.#X()}#X(){let Z=this;while(Z.#K.length){let{node:Q,patch:X}=Z.#K.pop();if(lZ(X.changes,(W)=>{switch(W.kind){case HW:Z.#W(Q,W.children,W.before);break;case JW:Z.#V(Q,W.key,W.before,W.count);break;case WV:Z.#Y(Q,W.key,W.count);break;case qW:Z.#J(Q,W.from,W.count);break;case YW:Z.#M(Q,W.from,W.count,W.with);break;case ZV:Z.#q(Q,W.content);break;case QV:Z.#F(Q,W.inner_html);break;case XV:Z.#I(Q,W.added,W.removed);break}}),X.removed)Z.#J(Q,Q.childNodes.length-X.removed,X.removed);lZ(X.children,(W)=>{Z.#K.push({node:KX(Q,W.index),patch:W})})}}#W(Z,Q,X){let W=I7();lZ(Q,(V)=>{let G=this.#U(V);HV(Z,G),FW(W,G)}),YV(Z,W,KX(Z,X))}#V(Z,Q,X,W){let V=F7(Z,Q),G=KX(Z,X);for(let J=0;J<W&&V!==null;++J){let Y=V.nextSibling;if(AK)Z.moveBefore(V,G);else YV(Z,V,G);V=Y}}#Y(Z,Q,X){this.#H(Z,F7(Z,Q),X)}#J(Z,Q,X){this.#H(Z,KX(Z,Q),X)}#H(Z,Q,X){while(X-- >0&&Q!==null){let W=Q.nextSibling,V=Q[b0].key;if(V)Z[b0].keyedChildren.delete(V);for(let[G,{timeout:J}]of Q[b0].debouncers)clearTimeout(J);Z.removeChild(Q),Q=W}}#M(Z,Q,X,W){this.#J(Z,Q,X);let V=this.#U(W);HV(Z,V),YV(Z,V,KX(Z,Q))}#q(Z,Q){Z.data=Q??""}#F(Z,Q){Z.innerHTML=Q??""}#I(Z,Q,X){lZ(X,(W)=>{let V=W.name;if(Z[b0].handlers.has(V)){if(Z.removeEventListener(V,z7),Z[b0].handlers.delete(V),Z[b0].throttles.has(V))Z[b0].throttles.delete(V);if(Z[b0].debouncers.has(V))clearTimeout(Z[b0].debouncers.get(V).timeout),Z[b0].debouncers.delete(V)}else Z.removeAttribute(V),N7[V]?.removed?.(Z,V)}),lZ(Q,(W)=>{this.#P(Z,W)})}#U(Z){switch(Z.kind){case a6:{let Q=U7(Z);return this.#z(Q,Z),this.#W(Q,Z.children,0),Q}case o6:{let Q=M7(Z.content);return iZ(Q,Z.key),Q}case i6:{let Q=I7(),X=M7();return iZ(X,Z.key),FW(Q,X),lZ(Z.children,(W)=>{FW(Q,this.#U(W))}),Q}case dK:{let Q=U7(Z);return this.#z(Q,Z),this.#F(Q,Z.inner_html),Q}}}#z(Z,{attributes:Q}){lZ(Q,(X)=>this.#P(Z,X))}#P(Z,Q){let X=Z[b0];switch(Q.kind){case g6:{let W=Q.name,V=Q.value??"";if(V!==Z.getAttribute(W))Z.setAttribute(W,V);N7[W]?.added?.(Z,V);break}case v6:Z[Q.name]=Q.value;break;case _6:{if(!X.handlers.has(Q.name))Z.addEventListener(Q.name,z7,{passive:!Q.prevent_default});let{prevent_default:W,stop_propagation:V,immediate:G}=Q,J=Array.isArray(Q.include)?Q.include:[];if(Q.limit?.kind===m6){let Y=X.throttles.get(Q.name)??{last:0,delay:Q.limit.delay};X.throttles.set(Q.name,Y)}if(Q.limit?.kind===$6){let Y=X.debouncers.get(Q.name)??{timeout:null,delay:Q.limit.delay};X.debouncers.set(Q.name,Y)}X.handlers.set(Q.name,(Y)=>{if(W)Y.preventDefault();if(V)Y.stopPropagation();let H=Y.type,q="",U=Y.currentTarget;while(U!==this.#Z){let N=U[b0].key,R=U.parentNode;if(N)q=`${r6}${N}${q}`;else{let D=R.childNodes,w=[].indexOf.call(D,U);if(R===this.#Z)w-=this.offset;q=`${n6}${w}${q}`}U=R}q=q.slice(1);let z=this.#G?vY(Y,J):Y;if(X.throttles.has(H)){let N=X.throttles.get(H),R=Date.now(),D=N.last||0;if(R>D+N.delay)N.last=R,this.#Q(z,q,H,G);else Y.preventDefault()}else if(X.debouncers.has(H)){let N=X.debouncers.get(H);clearTimeout(N.timeout),N.timeout=setTimeout(()=>{this.#Q(z,q,H,G)},N.delay)}else this.#Q(z,q,H,G)});break}}}}var lZ=(Z,Q)=>{if(Array.isArray(Z))for(let X=0;X<Z.length;X++)Q(Z[X]);else if(Z)for(Z;Z.tail;Z=Z.tail)Q(Z.head)},FW=(Z,Q)=>Z.appendChild(Q),YV=(Z,Q,X)=>Z.insertBefore(Q,X??null),U7=({key:Z,tag:Q,namespace:X})=>{let W=BZ.createElementNS(X||sX,Q);return iZ(W,Z),W},M7=(Z)=>BZ.createTextNode(Z??""),I7=()=>BZ.createDocumentFragment(),KX=(Z,Q)=>Z.childNodes[Q|0],b0=Symbol("lustre"),iZ=(Z,Q="")=>{switch(Z.nodeType){case lX:case e8:Z[b0]={key:Q,keyedChildren:new Map,handlers:new Map,throttles:new Map,debouncers:new Map};break;case iX:Z[b0]={key:Q,debouncers:new Map};break}};var HV=(Z,Q)=>{if(Q.nodeType===e8){for(Q=Q.firstChild;Q;Q=Q.nextSibling)HV(Z,Q);return}let X=Q[b0].key;if(X)Z[b0].keyedChildren.set(X,new WeakRef(Q))},F7=(Z,Q)=>Z[b0].keyedChildren.get(Q).deref(),z7=(Z)=>{let X=Z.currentTarget[b0].handlers.get(Z.type);if(Z.type==="submit")Z.detail??={},Z.detail.formData=[...new FormData(Z.target).entries()];X(Z)},vY=(Z,Q=[])=>{let X={};if(Z.type==="input"||Z.type==="change")Q.push("target.value");if(Z.type==="submit")Q.push("detail.formData");for(let W of Q){let V=W.split(".");for(let G=0,J=Z,Y=X;G<V.length;G++){if(G===V.length-1){Y[V[G]]=J[V[G]];break}Y=Y[V[G]]??={},J=J[V[G]]}}return X},P7=(Z)=>{return{added(Q){Q[Z]=!0},removed(Q){Q[Z]=!1}}},_Y=(Z)=>{return{added(Q,X){Q[Z]=X}}},N7={checked:P7("checked"),selected:P7("selected"),value:_Y("value"),autofocus:{added(Z){queueMicrotask(()=>Z.focus?.())}},autoplay:{added(Z){try{Z.play?.()}catch(Q){console.error(Q)}}}};var B7=(Z)=>{let Q=R7(Z);if(Q===null||Q.children instanceof A){let X=D7();return iZ(X),Z.appendChild(X),AZ()}else if(Q.children instanceof v0&&Q.children.tail instanceof A)return Q.children.head;else{let X=D7();return iZ(X),Z.insertBefore(X,Z.firstChild),UV(Q.children)}},D7=()=>{return BZ.createTextNode("")},R7=(Z)=>{switch(Z.nodeType){case lX:{let Q=Z.getAttribute("data-lustre-key");if(iZ(Z,Q),Q)Z.removeAttribute("data-lustre-key");let{localName:X,namespaceURI:W}=Z,V=!W||W===sX;if(V&&$Y.includes(X))mY(X,Z);let G=uY(Z),J=j7(Z),Y=V?M0(X,G,J):kQ(W,X,G,J);return Q?GW(Q,Y):Y}case iX:return iZ(Z),C(Z.data);case e8:return iZ(Z),Z.childNodes.length>0?UV(j7(Z)):null;default:return null}},$Y=["input","select","textarea"],mY=(Z,Q)=>{let{value:X,checked:W}=Q;if(Z==="input"&&Q.type==="checkbox"&&!W)return;if(Z==="input"&&Q.type==="radio"&&!W)return;if(Q.type!=="checkbox"&&Q.type!=="radio"&&!X)return;queueMicrotask(()=>{if(Q.value=X,Q.checked=W,Q.dispatchEvent(new Event("input",{bubbles:!0})),Q.dispatchEvent(new Event("change",{bubbles:!0})),BZ.activeElement!==Q)Q.dispatchEvent(new Event("blur",{bubbles:!0}))})},j7=(Z)=>{let Q=v,X=Z.lastChild;while(X){let W=R7(X),V=X.previousSibling;if(W)Q=new v0(W,Q);else Z.removeChild(X);X=V}return Q},uY=(Z)=>{let Q=Z.attributes.length,X=v;while(Q-- >0)X=new v0(cY(Z.attributes[Q]),X);return X},cY=(Z)=>{let{localName:Q,value:X}=Z;return F(Q,X)};var GX=()=>!!BZ;var MV=(Z,Q)=>Z===Q;class zW{constructor(Z,[Q,X],W,V){this.root=Z,this.#Z=Q,this.#Q=W,this.#G=V,this.#W=new qV(this.root,(G,J,Y)=>{let[H,q]=YX(this.#X,J,Y,G);if(this.#X=H,q.isOk())this.dispatch(q[0],!1)}),this.#K=B7(this.root),this.#X=JX(),this.#q=!0,this.#I(X)}root=null;set offset(Z){this.#W.offset=Z}dispatch(Z,Q=!1){if(this.#q||=Q,this.#V)this.#Y.push(Z);else{let[X,W]=this.#G(this.#Z,Z);this.#Z=X,this.#I(W)}}emit(Z,Q){(this.root.host??this.root).dispatchEvent(new CustomEvent(Z,{detail:Q,bubbles:!0,composed:!0}))}#Z;#Q;#G;#K;#X;#W;#V=!1;#Y=[];#J=v;#H=v;#M=null;#q=!1;#F={dispatch:(Z,Q)=>this.dispatch(Z,Q),emit:(Z,Q)=>this.emit(Z,Q),select:()=>{},root:()=>this.root};#I(Z){this.#V=!0;while(!0){for(let Q=Z.synchronous;Q.tail;Q=Q.tail)Q.head(this.#F);if(this.#J=A7(this.#J,Z.before_paint),this.#H=A7(this.#H,Z.after_paint),!this.#Y.length)break;[this.#Z,Z]=this.#G(this.#Z,this.#Y.shift())}if(this.#V=!1,this.#q)cancelAnimationFrame(this.#M),this.#U();else if(!this.#M)this.#M=requestAnimationFrame(()=>{this.#U()})}#U(){this.#q=!1,this.#M=null;let Z=this.#Q(this.#Z),{patch:Q,events:X}=VX(this.#X,this.#K,Z);if(this.#X=X,this.#K=Z,this.#W.push(Q),this.#J instanceof v0){let W=S7(this.#J);this.#J=v,queueMicrotask(()=>{this.#q=!0,this.#I(W)})}if(this.#H instanceof v0){let W=S7(this.#H);this.#H=v,requestAnimationFrame(()=>{this.#q=!0,this.#I(W)})}}}function S7(Z){return{synchronous:Z,after_paint:v,before_paint:v}}function A7(Z,Q){if(Z instanceof A)return Q;else if(Q instanceof A)return Z;else return S0(Z,Q)}class aZ extends I{constructor(Z,Q,X){super();this.handlers=Z,this.dispatched_paths=Q,this.next_dispatched_paths=X}}function JX(){return new aZ(YZ(),v,v)}function H7(Z){return new aZ(Z.handlers,Z.next_dispatched_paths,v)}function L7(Z,Q,X){return c6(Z,l6(Q,X))}function UW(Z,Q,X){let W=L7(Z.handlers,Q,X);return new aZ(W,Z.dispatched_paths,Z.next_dispatched_paths)}function T7(Z,Q,X){return k0(X,Z,(W,V)=>{if(V instanceof s0){let G=V.name;return L7(W,Q,G)}else return W})}function YX(Z,Q,X,W){let V=P(Q,Z.next_dispatched_paths),G=new aZ(Z.handlers,Z.dispatched_paths,V),J=Y8(G.handlers,Q+s6+X);if(J instanceof B){let Y=J[0];return[G,dZ(W,Y)]}else return[G,new k(K([]))]}function MW(Z,Q){return cK(Q,Z.dispatched_paths)}function w7(Z,Q,X,W,V){return H8(Z,l6(X,W),tQ(V,u0(Q)))}function I8(Z,Q,X,W,V){let G=w7(Z.handlers,Q,X,W,V);return new aZ(G,Z.dispatched_paths,Z.next_dispatched_paths)}function O7(Z,Q,X,W){return k0(W,Z,(V,G)=>{if(G instanceof s0){let{name:J,handler:Y}=G;return w7(V,Q,X,J,Y)}else return V})}function qQ(Z,Q){let X=MV(Z,u0);if(MV(Q,u0))return Z;else if(X)return Q;else return(V)=>{return Z(Q(V))}}function C7(Z,Q,X,W){while(!0){let V=Z,G=Q,J=X,Y=W;if(Y instanceof A)return V;else{let{head:H,tail:q}=Y;Z=E7(V,G,J,H),Q=G,X=J+A0(H),W=q}}}function E7(Z,Q,X,W){if(W instanceof ZZ){let V=W.children;return C7(Z,Q,X+1,V)}else if(W instanceof RZ){let{attributes:V,children:G}=W,J=HQ(Q,X,W.key),H=T7(Z,J,V);return C7(H,J,0,G)}else if(W instanceof SZ)return Z;else{let V=W.attributes,G=HQ(Q,X,W.key);return T7(Z,G,V)}}function rZ(Z,Q,X,W){let V=E7(Z.handlers,Q,X,W);return new aZ(V,Z.dispatched_paths,Z.next_dispatched_paths)}function IV(Z,Q,X,W,V){while(!0){let G=Z,J=Q,Y=X,H=W,q=V;if(q instanceof A)return G;else{let{head:U,tail:z}=q;Z=x7(G,J,Y,H,U),Q=J,X=Y,W=H+A0(U),V=z}}}function x7(Z,Q,X,W,V){if(V instanceof ZZ){let G=V.children,J=qQ(Q,V.mapper),Y=W+1;return IV(Z,J,X,Y,G)}else if(V instanceof RZ){let{attributes:G,children:J}=V,Y=HQ(X,W,V.key),H=qQ(Q,V.mapper),U=O7(Z,H,Y,G);return IV(U,H,Y,0,J)}else if(V instanceof SZ)return Z;else{let G=V.attributes,J=HQ(X,W,V.key),Y=qQ(Q,V.mapper);return O7(Z,Y,J,G)}}function sZ(Z,Q,X,W,V){let G=x7(Z.handlers,Q,X,W,V);return new aZ(G,Z.dispatched_paths,Z.next_dispatched_paths)}function k7(Z){return sZ(JX(),u0,KW,0,Z)}function q7(Z,Q,X,W,V){let G=IV(Z.handlers,Q,X,W,V);return new aZ(G,Z.dispatched_paths,Z.next_dispatched_paths)}function M0(Z,Q,X){return t6("",u0,"",Z,Q,X,YZ(),!1,!1)}function kQ(Z,Q,X,W){return t6("",u0,Z,Q,X,W,YZ(),!1,!1)}function C(Z){return e6("",u0,Z)}function AZ(){return e6("",u0,"")}function pY(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W;else{let V=X.head;if(V instanceof ZZ){let G=X.tail,J=V.children_count;Z=G,Q=W+J}else Z=X.tail,Q=W+1}}}function UV(Z){return nK("",u0,Z,YZ(),pY(Z,0))}function t(Z){return C(Z)}function f7(Z,Q){return M0("footer",Z,Q)}function PW(Z,Q){return M0("h1",Z,Q)}function y7(Z,Q){return M0("h3",Z,Q)}function NW(Z,Q){return M0("h4",Z,Q)}function b7(Z,Q){return M0("h5",Z,Q)}function h7(Z,Q){return M0("main",Z,Q)}function g7(Z,Q){return M0("section",Z,Q)}function L(Z,Q){return M0("div",Z,Q)}function Y0(Z,Q){return M0("li",Z,Q)}function XZ(Z,Q){return M0("p",Z,Q)}function oZ(Z,Q){return M0("ul",Z,Q)}function J0(Z,Q){return M0("a",Z,Q)}function v7(Z,Q){return M0("small",Z,Q)}function j0(Z,Q){return M0("span",Z,Q)}function F8(Z){return M0("img",Z,v)}function E0(Z,Q){return M0("button",Z,Q)}function FV(Z,Q){return M0("fieldset",Z,Q)}function zV(Z,Q){return M0("form",Z,Q)}function WZ(Z){return M0("input",Z,v)}function i0(Z,Q){return M0("label",Z,Q)}class PV extends I{constructor(Z,Q,X,W,V,G){super();this.kind=Z,this.open_shadow_root=Q,this.will_adopt_styles=X,this.observed_attributes=W,this.observed_properties=V,this.vdom=G}}class NV extends I{constructor(Z,Q){super();this.kind=Z,this.patch=Q}}class DW extends I{constructor(Z,Q,X){super();this.kind=Z,this.name=Q,this.data=X}}class jW extends I{constructor(Z,Q,X){super();this.kind=Z,this.name=Q,this.value=X}}class DV extends I{constructor(Z,Q,X,W){super();this.kind=Z,this.path=Q,this.name=X,this.event=W}}class BV extends I{constructor(Z){super();this.message=Z}}class RV extends I{constructor(Z){super();this.callback=Z}}class SV extends I{constructor(Z){super();this.callback=Z}}class fQ extends I{constructor(Z){super();this.message=Z}}class P8 extends I{constructor(Z,Q){super();this.name=Z,this.data=Q}}class AV extends I{constructor(Z,Q){super();this.messages=Z,this.effect=Q}}class yQ extends I{}class $7 extends I{constructor(Z,Q,X,W,V,G,J,Y){super();this.open_shadow_root=Z,this.adopt_styles=Q,this.attributes=X,this.properties=W,this.is_form_associated=V,this.on_form_autofill=G,this.on_form_reset=J,this.on_form_restore=Y}}function m7(Z){let Q=new $7(!1,!0,rX(),rX(),!1,aX,aX,aX);return k0(Z,Q,(X,W)=>{return W.apply(X)})}class TV{static start({init:Z,update:Q,view:X},W,V){if(!GX())return new k(new HX);let G=W instanceof HTMLElement?W:BZ.querySelector(W);if(!G)return new k(new OV(W));return new B(new TV(G,Z(V),Q,X))}#Z;constructor(Z,[Q,X],W,V){this.#Z=new zW(Z,[Q,X],V,W)}send(Z){switch(Z.constructor){case fQ:{this.dispatch(Z.message,!1);break}case P8:{this.emit(Z.name,Z.data);break}case yQ:break}}dispatch(Z,Q){this.#Z.dispatch(Z,Q)}emit(Z,Q){this.#Z.emit(Z,Q)}}var u7=TV.start;class rY{#Z;#Q;#G;#K;#X;#W;#V=new Set;constructor([Z,Q],X,W,V){this.#Z=Z,this.#Q=W,this.#G=X,this.#K=V,this.#X=this.#G(this.#Z),this.#W=k7(this.#X),this.#Y(Q.all,!1)}send(Z){if(this.#Z===null)return;switch(Z.constructor){case BV:switch(Z.message.constructor){case jW:{let{name:Q,value:X}=Z.messgae,W=[],V=this.#K.get(Q);if(!V)break;let G=dZ(X,V);if(G.constructor!==B)break;let[J,Y]=this.#Q(this.#Z,G[0]);this.#Z=J,W.push(Y);while(W.length)this.#Y(W.shift().all)}case DV:{let{path:Q,name:X,event:W}=Z.message,[V,G]=YX(this.#W,Q,X,W);if(this.#W=V,G.constructor===B)this.dispatch(G[0]);return}}case RV:{if(this.#V.has(Z.callback))return;let Q=new PV(this.#X);this.#V.add(Z.callback),Z.callback(Q);return}case SV:{this.#V.delete(Z.callback);return}case fQ:{this.dispatch(Z.message);return}case P8:{let Q=new DW(Z.name,Z.data);for(let X of this.#V)X(Q);return}case AV:{let Q=Z.messages,X=[Z.effect];for(let W=Q;Q.tail;W=W.tail){let[V,G]=this.#Q(this.#Z,W.head);this.#Z=V,X.push(G)}while(X.length)this.#Y(X.shift().all);return}case yQ:this.#Z=null,this.#Q=null,this.#G=null,this.#K=null,this.#W=JX(),this.#V.clear()}}dispatch(Z){let[Q,X]=this.#Q(this.#Z,Z);this.#Z=Q,this.#Y(X.all,immediate)}#Y(Z){let Q=[],X={root:null,emit:(W,V)=>this.#H(W,V),dispatch:(W)=>Q.push(W),select:()=>{}};while(!0){for(let V=Z;V.tail;V=V.tail)V.head(X);if(!Q.length)break;let W=Q.shift();[this.#Z,Z]=this.#Q(this.#Z,W)}this.#J()}#J(){let Z=this.#G(this.#Z),{patch:Q,events:X}=VX(this.#W,this.#X,Z);this.#W=X,this.#X=Z;let W=new NV(Q);for(let V of this.#V)V(W)}#H(Z,Q){let X=new DW(Z,Q);for(let W of this.#V)W(X)}}class c7 extends I{constructor(Z,Q,X,W){super();this.init=Z,this.update=Q,this.view=X,this.config=W}}class OV extends I{constructor(Z){super();this.selector=Z}}class HX extends I{}function p7(Z,Q,X){return new c7(Z,Q,X,m7(v))}function d7(Z,Q,X){return GK(!GX(),new k(new HX),()=>{return u7(Z,Q,X)})}class n extends I{constructor(Z,Q,X,W,V,G,J){super();this.scheme=Z,this.userinfo=Q,this.host=X,this.port=W,this.path=V,this.query=G,this.fragment=J}}var lY=new n(new b,new b,new b,new b,"",new b,new b);function iY(Z){return 48>=Z&&Z<=57||65>=Z&&Z<=90||97>=Z&&Z<=122||Z===58||Z===46}function vZ(Z,Q){return new B(new n(Q.scheme,Q.userinfo,Q.host,Q.port,Q.path,Q.query,new T(Z)))}function aY(Z,Q,X,W){while(!0){let V=Z,G=Q,J=X,Y=W;if(G.startsWith("#"))if(Y===0){let H=G.slice(1);return vZ(H,J)}else{let H=G.slice(1),q=$0(V,0,Y),U=new n(J.scheme,J.userinfo,J.host,J.port,J.path,new T(q),J.fragment);return vZ(H,U)}else if(G==="")return new B(new n(J.scheme,J.userinfo,J.host,J.port,J.path,new T(V),J.fragment));else{let H=RQ(G),q;q=H[1],Z=V,Q=q,X=J,W=Y+1}}}function UQ(Z,Q){return aY(Z,Z,Q,0)}function oY(Z,Q,X,W){while(!0){let V=Z,G=Q,J=X,Y=W;if(G.startsWith("?")){let H=G.slice(1),q=$0(V,0,Y),U=new n(J.scheme,J.userinfo,J.host,J.port,q,J.query,J.fragment);return UQ(H,U)}else if(G.startsWith("#")){let H=G.slice(1),q=$0(V,0,Y),U=new n(J.scheme,J.userinfo,J.host,J.port,q,J.query,J.fragment);return vZ(H,U)}else if(G==="")return new B(new n(J.scheme,J.userinfo,J.host,J.port,V,J.query,J.fragment));else{let H=RQ(G),q;q=H[1],Z=V,Q=q,X=J,W=Y+1}}}function D8(Z,Q){return oY(Z,Z,Q,0)}function gZ(Z,Q,X){while(!0){let W=Z,V=Q,G=X;if(W.startsWith("0"))Z=W.slice(1),Q=V,X=G*10;else if(W.startsWith("1"))Z=W.slice(1),Q=V,X=G*10+1;else if(W.startsWith("2"))Z=W.slice(1),Q=V,X=G*10+2;else if(W.startsWith("3"))Z=W.slice(1),Q=V,X=G*10+3;else if(W.startsWith("4"))Z=W.slice(1),Q=V,X=G*10+4;else if(W.startsWith("5"))Z=W.slice(1),Q=V,X=G*10+5;else if(W.startsWith("6"))Z=W.slice(1),Q=V,X=G*10+6;else if(W.startsWith("7"))Z=W.slice(1),Q=V,X=G*10+7;else if(W.startsWith("8"))Z=W.slice(1),Q=V,X=G*10+8;else if(W.startsWith("9"))Z=W.slice(1),Q=V,X=G*10+9;else if(W.startsWith("?")){let J=W.slice(1),Y=new n(V.scheme,V.userinfo,V.host,new T(G),V.path,V.query,V.fragment);return UQ(J,Y)}else if(W.startsWith("#")){let J=W.slice(1),Y=new n(V.scheme,V.userinfo,V.host,new T(G),V.path,V.query,V.fragment);return vZ(J,Y)}else if(W.startsWith("/")){let J=new n(V.scheme,V.userinfo,V.host,new T(G),V.path,V.query,V.fragment);return D8(W,J)}else if(W==="")return new B(new n(V.scheme,V.userinfo,V.host,new T(G),V.path,V.query,V.fragment));else return new k(void 0)}}function BW(Z,Q){if(Z.startsWith(":0")){let X=Z.slice(2);return gZ(X,Q,0)}else if(Z.startsWith(":1")){let X=Z.slice(2);return gZ(X,Q,1)}else if(Z.startsWith(":2")){let X=Z.slice(2);return gZ(X,Q,2)}else if(Z.startsWith(":3")){let X=Z.slice(2);return gZ(X,Q,3)}else if(Z.startsWith(":4")){let X=Z.slice(2);return gZ(X,Q,4)}else if(Z.startsWith(":5")){let X=Z.slice(2);return gZ(X,Q,5)}else if(Z.startsWith(":6")){let X=Z.slice(2);return gZ(X,Q,6)}else if(Z.startsWith(":7")){let X=Z.slice(2);return gZ(X,Q,7)}else if(Z.startsWith(":8")){let X=Z.slice(2);return gZ(X,Q,8)}else if(Z.startsWith(":9")){let X=Z.slice(2);return gZ(X,Q,9)}else if(Z.startsWith(":"))return new k(void 0);else if(Z.startsWith("?")){let X=Z.slice(1);return UQ(X,Q)}else if(Z.startsWith("#")){let X=Z.slice(1);return vZ(X,Q)}else if(Z.startsWith("/"))return D8(Z,Q);else if(Z==="")return new B(Q);else return new k(void 0)}function s7(Z,Q,X,W){while(!0){let V=Z,G=Q,J=X,Y=W;if(G==="")return new B(new n(J.scheme,J.userinfo,new T(V),J.port,J.path,J.query,J.fragment));else if(G.startsWith(":")){let H=$0(V,0,Y),q=new n(J.scheme,J.userinfo,new T(H),J.port,J.path,J.query,J.fragment);return BW(G,q)}else if(G.startsWith("/")){let H=$0(V,0,Y),q=new n(J.scheme,J.userinfo,new T(H),J.port,J.path,J.query,J.fragment);return D8(G,q)}else if(G.startsWith("?")){let H=G.slice(1),q=$0(V,0,Y),U=new n(J.scheme,J.userinfo,new T(q),J.port,J.path,J.query,J.fragment);return UQ(H,U)}else if(G.startsWith("#")){let H=G.slice(1),q=$0(V,0,Y),U=new n(J.scheme,J.userinfo,new T(q),J.port,J.path,J.query,J.fragment);return vZ(H,U)}else{let H=RQ(G),q;q=H[1],Z=V,Q=q,X=J,W=Y+1}}}function tY(Z,Q,X,W){while(!0){let V=Z,G=Q,J=X,Y=W;if(G==="")return new B(new n(J.scheme,J.userinfo,new T(G),J.port,J.path,J.query,J.fragment));else if(G.startsWith("]"))if(Y===0){let H=G.slice(1);return BW(H,J)}else{let H=G.slice(1),q=$0(V,0,Y+1),U=new n(J.scheme,J.userinfo,new T(q),J.port,J.path,J.query,J.fragment);return BW(H,U)}else if(G.startsWith("/"))if(Y===0)return D8(G,J);else{let H=$0(V,0,Y),q=new n(J.scheme,J.userinfo,new T(H),J.port,J.path,J.query,J.fragment);return D8(G,q)}else if(G.startsWith("?"))if(Y===0){let H=G.slice(1);return UQ(H,J)}else{let H=G.slice(1),q=$0(V,0,Y),U=new n(J.scheme,J.userinfo,new T(q),J.port,J.path,J.query,J.fragment);return UQ(H,U)}else if(G.startsWith("#"))if(Y===0){let H=G.slice(1);return vZ(H,J)}else{let H=G.slice(1),q=$0(V,0,Y),U=new n(J.scheme,J.userinfo,new T(q),J.port,J.path,J.query,J.fragment);return vZ(H,U)}else{let H=RQ(G),q,U;if(q=H[0],U=H[1],iY(q))Z=V,Q=U,X=J,W=Y+1;else return s7(V,V,J,0)}}}function eY(Z,Q){return tY(Z,Z,Q,0)}function Z5(Z,Q){return s7(Z,Z,Q,0)}function N8(Z,Q){if(Z.startsWith("["))return eY(Z,Q);else if(Z.startsWith(":")){let X=new n(Q.scheme,Q.userinfo,new T(""),Q.port,Q.path,Q.query,Q.fragment);return BW(Z,X)}else if(Z==="")return new B(new n(Q.scheme,Q.userinfo,new T(""),Q.port,Q.path,Q.query,Q.fragment));else return Z5(Z,Q)}function Q5(Z,Q,X,W){while(!0){let V=Z,G=Q,J=X,Y=W;if(G.startsWith("@"))if(Y===0){let H=G.slice(1);return N8(H,J)}else{let H=G.slice(1),q=$0(V,0,Y),U=new n(J.scheme,new T(q),J.host,J.port,J.path,J.query,J.fragment);return N8(H,U)}else if(G==="")return N8(V,J);else if(G.startsWith("/"))return N8(V,J);else if(G.startsWith("?"))return N8(V,J);else if(G.startsWith("#"))return N8(V,J);else{let H=RQ(G),q;q=H[1],Z=V,Q=q,X=J,W=Y+1}}}function X5(Z,Q){return Q5(Z,Z,Q,0)}function CV(Z,Q){if(Z==="//")return new B(new n(Q.scheme,Q.userinfo,new T(""),Q.port,Q.path,Q.query,Q.fragment));else if(Z.startsWith("//")){let X=Z.slice(2);return X5(X,Q)}else return D8(Z,Q)}function W5(Z,Q,X,W){while(!0){let V=Z,G=Q,J=X,Y=W;if(G.startsWith("/"))if(Y===0)return CV(G,J);else{let H=$0(V,0,Y),q=new n(new T(MZ(H)),J.userinfo,J.host,J.port,J.path,J.query,J.fragment);return CV(G,q)}else if(G.startsWith("?"))if(Y===0){let H=G.slice(1);return UQ(H,J)}else{let H=G.slice(1),q=$0(V,0,Y),U=new n(new T(MZ(q)),J.userinfo,J.host,J.port,J.path,J.query,J.fragment);return UQ(H,U)}else if(G.startsWith("#"))if(Y===0){let H=G.slice(1);return vZ(H,J)}else{let H=G.slice(1),q=$0(V,0,Y),U=new n(new T(MZ(q)),J.userinfo,J.host,J.port,J.path,J.query,J.fragment);return vZ(H,U)}else if(G.startsWith(":"))if(Y===0)return new k(void 0);else{let H=G.slice(1),q=$0(V,0,Y),U=new n(new T(MZ(q)),J.userinfo,J.host,J.port,J.path,J.query,J.fragment);return CV(H,U)}else if(G==="")return new B(new n(J.scheme,J.userinfo,J.host,J.port,V,J.query,J.fragment));else{let H=RQ(G),q;q=H[1],Z=V,Q=q,X=J,W=Y+1}}}function V5(Z,Q){while(!0){let X=Z,W=Q;if(X instanceof A)return W0(W);else{let{head:V,tail:G}=X,J;if(V==="")J=W;else if(V===".")J=W;else if(V==="..")if(W instanceof A)J=W;else J=W.tail;else J=P(V,W);let Y=J;Z=G,Q=Y}}}function n7(Z){return V5(Z,K([]))}function l7(Z){let Q,X=Z.fragment;if(X instanceof T){let j=X[0];Q=K(["#",j])}else Q=K([]);let W=Q,V,G=Z.query;if(G instanceof T){let j=G[0];V=P("?",P(j,W))}else V=W;let J=V,Y=P(Z.path,J),H,q=Z.host,U=fZ(Z.path,"/");if(q instanceof T&&!U)if(q[0]!=="")H=P("/",Y);else H=Y;else H=Y;let z=H,N,R=Z.host,D=Z.port;if(R instanceof T&&D instanceof T){let j=D[0];N=P(":",P(V0(j),z))}else N=z;let w=N,S,x=Z.scheme,O=Z.userinfo,E=Z.host;if(x instanceof T)if(O instanceof T)if(E instanceof T){let j=x[0],f=O[0],y=E[0];S=P(j,P("://",P(f,P("@",P(y,w)))))}else{let j=x[0];S=P(j,P(":",w))}else if(E instanceof T){let j=x[0],f=E[0];S=P(j,P("://",P(f,w)))}else{let j=x[0];S=P(j,P(":",w))}else if(O instanceof b&&E instanceof T){let j=E[0];S=P("//",P(j,w))}else S=w;return fX(S)}function K5(Z){return L9(Z,rQ(Z)-1)}function r7(Z){return aQ(P("",Z),"/")}function i7(Z,Q){if(Z.scheme instanceof T)if(Z.host instanceof T)if(Q.host instanceof T){let G,J=b8(Q.path,"/"),Y=n7(J);G=r7(Y);let H=G,q=new n(TX(Q.scheme,Z.scheme),new b,Q.host,TX(Q.port,Z.port),H,Q.query,Q.fragment);return new B(q)}else{let G;if(Q.path==="")G=[Z.path,TX(Q.query,Z.query)];else{let z;if(fZ(Q.path,"/"))z=b8(Q.path,"/");else{let O=b8(Z.path,"/"),E=K5(O);z=S0(E,b8(Q.path,"/"))}let R=z,D,S=n7(R);D=r7(S),G=[D,Q.query]}let Y=G,H,q;H=Y[0],q=Y[1];let U=new n(Z.scheme,new b,Z.host,Z.port,H,q,Q.fragment);return new B(U)}else return new k(void 0);else return new k(void 0)}function LV(Z){return W5(Z,Z,lY,0)}var o7=(Z,Q,X,W,V)=>{let G;if(typeof WebSocket==="function")G=new WebSocket(Z);else G={};G.onopen=(J)=>Q(G),G.onmessage=(J)=>{if(typeof J.data==="string")X(J.data);else W(J.data)},G.onclose=(J)=>V(J.code)},t7=(Z,Q)=>Z.send(Q);var e7=()=>document.URL;class RW extends I{}class SW extends I{}class AW extends I{}class TW extends I{}class OW extends I{}class CW extends I{}class LW extends I{}class wW extends I{}class EW extends I{}class xW extends I{}class kW extends I{}class fW extends I{}class ZG extends I{}class yW extends I{}class bW extends I{constructor(Z){super();this[0]=Z}}class hW extends I{constructor(Z){super();this[0]=Z}}class gW extends I{constructor(Z){super();this[0]=Z}}class QG extends I{constructor(Z){super();this[0]=Z}}function G5(Z){if(Z===1000)return new RW;else if(Z===1001)return new SW;else if(Z===1002)return new AW;else if(Z===1003)return new TW;else if(Z===1005)return new OW;else if(Z===1006)return new CW;else if(Z===1007)return new LW;else if(Z===1008)return new wW;else if(Z===1009)return new EW;else if(Z===1010)return new xW;else if(Z===1011)return new kW;else if(Z===1015)return new fW;else return new ZG}function J5(Z){if(Z==="https")return new B("wss");else if(Z==="http")return new B("ws");else if(Z==="ws")return new B(Z);else if(Z==="wss")return new B(Z);else return new k(void 0)}function Y5(Z,Q){let X,W=LV(Z);return X=DQ(W,new n(new b,new b,new b,new b,Z,new b,new b)),JQ(i7(Q,X),(G)=>{return JQ(nW(G.scheme,void 0),(J)=>{return JQ(J5(J),(Y)=>{let H=new n(new T(Y),G.userinfo,G.host,G.port,G.path,G.query,G.fragment),q=l7(H);return new B(q)})})})}function QZ(Z,Q){return YQ((X)=>{return t7(Z,Q)})}function H5(){let Z=e7();return LV(Z)}function q5(Z){let Q=H5();return JQ(Q,(X)=>{return Y5(Z,X)})}function XG(Z,Q){return YQ((W)=>{let V=q5(Z);if(V instanceof B){let G=V[0];return o7(G,(J)=>{return W(Q(new bW(J)))},(J)=>{return W(Q(new hW(J)))},(J)=>{return W(Q(new gW(J)))},(J)=>{let H=G5(J),q=new QG(H),U=Q(q);return W(U)})}else{let G=new yW,J=Q(G);return W(J)}})}function j8(){try{if(globalThis.Storage&&globalThis.localStorage instanceof globalThis.Storage)return new B(globalThis.localStorage);else return new k(null)}catch{return new k(null)}}function wV(Z,Q){return U5(Z.getItem(Q))}function EV(Z,Q,X){try{return Z.setItem(Q,X),new B(null)}catch{return new k(null)}}function xV(Z){Z.clear()}function U5(Z){if(Z!==null)return new B(Z);else return new k(null)}class B8 extends I{}class vW extends I{}class kV extends I{constructor(Z){super();this[0]=Z}}class _W extends I{}class $W extends I{constructor(Z){super();this[0]=Z}}class MQ extends I{}class bQ extends I{}class R8 extends I{}class qX extends I{constructor(Z){super();this[0]=Z}}class UX extends I{constructor(Z){super();this[0]=Z}}class S8 extends I{constructor(Z){super();this[0]=Z}}class A8 extends I{constructor(Z){super();this[0]=Z}}class MX extends I{constructor(Z){super();this[0]=Z}}class IX extends I{constructor(Z){super();this[0]=Z}}class FX extends I{}class hQ extends I{constructor(Z){super();this[0]=Z}}class zX extends I{constructor(Z){super();this[0]=Z}}class PX extends I{}class _Z extends I{}class tZ extends I{constructor(Z){super();this[0]=Z}}class NX extends I{constructor(Z,Q){super();this[0]=Z,this[1]=Q}}class fV extends I{constructor(Z,Q){super();this[0]=Z,this[1]=Q}}class DZ extends I{}class T0 extends I{constructor(Z,Q){super();this.fields=Z,this.ready=Q}}class h0 extends I{constructor(Z,Q){super();this.fields=Z,this.success=Q}}class O0 extends I{constructor(Z,Q){super();this.timeline_name=Z,this.modal=Q}}class IQ extends I{}class l extends I{constructor(Z,Q,X,W,V,G,J,Y){super();this.page=Z,this.user=Q,this.ws=X,this.token=W,this.status=V,this.cache=G,this.has_been_running_for_150ms=J,this.last_refresh_request_time=Y}}class yV extends I{constructor(Z,Q){super();this.unread_count=Z,this.cached_notifications=Q}}class eZ extends I{}class x0 extends I{constructor(Z){super();this[0]=Z}}class ZQ extends I{}class gQ extends I{}class mW extends I{}class T8 extends I{constructor(Z,Q,X){super();this.cached_posts=Z,this.cached_users=Q,this.cached_timelines=X}}class bV extends I{constructor(Z,Q,X,W){super();this.source_instance=Z,this.username=Q,this.avatar=X,this.last_updated=W}}class DX extends I{constructor(Z,Q,X,W,V,G){super();this.id=Z,this.pages=Q,this.total_count=X,this.current_page=W,this.has_more=V,this.last_updated=G}}class FQ extends I{constructor(Z,Q,X,W){super();this.usernamefield=Z,this.emailfield=Q,this.passwordfield=X,this.passwordconfirmfield=W}}class vQ extends I{constructor(Z,Q){super();this.emailfield=Z,this.passwordfield=Q}}class hV extends I{constructor(Z,Q,X,W,V){super();this.uid=Z,this.username=Q,this.email=X,this.avatar=W,this.notifs=V}}class gV extends I{constructor(Z,Q){super();this.page=Z,this.token=Q}}function M5(Z){if(Z instanceof DZ)return D0(K([["type",_("landing")]]));else if(Z instanceof T0){let{fields:Q,ready:X}=Z;return D0(K([["type",_("register")],["fields",(()=>{let W,V,G,J;return W=Q.usernamefield,V=Q.emailfield,G=Q.passwordfield,J=Q.passwordconfirmfield,D0(K([["usernamefield",_(W)],["emailfield",_(V)],["passwordfield",_(G)],["passwordconfirmfield",_(J)]]))})()],["ready",(()=>{return B6()})()]]))}else if(Z instanceof h0){let Q=Z.fields;return D0(K([["type",_("login")],["fields",(()=>{let X,W;return X=Q.emailfield,W=Q.passwordfield,D0(K([["emailfield",_(X)],["passwordfield",_(W)]]))})()]]))}else if(Z instanceof O0){let{timeline_name:Q,modal:X}=Z;return D0((()=>{let W=K([["type",_("home_timeline")]]),V=S0(W,(()=>{if(Q instanceof T){let G=Q[0];return K([["timeline_name",_(G)]])}else return K([])})());return S0(V,(()=>{if(X instanceof T){let G=X[0];return K([["modal",_(G[0])]])}else return K([])})())})())}else if(Z instanceof IQ)return D0(K([["type",_("licence")]]));else return D0(K([["type",_("landing")]]))}function I5(){return p("type",e,(Z)=>{if(Z==="landing")return o(new DZ);else if(Z==="licence")return o(new IQ);else if(Z==="register")return p("fields",p("usernamefield",e,(Q)=>{return p("emailfield",e,(X)=>{return p("passwordfield",e,(W)=>{return p("passwordconfirmfield",e,(V)=>{return o(new FQ(Q,X,W,V))})})})}),(Q)=>{let X=new b;return o(new T0(Q,X))});else if(Z==="login")return p("fields",p("emailfield",e,(Q)=>{return p("passwordfield",e,(X)=>{return o(new vQ(Q,X))})}),(Q)=>{return o(new h0(Q,new b))});else if(Z==="home_timeline")return P6("timeline_name",new b,eQ(e),(Q)=>{return P6("modal",new b,eQ(e),(X)=>{let W;return W=AX(X,(J)=>{return[J,R0()]}),o(new O0(Q,W))})});else return AQ(new DZ,"Page")})}function F5(Z){let Q,X;return Q=Z.page,X=Z.token,D0(K([["page",M5(Q)],["token",(()=>{if(X instanceof T){let W=X[0];return _(W)}else return B6()})()]]))}function z5(){return p("page",I5(),(Z)=>{return p("token",eQ(e),(Q)=>{return o(new gV(Z,Q))})})}function KG(Z){return v8(Z,z5())}function GG(Z){let Q,X;Q=Z.page,X=Z.token;let W=new gV(Q,X),V=F5(W);return m0(V)}function vV(Z,Q){let X=Z;do{if(X.classList&&X.classList.contains(Q))return!0;X=X.parentElement}while(X);return!1}function _V(Z,Q,X,W){let V=Z,G=Q,J=()=>{let q=X(V,G);W(q)},Y=(q)=>{V+=q.movementX,G+=q.movementY,J()},H=()=>{window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",Y),window.addEventListener("mouseup",H);return}function $V(){return[window.innerWidth,window.innerHeight]}function uV(Z,Q){return globalThis.setTimeout(Q,Z)}var uW="luminaModelJSOB";function JG(Z){return W8()}function cW(Z){let Q=K([Z.passwordfield!=="",Z.emailfield!==""]);return w9(Q,(X)=>{return X})}function cV(Z,Q){uV(Z,Q);return}function pV(){let Z,Q=$V();Z=D5(Q,void 0,"src/lumina_client/helpers.gleam",51);let X=Z,W,V;W=X[0],V=X[1];let G=globalThis.Math.trunc(V/2),J=globalThis.Math.trunc(W/2),Y=r(G),H=r(J);return[Y,H]}function D5(Z,Q,X,W){let J=`${X}:${W}`,H=new YG().inspect(Z),q=Q===void 0?"":" "+Q;if(globalThis.process?.stderr?.write){let U=`\x1B[90m${J}\x1B[39m${q} 6 - ${H} 7 - `;globalThis.process.stderr.write(U)}else if(globalThis.Deno){let U=`\x1B[90m${J}\x1B[39m${q} 8 - ${H} 9 - `;globalThis.Deno.stderr.writeSync(new TextEncoder().encode(U))}else{let U=`${J}${q} 10 - ${H}`;globalThis.console.log(U)}return Z}class YG{#Z=new globalThis.Set;#Q(Z){try{let X=R0().constructor;return Z instanceof X}catch{return!1}}#G(Z){let Q=Z.toString().replace("+","");if(Q.indexOf(".")>=0)return Q;else{let X=Q.indexOf("e");if(X>=0)return Q.slice(0,X)+".0"+Q.slice(X);else return Q+".0"}}inspect(Z){let Q=typeof Z;if(Z===!0)return"True";if(Z===!1)return"False";if(Z===null)return"//js(null)";if(Z===void 0)return"Nil";if(Q==="string")return this.#Y(Z);if(Q==="bigint"||globalThis.Number.isInteger(Z))return Z.toString();if(Q==="number")return this.#G(Z);if(Z instanceof PQ)return this.#J(Z);if(Z instanceof CZ)return this.#H(Z);if(Z instanceof globalThis.RegExp)return`//js(${Z})`;if(Z instanceof globalThis.Date)return`//js(Date("${Z.toISOString()}"))`;if(Z instanceof globalThis.Error)return`//js(${Z.toString()})`;if(Z instanceof globalThis.Function){let W=[];for(let V of globalThis.Array(Z.length).keys())W.push(globalThis.String.fromCharCode(V+97));return`//fn(${W.join(", ")}) { ... }`}if(this.#Z.size===this.#Z.add(Z).size)return"//js(circular reference)";let X;if(globalThis.Array.isArray(Z))X=`#(${Z.map((W)=>this.inspect(W)).join(", ")})`;else if(Z instanceof C0)X=this.#V(Z);else if(Z instanceof I)X=this.#W(Z);else if(this.#Q(Z))X=this.#X(Z);else if(Z instanceof Set)return`//js(Set(${[...Z].map((W)=>this.inspect(W)).join(", ")}))`;else X=this.#K(Z);return this.#Z.delete(Z),X}#K(Z){let Q=globalThis.Object.getPrototypeOf(Z)?.constructor?.name||"Object",X=[];for(let G of globalThis.Object.keys(Z))X.push(`${this.inspect(G)}: ${this.inspect(Z[G])}`);let W=X.length?" "+X.join(", ")+" ":"";return`//js(${Q==="Object"?"":Q+" "}{${W}})`}#X(Z){let Q="dict.from_list([",X=!0,W=KQ(Z,[],(V,G,J)=>{return V.push([G,J]),V});return W.sort(),W.forEach(([V,G])=>{if(!X)Q=Q+", ";Q=Q+"#("+this.inspect(V)+", "+this.inspect(G)+")",X=!1}),Q+"])"}#W(Z){let Q=globalThis.Object.keys(Z).map((X)=>{let W=this.inspect(Z[X]);return isNaN(parseInt(X))?`${X}: ${W}`:W}).join(", ");return Q?`${Z.constructor.name}(${Q})`:Z.constructor.name}#V(Z){if(Z instanceof A)return"[]";let Q='charlist.from_string("',X="[",W=Z;while(W instanceof v0){let V=W.head;if(W=W.tail,X!=="[")X+=", ";if(X+=this.inspect(V),Q)if(globalThis.Number.isInteger(V)&&V>=32&&V<=126)Q+=globalThis.String.fromCharCode(V);else Q=null}if(Q)return Q+'")';else return X+"]"}#Y(Z){let Q='"';for(let X=0;X<Z.length;X++){let W=Z[X];switch(W){case` 11 - `:Q+="\\n";break;case"\r":Q+="\\r";break;case"\t":Q+="\\t";break;case"\f":Q+="\\f";break;case"\\":Q+="\\\\";break;case'"':Q+="\\\"";break;default:if(W<" "||W>"~"&&W<" ")Q+="\\u{"+W.charCodeAt(0).toString(16).toUpperCase().padStart(4,"0")+"}";else Q+=W}}return Q+='"',Q}#J(Z){return`//utfcodepoint(${globalThis.String.fromCodePoint(Z.value)})`}#H(Z){if(Z.bitSize===0)return"<<>>";let Q="<<";for(let X=0;X<Z.byteSize-1;X++)Q+=Z.byteAt(X).toString(),Q+=", ";if(Z.byteSize*8===Z.bitSize)Q+=Z.byteAt(Z.byteSize-1).toString();else{let X=Z.bitSize%8;Q+=Z.byteAt(Z.byteSize-1)>>8-X,Q+=`:size(${X})`}return Q+=">>",Q}}function j5(Z){if(Z==="input")return!0;else if(Z==="change")return!0;else if(Z==="focus")return!0;else if(Z==="focusin")return!0;else if(Z==="focusout")return!0;else if(Z==="blur")return!0;else if(Z==="select")return!0;else return!1}function TZ(Z,Q){return bK(Z,Q,v,!1,!1,j5(Z),new ZX(0))}function B5(Z){if(Z instanceof s0)return new s0(Z.kind,Z.name,Z.handler,Z.include,!0,Z.stop_propagation,Z.immediate,Z.limit);else return Z}function H0(Z){return TZ("click",o(Z))}function HG(Z){return TZ("mousedown",o(Z))}function _Q(Z){return TZ("input",vX(K(["target","value"]),e,(Q)=>{return o(Z(Q))}))}function R5(){let Q=p(0,e,(W)=>{return p(1,gX(tQ(e,(V)=>{return new B(V)}),K([o(new k(void 0))])),(V)=>{let J=iW(V,(Y)=>{return T9(W,Y)});return o(J)})}),X=Z8(Q);return tQ(X,f9)}function nV(Z){let Q=TZ("submit",vX(K(["detail","formData"]),R5(),(X)=>{let V=Z(X);return o(V)}));return B5(Q)}function O8(Z,Q){return L(K([M("font-sans")]),K([L(K([M("navbar bg-base-100 dark:bg-neutral-800 shadow-sm")]),K([L(K([M("flex-none")]),K([E0(K([M("")]),K([F8(K([K8("/static/logo.svg"),ZW("Lumina logo"),M("h-8")]))]))])),L(K([M("flex-1")]),K([J0(K([M("btn btn-ghost text-xl font-logo")]),K([C("Lumina")]))])),L(K([M("flex-none")]),K([oZ(K([M("menu menu-horizontal px-1 font-menuitems")]),Q)]))])),L(K([M("bg-base-200 h-screen max-h-[calc(100vh-4rem)]")]),Z)]))}var rV="http://www.w3.org/2000/svg";function jX(Z){return kQ(rV,"circle",Z,v)}function $Z(Z,Q){return kQ(rV,"svg",Z,Q)}function F0(Z){return kQ(rV,"path",Z,v)}var A5=K([[sV,"https://www.svgrepo.com/svg/524520/earth"],[lV,"https://www.svgrepo.com/svg/524793/pen-2"],[iV,"https://www.svgrepo.com/svg/524361/camera"],[aV,"https://www.svgrepo.com/svg/524800/pen-new-square"],[oV,"https://www.svgrepo.com/svg/524621/hashtag-square"],[tV,"https://www.svgrepo.com/svg/524223/add-square"],[eV,"https://www.svgrepo.com/svg/523982/archive"]]);function sV(Z){return $Z(K([F("xmlns","http://www.w3.org/2000/svg"),M(Z),F("fill","none"),F("viewBox","0 0 24 24")]),K([jX(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("r","10"),F("cy","12"),F("cx","12")])),F0(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M6 4.71053C6.78024 5.42105 8.38755 7.36316 8.57481 9.44737C8.74984 11.3955 10.0357 12.9786 12 13C12.7549 13.0082 13.5183 12.4629 13.5164 11.708C13.5158 11.4745 13.4773 11.2358 13.417 11.0163C13.3331 10.7108 13.3257 10.3595 13.5 10C14.1099 8.74254 15.3094 8.40477 16.2599 7.72186C16.6814 7.41898 17.0659 7.09947 17.2355 6.84211C17.7037 6.13158 18.1718 4.71053 17.9377 4")])),F0(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M22 13C21.6706 13.931 21.4375 16.375 17.7182 16.4138C17.7182 16.4138 14.4246 16.4138 13.4365 18.2759C12.646 19.7655 13.1071 21.3793 13.4365 22")]))]))}function MG(Z){return $Z(K([M(Z),F("fill","none"),F("stroke","currentColor"),F("viewBox","0 0 24 24"),F("xmlns","http://www.w3.org/2000/svg")]),K([jX(K([F("cx","8"),F("cy","8"),F("r","3"),F("opacity","0.6"),F("stroke-width","2")])),jX(K([F("cx","16"),F("cy","8"),F("r","3"),F("opacity","0.6"),F("stroke-width","2")])),F0(K([F("stroke-width","2"),F("stroke-linecap","round"),F("opacity","0.6"),F("stroke-linejoin","round"),F("d","M2 20v-1a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v1")])),F0(K([F("stroke-width","2"),F("opacity","0.6"),F("stroke-linecap","round"),F("stroke-linejoin","round"),F("d","M14 20v-1a4 4 0 0 1 4-4h0a4 4 0 0 1 4 4v1")]))]))}function IG(Z){return $Z(K([M(Z),F("fill","none"),F("stroke","currentColor"),F("viewBox","0 0 24 24"),F("xmlns","http://www.w3.org/2000/svg")]),K([F0(K([F("stroke-width","2"),F("stroke-linecap","round"),F("stroke-linejoin","round"),F("d","M9 19C5 15 2 12.5 2 9.5C2 7 4 5 6.5 5C8 5 9 6.5 9 6.5C9 6.5 10 5 11.5 5C14 5 16 7 16 9.5C16 12.5 13 15 9 19Z"),F("opacity","0.6")])),F0(K([F("stroke-width","2"),F("stroke-linecap","round"),F("stroke-linejoin","round"),F("d","M15 4.5l2.09 4.24 4.68.68-3.39 3.3.8 4.63L15 15.77l-4.18 2.18.8-4.63-3.39-3.3 4.68-.68L15 4.5z"),F("opacity","0.6")]))]))}function lV(Z){return $Z(K([F("xmlns","http://www.w3.org/2000/svg"),F("fill","none"),F("viewBox","0 0 24 24"),M(Z)]),K([F0(K([F("stroke-linecap","round"),F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M4 22H20")])),F0(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M13.8881 3.66293L14.6296 2.92142C15.8581 1.69286 17.85 1.69286 19.0786 2.92142C20.3071 4.14999 20.3071 6.14188 19.0786 7.37044L18.3371 8.11195M13.8881 3.66293C13.8881 3.66293 13.9807 5.23862 15.3711 6.62894C16.7614 8.01926 18.3371 8.11195 18.3371 8.11195M13.8881 3.66293L7.07106 10.4799C6.60933 10.9416 6.37846 11.1725 6.17992 11.4271C5.94571 11.7273 5.74491 12.0522 5.58107 12.396C5.44219 12.6874 5.33894 12.9972 5.13245 13.6167L4.25745 16.2417M18.3371 8.11195L11.5201 14.9289C11.0584 15.3907 10.8275 15.6215 10.5729 15.8201C10.2727 16.0543 9.94775 16.2551 9.60398 16.4189C9.31256 16.5578 9.00282 16.6611 8.38334 16.8675L5.75834 17.7426M5.75834 17.7426L5.11667 17.9564C4.81182 18.0581 4.47573 17.9787 4.2485 17.7515C4.02128 17.5243 3.94194 17.1882 4.04356 16.8833L4.25745 16.2417M5.75834 17.7426L4.25745 16.2417")]))]))}function iV(Z){return $Z(K([F("xmlns","http://www.w3.org/2000/svg"),F("fill","none"),F("viewBox","0 0 24 24"),M(Z)]),K([jX(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("r","3"),F("cy","13"),F("cx","12")])),F0(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M9.77778 21H14.2222C17.3433 21 18.9038 21 20.0248 20.2646C20.51 19.9462 20.9267 19.5371 21.251 19.0607C22 17.9601 22 16.4279 22 13.3636C22 10.2994 22 8.76721 21.251 7.6666C20.9267 7.19014 20.51 6.78104 20.0248 6.46268C19.3044 5.99013 18.4027 5.82123 17.022 5.76086C16.3631 5.76086 15.7959 5.27068 15.6667 4.63636C15.4728 3.68489 14.6219 3 13.6337 3H10.3663C9.37805 3 8.52715 3.68489 8.33333 4.63636C8.20412 5.27068 7.63685 5.76086 6.978 5.76086C5.59733 5.82123 4.69555 5.99013 3.97524 6.46268C3.48995 6.78104 3.07328 7.19014 2.74902 7.6666C2 8.76721 2 10.2994 2 13.3636C2 16.4279 2 17.9601 2.74902 19.0607C3.07328 19.5371 3.48995 19.9462 3.97524 20.2646C5.09624 21 6.65675 21 9.77778 21Z")])),F0(K([F("stroke-linecap","round"),F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M19 10H18")]))]))}function aV(Z){return $Z(K([F("xmlns","http://www.w3.org/2000/svg"),F("fill","none"),F("viewBox","0 0 24 24"),M(Z)]),K([F0(K([F("stroke-linecap","round"),F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M22 10.5V12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2H13.5")])),F0(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M16.652 3.45506L17.3009 2.80624C18.3759 1.73125 20.1188 1.73125 21.1938 2.80624C22.2687 3.88124 22.2687 5.62415 21.1938 6.69914L20.5449 7.34795M16.652 3.45506C16.652 3.45506 16.7331 4.83379 17.9497 6.05032C19.1662 7.26685 20.5449 7.34795 20.5449 7.34795M16.652 3.45506L10.6872 9.41993C10.2832 9.82394 10.0812 10.0259 9.90743 10.2487C9.70249 10.5114 9.52679 10.7957 9.38344 11.0965C9.26191 11.3515 9.17157 11.6225 8.99089 12.1646L8.41242 13.9M20.5449 7.34795L14.5801 13.3128C14.1761 13.7168 13.9741 13.9188 13.7513 14.0926C13.4886 14.2975 13.2043 14.4732 12.9035 14.6166C12.6485 14.7381 12.3775 14.8284 11.8354 15.0091L10.1 15.5876M10.1 15.5876L8.97709 15.9619C8.71035 16.0508 8.41626 15.9814 8.21744 15.7826C8.01862 15.5837 7.9492 15.2897 8.03811 15.0229L8.41242 13.9M10.1 15.5876L8.41242 13.9")]))]))}function oV(Z){return $Z(K([F("xmlns","http://www.w3.org/2000/svg"),F("fill","none"),F("viewBox","0 0 24 24"),M(Z)]),K([F0(K([F("stroke-linejoin","round"),F("stroke-linecap","round"),F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M11 7L8 17")])),F0(K([F("stroke-linejoin","round"),F("stroke-linecap","round"),F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M16 7L13 17")])),F0(K([F("stroke-linejoin","round"),F("stroke-linecap","round"),F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M18 10H7")])),F0(K([F("stroke-linejoin","round"),F("stroke-linecap","round"),F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M17 14H6")])),F0(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2C16.714 2 19.0711 2 20.5355 3.46447C22 4.92893 22 7.28595 22 12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12Z")]))]))}function tV(Z){return $Z(K([F("xmlns","http://www.w3.org/2000/svg"),F("fill","none"),F("viewBox","0 0 24 24"),M(Z)]),K([F0(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2C16.714 2 19.0711 2 20.5355 3.46447C22 4.92893 22 7.28595 22 12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12Z")])),F0(K([F("stroke-linecap","round"),F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M15 12L12 12M12 12L9 12M12 12L12 9M12 12L12 15")]))]))}function eV(Z){return $Z(K([F("xmlns","http://www.w3.org/2000/svg"),F("fill","none"),F("viewBox","0 0 24 24"),M(Z)]),K([F0(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M9 12C9 11.5341 9 11.3011 9.07612 11.1173C9.17761 10.8723 9.37229 10.6776 9.61732 10.5761C9.80109 10.5 10.0341 10.5 10.5 10.5H13.5C13.9659 10.5 14.1989 10.5 14.3827 10.5761C14.6277 10.6776 14.8224 10.8723 14.9239 11.1173C15 11.3011 15 11.5341 15 12C15 12.4659 15 12.6989 14.9239 12.8827C14.8224 13.1277 14.6277 13.3224 14.3827 13.4239C14.1989 13.5 13.9659 13.5 13.5 13.5H10.5C10.0341 13.5 9.80109 13.5 9.61732 13.4239C9.37229 13.3224 9.17761 13.1277 9.07612 12.8827C9 12.6989 9 12.4659 9 12Z")])),F0(K([F("stroke-linecap","round"),F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M20.5 7V13C20.5 16.7712 20.5 18.6569 19.3284 19.8284C18.1569 21 16.2712 21 12.5 21H11.5C7.72876 21 5.84315 21 4.67157 19.8284C3.5 18.6569 3.5 16.7712 3.5 13V7")])),F0(K([F("stroke-width","1.5"),F("stroke","currentColor"),F("d","M2 5C2 4.05719 2 3.58579 2.29289 3.29289C2.58579 3 3.05719 3 4 3H20C20.9428 3 21.4142 3 21.7071 3.29289C22 3.58579 22 4.05719 22 5C22 5.94281 22 6.41421 21.7071 6.70711C21.4142 7 20.9428 7 20 7H4C3.05719 7 2.58579 7 2.29289 6.70711C2 6.41421 2 5.94281 2 5Z")]))]))}function FG(){return E9(A5)}function T5(Z,Q){return L(K([]),K([t("This is the text post editor!")]))}function O5(Z,Q){return L(K([]),K([t("This is the media post editor!")]))}function C5(Z,Q){return L(K([]),K([t("This is the article post editor!")]))}function zG(Z,Q){return L(K([M("tabs tabs-lift h-full")]),K([i0(K([M("tab")]),K([WZ(K([QW("editortypeswitch"),l0("radio")])),iV("class size-4 me-2"),t(" Snap ")])),i0(K([M("tab")]),K([WZ(K([QW("editortypeswitch"),l0("radio"),vK(!0)])),lV("class size-4 me-2"),t(" Jot ")])),L(K([M("tab-content bg-base-100 border-base-300 p-6")]),K([T5(Z,Q)])),L(K([M("tab-content bg-base-100 border-base-300 p-6")]),K([O5(Z,Q)])),i0(K([M("tab")]),K([WZ(K([QW("editortypeswitch"),l0("radio")])),aV("class size-4 me-2"),t(" Compose ")])),L(K([M("tab-content bg-base-100 border-base-300 p-6")]),K([C5(Z,Q)]))]))}var w5="src/lumina_client/view/homepage/posts.gleam";function PG(Z,Q){let X=o0(Z.cache.cached_posts,Q);return L(K([M("flex flex-col gap-2 p-4 m-8 bg-base-300 text-base-300-content rounded-md w-full bg-opacity-25 font-content")]),(()=>{let W;if(X instanceof B)throw c("todo",w5,"lumina_client/view/homepage/posts",41,"element_from_id","Post rendering not yet implemented",{});else W=K([XZ(K([]),K([C("Loading post..."),j0(K([M("loading loading-spinner loading-md float-right")]),K([]))]))]);return S0(W,K([v7(K([M("opacity-50 text-xs font-script")]),K([C("ID:"+Q)]))]))})())}var BX="src/lumina_client/view/homepage.gleam";class Q9 extends I{}class dW extends I{constructor(Z){super();this[0]=Z}}class X9 extends I{constructor(Z,Q,X,W,V){super();this.id=Z,this.title=Q,this.containing=X,this.closeable=W,this.params=V}}class W9 extends I{constructor(Z,Q){super();this[0]=Z,this[1]=Q}}class V9 extends I{}function pW(){return p("target",z6,(Z)=>{if(KK(vV(Z,"modal-box")))return o(new _Z);else return AQ(new _Z,"Clicked inside modal-box, ignoring")})}function NG(Z){let Q=Z.pages,X=GQ(Q),W=w8(X,(G,J)=>{let Y;Y=G[0];let H;if(H=J[0],Y<H)return new P0;else if(Y===H)return new N0;else return new jZ}),V=w0(W,(G)=>{let J;return J=G[1],J});return lW(V)}function x5(Z){let Q,X,W=Z.page;if(W instanceof O0)X=Z.cache,Q=W.timeline_name;else throw c("let_assert",BX,"lumina_client/view/homepage",473,"timeline","Pattern match failed, no pattern matched the value.",{value:Z,start:16385,end:16506,pattern_start:16396,pattern_end:16498});let V=wZ(Q,"global"),G=o0(X.cached_timelines,V);if(G instanceof B){let J=G[0],Y=NG(J),H=J.has_more;return L(K([M("flex w-4/6 flex-col gap-4 items-start")]),(()=>{if(Y instanceof A)return K([L(K([M("justify-center p-4")]),K([C("This timeline is empty! Make sure to fill it!")]))]);else{let q=w0(Y,(U)=>{return PG(Z,U)});if(H)return S0(q,K([L(K([M("flex justify-center p-4")]),K([E0(K([M("btn btn-primary font-menuitems"),H0(new zX(V))]),K([C("Load More Posts")]))]))]));else return q}})())}else return L(K([M("flex w-4/6 flex-col gap-4 items-start")]),K([C('Loading timeline "'+V+'" ...'),L(K([M("skeleton h-32 w-full")]),K([])),L(K([M("skeleton h-4 w-28")]),K([])),L(K([M("skeleton h-4 w-full")]),K([])),L(K([M("skeleton h-32 w-full")]),K([])),L(K([M("skeleton h-4 w-28")]),K([])),L(K([M("skeleton h-4 w-full")]),K([])),L(K([M("skeleton h-4 w-full")]),K([])),L(K([M("skeleton h-32 w-full")]),K([])),L(K([M("skeleton h-4 w-28")]),K([])),L(K([M("skeleton h-4 w-full")]),K([])),L(K([M("skeleton h-32 w-full")]),K([])),L(K([M("skeleton h-4 w-28")]),K([])),L(K([M("skeleton h-4 w-full")]),K([])),C("Skeleton should be remodeled after the actual post view later.")]))}function DG(Z){let Q=Z.pages,X=rW(Q);return k0(X,0,(W,V)=>{if(V>W)return V;else return W})}function jG(Z){let Q=Z.pages,X=sW(Q),W=w0(X,rQ);return k0(W,0,(V,G)=>{return V+G})}function BG(Z,Q,X){let W=jG(Z);return Q+X>=W&&Z.has_more}function RG(){return new DX("",R0(),0,0,!1,0)}function K9(Z,Q,X,W,V,G){return new DX(Q,(()=>{let J=Z.pages;return qZ(J,X,W)})(),V,X,G,SQ(Q8(CQ())))}function G9(Z){if(Z.has_more){let X=DG(Z);return new T(X+1)}else return new b}function SG(Z,Q){let X=jG(Z),W=DG(Z);return"Timeline '"+Q+"': "+V0(X)+"/"+V0(Z.total_count)+" posts cached, pages 0-"+V0(W)+", has_more: "+$X(Z.has_more)}function k5(Z,Q){let X,W;X=Z[0],W=Z[1];let V,G=Q.user;if(G instanceof T)if(Q.page instanceof O0)V=G[0];else throw c("let_assert",BX,"lumina_client/view/homepage",761,"modal_by_id","Pattern match failed, no pattern matched the value.",{value:Q,start:24954,end:25094,pattern_start:24965,pattern_end:25079});else throw c("let_assert",BX,"lumina_client/view/homepage",761,"modal_by_id","Pattern match failed, no pattern matched the value.",{value:Q,start:24954,end:25094,pattern_start:24965,pattern_end:25079});if(X==="test")return new dW(L(K([]),K([C("Welcome to Lumina! This is a test modal screen.")])));else if(X==="selfmenu")return new W9(new Q9,oZ(K([M("menu menu-xl rounded-box w-2/3 justify-center text-center items-center space-y-4")]),K([Y0(K([M("menu-title")]),K([C("Hi, @"+V.username)])),Y0(K([]),K([C("There's not much in this menu as of yet.")])),Y0(K([M("md:hidden")]),K([J0(K([M("btn btn-info font-menuitems"),H0(new tZ("selfsettings"))]),K([C("Settings")]))])),Y0(K([]),K([J0(K([M("btn btn-warn font-menuitems"),H0(new PX)]),K([C("Log out")]))]))])));else if(X==="selfsettings")return new dW(L(K([]),K([C("User settings will be here eventually.")])));else if(X==="mdl-postedit")return new X9("mdl-postedit","New Post",zG(W,Q),!0,W);else return new V9}function AG(Z){let Q,X,W,V=Z.page;if(V instanceof O0)W=Z.user,Q=V.timeline_name,X=V.modal;else throw c("let_assert",BX,"lumina_client/view/homepage",57,"view","Pattern match failed, no pattern matched the value.",{value:Z,start:2141,end:2259,pattern_start:2152,pattern_end:2251});return((G)=>{return $8(VQ(W),G,()=>{return C("Loading user...")})})(()=>{let G;if(W instanceof T)G=W[0];else throw c("let_assert",BX,"lumina_client/view/homepage",66,"view","User must be logged in to see homepage, got None from model where a user-submodel was expected. (Got past a guard?)",{value:W,start:2368,end:2396,pattern_start:2379,pattern_end:2389});let J=wZ(Q,"global"),Y,H=(()=>{let N=AX(X,(R)=>{return k5(R,Z)});return wZ(N,new V9)})();if(H instanceof dW){let z=H[0];Y=L(K([M("modal modal-open fixed inset-0 flex items-center justify-center z-50 bg-black bg-opacity-50 w-screen h-screen"),TZ("click",pW())]),K([L(K([M("modal-box w-[99vw] lg:w-[80vw] max-w-[unset] h-[80lvh] flex flex-col justify-center items-center bg-base-100 shadow-2xl relative")]),K([E0(K([M("btn rounded-none rounded-bl-sm btn-error absolute top-0 right-0 text-2xl"),H0(new _Z)]),K([C("×")])),z,L(K([M("modal-action")]),K([]))]))]))}else if(H instanceof X9){let{id:z,title:N,containing:R,closeable:D,params:w}=H,S=pV()[1],x=pV()[0],O=o0(w,"pos_x"),E=o0(w,"pos_y"),h;if(O instanceof B){let g=O[0],d=kX(g);h=DQ(d,S)}else h=S;let j=h,f;if(E instanceof B){let g=E[0],d=kX(g);f=DQ(d,x)}else f=x;let y=f;Y=L(K([M("modal modal-open fixed inset-0 flex items-center justify-center z-50 bg-black bg-opacity-50 w-screen h-screen"),TZ("click",pW())]),K([L(K([V8(z),M("modal-box lg:freeroam flex flex-col justify-center items-center bg-base-100 shadow-2xl w-[99vw] lg:w-[32rem] max-w-[unset] lg:max-w-[99vw] h-[80lvh] lg:h-[80lvh] lg:max-h-[90vh] relative lg:absolute"),eX("--left",(()=>{return cZ(j)})()+"px"),eX("--top",(()=>{return cZ(y)})()+"px"),eX("--transform","translate(-50%, -50%)")]),K([g7(K([M("w-full h-10 absolute top-0 left-0 bg-transparent cursor-move bg-info text-info-content rounded-t-xl flex items-center justify-center"),HG(new NX(j,y))]),K([C(N)])),(()=>{if(D)return E0(K([M("btn rounded-none rounded-bl-sm btn-error absolute top-0 right-0 text-2xl"),H0(new _Z)]),K([C("×")]));else return AZ()})(),L(K([M("w-full h-full mt-10")]),K([R]))]))]))}else if(H instanceof W9)if(H[0]instanceof Q9){let N=H[1];Y=L(K([M("modal modal-open fixed top-[4rem] right-0 left-0 bottom-0 flex items-end justify-end z-50 bg-black bg-opacity-50 w-screen max-h-[calc(100vh-4rem)]"),TZ("click",pW())]),K([L(K([M("modal-box w-[24rem] lg:max-h-[calc(100vh-4rem)] flex flex-col justify-start items-center bg-base-100 shadow-2xl relative rounded-xl md:max-h-[calc(100vh-4rem)] h-[60vh] max-h-[60vh] mb-[20vh]")]),K([E0(K([M("btn rounded-none rounded-bl-sm btn-error absolute top-0 right-0 text-2xl"),H0(new _Z)]),K([C("×")])),N,L(K([M("modal-action")]),K([]))]))]))}else{let N=H[1];Y=L(K([M("modal modal-open fixed top-[4rem] right-0 left-0 bottom-0 flex items-end justify-start z-50 bg-black bg-opacity-50 w-screen max-h-[calc(100vh-4rem)]"),TZ("click",pW())]),K([L(K([M("modal-box w-[24rem] lg:max-h-[calc(100vh-4rem)] flex flex-col justify-start items-center bg-base-100 shadow-2xl relative rounded-xl md:max-h-[calc(100vh-4rem)] h-[60vh] max-h-[60vh] mb-[20vh]")]),K([E0(K([M("btn btn-circle btn-error absolute top-4 right-4 text-2xl"),H0(new _Z)]),K([C("×")])),N,L(K([M("modal-action")]),K([]))]))]))}else Y=L(K([M("items")]),K([L(K([M("dock lg:hidden")]),K([i0(K([M("drawer-button"),G8("timelineswitcher")]),K([oV("size-[1.2em]"),j0(K([M("dock-label")]),K([t("Switch")]))])),E0(K([M(""),H0(new tZ("mdl-postedit"))]),K([tV("size-[1.2em]"),j0(K([M("dock-label")]),K([t("Create")]))])),E0(K([]),K([L(K([M("indicator")]),K([(()=>{let z=G.notifs.unread_count;if(z===0)return AZ();else{let N=z;return j0(K([M("indicator-item badge badge-secondary")]),K([t(V0(N))]))}})(),eV("size-[1.2em]")])),j0(K([M("dock-label")]),K([t("Notifications")]))]))])),L(K([M("absolute bottom-4 right-4 p-4 z-50 hidden lg:block")]),K([E0(K([M("btn btn-circle btn-success btn-lg text-3xl"),V8("btn-new-post"),H0(new tZ("mdl-postedit"))]),K([C("+")]))])),L(K([M("fixed bottom-20 right-4 p-4 z-50 ")]),K([]))]));let U=K([Y,L(K([M("drawer lg:drawer-open max-h-[calc(100vh-4rem)]")]),K([WZ(K([M("drawer-toggle"),l0("checkbox"),V8("timelineswitcher")])),h7(K([M("drawer-content items-center flex flex-col bg-neutral text-neutral-content h-screen max-h-[calc(100vh-4rem)] overflow-y-auto"+(()=>{let z=CQ(),N=zK(z,MK()),R,D,w;return R=N[0].year,D=N[0].month,w=N[0].day," "+("yearclass-"+V0(R))+" "+(()=>{if(D instanceof m8)return"monthclass-1";else if(D instanceof u8)return"monthclass-2";else if(D instanceof c8)return"monthclass-3";else if(D instanceof p8)return"monthclass-4";else if(D instanceof d8)return"monthclass-5";else if(D instanceof n8)return"monthclass-6";else if(D instanceof r8)return"monthclass-7";else if(D instanceof s8)return"monthclass-8";else if(D instanceof l8)return"monthclass-9";else if(D instanceof i8)return"monthclass-10";else if(D instanceof a8)return"monthclass-11";else return"monthclass-12"})()+" "+("dayclass-"+V0(w))})())]),K([x5(Z)])),L(K([M("drawer-side font-menuitems")]),K([i0(K([M("drawer-overlay"),F("aria-label","close sidebar"),G8("timelineswitcher")]),K([])),oZ(K([M("menu bg-base-200 bg-opacity-75 text-base-content h-screen lg:max-h-[calc(100vh-4rem)] w-80 p-4")]),K([Y0(K([M("menu-title font-sans")]),K([C("Timeline")])),oZ(K([]),K([Y0(K([]),K([J0(K([$8(J==="global",()=>{return M("menu-active")},()=>{return W8()}),H0(new hQ("global"))]),K([sV("inline h-5 w-5 mr-2"),C("Global")]))])),Y0(K([]),K([J0(K([$8(J==="following",()=>{return M("menu-active")},()=>{return W8()}),H0(new hQ("following"))]),K([MG("inline h-5 w-5 mr-2"),C("Following")]))])),Y0(K([]),K([J0(K([$8(J==="mutuals",()=>{return M("menu-active")},()=>{return W8()}),H0(new hQ("mutuals"))]),K([IG("inline h-5 w-5 mr-2"),C("Mutuals")]))]))]))]))]))]))]);return O8(U,K([Y0(K([M("hidden md:flex"),H0(new tZ("selfsettings"))]),K([E0(K([M("btn md:btn-neutral btn-ghost")]),K([C("Settings")]))])),Y0(K([]),K([E0(K([M("btn md:btn-neutral btn-ghost"),H0(new tZ("selfmenu"))]),K([j0(K([M("hidden md:inline")]),K([C("@"+G.username)])),L(K([M("avatar")]),K([L(K([M("h-8 w-8 mask-squircle mask")]),K([F8(K([K8(G.avatar),ZW(G.username)]))]))]))]))]))]))})}var RX="src/lumina_client/view.gleam";function y5(){return L(K([M("overflow-y-auto max-h-[45vh]")]),K([oZ(K([]),K([Y0(K([M("card block bg-neutral p-4 mb-4 rounded-lg")]),K([NW(K([M("text-lg font-bold mb-2")]),K([t("Icons from SVGrepo.com")])),b7(K([M("text-[1.100rem] font-bold mb-2")]),K([t("Solar Linear icon set")])),L(K([M("flex flex-row items-center w-full")]),(()=>{let Z=FG();return w0(Z,(Q)=>{let X,W;return X=Q[0],W=Q[1],J0(K([PZ(W)]),K([X("w-6 h-6 me-2 hover:scale-110")]))})})()),t("Vectors and icons by "),J0(K([u6("_blank"),M("link"),PZ("https://www.figma.com/community/file/1166831539721848736?ref=svgrepo.com")]),K([t("Solar Icons")])),t(" in CC Attribution License via "),J0(K([M("link"),u6("_blank"),PZ("https://www.svgrepo.com/")]),K([t("SVG Repo")]))])),Y0(K([M("card block bg-neutral p-4 mb-4 rounded-lg")]),K([NW(K([M("text-lg font-bold mb-2")]),K([F8(K([K8("https://gleam.run/images/lucy/lucy.svg"),M("inline-block w-5 h-auto ms-2 align-middle")])),t("Gleam")])),C("Much thanks to the "),J0(K([PZ("https://gleam.run/"),M("link ")]),K([t("Gleam programming language")])),C(" and its community!")])),Y0(K([M("card block bg-neutral p-4 mb-4 rounded-lg")]),K([NW(K([M("text-lg font-bold mb-2")]),K([t("Fonts used")])),oZ(K([M("list-disc list-inside")]),K([Y0(K([]),K([j0(K([]),K([J0(K([PZ("https://fonts.google.com/specimen/Vend+Sans"),M("link font-sans")]),K([t("Vend Sans")])),C(" "),j0(K([M("badge badge-xs badge-soft badge-secondary text-xs")]),K([C("font-sans")]))])),XZ(K([M("text-xs")]),K([C("Designed by Bloom Type Foundry and Baptiste Guesnon under SIL Open Font License.")]))])),Y0(K([]),K([j0(K([]),K([J0(K([PZ("https://fonts.google.com/specimen/Gantari"),M("link font-logo")]),K([t("Gantari")])),C(" "),j0(K([M("badge badge-xs badge-soft badge-secondary text-xs")]),K([C("font-logo")]))])),XZ(K([M("text-xs")]),K([C("Designed by Lafontype")]))])),Y0(K([]),K([j0(K([]),K([J0(K([PZ("https://fonts.google.com/specimen/Elms+Sans"),M("link font-content")]),K([t("Elms Sans")])),C(" "),j0(K([M("badge badge-xs badge-soft badge-secondary text-xs")]),K([C("font-content")]))])),XZ(K([M("text-xs")]),K([C("Designed by Amarachi Nwauwa under SIL Open Font License")]))])),Y0(K([]),K([j0(K([]),K([J0(K([PZ("https://fonts.google.com/specimen/Josefin+Sans"),M("link font-menuitems")]),K([t("Josefin Sans")])),C(" "),j0(K([M("badge badge-xs badge-soft badge-secondary text-xs")]),K([C("font-menuitems")]))])),XZ(K([M("text-xs")]),K([C("Designed by Santiago Orozco under SIL Open Font License")]))])),Y0(K([]),K([j0(K([]),K([J0(K([PZ("https://fonts.google.com/specimen/DM+Mono"),M("link font-script")]),K([t("DM Mono")])),C(" "),j0(K([M("badge badge-xs badge-soft badge-secondary text-xs")]),K([C("font-script")]))])),XZ(K([M("text-xs")]),K([C("Designed by Colophon Foundry under SIL Open Font License")]))]))]))]))]))]))}function b5(){let Z=K([L(K([M("hero h-screen max-h-[calc(100vh-4rem)] overflow-auto")]),K([L(K([M("hero-content text-center")]),K([L(K([M("max-w-md")]),K([PW(K([M("text-5xl font-bold")]),K([C("Welcome to Lumina!")])),XZ(K([M("py-6")]),K([C("This should be a nice landing page, but I don't know what to put here right now. Go away! Skram!")])),E0(K([M("btn btn-primary font-menuitems"),H0(new MQ)]),K([C("Login")])),E0(K([M("btn btn-secondary font-menuitems"),H0(new bQ)]),K([C("Register")]))]))]))])),WZ(K([M("modal-toggle"),V8("landing-attributions-show"),l0("checkbox")])),L(K([$K("dialog"),M("modal")]),K([L(K([M("modal-box max-h-[70VH] overflow-y-clip")]),K([y7(K([M("text-lg font-bold")]),K([t("Attributions")])),XZ(K([M("py-4")]),K([y5()])),L(K([M("modal-action")]),K([i0(K([M("btn btn-error font-menuitems"),G8("landing-attributions-show")]),K([t("Close")]))]))]))])),f7(K([M("absolute footer footer-center p-4 bg-base-300 text-base-content bottom-0")]),K([L(K([]),K([XZ(K([]),K([C("The Lumina/Peonies project, by MLC 'Strawmelonjuice' Bloeiman and contributors. "),J0(K([PZ("/licence"),M("link link-neutral-content")]),K([C("Licensed under the European Union Public Licence, with special notice for AI usage.")])),C(".")])),XZ(K([]),K([C("Also uses some CC-BY and other open-source assets, "),i0(K([M("link link-neutral-content"),G8("landing-attributions-show")]),K([t("see attributions")])),C(".")]))]))]))]);return O8(Z,K([]))}function h5(Z){let Q=Z.page,X,W;if(Q instanceof h0)X=Q.fields,W=Q.success;else throw c("let_assert",RX,"lumina_client/view",477,"view_login","Pattern match failed, no pattern matched the value.",{value:Q,start:15758,end:15812,pattern_start:15769,pattern_end:15799});let V=cW(X),G=K([L(K([M("hero h-screen max-h-[calc(100vh-4rem)] overflow-auto")]),K([L(K([M("hero-content flex-col lg:flex-row-reverse")]),K([L(K([M("text-center lg:text-left")]),K([PW(K([M("text-5xl font-bold")]),K([C("Log in to Lumina!")])),XZ(K([M("py-6")]),K([C("And we have boiling water. I REALLY don't know what to put here right now.")]))])),L(K([M("card w-full max-w-sm shrink-0 shadow-2xl transition-colors bg-neutral")]),K([zV(K([M("card-body m-4 transition-[height] duration-300 ease-in-out transition"),nV((J)=>{return new qX(J)})]),K([FV(K([M("fieldset")]),K([i0(K([M("fieldset-label")]),K([C("Email or username")])),WZ(K([wQ("me@mymail.com"),M("input input-primary bg-primary font-content"),l0("text"),EQ(X.emailfield),_Q((J)=>{return new S8(J)}),TZ("focusout",o(new FX))])),i0(K([M("fieldset-label")]),K([C("Password")])),WZ(K([EQ(X.passwordfield),_Q((J)=>{return new A8(J)}),wQ("Password"),M("input input-primary bg-primary font-content"),l0("password")])),L(K([]),K([J0(K([M("link link-hover")]),K([C("Forgot password?")]))])),(()=>{if(W instanceof T)if(!W[0])return L(K([M("text-error-content bg-error p-3 rounded-lg")]),K([C("Incorrect password and/or username!")]));else return AZ();else return AZ()})(),E0((()=>{if(V)return K([M("btn btn-accent w-full mt-4 font-menuitems"),l0("submit")]);else return K([M("btn btn-accent w-full mt-4 btn-disabled font-menuitems bg-accent hidden"),_K(!0)])})(),K([C("Login")]))]))]))]))]))]))]);return O8(G,K([Y0(K([H0(new R8)]),K([J0(K([]),K([C("Back")]))])),Y0(K([H0(new bQ)]),K([J0(K([]),K([C("Register")]))])),Y0(K([H0(new MQ)]),K([J0(K([M("bg-primary text-primary-content")]),K([C("Login")]))]))]))}function g5(Z){let Q=Z.page,X,W;if(Q instanceof T0)X=Q.fields,W=Q.ready;else throw c("let_assert",RX,"lumina_client/view",604,"view_register","Pattern match failed, no pattern matched the value.",{value:Q,start:20770,end:20840,pattern_start:20781,pattern_end:20809});let V=K([L(K([M("hero h-screen max-h-[calc(100vh-4rem)] overflow-auto")]),K([L(K([M("hero-content flex-col lg:flex-row-reverse")]),K([L(K([M("card bg-neutral w-full max-w-sm shrink-0 shadow-2xl")]),K([zV(K([M("card-body m-4 delay-150 duration-300 ease-in-out transition-[height]"),nV((G)=>{return new UX(G)})]),K([FV(K([M("fieldset")]),K([i0(K([M("fieldset-label")]),K([C("Email")])),WZ(K([wQ("Email"),M("input input-primary bg-primary font-content"),l0("email"),EQ(X.emailfield),_Q((G)=>{return new S8(G)})])),i0(K([M("fieldset-label")]),K([C("Username")])),WZ(K([wQ("Username"),M("input input-primary bg-primary font-content"),l0("string"),EQ(X.usernamefield),_Q((G)=>{return new MX(G)})])),i0(K([M("fieldset-label")]),K([C("Password")])),WZ(K([EQ(X.passwordfield),_Q((G)=>{return new A8(G)}),wQ("Password"),M("input input-primary bg-primary font-content"),l0("password")])),i0(K([M("fieldset-label")]),K([C("Confirm Password")])),WZ(K([EQ(X.passwordconfirmfield),_Q((G)=>{return new IX(G)}),wQ("Re-type password"),M("input input-primary bg-primary font-content"),l0("password")])),(()=>{if((()=>{return VQ(W)})()&&(()=>{let Y=wZ(W,new k(""));return NQ(Y)})()&&X.passwordfield===X.passwordconfirmfield)return E0(K([M("btn btn-accent font-menuitems w-full m-0 p-0 mt-2"),l0("submit")]),K([t((()=>{if((()=>{return VQ(W)})()&&(()=>{let H=wZ(W,new k(""));return NQ(H)})())return"Sign up as "+X.usernamefield;else return"Sign up"})())]));else return L(K([M((()=>{if((()=>{return VQ(W)})())return"btn bg-base-200 hover:bg-base-200 text-warning-content font-menuitems w-full m-0 p-0 rounded-lg mt-2 opacity-80 hover:opacity-80 cursor-default no-animation disabled";else return"hidden"})())]),K([(()=>{let J=(()=>{return wZ(W,new B(void 0))})(),Y=X.passwordfield===X.passwordconfirmfield;if(J instanceof B)if(Y)return AZ();else return L(K([M("")]),K([C("Passwords don't match!")]));else{let H=J[0];return L(K([M("")]),K([j0(K([]),(()=>{if(iQ(H,"in use"))return K([C(" "+H+", do you want to "),J0(K([H0(new MQ),M("link link-primary")]),K([C("log in instead")])),C("?")]);else return K([C(" "+H)])})())]))}})()]))})()]))]))])),L(K([M("text-center lg:text-left")]),K([PW(K([M("text-5xl font-bold")]),K([C("Sign up for Lumina!")])),XZ(K([M("py-6")]),K([C("We have real good food, I don't know what to put here right now.")]))]))]))]))]);return O8(V,K([Y0(K([H0(new R8)]),K([J0(K([]),K([C("Back")]))])),Y0(K([H0(new bQ)]),K([J0(K([M("bg-primary text-primary-content")]),K([C("Register")]))])),Y0(K([H0(new MQ)]),K([J0(K([]),K([C("Login")]))]))]))}function OG(Z){let Q=j8(),X;if(Q instanceof B)X=Q[0];else throw c("let_assert",RX,"lumina_client/view",45,"view","localstorage should be available on ALL major browsers.",{value:Q,start:1839,end:1884,pattern_start:1850,pattern_end:1866});let W=EV(X,uW,GG(Z)),V,G=Z.page;if(G instanceof DZ)V=b5();else if(G instanceof T0)V=g5(Z);else if(G instanceof h0)V=h5(Z);else if(G instanceof O0)V=AG(Z);else if(G instanceof IQ)throw c("todo",RX,"lumina_client/view",60,"view","Licence should be shown by the client if it's not shown by the server.",{});else{let Y=G.uri;throw c("todo",RX,"lumina_client/view",58,"view","No 404 page yet.",{})}let J=V;return L(K([JG(Z),M("w-screen h-screen content")]),K([(()=>{let Y=Z.ws;if(Y instanceof eZ)return L(K([F("open",""),M("modal modal-bottom sm:modal-middle")]),K([L(K([M("modal-box")]),K([C("Connecting to server..."),L(K([M("float-right")]),K([j0(K([M("loading loading-spinner loading-xl")]),K([]))]))]))]));else if(Y instanceof x0)return AZ();else if(Y instanceof ZQ)return L(K([F("open",""),M("toast toast-top toast-center z-100")]),K([L(K([M("alert alert-info")]),K([C("Connection to server ended! "),E0(K([M("btn btn-primary font-menuitems"),H0(new B8)]),K([C("Reconnect")]))]))]));else if(Y instanceof gQ)return AZ();else return L(K([F("open",""),M("toast toast-top toast-center z-100")]),K([L(K([M("alert alert-info")]),K([C("Connection to server ended! Reconnecting..."),L(K([M("float-right")]),K([j0(K([M("loading loading-spinner loading-lg")]),K([]))]))]))]))})(),J]))}var g0="src/lumina_client.gleam";class Y9 extends I{constructor(Z){super();this.greeting=Z}}class H9 extends I{constructor(Z,Q){super();this.ok=Z,this.why=Q}}class q9 extends I{constructor(Z,Q){super();this.username=Z,this.token=Q}}class U9 extends I{}class M9 extends I{constructor(Z,Q,X,W,V,G){super();this.timeline_name=Z,this.timeline_id=Q,this.items=X,this.total_count=W,this.page=V,this.has_more=G}}class I9 extends I{constructor(Z,Q,X,W,V){super();this.username=Z,this.email=Q,this.avatar=X,this.uuid=W,this.unread_notifications=V}}class J9 extends I{}class F9 extends I{}class z9 extends I{constructor(Z,Q){super();this.email_username=Z,this.password=Q}}class P9 extends I{constructor(Z,Q,X){super();this.email=Z,this.username=Q,this.password=X}}class $Q extends I{constructor(Z,Q){super();this.timeline_name=Z,this.page=Q}}class C8 extends I{constructor(Z,Q,X){super();this.email=Z,this.username=Q,this.password=X}}class CG extends I{constructor(Z){super();this.post_id=Z}}function _5(Z,Q){return YQ((X)=>{return _V(Z,Q,(W,V)=>{return new fV(W,V)},X)})}function $5(){return YQ((Z)=>{return cV(150,()=>{return Z(new vW)})})}function N9(Z){let Q=j8(),X;if(Q instanceof B)X=Q[0];else throw c("let_assert",g0,"lumina_client",115,"init","localstorage should be available on ALL major browsers.",{value:Q,start:4002,end:4047,pattern_start:4013,pattern_end:4029});let W=new l(new DZ,new b,new eZ,new b,new B(void 0),new T8(R0(),R0(),R0()),Z,SQ(Q8(CQ())));return[(()=>{let V=wV(X,uW);if(V instanceof B){let G=V[0],J=KG(G);if(J instanceof B){let Y=J[0];return new l(Y.page,new b,(()=>{if(Z)return new mW;else return new eZ})(),Y.token,new B(void 0),new T8(R0(),R0(),R0()),Z,SQ(Q8(CQ())))}else return LQ("Could not deserialise last saved model."),W}else return yZ("No model to restore"),W})(),XX(K([XG("/connection",(V)=>{return new $W(V)}),$5()]))]}function m5(Z){return YQ((Q)=>{let X=Z.ws;if(Z.has_been_running_for_150ms)if(X instanceof eZ)return;else if(X instanceof x0)return;else if(X instanceof ZQ)return;else if(X instanceof gQ)return Q(new _W);else return;else if(X instanceof eZ)return;else if(X instanceof x0)return;else if(X instanceof ZQ)return;else if(X instanceof gQ)return;else return})}function HZ(Z){if(Z instanceof F9)return D0(K([["type",_("own_user_information_request")]]));else if(Z instanceof z9){let{email_username:Q,password:X}=Z;return D0(K([["type",_("login_authentication_request")],["email_username",_(Q)],["password",_(X)]]))}else if(Z instanceof P9){let{email:Q,username:X,password:W}=Z;return D0(K([["type",_("register_request")],["email",_(Q)],["username",_(X)],["password",_(W)]]))}else if(Z instanceof $Q){let{timeline_name:Q,page:X}=Z;return D0(K([["type",_("timeline_request")],["by_name",_(Q)],["page",_8(X)]]))}else if(Z instanceof C8){let{email:Q,username:X,password:W}=Z;return D0(K([["type",_("register_precheck")],["email",_(Q)],["username",_(X)],["password",_(W)]]))}else{let Q=Z.post_id;return D0(K([["type",_("post_view_request")],["post_id",_(Q)]]))}}function u5(Z,Q){let X=Z.ws,W;if(X instanceof x0)W=X[0];else throw c("let_assert",g0,"lumina_client",83,"request_next_timeline_page","Socket not connected",{value:X,start:3053,end:3115,pattern_start:3064,pattern_end:3104});let V=(()=>{let G=Z.cache.cached_timelines;return o0(G,Q)})();if(V instanceof B){let G=V[0],J=G9(G);if(J instanceof T){let Y=J[0],H=new $Q(Q,Y),q=HZ(H),U=m0(q);return((z)=>{return QZ(W,z)})(U)}else return $()}else{let G=new $Q(Q,0),J=HZ(G),Y=m0(J);return((H)=>{return QZ(W,H)})(Y)}}function c5(Z){if(Z==="auth_success")return p("username",e,(Q)=>{return p("token",e,(X)=>{return o(new q9(Q,X))})});else if(Z==="auth_failure")return o(new U9);else if(Z==="unknown")return o(new J9);else if(Z==="register_precheck_response")return p("ok",hX,(Q)=>{return p("why",e,(X)=>{return o(new H9(Q,X))})});else if(Z==="greeting")return p("greeting",e,(Q)=>{return o(new Y9(Q))});else if(Z==="timeline_response")return yZ("Decoding timeline response: "+Z),p("timeline_name",e,(Q)=>{return p("timeline_id",e,(X)=>{return p("post_ids",Z8(e),(W)=>{return p("total_count",oQ,(V)=>{return p("page",oQ,(G)=>{return p("has_more",hX,(J)=>{return o(new M9(Q,X,W,V,G,J))})})})})})});else if(Z==="own_user_information_response")return p("username",e,(Q)=>{return p("email",e,(X)=>{return p("unread_notifications",oQ,(W)=>{return p("avatar",eQ(Z8(e)),(V)=>{let G;if(V instanceof T){let Y=V[0];if(Y instanceof A)G=new b;else{let H=Y.tail;if(H instanceof A)G=new b;else if(H.tail instanceof A){let U=Y.head,z=H.head;G=new T([U,z])}else G=new b}}else G=V;let J=G;return p("uuid",e,(Y)=>{return o(new I9(Q,X,J,Y,W))})})})})});else{let Q=Z;return LQ("Unknown message type: "+Q),AQ(new J9,Q)}}function p5(){return p("type",e,(Z)=>{return o(Z)})}function SX(){uX("Destroying session.");let Z=j8(),Q;if(Z instanceof B)Q=Z[0];else throw c("let_assert",g0,"lumina_client",1049,"session_destroy","Pattern match failed, no pattern matched the value.",{value:Z,start:34306,end:34340,pattern_start:34317,pattern_end:34322});return xV(Q),uX("Recreating model."),N9(!1)}function d5(Z,Q){if(r5(Q,void 0,"src/lumina_client.gleam",590),Q instanceof yW)throw c("panic",g0,"lumina_client",592,"update_ws","`panic` expression evaluated.",{});else if(Q instanceof bW){let X=Q[0];return[new l(Z.page,Z.user,new x0(X),Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),QZ(X,(()=>{let W;{let G=K([["type",_("introduction")],["client_kind",_("web")]]);W=D0((()=>{let{user:J,token:Y}=Z;if(J instanceof b&&Y instanceof T){let H=Y[0];return S0(G,K([["try_revive",_(H)]]))}else return G})())}return m0(W)})())]}else if(Q instanceof hW){let X=Q[0],W=v8(X,c5((()=>{let V=v8(X,p5());return DQ(V,"Unparsable message")})()));if(W instanceof B){let V=W[0];if(V instanceof Y9){let G=V.greeting;return yZ("The server says hi! '"+G+"'"),[Z,$()]}else if(V instanceof H9){let{ok:G,why:J}=V;yZ("Register precheck response: "+h8(G));let Y,H;if(G)H=new B(void 0);else H=new k(J);Y=new T(H);let U=Y,z=Z.page;if(z instanceof T0){let N=z.fields;return[new l(new T0(N,U),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()]}else return[Z,$()]}else if(V instanceof q9){let G=V.token,J=Z.ws,Y;if(J instanceof x0)Y=J[0];else throw c("let_assert",g0,"lumina_client",667,"update_ws","Socket not connected",{value:J,start:21412,end:21474,pattern_start:21423,pattern_end:21463});return[new l(new O0(new b,new b),Z.user,Z.ws,new T(G),Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),XX(K([(()=>{let H=new F9,q=HZ(H),U=m0(q);return((z)=>{return QZ(Y,z)})(U)})(),(()=>{let H=new $Q("global",0),q=HZ(H),U=m0(q);return((z)=>{return QZ(Y,z)})(U)})()]))]}else if(V instanceof U9){let G=Z.page;if(G instanceof DZ)return SX();else if(G instanceof T0)return[Z,$()];else if(G instanceof h0){let J=G.fields;return[new l(new h0(J,new T(!1)),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()]}else if(G instanceof O0)return SX();else if(G instanceof IQ)return SX();else return SX()}else if(V instanceof M9){let{timeline_name:G,timeline_id:J,items:Y,total_count:H,page:q,has_more:U}=V;yZ("Received timeline response for "+G+" (id: "+J+") with "+V0(rQ(Y))+" items (page "+V0(q)+" of "+V0(H)+" total, has_more: "+$X(U)+").");let z=Z.ws,N;if(z instanceof x0)N=z[0];else throw c("let_assert",g0,"lumina_client",725,"update_ws","Socket not connected",{value:z,start:23474,end:23536,pattern_start:23485,pattern_end:23525});let R=XX(w0(Y,(h)=>{let j=new CG(h),f=HZ(j),y=m0(f);return((g)=>{return QZ(N,g)})(y)})),D,w=(()=>{let h=Z.cache.cached_timelines;return o0(h,G)})();if(w instanceof B){let h=w[0];D=K9(h,J,q,Y,H,U)}else{let h=RG();D=K9(h,J,q,Y,H,U)}let S=D;yZ(SG(S,G));let x,O=Z.cache.cached_timelines;x=qZ(O,G,S);let E=x;return[new l(Z.page,Z.user,Z.ws,Z.token,Z.status,(()=>{let h=Z.cache;return new T8(h.cached_posts,h.cached_users,E)})(),Z.has_been_running_for_150ms,Z.last_refresh_request_time),R]}else if(V instanceof I9){let{username:G,email:J,avatar:Y,uuid:H,unread_notifications:q}=V,U;if(Y instanceof T){let w=Y[0][0],S=Y[0][1];U="data:"+w+";base64,"+S}else U="";let z=U,N,R=Z.cache.cached_users;N=qZ(R,H,new bV("local",G,z,SQ(Q8(CQ()))));let D=N;return[new l(Z.page,new T(new hV(H,G,J,z,new yV(q,K([])))),Z.ws,Z.token,Z.status,(()=>{let w=Z.cache;return new T8(w.cached_posts,D,w.cached_timelines)})(),Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()]}else throw c("panic",g0,"lumina_client",790,"update_ws",`Received message that was explicitly marked as undecodable, this should not happen 12 - as the decoder should have returned an error instead of Undecodable. Check the decoder implementation and the logs 13 - for the raw message.`,{})}else{let V=W[0];return LQ("Message could not be parsed:"+E6(h8(V))+` 14 - in: 15 - `+E6(X)),[Z,$()]}}else if(Q instanceof gW){let X=Q[0];return cX("Received unexpected: "+x6(h8(X))),[Z,$()]}else{let X=Q[0];cX("Given close reason: "+x6((()=>{if(X instanceof RW)return"Normal close";else if(X instanceof SW)return"Going away";else if(X instanceof AW)return"Protocol error";else if(X instanceof TW)return"Unexpected type of data";else if(X instanceof OW)return"No code from server";else if(X instanceof CW)return"Abnormal close (no close frame was received)";else if(X instanceof LW)return"Incomprehensible frame";else if(X instanceof wW)return"Policy violation";else if(X instanceof EW)return"Message was too big";else if(X instanceof xW)return"Failed extension negotation";else if(X instanceof kW)return"Unexpected faillure";else if(X instanceof fW)return"Failed TLS handshake";else return"Other close reason (unknown)"})()));let W=Z.ws;if(W instanceof eZ)return[Z,$()];else if(W instanceof mW)return[new l(Z.page,Z.user,new ZQ,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()];else{let V=new l(Z.page,Z.user,new gQ,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time);return[V,m5(V)]}}}function n5(Z,Q){if(Q instanceof B8)if(Z.ws instanceof ZQ)return N9(Z.has_been_running_for_150ms);else return[Z,$()];else if(Q instanceof vW)return[new l(Z.page,Z.user,Z.ws,Z.token,Z.status,Z.cache,!0,Z.last_refresh_request_time),$()];else if(Q instanceof kV){let X=Q[0];return[new l(Z.page,Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,X),$()]}else if(Q instanceof _W){let X=(W)=>{return YQ((V)=>{return cV(W,()=>{return V(new B8)})})};return[new l(Z.page,Z.user,new ZQ,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),XX(K([X(1500),X(3000),X(6000),X(12000),X(24000)]))]}else if(Q instanceof $W){let X=Q[0];return d5(Z,X)}else if(Q instanceof MQ)return[new l(new h0(new vQ("",""),new b),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()];else if(Q instanceof bQ)return[new l(new T0(new FQ("","","",""),new b),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()];else if(Q instanceof R8)return[new l(new DZ,Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()];else if(Q instanceof qX){let X=Z.page,W;if(X instanceof h0)W=X.fields;else throw c("let_assert",g0,"lumina_client",445,"update","Pattern match failed, no pattern matched the value.",{value:X,start:14400,end:14440,pattern_start:14411,pattern_end:14427});if(cW(W)){yZ("Submitting login form");let G,J=HZ(new z9(W.emailfield,W.passwordfield));G=m0(J);let Y=G,H=Z.ws,q;if(H instanceof x0)q=H[0];else throw c("let_assert",g0,"lumina_client",456,"update","Socket not connected",{value:H,start:14779,end:14841,pattern_start:14790,pattern_end:14830});return[new l(Z.page,Z.user,new x0(q),Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),QZ(q,Y)]}else return LQ("Form not ready to submit"),[Z,$()]}else if(Q instanceof UX){let X=Z.page,W,V;if(X instanceof T0)W=X.fields,V=X.ready;else throw c("let_assert",g0,"lumina_client",470,"update","Pattern match failed, no pattern matched the value.",{value:X,start:15205,end:15252,pattern_start:15216,pattern_end:15239});if((()=>{return VQ(V)})()&&(()=>{let Y=wZ(V,new k(""));return NQ(Y)})()&&W.passwordfield===W.passwordconfirmfield){yZ("Submitting signup form");let J,Y=HZ(new P9(W.emailfield,W.usernamefield,W.passwordfield));J=m0(Y);let H=J,q=Z.ws,U;if(q instanceof x0)U=q[0];else throw c("let_assert",g0,"lumina_client",488,"update","Socket not connected",{value:q,start:15763,end:15825,pattern_start:15774,pattern_end:15814});return[new l(Z.page,Z.user,new x0(U),Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),QZ(U,H)]}else return LQ("Form not ready to submit"),[Z,$()]}else if(Q instanceof S8){let X=Q[0],W=Z.page;if(W instanceof T0){let{fields:V,ready:G}=W;return[new l(new T0(new FQ(V.usernamefield,X,V.passwordfield,V.passwordconfirmfield),G),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),(()=>{let J=Z.ws,Y;if(J instanceof x0)Y=J[0];else throw c("let_assert",g0,"lumina_client",266,"update","Socket not connected",{value:J,start:8791,end:8853,pattern_start:8802,pattern_end:8842});let H=HZ(new C8(V.emailfield,V.usernamefield,V.passwordfield)),q=m0(H);return((U)=>{return QZ(Y,U)})(q)})()]}else if(W instanceof h0){let V=W.fields;return[new l(new h0(new vQ(X,V.passwordfield),new b),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()]}else return[Z,$()]}else if(Q instanceof A8){let X=Q[0],W=Z.page;if(W instanceof T0){let{fields:V,ready:G}=W;return[new l(new T0(new FQ(V.usernamefield,V.emailfield,X,V.passwordconfirmfield),G),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),(()=>{let J=Z.ws,Y;if(J instanceof x0)Y=J[0];else throw c("let_assert",g0,"lumina_client",302,"update","Socket not connected",{value:J,start:9888,end:9950,pattern_start:9899,pattern_end:9939});let H=HZ(new C8(V.emailfield,V.usernamefield,V.passwordfield)),q=m0(H);return((U)=>{return QZ(Y,U)})(q)})()]}else if(W instanceof h0){let V=W.fields,G;if(fZ(V.emailfield,"@"))G=bX(V.emailfield,1);else G=V.emailfield;let Y=G,H;if(iQ(Y,"@"))H=Y;else{let z=yX(Y),N=zZ(z," ",""),R=MZ(N),D=zZ(R,"@","");H=zZ(D,".","")}return[new l(new h0(new vQ(H,X),new b),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()]}else return[Z,$()]}else if(Q instanceof MX){let X=Q[0],W=Z.page;if(W instanceof T0){let{fields:V,ready:G}=W;return[new l(new T0(new FQ((()=>{let J;if(fZ(X,"@"))J=bX(X,1);else J=X;let q=yX(J),U=zZ(q," ",""),z=MZ(U),N=zZ(z,"@","");return zZ(N,".","")})(),V.emailfield,V.passwordfield,V.passwordconfirmfield),G),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),(()=>{let J=Z.ws,Y;if(J instanceof x0)Y=J[0];else throw c("let_assert",g0,"lumina_client",398,"update","Socket not connected",{value:J,start:12985,end:13047,pattern_start:12996,pattern_end:13036});let H=HZ(new C8(V.emailfield,V.usernamefield,V.passwordfield)),q=m0(H);return((U)=>{return QZ(Y,U)})(q)})()]}else return[Z,$()]}else if(Q instanceof IX){let X=Q[0],W=Z.page;if(W instanceof T0){let{fields:V,ready:G}=W;return[new l(new T0(new FQ(V.usernamefield,V.emailfield,V.passwordfield,X),G),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),(()=>{let J=Z.ws,Y;if(J instanceof x0)Y=J[0];else throw c("let_assert",g0,"lumina_client",363,"update","Socket not connected",{value:J,start:11838,end:11900,pattern_start:11849,pattern_end:11889});let H=HZ(new C8(V.emailfield,V.usernamefield,V.passwordfield)),q=m0(H);return((U)=>{return QZ(Y,U)})(q)})()]}else return[Z,$()]}else if(Q instanceof FX){let X=Z.page,W;if(X instanceof h0)W=X.fields;else throw c("let_assert",g0,"lumina_client",414,"update","Pattern match failed, no pattern matched the value.",{value:X,start:13539,end:13586,pattern_start:13550,pattern_end:13573});let V;if(fZ(W.emailfield,"@"))V=bX(W.emailfield,1);else V=W.emailfield;let J=V,Y;if(iQ(J,"@"))Y=J;else{let U=yX(J),z=zZ(U," ",""),N=MZ(z),R=zZ(N,"@","");Y=zZ(R,".","")}return[new l(new h0(new vQ(Y,W.passwordfield),new b),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()]}else if(Q instanceof hQ){let X=Q[0],W=Z.ws,V;if(W instanceof x0)V=W[0];else throw c("let_assert",g0,"lumina_client",502,"update","Socket not connected",{value:W,start:16205,end:16267,pattern_start:16216,pattern_end:16256});let G,J=Z.page;if(J instanceof O0){let z=J.modal;G=new l(new O0(new T(X),z),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time)}else G=Z;let Y=G,H,q=(()=>{let z=Y.cache.cached_timelines;return o0(z,X)})();if(q instanceof B){let z=q[0];if(BG(z,20,10)){let R=G9(z);if(R instanceof T){let D=R[0],w=new $Q(X,D),S=HZ(w),x=m0(S);H=((O)=>{return QZ(V,O)})(x)}else H=$()}else H=$()}else{let z=new $Q(X,0),N=HZ(z),R=m0(N);H=((D)=>{return QZ(V,D)})(R)}return[Y,H]}else if(Q instanceof zX){let X=Q[0],W=u5(Z,X);return[Z,W]}else if(Q instanceof PX)return SX();else if(Q instanceof _Z){let X=Z.page;if(X instanceof O0){let W=X.timeline_name;return[new l(new O0(W,new b),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()]}else return[Z,$()]}else if(Q instanceof tZ){let X=Q[0],W=Z.page;if(W instanceof O0){let V=W.timeline_name;return[new l(new O0(V,new T([X,R0()])),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()]}else return[Z,$()]}else if(Q instanceof NX){let X=Q[0],W=Q[1];return[Z,_5(X,W)]}else{let X=Q[0],W=Q[1],V=Z.page;if(V instanceof O0){let G=V.modal;if(G instanceof T)if(G[0][0]==="mdl-postedit"){let Y=V.timeline_name,H=G[0][1],q,z=qZ(H,"pos_x",cZ(X));return q=qZ(z,"pos_y",cZ(W)),[new l(new O0(Y,new T(["mdl-postedit",q])),Z.user,Z.ws,Z.token,Z.status,Z.cache,Z.has_been_running_for_150ms,Z.last_refresh_request_time),$()]}else return[Z,$()];else return[Z,$()]}else return[Z,$()]}}function LG(){let Z=p7(N9,n5,OG),Q=d7(Z,"#app",!1);if(!(Q instanceof B))throw c("let_assert",g0,"lumina_client",109,"main","Pattern match failed, no pattern matched the value.",{value:Q,start:3815,end:3866,pattern_start:3826,pattern_end:3831});return Q}function r5(Z,Q,X,W){let J=`${X}:${W}`,H=new wG().inspect(Z),q=Q===void 0?"":" "+Q;if(globalThis.process?.stderr?.write){let U=`\x1B[90m${J}\x1B[39m${q} 16 - ${H} 17 - `;globalThis.process.stderr.write(U)}else if(globalThis.Deno){let U=`\x1B[90m${J}\x1B[39m${q} 18 - ${H} 19 - `;globalThis.Deno.stderr.writeSync(new TextEncoder().encode(U))}else{let U=`${J}${q} 20 - ${H}`;globalThis.console.log(U)}return Z}class wG{#Z=new globalThis.Set;#Q(Z){try{let X=R0().constructor;return Z instanceof X}catch{return!1}}#G(Z){let Q=Z.toString().replace("+","");if(Q.indexOf(".")>=0)return Q;else{let X=Q.indexOf("e");if(X>=0)return Q.slice(0,X)+".0"+Q.slice(X);else return Q+".0"}}inspect(Z){let Q=typeof Z;if(Z===!0)return"True";if(Z===!1)return"False";if(Z===null)return"//js(null)";if(Z===void 0)return"Nil";if(Q==="string")return this.#Y(Z);if(Q==="bigint"||globalThis.Number.isInteger(Z))return Z.toString();if(Q==="number")return this.#G(Z);if(Z instanceof PQ)return this.#J(Z);if(Z instanceof CZ)return this.#H(Z);if(Z instanceof globalThis.RegExp)return`//js(${Z})`;if(Z instanceof globalThis.Date)return`//js(Date("${Z.toISOString()}"))`;if(Z instanceof globalThis.Error)return`//js(${Z.toString()})`;if(Z instanceof globalThis.Function){let W=[];for(let V of globalThis.Array(Z.length).keys())W.push(globalThis.String.fromCharCode(V+97));return`//fn(${W.join(", ")}) { ... }`}if(this.#Z.size===this.#Z.add(Z).size)return"//js(circular reference)";let X;if(globalThis.Array.isArray(Z))X=`#(${Z.map((W)=>this.inspect(W)).join(", ")})`;else if(Z instanceof C0)X=this.#V(Z);else if(Z instanceof I)X=this.#W(Z);else if(this.#Q(Z))X=this.#X(Z);else if(Z instanceof Set)return`//js(Set(${[...Z].map((W)=>this.inspect(W)).join(", ")}))`;else X=this.#K(Z);return this.#Z.delete(Z),X}#K(Z){let Q=globalThis.Object.getPrototypeOf(Z)?.constructor?.name||"Object",X=[];for(let G of globalThis.Object.keys(Z))X.push(`${this.inspect(G)}: ${this.inspect(Z[G])}`);let W=X.length?" "+X.join(", ")+" ":"";return`//js(${Q==="Object"?"":Q+" "}{${W}})`}#X(Z){let Q="dict.from_list([",X=!0,W=KQ(Z,[],(V,G,J)=>{return V.push([G,J]),V});return W.sort(),W.forEach(([V,G])=>{if(!X)Q=Q+", ";Q=Q+"#("+this.inspect(V)+", "+this.inspect(G)+")",X=!1}),Q+"])"}#W(Z){let Q=globalThis.Object.keys(Z).map((X)=>{let W=this.inspect(Z[X]);return isNaN(parseInt(X))?`${X}: ${W}`:W}).join(", ");return Q?`${Z.constructor.name}(${Q})`:Z.constructor.name}#V(Z){if(Z instanceof A)return"[]";let Q='charlist.from_string("',X="[",W=Z;while(W instanceof v0){let V=W.head;if(W=W.tail,X!=="[")X+=", ";if(X+=this.inspect(V),Q)if(globalThis.Number.isInteger(V)&&V>=32&&V<=126)Q+=globalThis.String.fromCharCode(V);else Q=null}if(Q)return Q+'")';else return X+"]"}#Y(Z){let Q='"';for(let X=0;X<Z.length;X++){let W=Z[X];switch(W){case` 21 - `:Q+="\\n";break;case"\r":Q+="\\r";break;case"\t":Q+="\\t";break;case"\f":Q+="\\f";break;case"\\":Q+="\\\\";break;case'"':Q+="\\\"";break;default:if(W<" "||W>"~"&&W<" ")Q+="\\u{"+W.charCodeAt(0).toString(16).toUpperCase().padStart(4,"0")+"}";else Q+=W}}return Q+='"',Q}#J(Z){return`//utfcodepoint(${globalThis.String.fromCodePoint(Z.value)})`}#H(Z){if(Z.bitSize===0)return"<<>>";let Q="<<";for(let X=0;X<Z.byteSize-1;X++)Q+=Z.byteAt(X).toString(),Q+=", ";if(Z.byteSize*8===Z.bitSize)Q+=Z.byteAt(Z.byteSize-1).toString();else{let X=Z.bitSize%8;Q+=Z.byteAt(Z.byteSize-1)>>8-X,Q+=`:size(${X})`}return Q+=">>",Q}}document.addEventListener("DOMContentLoaded",LG());
-10111
server/priv/static/lumina_client.mjs
··· 1 - // build/dev/javascript/prelude.mjs 2 - class CustomType { 3 - withFields(fields) { 4 - let properties = Object.keys(this).map((label) => (label in fields) ? fields[label] : this[label]); 5 - return new this.constructor(...properties); 6 - } 7 - } 8 - 9 - class List { 10 - static fromArray(array, tail) { 11 - let t = tail || new Empty; 12 - for (let i = array.length - 1;i >= 0; --i) { 13 - t = new NonEmpty(array[i], t); 14 - } 15 - return t; 16 - } 17 - [Symbol.iterator]() { 18 - return new ListIterator(this); 19 - } 20 - toArray() { 21 - return [...this]; 22 - } 23 - atLeastLength(desired) { 24 - let current = this; 25 - while (desired-- > 0 && current) 26 - current = current.tail; 27 - return current !== undefined; 28 - } 29 - hasLength(desired) { 30 - let current = this; 31 - while (desired-- > 0 && current) 32 - current = current.tail; 33 - return desired === -1 && current instanceof Empty; 34 - } 35 - countLength() { 36 - let current = this; 37 - let length = 0; 38 - while (current) { 39 - current = current.tail; 40 - length++; 41 - } 42 - return length - 1; 43 - } 44 - } 45 - function prepend(element, tail) { 46 - return new NonEmpty(element, tail); 47 - } 48 - function toList(elements, tail) { 49 - return List.fromArray(elements, tail); 50 - } 51 - 52 - class ListIterator { 53 - #current; 54 - constructor(current) { 55 - this.#current = current; 56 - } 57 - next() { 58 - if (this.#current instanceof Empty) { 59 - return { done: true }; 60 - } else { 61 - let { head, tail } = this.#current; 62 - this.#current = tail; 63 - return { value: head, done: false }; 64 - } 65 - } 66 - } 67 - 68 - class Empty extends List { 69 - } 70 - class NonEmpty extends List { 71 - constructor(head, tail) { 72 - super(); 73 - this.head = head; 74 - this.tail = tail; 75 - } 76 - } 77 - class BitArray { 78 - bitSize; 79 - byteSize; 80 - bitOffset; 81 - rawBuffer; 82 - constructor(buffer, bitSize, bitOffset) { 83 - if (!(buffer instanceof Uint8Array)) { 84 - throw globalThis.Error("BitArray can only be constructed from a Uint8Array"); 85 - } 86 - this.bitSize = bitSize ?? buffer.length * 8; 87 - this.byteSize = Math.trunc((this.bitSize + 7) / 8); 88 - this.bitOffset = bitOffset ?? 0; 89 - if (this.bitSize < 0) { 90 - throw globalThis.Error(`BitArray bit size is invalid: ${this.bitSize}`); 91 - } 92 - if (this.bitOffset < 0 || this.bitOffset > 7) { 93 - throw globalThis.Error(`BitArray bit offset is invalid: ${this.bitOffset}`); 94 - } 95 - if (buffer.length !== Math.trunc((this.bitOffset + this.bitSize + 7) / 8)) { 96 - throw globalThis.Error("BitArray buffer length is invalid"); 97 - } 98 - this.rawBuffer = buffer; 99 - } 100 - byteAt(index) { 101 - if (index < 0 || index >= this.byteSize) { 102 - return; 103 - } 104 - return bitArrayByteAt(this.rawBuffer, this.bitOffset, index); 105 - } 106 - equals(other) { 107 - if (this.bitSize !== other.bitSize) { 108 - return false; 109 - } 110 - const wholeByteCount = Math.trunc(this.bitSize / 8); 111 - if (this.bitOffset === 0 && other.bitOffset === 0) { 112 - for (let i = 0;i < wholeByteCount; i++) { 113 - if (this.rawBuffer[i] !== other.rawBuffer[i]) { 114 - return false; 115 - } 116 - } 117 - const trailingBitsCount = this.bitSize % 8; 118 - if (trailingBitsCount) { 119 - const unusedLowBitCount = 8 - trailingBitsCount; 120 - if (this.rawBuffer[wholeByteCount] >> unusedLowBitCount !== other.rawBuffer[wholeByteCount] >> unusedLowBitCount) { 121 - return false; 122 - } 123 - } 124 - } else { 125 - for (let i = 0;i < wholeByteCount; i++) { 126 - const a = bitArrayByteAt(this.rawBuffer, this.bitOffset, i); 127 - const b = bitArrayByteAt(other.rawBuffer, other.bitOffset, i); 128 - if (a !== b) { 129 - return false; 130 - } 131 - } 132 - const trailingBitsCount = this.bitSize % 8; 133 - if (trailingBitsCount) { 134 - const a = bitArrayByteAt(this.rawBuffer, this.bitOffset, wholeByteCount); 135 - const b = bitArrayByteAt(other.rawBuffer, other.bitOffset, wholeByteCount); 136 - const unusedLowBitCount = 8 - trailingBitsCount; 137 - if (a >> unusedLowBitCount !== b >> unusedLowBitCount) { 138 - return false; 139 - } 140 - } 141 - } 142 - return true; 143 - } 144 - get buffer() { 145 - if (this.bitOffset !== 0 || this.bitSize % 8 !== 0) { 146 - throw new globalThis.Error("BitArray.buffer does not support unaligned bit arrays"); 147 - } 148 - return this.rawBuffer; 149 - } 150 - get length() { 151 - if (this.bitOffset !== 0 || this.bitSize % 8 !== 0) { 152 - throw new globalThis.Error("BitArray.length does not support unaligned bit arrays"); 153 - } 154 - return this.rawBuffer.length; 155 - } 156 - } 157 - function bitArrayByteAt(buffer, bitOffset, index) { 158 - if (bitOffset === 0) { 159 - return buffer[index] ?? 0; 160 - } else { 161 - const a = buffer[index] << bitOffset & 255; 162 - const b = buffer[index + 1] >> 8 - bitOffset; 163 - return a | b; 164 - } 165 - } 166 - 167 - class UtfCodepoint { 168 - constructor(value) { 169 - this.value = value; 170 - } 171 - } 172 - class Result extends CustomType { 173 - static isResult(data) { 174 - return data instanceof Result; 175 - } 176 - } 177 - 178 - class Ok extends Result { 179 - constructor(value) { 180 - super(); 181 - this[0] = value; 182 - } 183 - isOk() { 184 - return true; 185 - } 186 - } 187 - class Error extends Result { 188 - constructor(detail) { 189 - super(); 190 - this[0] = detail; 191 - } 192 - isOk() { 193 - return false; 194 - } 195 - } 196 - function isEqual(x, y) { 197 - let values = [x, y]; 198 - while (values.length) { 199 - let a = values.pop(); 200 - let b = values.pop(); 201 - if (a === b) 202 - continue; 203 - if (!isObject(a) || !isObject(b)) 204 - return false; 205 - let unequal = !structurallyCompatibleObjects(a, b) || unequalDates(a, b) || unequalBuffers(a, b) || unequalArrays(a, b) || unequalMaps(a, b) || unequalSets(a, b) || unequalRegExps(a, b); 206 - if (unequal) 207 - return false; 208 - const proto = Object.getPrototypeOf(a); 209 - if (proto !== null && typeof proto.equals === "function") { 210 - try { 211 - if (a.equals(b)) 212 - continue; 213 - else 214 - return false; 215 - } catch {} 216 - } 217 - let [keys, get] = getters(a); 218 - const ka = keys(a); 219 - const kb = keys(b); 220 - if (ka.length !== kb.length) 221 - return false; 222 - for (let k of ka) { 223 - values.push(get(a, k), get(b, k)); 224 - } 225 - } 226 - return true; 227 - } 228 - function getters(object) { 229 - if (object instanceof Map) { 230 - return [(x) => x.keys(), (x, y) => x.get(y)]; 231 - } else { 232 - let extra = object instanceof globalThis.Error ? ["message"] : []; 233 - return [(x) => [...extra, ...Object.keys(x)], (x, y) => x[y]]; 234 - } 235 - } 236 - function unequalDates(a, b) { 237 - return a instanceof Date && (a > b || a < b); 238 - } 239 - function unequalBuffers(a, b) { 240 - return !(a instanceof BitArray) && a.buffer instanceof ArrayBuffer && a.BYTES_PER_ELEMENT && !(a.byteLength === b.byteLength && a.every((n, i) => n === b[i])); 241 - } 242 - function unequalArrays(a, b) { 243 - return Array.isArray(a) && a.length !== b.length; 244 - } 245 - function unequalMaps(a, b) { 246 - return a instanceof Map && a.size !== b.size; 247 - } 248 - function unequalSets(a, b) { 249 - return a instanceof Set && (a.size != b.size || [...a].some((e) => !b.has(e))); 250 - } 251 - function unequalRegExps(a, b) { 252 - return a instanceof RegExp && (a.source !== b.source || a.flags !== b.flags); 253 - } 254 - function isObject(a) { 255 - return typeof a === "object" && a !== null; 256 - } 257 - function structurallyCompatibleObjects(a, b) { 258 - if (typeof a !== "object" && typeof b !== "object" && (!a || !b)) 259 - return false; 260 - let nonstructural = [Promise, WeakSet, WeakMap, Function]; 261 - if (nonstructural.some((c) => a instanceof c)) 262 - return false; 263 - return a.constructor === b.constructor; 264 - } 265 - function remainderInt(a, b) { 266 - if (b === 0) { 267 - return 0; 268 - } else { 269 - return a % b; 270 - } 271 - } 272 - function divideInt(a, b) { 273 - return Math.trunc(divideFloat(a, b)); 274 - } 275 - function divideFloat(a, b) { 276 - if (b === 0) { 277 - return 0; 278 - } else { 279 - return a / b; 280 - } 281 - } 282 - function makeError(variant, file, module, line, fn, message, extra) { 283 - let error = new globalThis.Error(message); 284 - error.gleam_error = variant; 285 - error.file = file; 286 - error.module = module; 287 - error.line = line; 288 - error.function = fn; 289 - error.fn = fn; 290 - for (let k in extra) 291 - error[k] = extra[k]; 292 - return error; 293 - } 294 - // build/dev/javascript/gleam_stdlib/gleam/order.mjs 295 - class Lt extends CustomType { 296 - } 297 - class Eq extends CustomType { 298 - } 299 - class Gt extends CustomType { 300 - } 301 - 302 - // build/dev/javascript/gleam_stdlib/gleam/option.mjs 303 - class Some extends CustomType { 304 - constructor($0) { 305 - super(); 306 - this[0] = $0; 307 - } 308 - } 309 - class None extends CustomType { 310 - } 311 - function is_some(option) { 312 - return !(option instanceof None); 313 - } 314 - function to_result(option, e) { 315 - if (option instanceof Some) { 316 - let a = option[0]; 317 - return new Ok(a); 318 - } else { 319 - return new Error(e); 320 - } 321 - } 322 - function unwrap(option, default$) { 323 - if (option instanceof Some) { 324 - let x = option[0]; 325 - return x; 326 - } else { 327 - return default$; 328 - } 329 - } 330 - function map(option, fun) { 331 - if (option instanceof Some) { 332 - let x = option[0]; 333 - return new Some(fun(x)); 334 - } else { 335 - return option; 336 - } 337 - } 338 - function or(first, second) { 339 - if (first instanceof Some) { 340 - return first; 341 - } else { 342 - return second; 343 - } 344 - } 345 - 346 - // build/dev/javascript/gleam_stdlib/gleam/dict.mjs 347 - function insert(dict, key, value) { 348 - return map_insert(key, value, dict); 349 - } 350 - function reverse_and_concat(loop$remaining, loop$accumulator) { 351 - while (true) { 352 - let remaining = loop$remaining; 353 - let accumulator = loop$accumulator; 354 - if (remaining instanceof Empty) { 355 - return accumulator; 356 - } else { 357 - let first = remaining.head; 358 - let rest = remaining.tail; 359 - loop$remaining = rest; 360 - loop$accumulator = prepend(first, accumulator); 361 - } 362 - } 363 - } 364 - function do_keys_loop(loop$list, loop$acc) { 365 - while (true) { 366 - let list = loop$list; 367 - let acc = loop$acc; 368 - if (list instanceof Empty) { 369 - return reverse_and_concat(acc, toList([])); 370 - } else { 371 - let rest = list.tail; 372 - let key = list.head[0]; 373 - loop$list = rest; 374 - loop$acc = prepend(key, acc); 375 - } 376 - } 377 - } 378 - function keys(dict) { 379 - return do_keys_loop(map_to_list(dict), toList([])); 380 - } 381 - function do_values_loop(loop$list, loop$acc) { 382 - while (true) { 383 - let list = loop$list; 384 - let acc = loop$acc; 385 - if (list instanceof Empty) { 386 - return reverse_and_concat(acc, toList([])); 387 - } else { 388 - let rest = list.tail; 389 - let value = list.head[1]; 390 - loop$list = rest; 391 - loop$acc = prepend(value, acc); 392 - } 393 - } 394 - } 395 - function values(dict) { 396 - let list_of_pairs = map_to_list(dict); 397 - return do_values_loop(list_of_pairs, toList([])); 398 - } 399 - function fold_loop(loop$list, loop$initial, loop$fun) { 400 - while (true) { 401 - let list = loop$list; 402 - let initial = loop$initial; 403 - let fun = loop$fun; 404 - if (list instanceof Empty) { 405 - return initial; 406 - } else { 407 - let rest = list.tail; 408 - let k = list.head[0]; 409 - let v = list.head[1]; 410 - loop$list = rest; 411 - loop$initial = fun(initial, k, v); 412 - loop$fun = fun; 413 - } 414 - } 415 - } 416 - function fold(dict, initial, fun) { 417 - return fold_loop(map_to_list(dict), initial, fun); 418 - } 419 - 420 - // build/dev/javascript/gleam_stdlib/gleam/pair.mjs 421 - function new$(first, second) { 422 - return [first, second]; 423 - } 424 - 425 - // build/dev/javascript/gleam_stdlib/gleam/list.mjs 426 - class Ascending extends CustomType { 427 - } 428 - 429 - class Descending extends CustomType { 430 - } 431 - function length_loop(loop$list, loop$count) { 432 - while (true) { 433 - let list = loop$list; 434 - let count = loop$count; 435 - if (list instanceof Empty) { 436 - return count; 437 - } else { 438 - let list$1 = list.tail; 439 - loop$list = list$1; 440 - loop$count = count + 1; 441 - } 442 - } 443 - } 444 - function length(list) { 445 - return length_loop(list, 0); 446 - } 447 - function reverse_and_prepend(loop$prefix, loop$suffix) { 448 - while (true) { 449 - let prefix = loop$prefix; 450 - let suffix = loop$suffix; 451 - if (prefix instanceof Empty) { 452 - return suffix; 453 - } else { 454 - let first$1 = prefix.head; 455 - let rest$1 = prefix.tail; 456 - loop$prefix = rest$1; 457 - loop$suffix = prepend(first$1, suffix); 458 - } 459 - } 460 - } 461 - function reverse(list) { 462 - return reverse_and_prepend(list, toList([])); 463 - } 464 - function filter_map_loop(loop$list, loop$fun, loop$acc) { 465 - while (true) { 466 - let list = loop$list; 467 - let fun = loop$fun; 468 - let acc = loop$acc; 469 - if (list instanceof Empty) { 470 - return reverse(acc); 471 - } else { 472 - let first$1 = list.head; 473 - let rest$1 = list.tail; 474 - let _block; 475 - let $ = fun(first$1); 476 - if ($ instanceof Ok) { 477 - let first$2 = $[0]; 478 - _block = prepend(first$2, acc); 479 - } else { 480 - _block = acc; 481 - } 482 - let new_acc = _block; 483 - loop$list = rest$1; 484 - loop$fun = fun; 485 - loop$acc = new_acc; 486 - } 487 - } 488 - } 489 - function filter_map(list, fun) { 490 - return filter_map_loop(list, fun, toList([])); 491 - } 492 - function map_loop(loop$list, loop$fun, loop$acc) { 493 - while (true) { 494 - let list = loop$list; 495 - let fun = loop$fun; 496 - let acc = loop$acc; 497 - if (list instanceof Empty) { 498 - return reverse(acc); 499 - } else { 500 - let first$1 = list.head; 501 - let rest$1 = list.tail; 502 - loop$list = rest$1; 503 - loop$fun = fun; 504 - loop$acc = prepend(fun(first$1), acc); 505 - } 506 - } 507 - } 508 - function map2(list, fun) { 509 - return map_loop(list, fun, toList([])); 510 - } 511 - function take_loop(loop$list, loop$n, loop$acc) { 512 - while (true) { 513 - let list = loop$list; 514 - let n = loop$n; 515 - let acc = loop$acc; 516 - let $ = n <= 0; 517 - if ($) { 518 - return reverse(acc); 519 - } else { 520 - if (list instanceof Empty) { 521 - return reverse(acc); 522 - } else { 523 - let first$1 = list.head; 524 - let rest$1 = list.tail; 525 - loop$list = rest$1; 526 - loop$n = n - 1; 527 - loop$acc = prepend(first$1, acc); 528 - } 529 - } 530 - } 531 - } 532 - function take(list, n) { 533 - return take_loop(list, n, toList([])); 534 - } 535 - function append_loop(loop$first, loop$second) { 536 - while (true) { 537 - let first = loop$first; 538 - let second = loop$second; 539 - if (first instanceof Empty) { 540 - return second; 541 - } else { 542 - let first$1 = first.head; 543 - let rest$1 = first.tail; 544 - loop$first = rest$1; 545 - loop$second = prepend(first$1, second); 546 - } 547 - } 548 - } 549 - function append(first, second) { 550 - return append_loop(reverse(first), second); 551 - } 552 - function prepend2(list, item) { 553 - return prepend(item, list); 554 - } 555 - function flatten_loop(loop$lists, loop$acc) { 556 - while (true) { 557 - let lists = loop$lists; 558 - let acc = loop$acc; 559 - if (lists instanceof Empty) { 560 - return reverse(acc); 561 - } else { 562 - let list = lists.head; 563 - let further_lists = lists.tail; 564 - loop$lists = further_lists; 565 - loop$acc = reverse_and_prepend(list, acc); 566 - } 567 - } 568 - } 569 - function flatten(lists) { 570 - return flatten_loop(lists, toList([])); 571 - } 572 - function fold2(loop$list, loop$initial, loop$fun) { 573 - while (true) { 574 - let list = loop$list; 575 - let initial = loop$initial; 576 - let fun = loop$fun; 577 - if (list instanceof Empty) { 578 - return initial; 579 - } else { 580 - let first$1 = list.head; 581 - let rest$1 = list.tail; 582 - loop$list = rest$1; 583 - loop$initial = fun(initial, first$1); 584 - loop$fun = fun; 585 - } 586 - } 587 - } 588 - function all(loop$list, loop$predicate) { 589 - while (true) { 590 - let list = loop$list; 591 - let predicate = loop$predicate; 592 - if (list instanceof Empty) { 593 - return true; 594 - } else { 595 - let first$1 = list.head; 596 - let rest$1 = list.tail; 597 - let $ = predicate(first$1); 598 - if ($) { 599 - loop$list = rest$1; 600 - loop$predicate = predicate; 601 - } else { 602 - return $; 603 - } 604 - } 605 - } 606 - } 607 - function sequences(loop$list, loop$compare, loop$growing, loop$direction, loop$prev, loop$acc) { 608 - while (true) { 609 - let list = loop$list; 610 - let compare3 = loop$compare; 611 - let growing = loop$growing; 612 - let direction = loop$direction; 613 - let prev = loop$prev; 614 - let acc = loop$acc; 615 - let growing$1 = prepend(prev, growing); 616 - if (list instanceof Empty) { 617 - if (direction instanceof Ascending) { 618 - return prepend(reverse(growing$1), acc); 619 - } else { 620 - return prepend(growing$1, acc); 621 - } 622 - } else { 623 - let new$1 = list.head; 624 - let rest$1 = list.tail; 625 - let $ = compare3(prev, new$1); 626 - if (direction instanceof Ascending) { 627 - if ($ instanceof Lt) { 628 - loop$list = rest$1; 629 - loop$compare = compare3; 630 - loop$growing = growing$1; 631 - loop$direction = direction; 632 - loop$prev = new$1; 633 - loop$acc = acc; 634 - } else if ($ instanceof Eq) { 635 - loop$list = rest$1; 636 - loop$compare = compare3; 637 - loop$growing = growing$1; 638 - loop$direction = direction; 639 - loop$prev = new$1; 640 - loop$acc = acc; 641 - } else { 642 - let _block; 643 - if (direction instanceof Ascending) { 644 - _block = prepend(reverse(growing$1), acc); 645 - } else { 646 - _block = prepend(growing$1, acc); 647 - } 648 - let acc$1 = _block; 649 - if (rest$1 instanceof Empty) { 650 - return prepend(toList([new$1]), acc$1); 651 - } else { 652 - let next = rest$1.head; 653 - let rest$2 = rest$1.tail; 654 - let _block$1; 655 - let $1 = compare3(new$1, next); 656 - if ($1 instanceof Lt) { 657 - _block$1 = new Ascending; 658 - } else if ($1 instanceof Eq) { 659 - _block$1 = new Ascending; 660 - } else { 661 - _block$1 = new Descending; 662 - } 663 - let direction$1 = _block$1; 664 - loop$list = rest$2; 665 - loop$compare = compare3; 666 - loop$growing = toList([new$1]); 667 - loop$direction = direction$1; 668 - loop$prev = next; 669 - loop$acc = acc$1; 670 - } 671 - } 672 - } else if ($ instanceof Lt) { 673 - let _block; 674 - if (direction instanceof Ascending) { 675 - _block = prepend(reverse(growing$1), acc); 676 - } else { 677 - _block = prepend(growing$1, acc); 678 - } 679 - let acc$1 = _block; 680 - if (rest$1 instanceof Empty) { 681 - return prepend(toList([new$1]), acc$1); 682 - } else { 683 - let next = rest$1.head; 684 - let rest$2 = rest$1.tail; 685 - let _block$1; 686 - let $1 = compare3(new$1, next); 687 - if ($1 instanceof Lt) { 688 - _block$1 = new Ascending; 689 - } else if ($1 instanceof Eq) { 690 - _block$1 = new Ascending; 691 - } else { 692 - _block$1 = new Descending; 693 - } 694 - let direction$1 = _block$1; 695 - loop$list = rest$2; 696 - loop$compare = compare3; 697 - loop$growing = toList([new$1]); 698 - loop$direction = direction$1; 699 - loop$prev = next; 700 - loop$acc = acc$1; 701 - } 702 - } else if ($ instanceof Eq) { 703 - let _block; 704 - if (direction instanceof Ascending) { 705 - _block = prepend(reverse(growing$1), acc); 706 - } else { 707 - _block = prepend(growing$1, acc); 708 - } 709 - let acc$1 = _block; 710 - if (rest$1 instanceof Empty) { 711 - return prepend(toList([new$1]), acc$1); 712 - } else { 713 - let next = rest$1.head; 714 - let rest$2 = rest$1.tail; 715 - let _block$1; 716 - let $1 = compare3(new$1, next); 717 - if ($1 instanceof Lt) { 718 - _block$1 = new Ascending; 719 - } else if ($1 instanceof Eq) { 720 - _block$1 = new Ascending; 721 - } else { 722 - _block$1 = new Descending; 723 - } 724 - let direction$1 = _block$1; 725 - loop$list = rest$2; 726 - loop$compare = compare3; 727 - loop$growing = toList([new$1]); 728 - loop$direction = direction$1; 729 - loop$prev = next; 730 - loop$acc = acc$1; 731 - } 732 - } else { 733 - loop$list = rest$1; 734 - loop$compare = compare3; 735 - loop$growing = growing$1; 736 - loop$direction = direction; 737 - loop$prev = new$1; 738 - loop$acc = acc; 739 - } 740 - } 741 - } 742 - } 743 - function merge_ascendings(loop$list1, loop$list2, loop$compare, loop$acc) { 744 - while (true) { 745 - let list1 = loop$list1; 746 - let list2 = loop$list2; 747 - let compare3 = loop$compare; 748 - let acc = loop$acc; 749 - if (list1 instanceof Empty) { 750 - let list = list2; 751 - return reverse_and_prepend(list, acc); 752 - } else if (list2 instanceof Empty) { 753 - let list = list1; 754 - return reverse_and_prepend(list, acc); 755 - } else { 756 - let first1 = list1.head; 757 - let rest1 = list1.tail; 758 - let first2 = list2.head; 759 - let rest2 = list2.tail; 760 - let $ = compare3(first1, first2); 761 - if ($ instanceof Lt) { 762 - loop$list1 = rest1; 763 - loop$list2 = list2; 764 - loop$compare = compare3; 765 - loop$acc = prepend(first1, acc); 766 - } else if ($ instanceof Eq) { 767 - loop$list1 = list1; 768 - loop$list2 = rest2; 769 - loop$compare = compare3; 770 - loop$acc = prepend(first2, acc); 771 - } else { 772 - loop$list1 = list1; 773 - loop$list2 = rest2; 774 - loop$compare = compare3; 775 - loop$acc = prepend(first2, acc); 776 - } 777 - } 778 - } 779 - } 780 - function merge_ascending_pairs(loop$sequences, loop$compare, loop$acc) { 781 - while (true) { 782 - let sequences2 = loop$sequences; 783 - let compare3 = loop$compare; 784 - let acc = loop$acc; 785 - if (sequences2 instanceof Empty) { 786 - return reverse(acc); 787 - } else { 788 - let $ = sequences2.tail; 789 - if ($ instanceof Empty) { 790 - let sequence = sequences2.head; 791 - return reverse(prepend(reverse(sequence), acc)); 792 - } else { 793 - let ascending1 = sequences2.head; 794 - let ascending2 = $.head; 795 - let rest$1 = $.tail; 796 - let descending = merge_ascendings(ascending1, ascending2, compare3, toList([])); 797 - loop$sequences = rest$1; 798 - loop$compare = compare3; 799 - loop$acc = prepend(descending, acc); 800 - } 801 - } 802 - } 803 - } 804 - function merge_descendings(loop$list1, loop$list2, loop$compare, loop$acc) { 805 - while (true) { 806 - let list1 = loop$list1; 807 - let list2 = loop$list2; 808 - let compare3 = loop$compare; 809 - let acc = loop$acc; 810 - if (list1 instanceof Empty) { 811 - let list = list2; 812 - return reverse_and_prepend(list, acc); 813 - } else if (list2 instanceof Empty) { 814 - let list = list1; 815 - return reverse_and_prepend(list, acc); 816 - } else { 817 - let first1 = list1.head; 818 - let rest1 = list1.tail; 819 - let first2 = list2.head; 820 - let rest2 = list2.tail; 821 - let $ = compare3(first1, first2); 822 - if ($ instanceof Lt) { 823 - loop$list1 = list1; 824 - loop$list2 = rest2; 825 - loop$compare = compare3; 826 - loop$acc = prepend(first2, acc); 827 - } else if ($ instanceof Eq) { 828 - loop$list1 = rest1; 829 - loop$list2 = list2; 830 - loop$compare = compare3; 831 - loop$acc = prepend(first1, acc); 832 - } else { 833 - loop$list1 = rest1; 834 - loop$list2 = list2; 835 - loop$compare = compare3; 836 - loop$acc = prepend(first1, acc); 837 - } 838 - } 839 - } 840 - } 841 - function merge_descending_pairs(loop$sequences, loop$compare, loop$acc) { 842 - while (true) { 843 - let sequences2 = loop$sequences; 844 - let compare3 = loop$compare; 845 - let acc = loop$acc; 846 - if (sequences2 instanceof Empty) { 847 - return reverse(acc); 848 - } else { 849 - let $ = sequences2.tail; 850 - if ($ instanceof Empty) { 851 - let sequence = sequences2.head; 852 - return reverse(prepend(reverse(sequence), acc)); 853 - } else { 854 - let descending1 = sequences2.head; 855 - let descending2 = $.head; 856 - let rest$1 = $.tail; 857 - let ascending = merge_descendings(descending1, descending2, compare3, toList([])); 858 - loop$sequences = rest$1; 859 - loop$compare = compare3; 860 - loop$acc = prepend(ascending, acc); 861 - } 862 - } 863 - } 864 - } 865 - function merge_all(loop$sequences, loop$direction, loop$compare) { 866 - while (true) { 867 - let sequences2 = loop$sequences; 868 - let direction = loop$direction; 869 - let compare3 = loop$compare; 870 - if (sequences2 instanceof Empty) { 871 - return sequences2; 872 - } else if (direction instanceof Ascending) { 873 - let $ = sequences2.tail; 874 - if ($ instanceof Empty) { 875 - let sequence = sequences2.head; 876 - return sequence; 877 - } else { 878 - let sequences$1 = merge_ascending_pairs(sequences2, compare3, toList([])); 879 - loop$sequences = sequences$1; 880 - loop$direction = new Descending; 881 - loop$compare = compare3; 882 - } 883 - } else { 884 - let $ = sequences2.tail; 885 - if ($ instanceof Empty) { 886 - let sequence = sequences2.head; 887 - return reverse(sequence); 888 - } else { 889 - let sequences$1 = merge_descending_pairs(sequences2, compare3, toList([])); 890 - loop$sequences = sequences$1; 891 - loop$direction = new Ascending; 892 - loop$compare = compare3; 893 - } 894 - } 895 - } 896 - } 897 - function sort(list, compare3) { 898 - if (list instanceof Empty) { 899 - return list; 900 - } else { 901 - let $ = list.tail; 902 - if ($ instanceof Empty) { 903 - return list; 904 - } else { 905 - let x = list.head; 906 - let y = $.head; 907 - let rest$1 = $.tail; 908 - let _block; 909 - let $1 = compare3(x, y); 910 - if ($1 instanceof Lt) { 911 - _block = new Ascending; 912 - } else if ($1 instanceof Eq) { 913 - _block = new Ascending; 914 - } else { 915 - _block = new Descending; 916 - } 917 - let direction = _block; 918 - let sequences$1 = sequences(rest$1, compare3, toList([x]), direction, y, toList([])); 919 - return merge_all(sequences$1, new Ascending, compare3); 920 - } 921 - } 922 - } 923 - function shuffle_pair_unwrap_loop(loop$list, loop$acc) { 924 - while (true) { 925 - let list = loop$list; 926 - let acc = loop$acc; 927 - if (list instanceof Empty) { 928 - return acc; 929 - } else { 930 - let elem_pair = list.head; 931 - let enumerable = list.tail; 932 - loop$list = enumerable; 933 - loop$acc = prepend(elem_pair[1], acc); 934 - } 935 - } 936 - } 937 - function do_shuffle_by_pair_indexes(list_of_pairs) { 938 - return sort(list_of_pairs, (a_pair, b_pair) => { 939 - return compare(a_pair[0], b_pair[0]); 940 - }); 941 - } 942 - function shuffle(list) { 943 - let _pipe = list; 944 - let _pipe$1 = fold2(_pipe, toList([]), (acc, a) => { 945 - return prepend([random_uniform(), a], acc); 946 - }); 947 - let _pipe$2 = do_shuffle_by_pair_indexes(_pipe$1); 948 - return shuffle_pair_unwrap_loop(_pipe$2, toList([])); 949 - } 950 - 951 - // build/dev/javascript/gleam_stdlib/gleam/result.mjs 952 - function is_ok(result) { 953 - if (result instanceof Ok) { 954 - return true; 955 - } else { 956 - return false; 957 - } 958 - } 959 - function map3(result, fun) { 960 - if (result instanceof Ok) { 961 - let x = result[0]; 962 - return new Ok(fun(x)); 963 - } else { 964 - return result; 965 - } 966 - } 967 - function map_error(result, fun) { 968 - if (result instanceof Ok) { 969 - return result; 970 - } else { 971 - let error = result[0]; 972 - return new Error(fun(error)); 973 - } 974 - } 975 - function try$(result, fun) { 976 - if (result instanceof Ok) { 977 - let x = result[0]; 978 - return fun(x); 979 - } else { 980 - return result; 981 - } 982 - } 983 - function then$(result, fun) { 984 - return try$(result, fun); 985 - } 986 - function unwrap2(result, default$) { 987 - if (result instanceof Ok) { 988 - let v = result[0]; 989 - return v; 990 - } else { 991 - return default$; 992 - } 993 - } 994 - function values2(results) { 995 - return filter_map(results, (r) => { 996 - return r; 997 - }); 998 - } 999 - 1000 - // build/dev/javascript/gleam_stdlib/dict.mjs 1001 - var referenceMap = /* @__PURE__ */ new WeakMap; 1002 - var tempDataView = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)); 1003 - var referenceUID = 0; 1004 - function hashByReference(o) { 1005 - const known = referenceMap.get(o); 1006 - if (known !== undefined) { 1007 - return known; 1008 - } 1009 - const hash = referenceUID++; 1010 - if (referenceUID === 2147483647) { 1011 - referenceUID = 0; 1012 - } 1013 - referenceMap.set(o, hash); 1014 - return hash; 1015 - } 1016 - function hashMerge(a, b) { 1017 - return a ^ b + 2654435769 + (a << 6) + (a >> 2) | 0; 1018 - } 1019 - function hashString(s) { 1020 - let hash = 0; 1021 - const len = s.length; 1022 - for (let i = 0;i < len; i++) { 1023 - hash = Math.imul(31, hash) + s.charCodeAt(i) | 0; 1024 - } 1025 - return hash; 1026 - } 1027 - function hashNumber(n) { 1028 - tempDataView.setFloat64(0, n); 1029 - const i = tempDataView.getInt32(0); 1030 - const j = tempDataView.getInt32(4); 1031 - return Math.imul(73244475, i >> 16 ^ i) ^ j; 1032 - } 1033 - function hashBigInt(n) { 1034 - return hashString(n.toString()); 1035 - } 1036 - function hashObject(o) { 1037 - const proto = Object.getPrototypeOf(o); 1038 - if (proto !== null && typeof proto.hashCode === "function") { 1039 - try { 1040 - const code = o.hashCode(o); 1041 - if (typeof code === "number") { 1042 - return code; 1043 - } 1044 - } catch {} 1045 - } 1046 - if (o instanceof Promise || o instanceof WeakSet || o instanceof WeakMap) { 1047 - return hashByReference(o); 1048 - } 1049 - if (o instanceof Date) { 1050 - return hashNumber(o.getTime()); 1051 - } 1052 - let h = 0; 1053 - if (o instanceof ArrayBuffer) { 1054 - o = new Uint8Array(o); 1055 - } 1056 - if (Array.isArray(o) || o instanceof Uint8Array) { 1057 - for (let i = 0;i < o.length; i++) { 1058 - h = Math.imul(31, h) + getHash(o[i]) | 0; 1059 - } 1060 - } else if (o instanceof Set) { 1061 - o.forEach((v) => { 1062 - h = h + getHash(v) | 0; 1063 - }); 1064 - } else if (o instanceof Map) { 1065 - o.forEach((v, k) => { 1066 - h = h + hashMerge(getHash(v), getHash(k)) | 0; 1067 - }); 1068 - } else { 1069 - const keys2 = Object.keys(o); 1070 - for (let i = 0;i < keys2.length; i++) { 1071 - const k = keys2[i]; 1072 - const v = o[k]; 1073 - h = h + hashMerge(getHash(v), hashString(k)) | 0; 1074 - } 1075 - } 1076 - return h; 1077 - } 1078 - function getHash(u) { 1079 - if (u === null) 1080 - return 1108378658; 1081 - if (u === undefined) 1082 - return 1108378659; 1083 - if (u === true) 1084 - return 1108378657; 1085 - if (u === false) 1086 - return 1108378656; 1087 - switch (typeof u) { 1088 - case "number": 1089 - return hashNumber(u); 1090 - case "string": 1091 - return hashString(u); 1092 - case "bigint": 1093 - return hashBigInt(u); 1094 - case "object": 1095 - return hashObject(u); 1096 - case "symbol": 1097 - return hashByReference(u); 1098 - case "function": 1099 - return hashByReference(u); 1100 - default: 1101 - return 0; 1102 - } 1103 - } 1104 - var SHIFT = 5; 1105 - var BUCKET_SIZE = Math.pow(2, SHIFT); 1106 - var MASK = BUCKET_SIZE - 1; 1107 - var MAX_INDEX_NODE = BUCKET_SIZE / 2; 1108 - var MIN_ARRAY_NODE = BUCKET_SIZE / 4; 1109 - var ENTRY = 0; 1110 - var ARRAY_NODE = 1; 1111 - var INDEX_NODE = 2; 1112 - var COLLISION_NODE = 3; 1113 - var EMPTY = { 1114 - type: INDEX_NODE, 1115 - bitmap: 0, 1116 - array: [] 1117 - }; 1118 - function mask(hash, shift) { 1119 - return hash >>> shift & MASK; 1120 - } 1121 - function bitpos(hash, shift) { 1122 - return 1 << mask(hash, shift); 1123 - } 1124 - function bitcount(x) { 1125 - x -= x >> 1 & 1431655765; 1126 - x = (x & 858993459) + (x >> 2 & 858993459); 1127 - x = x + (x >> 4) & 252645135; 1128 - x += x >> 8; 1129 - x += x >> 16; 1130 - return x & 127; 1131 - } 1132 - function index(bitmap, bit) { 1133 - return bitcount(bitmap & bit - 1); 1134 - } 1135 - function cloneAndSet(arr, at, val) { 1136 - const len = arr.length; 1137 - const out = new Array(len); 1138 - for (let i = 0;i < len; ++i) { 1139 - out[i] = arr[i]; 1140 - } 1141 - out[at] = val; 1142 - return out; 1143 - } 1144 - function spliceIn(arr, at, val) { 1145 - const len = arr.length; 1146 - const out = new Array(len + 1); 1147 - let i = 0; 1148 - let g = 0; 1149 - while (i < at) { 1150 - out[g++] = arr[i++]; 1151 - } 1152 - out[g++] = val; 1153 - while (i < len) { 1154 - out[g++] = arr[i++]; 1155 - } 1156 - return out; 1157 - } 1158 - function spliceOut(arr, at) { 1159 - const len = arr.length; 1160 - const out = new Array(len - 1); 1161 - let i = 0; 1162 - let g = 0; 1163 - while (i < at) { 1164 - out[g++] = arr[i++]; 1165 - } 1166 - ++i; 1167 - while (i < len) { 1168 - out[g++] = arr[i++]; 1169 - } 1170 - return out; 1171 - } 1172 - function createNode(shift, key1, val1, key2hash, key2, val2) { 1173 - const key1hash = getHash(key1); 1174 - if (key1hash === key2hash) { 1175 - return { 1176 - type: COLLISION_NODE, 1177 - hash: key1hash, 1178 - array: [ 1179 - { type: ENTRY, k: key1, v: val1 }, 1180 - { type: ENTRY, k: key2, v: val2 } 1181 - ] 1182 - }; 1183 - } 1184 - const addedLeaf = { val: false }; 1185 - return assoc(assocIndex(EMPTY, shift, key1hash, key1, val1, addedLeaf), shift, key2hash, key2, val2, addedLeaf); 1186 - } 1187 - function assoc(root2, shift, hash, key, val, addedLeaf) { 1188 - switch (root2.type) { 1189 - case ARRAY_NODE: 1190 - return assocArray(root2, shift, hash, key, val, addedLeaf); 1191 - case INDEX_NODE: 1192 - return assocIndex(root2, shift, hash, key, val, addedLeaf); 1193 - case COLLISION_NODE: 1194 - return assocCollision(root2, shift, hash, key, val, addedLeaf); 1195 - } 1196 - } 1197 - function assocArray(root2, shift, hash, key, val, addedLeaf) { 1198 - const idx = mask(hash, shift); 1199 - const node = root2.array[idx]; 1200 - if (node === undefined) { 1201 - addedLeaf.val = true; 1202 - return { 1203 - type: ARRAY_NODE, 1204 - size: root2.size + 1, 1205 - array: cloneAndSet(root2.array, idx, { type: ENTRY, k: key, v: val }) 1206 - }; 1207 - } 1208 - if (node.type === ENTRY) { 1209 - if (isEqual(key, node.k)) { 1210 - if (val === node.v) { 1211 - return root2; 1212 - } 1213 - return { 1214 - type: ARRAY_NODE, 1215 - size: root2.size, 1216 - array: cloneAndSet(root2.array, idx, { 1217 - type: ENTRY, 1218 - k: key, 1219 - v: val 1220 - }) 1221 - }; 1222 - } 1223 - addedLeaf.val = true; 1224 - return { 1225 - type: ARRAY_NODE, 1226 - size: root2.size, 1227 - array: cloneAndSet(root2.array, idx, createNode(shift + SHIFT, node.k, node.v, hash, key, val)) 1228 - }; 1229 - } 1230 - const n = assoc(node, shift + SHIFT, hash, key, val, addedLeaf); 1231 - if (n === node) { 1232 - return root2; 1233 - } 1234 - return { 1235 - type: ARRAY_NODE, 1236 - size: root2.size, 1237 - array: cloneAndSet(root2.array, idx, n) 1238 - }; 1239 - } 1240 - function assocIndex(root2, shift, hash, key, val, addedLeaf) { 1241 - const bit = bitpos(hash, shift); 1242 - const idx = index(root2.bitmap, bit); 1243 - if ((root2.bitmap & bit) !== 0) { 1244 - const node = root2.array[idx]; 1245 - if (node.type !== ENTRY) { 1246 - const n = assoc(node, shift + SHIFT, hash, key, val, addedLeaf); 1247 - if (n === node) { 1248 - return root2; 1249 - } 1250 - return { 1251 - type: INDEX_NODE, 1252 - bitmap: root2.bitmap, 1253 - array: cloneAndSet(root2.array, idx, n) 1254 - }; 1255 - } 1256 - const nodeKey = node.k; 1257 - if (isEqual(key, nodeKey)) { 1258 - if (val === node.v) { 1259 - return root2; 1260 - } 1261 - return { 1262 - type: INDEX_NODE, 1263 - bitmap: root2.bitmap, 1264 - array: cloneAndSet(root2.array, idx, { 1265 - type: ENTRY, 1266 - k: key, 1267 - v: val 1268 - }) 1269 - }; 1270 - } 1271 - addedLeaf.val = true; 1272 - return { 1273 - type: INDEX_NODE, 1274 - bitmap: root2.bitmap, 1275 - array: cloneAndSet(root2.array, idx, createNode(shift + SHIFT, nodeKey, node.v, hash, key, val)) 1276 - }; 1277 - } else { 1278 - const n = root2.array.length; 1279 - if (n >= MAX_INDEX_NODE) { 1280 - const nodes = new Array(32); 1281 - const jdx = mask(hash, shift); 1282 - nodes[jdx] = assocIndex(EMPTY, shift + SHIFT, hash, key, val, addedLeaf); 1283 - let j = 0; 1284 - let bitmap = root2.bitmap; 1285 - for (let i = 0;i < 32; i++) { 1286 - if ((bitmap & 1) !== 0) { 1287 - const node = root2.array[j++]; 1288 - nodes[i] = node; 1289 - } 1290 - bitmap = bitmap >>> 1; 1291 - } 1292 - return { 1293 - type: ARRAY_NODE, 1294 - size: n + 1, 1295 - array: nodes 1296 - }; 1297 - } else { 1298 - const newArray = spliceIn(root2.array, idx, { 1299 - type: ENTRY, 1300 - k: key, 1301 - v: val 1302 - }); 1303 - addedLeaf.val = true; 1304 - return { 1305 - type: INDEX_NODE, 1306 - bitmap: root2.bitmap | bit, 1307 - array: newArray 1308 - }; 1309 - } 1310 - } 1311 - } 1312 - function assocCollision(root2, shift, hash, key, val, addedLeaf) { 1313 - if (hash === root2.hash) { 1314 - const idx = collisionIndexOf(root2, key); 1315 - if (idx !== -1) { 1316 - const entry = root2.array[idx]; 1317 - if (entry.v === val) { 1318 - return root2; 1319 - } 1320 - return { 1321 - type: COLLISION_NODE, 1322 - hash, 1323 - array: cloneAndSet(root2.array, idx, { type: ENTRY, k: key, v: val }) 1324 - }; 1325 - } 1326 - const size = root2.array.length; 1327 - addedLeaf.val = true; 1328 - return { 1329 - type: COLLISION_NODE, 1330 - hash, 1331 - array: cloneAndSet(root2.array, size, { type: ENTRY, k: key, v: val }) 1332 - }; 1333 - } 1334 - return assoc({ 1335 - type: INDEX_NODE, 1336 - bitmap: bitpos(root2.hash, shift), 1337 - array: [root2] 1338 - }, shift, hash, key, val, addedLeaf); 1339 - } 1340 - function collisionIndexOf(root2, key) { 1341 - const size = root2.array.length; 1342 - for (let i = 0;i < size; i++) { 1343 - if (isEqual(key, root2.array[i].k)) { 1344 - return i; 1345 - } 1346 - } 1347 - return -1; 1348 - } 1349 - function find(root2, shift, hash, key) { 1350 - switch (root2.type) { 1351 - case ARRAY_NODE: 1352 - return findArray(root2, shift, hash, key); 1353 - case INDEX_NODE: 1354 - return findIndex(root2, shift, hash, key); 1355 - case COLLISION_NODE: 1356 - return findCollision(root2, key); 1357 - } 1358 - } 1359 - function findArray(root2, shift, hash, key) { 1360 - const idx = mask(hash, shift); 1361 - const node = root2.array[idx]; 1362 - if (node === undefined) { 1363 - return; 1364 - } 1365 - if (node.type !== ENTRY) { 1366 - return find(node, shift + SHIFT, hash, key); 1367 - } 1368 - if (isEqual(key, node.k)) { 1369 - return node; 1370 - } 1371 - return; 1372 - } 1373 - function findIndex(root2, shift, hash, key) { 1374 - const bit = bitpos(hash, shift); 1375 - if ((root2.bitmap & bit) === 0) { 1376 - return; 1377 - } 1378 - const idx = index(root2.bitmap, bit); 1379 - const node = root2.array[idx]; 1380 - if (node.type !== ENTRY) { 1381 - return find(node, shift + SHIFT, hash, key); 1382 - } 1383 - if (isEqual(key, node.k)) { 1384 - return node; 1385 - } 1386 - return; 1387 - } 1388 - function findCollision(root2, key) { 1389 - const idx = collisionIndexOf(root2, key); 1390 - if (idx < 0) { 1391 - return; 1392 - } 1393 - return root2.array[idx]; 1394 - } 1395 - function without(root2, shift, hash, key) { 1396 - switch (root2.type) { 1397 - case ARRAY_NODE: 1398 - return withoutArray(root2, shift, hash, key); 1399 - case INDEX_NODE: 1400 - return withoutIndex(root2, shift, hash, key); 1401 - case COLLISION_NODE: 1402 - return withoutCollision(root2, key); 1403 - } 1404 - } 1405 - function withoutArray(root2, shift, hash, key) { 1406 - const idx = mask(hash, shift); 1407 - const node = root2.array[idx]; 1408 - if (node === undefined) { 1409 - return root2; 1410 - } 1411 - let n = undefined; 1412 - if (node.type === ENTRY) { 1413 - if (!isEqual(node.k, key)) { 1414 - return root2; 1415 - } 1416 - } else { 1417 - n = without(node, shift + SHIFT, hash, key); 1418 - if (n === node) { 1419 - return root2; 1420 - } 1421 - } 1422 - if (n === undefined) { 1423 - if (root2.size <= MIN_ARRAY_NODE) { 1424 - const arr = root2.array; 1425 - const out = new Array(root2.size - 1); 1426 - let i = 0; 1427 - let j = 0; 1428 - let bitmap = 0; 1429 - while (i < idx) { 1430 - const nv = arr[i]; 1431 - if (nv !== undefined) { 1432 - out[j] = nv; 1433 - bitmap |= 1 << i; 1434 - ++j; 1435 - } 1436 - ++i; 1437 - } 1438 - ++i; 1439 - while (i < arr.length) { 1440 - const nv = arr[i]; 1441 - if (nv !== undefined) { 1442 - out[j] = nv; 1443 - bitmap |= 1 << i; 1444 - ++j; 1445 - } 1446 - ++i; 1447 - } 1448 - return { 1449 - type: INDEX_NODE, 1450 - bitmap, 1451 - array: out 1452 - }; 1453 - } 1454 - return { 1455 - type: ARRAY_NODE, 1456 - size: root2.size - 1, 1457 - array: cloneAndSet(root2.array, idx, n) 1458 - }; 1459 - } 1460 - return { 1461 - type: ARRAY_NODE, 1462 - size: root2.size, 1463 - array: cloneAndSet(root2.array, idx, n) 1464 - }; 1465 - } 1466 - function withoutIndex(root2, shift, hash, key) { 1467 - const bit = bitpos(hash, shift); 1468 - if ((root2.bitmap & bit) === 0) { 1469 - return root2; 1470 - } 1471 - const idx = index(root2.bitmap, bit); 1472 - const node = root2.array[idx]; 1473 - if (node.type !== ENTRY) { 1474 - const n = without(node, shift + SHIFT, hash, key); 1475 - if (n === node) { 1476 - return root2; 1477 - } 1478 - if (n !== undefined) { 1479 - return { 1480 - type: INDEX_NODE, 1481 - bitmap: root2.bitmap, 1482 - array: cloneAndSet(root2.array, idx, n) 1483 - }; 1484 - } 1485 - if (root2.bitmap === bit) { 1486 - return; 1487 - } 1488 - return { 1489 - type: INDEX_NODE, 1490 - bitmap: root2.bitmap ^ bit, 1491 - array: spliceOut(root2.array, idx) 1492 - }; 1493 - } 1494 - if (isEqual(key, node.k)) { 1495 - if (root2.bitmap === bit) { 1496 - return; 1497 - } 1498 - return { 1499 - type: INDEX_NODE, 1500 - bitmap: root2.bitmap ^ bit, 1501 - array: spliceOut(root2.array, idx) 1502 - }; 1503 - } 1504 - return root2; 1505 - } 1506 - function withoutCollision(root2, key) { 1507 - const idx = collisionIndexOf(root2, key); 1508 - if (idx < 0) { 1509 - return root2; 1510 - } 1511 - if (root2.array.length === 1) { 1512 - return; 1513 - } 1514 - return { 1515 - type: COLLISION_NODE, 1516 - hash: root2.hash, 1517 - array: spliceOut(root2.array, idx) 1518 - }; 1519 - } 1520 - function forEach(root2, fn) { 1521 - if (root2 === undefined) { 1522 - return; 1523 - } 1524 - const items = root2.array; 1525 - const size = items.length; 1526 - for (let i = 0;i < size; i++) { 1527 - const item = items[i]; 1528 - if (item === undefined) { 1529 - continue; 1530 - } 1531 - if (item.type === ENTRY) { 1532 - fn(item.v, item.k); 1533 - continue; 1534 - } 1535 - forEach(item, fn); 1536 - } 1537 - } 1538 - 1539 - class Dict { 1540 - static fromObject(o) { 1541 - const keys2 = Object.keys(o); 1542 - let m = Dict.new(); 1543 - for (let i = 0;i < keys2.length; i++) { 1544 - const k = keys2[i]; 1545 - m = m.set(k, o[k]); 1546 - } 1547 - return m; 1548 - } 1549 - static fromMap(o) { 1550 - let m = Dict.new(); 1551 - o.forEach((v, k) => { 1552 - m = m.set(k, v); 1553 - }); 1554 - return m; 1555 - } 1556 - static new() { 1557 - return new Dict(undefined, 0); 1558 - } 1559 - constructor(root2, size) { 1560 - this.root = root2; 1561 - this.size = size; 1562 - } 1563 - get(key, notFound) { 1564 - if (this.root === undefined) { 1565 - return notFound; 1566 - } 1567 - const found = find(this.root, 0, getHash(key), key); 1568 - if (found === undefined) { 1569 - return notFound; 1570 - } 1571 - return found.v; 1572 - } 1573 - set(key, val) { 1574 - const addedLeaf = { val: false }; 1575 - const root2 = this.root === undefined ? EMPTY : this.root; 1576 - const newRoot = assoc(root2, 0, getHash(key), key, val, addedLeaf); 1577 - if (newRoot === this.root) { 1578 - return this; 1579 - } 1580 - return new Dict(newRoot, addedLeaf.val ? this.size + 1 : this.size); 1581 - } 1582 - delete(key) { 1583 - if (this.root === undefined) { 1584 - return this; 1585 - } 1586 - const newRoot = without(this.root, 0, getHash(key), key); 1587 - if (newRoot === this.root) { 1588 - return this; 1589 - } 1590 - if (newRoot === undefined) { 1591 - return Dict.new(); 1592 - } 1593 - return new Dict(newRoot, this.size - 1); 1594 - } 1595 - has(key) { 1596 - if (this.root === undefined) { 1597 - return false; 1598 - } 1599 - return find(this.root, 0, getHash(key), key) !== undefined; 1600 - } 1601 - entries() { 1602 - if (this.root === undefined) { 1603 - return []; 1604 - } 1605 - const result = []; 1606 - this.forEach((v, k) => result.push([k, v])); 1607 - return result; 1608 - } 1609 - forEach(fn) { 1610 - forEach(this.root, fn); 1611 - } 1612 - hashCode() { 1613 - let h = 0; 1614 - this.forEach((v, k) => { 1615 - h = h + hashMerge(getHash(v), getHash(k)) | 0; 1616 - }); 1617 - return h; 1618 - } 1619 - equals(o) { 1620 - if (!(o instanceof Dict) || this.size !== o.size) { 1621 - return false; 1622 - } 1623 - try { 1624 - this.forEach((v, k) => { 1625 - if (!isEqual(o.get(k, !v), v)) { 1626 - throw unequalDictSymbol; 1627 - } 1628 - }); 1629 - return true; 1630 - } catch (e) { 1631 - if (e === unequalDictSymbol) { 1632 - return false; 1633 - } 1634 - throw e; 1635 - } 1636 - } 1637 - } 1638 - var unequalDictSymbol = /* @__PURE__ */ Symbol(); 1639 - 1640 - // build/dev/javascript/gleam_stdlib/gleam_stdlib.mjs 1641 - var Nil = undefined; 1642 - var NOT_FOUND = {}; 1643 - function identity(x) { 1644 - return x; 1645 - } 1646 - function parse_float(value) { 1647 - if (/^[-+]?(\d+)\.(\d+)([eE][-+]?\d+)?$/.test(value)) { 1648 - return new Ok(parseFloat(value)); 1649 - } else { 1650 - return new Error(Nil); 1651 - } 1652 - } 1653 - function to_string(term) { 1654 - return term.toString(); 1655 - } 1656 - function float_to_string(float) { 1657 - const string = float.toString().replace("+", ""); 1658 - if (string.indexOf(".") >= 0) { 1659 - return string; 1660 - } else { 1661 - const index2 = string.indexOf("e"); 1662 - if (index2 >= 0) { 1663 - return string.slice(0, index2) + ".0" + string.slice(index2); 1664 - } else { 1665 - return string + ".0"; 1666 - } 1667 - } 1668 - } 1669 - function string_replace(string, target, substitute) { 1670 - if (typeof string.replaceAll !== "undefined") { 1671 - return string.replaceAll(target, substitute); 1672 - } 1673 - return string.replace(new RegExp(target.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), substitute); 1674 - } 1675 - function graphemes(string) { 1676 - const iterator = graphemes_iterator(string); 1677 - if (iterator) { 1678 - return List.fromArray(Array.from(iterator).map((item) => item.segment)); 1679 - } else { 1680 - return List.fromArray(string.match(/./gsu)); 1681 - } 1682 - } 1683 - var segmenter = undefined; 1684 - function graphemes_iterator(string) { 1685 - if (globalThis.Intl && Intl.Segmenter) { 1686 - segmenter ||= new Intl.Segmenter; 1687 - return segmenter.segment(string)[Symbol.iterator](); 1688 - } 1689 - } 1690 - function pop_grapheme(string) { 1691 - let first; 1692 - const iterator = graphemes_iterator(string); 1693 - if (iterator) { 1694 - first = iterator.next().value?.segment; 1695 - } else { 1696 - first = string.match(/./su)?.[0]; 1697 - } 1698 - if (first) { 1699 - return new Ok([first, string.slice(first.length)]); 1700 - } else { 1701 - return new Error(Nil); 1702 - } 1703 - } 1704 - function pop_codeunit(str) { 1705 - return [str.charCodeAt(0) | 0, str.slice(1)]; 1706 - } 1707 - function lowercase(string) { 1708 - return string.toLowerCase(); 1709 - } 1710 - function split(xs, pattern) { 1711 - return List.fromArray(xs.split(pattern)); 1712 - } 1713 - function string_codeunit_slice(str, from, length3) { 1714 - return str.slice(from, from + length3); 1715 - } 1716 - function contains_string(haystack, needle) { 1717 - return haystack.indexOf(needle) >= 0; 1718 - } 1719 - function starts_with(haystack, needle) { 1720 - return haystack.startsWith(needle); 1721 - } 1722 - var unicode_whitespaces = [ 1723 - " ", 1724 - "\t", 1725 - ` 1726 - `, 1727 - "\v", 1728 - "\f", 1729 - "\r", 1730 - "…", 1731 - "\u2028", 1732 - "\u2029" 1733 - ].join(""); 1734 - var trim_start_regex = /* @__PURE__ */ new RegExp(`^[${unicode_whitespaces}]*`); 1735 - var trim_end_regex = /* @__PURE__ */ new RegExp(`[${unicode_whitespaces}]*$`); 1736 - function trim_start(string) { 1737 - return string.replace(trim_start_regex, ""); 1738 - } 1739 - function trim_end(string) { 1740 - return string.replace(trim_end_regex, ""); 1741 - } 1742 - function floor(float) { 1743 - return Math.floor(float); 1744 - } 1745 - function round2(float) { 1746 - return Math.round(float); 1747 - } 1748 - function truncate(float) { 1749 - return Math.trunc(float); 1750 - } 1751 - function random_uniform() { 1752 - const random_uniform_result = Math.random(); 1753 - if (random_uniform_result === 1) { 1754 - return random_uniform(); 1755 - } 1756 - return random_uniform_result; 1757 - } 1758 - function new_map() { 1759 - return Dict.new(); 1760 - } 1761 - function map_to_list(map4) { 1762 - return List.fromArray(map4.entries()); 1763 - } 1764 - function map_get(map4, key) { 1765 - const value = map4.get(key, NOT_FOUND); 1766 - if (value === NOT_FOUND) { 1767 - return new Error(Nil); 1768 - } 1769 - return new Ok(value); 1770 - } 1771 - function map_insert(key, value, map4) { 1772 - return map4.set(key, value); 1773 - } 1774 - function classify_dynamic(data) { 1775 - if (typeof data === "string") { 1776 - return "String"; 1777 - } else if (typeof data === "boolean") { 1778 - return "Bool"; 1779 - } else if (data instanceof Result) { 1780 - return "Result"; 1781 - } else if (data instanceof List) { 1782 - return "List"; 1783 - } else if (data instanceof BitArray) { 1784 - return "BitArray"; 1785 - } else if (data instanceof Dict) { 1786 - return "Dict"; 1787 - } else if (Number.isInteger(data)) { 1788 - return "Int"; 1789 - } else if (Array.isArray(data)) { 1790 - return `Tuple of ${data.length} elements`; 1791 - } else if (typeof data === "number") { 1792 - return "Float"; 1793 - } else if (data === null) { 1794 - return "Null"; 1795 - } else if (data === undefined) { 1796 - return "Nil"; 1797 - } else { 1798 - const type = typeof data; 1799 - return type.charAt(0).toUpperCase() + type.slice(1); 1800 - } 1801 - } 1802 - function inspect(v) { 1803 - const t = typeof v; 1804 - if (v === true) 1805 - return "True"; 1806 - if (v === false) 1807 - return "False"; 1808 - if (v === null) 1809 - return "//js(null)"; 1810 - if (v === undefined) 1811 - return "Nil"; 1812 - if (t === "string") 1813 - return inspectString(v); 1814 - if (t === "bigint" || Number.isInteger(v)) 1815 - return v.toString(); 1816 - if (t === "number") 1817 - return float_to_string(v); 1818 - if (Array.isArray(v)) 1819 - return `#(${v.map(inspect).join(", ")})`; 1820 - if (v instanceof List) 1821 - return inspectList(v); 1822 - if (v instanceof UtfCodepoint) 1823 - return inspectUtfCodepoint(v); 1824 - if (v instanceof BitArray) 1825 - return `<<${bit_array_inspect(v, "")}>>`; 1826 - if (v instanceof CustomType) 1827 - return inspectCustomType(v); 1828 - if (v instanceof Dict) 1829 - return inspectDict(v); 1830 - if (v instanceof Set) 1831 - return `//js(Set(${[...v].map(inspect).join(", ")}))`; 1832 - if (v instanceof RegExp) 1833 - return `//js(${v})`; 1834 - if (v instanceof Date) 1835 - return `//js(Date("${v.toISOString()}"))`; 1836 - if (v instanceof Function) { 1837 - const args = []; 1838 - for (const i of Array(v.length).keys()) 1839 - args.push(String.fromCharCode(i + 97)); 1840 - return `//fn(${args.join(", ")}) { ... }`; 1841 - } 1842 - return inspectObject(v); 1843 - } 1844 - function inspectString(str) { 1845 - let new_str = '"'; 1846 - for (let i = 0;i < str.length; i++) { 1847 - const char = str[i]; 1848 - switch (char) { 1849 - case ` 1850 - `: 1851 - new_str += "\\n"; 1852 - break; 1853 - case "\r": 1854 - new_str += "\\r"; 1855 - break; 1856 - case "\t": 1857 - new_str += "\\t"; 1858 - break; 1859 - case "\f": 1860 - new_str += "\\f"; 1861 - break; 1862 - case "\\": 1863 - new_str += "\\\\"; 1864 - break; 1865 - case '"': 1866 - new_str += "\\\""; 1867 - break; 1868 - default: 1869 - if (char < " " || char > "~" && char < " ") { 1870 - new_str += "\\u{" + char.charCodeAt(0).toString(16).toUpperCase().padStart(4, "0") + "}"; 1871 - } else { 1872 - new_str += char; 1873 - } 1874 - } 1875 - } 1876 - new_str += '"'; 1877 - return new_str; 1878 - } 1879 - function inspectDict(map4) { 1880 - let body = "dict.from_list(["; 1881 - let first = true; 1882 - map4.forEach((value, key) => { 1883 - if (!first) 1884 - body = body + ", "; 1885 - body = body + "#(" + inspect(key) + ", " + inspect(value) + ")"; 1886 - first = false; 1887 - }); 1888 - return body + "])"; 1889 - } 1890 - function inspectObject(v) { 1891 - const name = Object.getPrototypeOf(v)?.constructor?.name || "Object"; 1892 - const props = []; 1893 - for (const k of Object.keys(v)) { 1894 - props.push(`${inspect(k)}: ${inspect(v[k])}`); 1895 - } 1896 - const body = props.length ? " " + props.join(", ") + " " : ""; 1897 - const head = name === "Object" ? "" : name + " "; 1898 - return `//js(${head}{${body}})`; 1899 - } 1900 - function inspectCustomType(record) { 1901 - const props = Object.keys(record).map((label) => { 1902 - const value = inspect(record[label]); 1903 - return isNaN(parseInt(label)) ? `${label}: ${value}` : value; 1904 - }).join(", "); 1905 - return props ? `${record.constructor.name}(${props})` : record.constructor.name; 1906 - } 1907 - function inspectList(list) { 1908 - return `[${list.toArray().map(inspect).join(", ")}]`; 1909 - } 1910 - function inspectUtfCodepoint(codepoint) { 1911 - return `//utfcodepoint(${String.fromCodePoint(codepoint.value)})`; 1912 - } 1913 - function bit_array_inspect(bits, acc) { 1914 - if (bits.bitSize === 0) { 1915 - return acc; 1916 - } 1917 - for (let i = 0;i < bits.byteSize - 1; i++) { 1918 - acc += bits.byteAt(i).toString(); 1919 - acc += ", "; 1920 - } 1921 - if (bits.byteSize * 8 === bits.bitSize) { 1922 - acc += bits.byteAt(bits.byteSize - 1).toString(); 1923 - } else { 1924 - const trailingBitsCount = bits.bitSize % 8; 1925 - acc += bits.byteAt(bits.byteSize - 1) >> 8 - trailingBitsCount; 1926 - acc += `:size(${trailingBitsCount})`; 1927 - } 1928 - return acc; 1929 - } 1930 - 1931 - // build/dev/javascript/gleam_stdlib/gleam/float.mjs 1932 - function compare(a, b) { 1933 - let $ = a === b; 1934 - if ($) { 1935 - return new Eq; 1936 - } else { 1937 - let $1 = a < b; 1938 - if ($1) { 1939 - return new Lt; 1940 - } else { 1941 - return new Gt; 1942 - } 1943 - } 1944 - } 1945 - function negate(x) { 1946 - return -1 * x; 1947 - } 1948 - function round(x) { 1949 - let $ = x >= 0; 1950 - if ($) { 1951 - return round2(x); 1952 - } else { 1953 - return 0 - round2(negate(x)); 1954 - } 1955 - } 1956 - 1957 - // build/dev/javascript/gleam_stdlib/gleam/int.mjs 1958 - function modulo(dividend, divisor) { 1959 - if (divisor === 0) { 1960 - return new Error(undefined); 1961 - } else { 1962 - let remainder$1 = remainderInt(dividend, divisor); 1963 - let $ = remainder$1 * divisor < 0; 1964 - if ($) { 1965 - return new Ok(remainder$1 + divisor); 1966 - } else { 1967 - return new Ok(remainder$1); 1968 - } 1969 - } 1970 - } 1971 - 1972 - // build/dev/javascript/gleam_stdlib/gleam/string.mjs 1973 - function replace(string, pattern, substitute) { 1974 - let _pipe = string; 1975 - let _pipe$1 = identity(_pipe); 1976 - let _pipe$2 = string_replace(_pipe$1, pattern, substitute); 1977 - return identity(_pipe$2); 1978 - } 1979 - function concat_loop(loop$strings, loop$accumulator) { 1980 - while (true) { 1981 - let strings = loop$strings; 1982 - let accumulator = loop$accumulator; 1983 - if (strings instanceof Empty) { 1984 - return accumulator; 1985 - } else { 1986 - let string = strings.head; 1987 - let strings$1 = strings.tail; 1988 - loop$strings = strings$1; 1989 - loop$accumulator = accumulator + string; 1990 - } 1991 - } 1992 - } 1993 - function concat2(strings) { 1994 - return concat_loop(strings, ""); 1995 - } 1996 - function join_loop(loop$strings, loop$separator, loop$accumulator) { 1997 - while (true) { 1998 - let strings = loop$strings; 1999 - let separator = loop$separator; 2000 - let accumulator = loop$accumulator; 2001 - if (strings instanceof Empty) { 2002 - return accumulator; 2003 - } else { 2004 - let string = strings.head; 2005 - let strings$1 = strings.tail; 2006 - loop$strings = strings$1; 2007 - loop$separator = separator; 2008 - loop$accumulator = accumulator + separator + string; 2009 - } 2010 - } 2011 - } 2012 - function join(strings, separator) { 2013 - if (strings instanceof Empty) { 2014 - return ""; 2015 - } else { 2016 - let first$1 = strings.head; 2017 - let rest = strings.tail; 2018 - return join_loop(rest, separator, first$1); 2019 - } 2020 - } 2021 - function trim(string) { 2022 - let _pipe = string; 2023 - let _pipe$1 = trim_start(_pipe); 2024 - return trim_end(_pipe$1); 2025 - } 2026 - function drop_start(loop$string, loop$num_graphemes) { 2027 - while (true) { 2028 - let string = loop$string; 2029 - let num_graphemes = loop$num_graphemes; 2030 - let $ = num_graphemes > 0; 2031 - if ($) { 2032 - let $1 = pop_grapheme(string); 2033 - if ($1 instanceof Ok) { 2034 - let string$1 = $1[0][1]; 2035 - loop$string = string$1; 2036 - loop$num_graphemes = num_graphemes - 1; 2037 - } else { 2038 - return string; 2039 - } 2040 - } else { 2041 - return string; 2042 - } 2043 - } 2044 - } 2045 - function split2(x, substring) { 2046 - if (substring === "") { 2047 - return graphemes(x); 2048 - } else { 2049 - let _pipe = x; 2050 - let _pipe$1 = identity(_pipe); 2051 - let _pipe$2 = split(_pipe$1, substring); 2052 - return map2(_pipe$2, identity); 2053 - } 2054 - } 2055 - function inspect2(term) { 2056 - let _pipe = inspect(term); 2057 - return identity(_pipe); 2058 - } 2059 - 2060 - // build/dev/javascript/gleam_stdlib/gleam_stdlib_decode_ffi.mjs 2061 - function index2(data, key) { 2062 - if (data instanceof Dict || data instanceof WeakMap || data instanceof Map) { 2063 - const token = {}; 2064 - const entry = data.get(key, token); 2065 - if (entry === token) 2066 - return new Ok(new None); 2067 - return new Ok(new Some(entry)); 2068 - } 2069 - const key_is_int = Number.isInteger(key); 2070 - if (key_is_int && key >= 0 && key < 8 && data instanceof List) { 2071 - let i = 0; 2072 - for (const value of data) { 2073 - if (i === key) 2074 - return new Ok(new Some(value)); 2075 - i++; 2076 - } 2077 - return new Error("Indexable"); 2078 - } 2079 - if (key_is_int && Array.isArray(data) || data && typeof data === "object" || data && Object.getPrototypeOf(data) === Object.prototype) { 2080 - if (key in data) 2081 - return new Ok(new Some(data[key])); 2082 - return new Ok(new None); 2083 - } 2084 - return new Error(key_is_int ? "Indexable" : "Dict"); 2085 - } 2086 - function list(data, decode, pushPath, index3, emptyList) { 2087 - if (!(data instanceof List || Array.isArray(data))) { 2088 - const error = new DecodeError2("List", classify_dynamic(data), emptyList); 2089 - return [emptyList, List.fromArray([error])]; 2090 - } 2091 - const decoded = []; 2092 - for (const element of data) { 2093 - const layer = decode(element); 2094 - const [out, errors] = layer; 2095 - if (errors instanceof NonEmpty) { 2096 - const [_, errors2] = pushPath(layer, index3.toString()); 2097 - return [emptyList, errors2]; 2098 - } 2099 - decoded.push(out); 2100 - index3++; 2101 - } 2102 - return [List.fromArray(decoded), emptyList]; 2103 - } 2104 - function int(data) { 2105 - if (Number.isInteger(data)) 2106 - return new Ok(data); 2107 - return new Error(0); 2108 - } 2109 - function string(data) { 2110 - if (typeof data === "string") 2111 - return new Ok(data); 2112 - return new Error(""); 2113 - } 2114 - function is_null(data) { 2115 - return data === null || data === undefined; 2116 - } 2117 - 2118 - // build/dev/javascript/gleam_stdlib/gleam/dynamic/decode.mjs 2119 - class DecodeError2 extends CustomType { 2120 - constructor(expected, found, path) { 2121 - super(); 2122 - this.expected = expected; 2123 - this.found = found; 2124 - this.path = path; 2125 - } 2126 - } 2127 - class Decoder extends CustomType { 2128 - constructor(function$) { 2129 - super(); 2130 - this.function = function$; 2131 - } 2132 - } 2133 - var dynamic = /* @__PURE__ */ new Decoder(decode_dynamic); 2134 - var bool = /* @__PURE__ */ new Decoder(decode_bool2); 2135 - var int2 = /* @__PURE__ */ new Decoder(decode_int2); 2136 - var string2 = /* @__PURE__ */ new Decoder(decode_string2); 2137 - function run(data, decoder) { 2138 - let $ = decoder.function(data); 2139 - let maybe_invalid_data; 2140 - let errors; 2141 - maybe_invalid_data = $[0]; 2142 - errors = $[1]; 2143 - if (errors instanceof Empty) { 2144 - return new Ok(maybe_invalid_data); 2145 - } else { 2146 - return new Error(errors); 2147 - } 2148 - } 2149 - function success(data) { 2150 - return new Decoder((_) => { 2151 - return [data, toList([])]; 2152 - }); 2153 - } 2154 - function decode_dynamic(data) { 2155 - return [data, toList([])]; 2156 - } 2157 - function map4(decoder, transformer) { 2158 - return new Decoder((d) => { 2159 - let $ = decoder.function(d); 2160 - let data; 2161 - let errors; 2162 - data = $[0]; 2163 - errors = $[1]; 2164 - return [transformer(data), errors]; 2165 - }); 2166 - } 2167 - function run_decoders(loop$data, loop$failure, loop$decoders) { 2168 - while (true) { 2169 - let data = loop$data; 2170 - let failure = loop$failure; 2171 - let decoders = loop$decoders; 2172 - if (decoders instanceof Empty) { 2173 - return failure; 2174 - } else { 2175 - let decoder = decoders.head; 2176 - let decoders$1 = decoders.tail; 2177 - let $ = decoder.function(data); 2178 - let layer; 2179 - let errors; 2180 - layer = $; 2181 - errors = $[1]; 2182 - if (errors instanceof Empty) { 2183 - return layer; 2184 - } else { 2185 - loop$data = data; 2186 - loop$failure = failure; 2187 - loop$decoders = decoders$1; 2188 - } 2189 - } 2190 - } 2191 - } 2192 - function one_of(first, alternatives) { 2193 - return new Decoder((dynamic_data) => { 2194 - let $ = first.function(dynamic_data); 2195 - let layer; 2196 - let errors; 2197 - layer = $; 2198 - errors = $[1]; 2199 - if (errors instanceof Empty) { 2200 - return layer; 2201 - } else { 2202 - return run_decoders(dynamic_data, layer, alternatives); 2203 - } 2204 - }); 2205 - } 2206 - function optional(inner) { 2207 - return new Decoder((data) => { 2208 - let $ = is_null(data); 2209 - if ($) { 2210 - return [new None, toList([])]; 2211 - } else { 2212 - let $1 = inner.function(data); 2213 - let data$1; 2214 - let errors; 2215 - data$1 = $1[0]; 2216 - errors = $1[1]; 2217 - return [new Some(data$1), errors]; 2218 - } 2219 - }); 2220 - } 2221 - function decode_error(expected, found) { 2222 - return toList([ 2223 - new DecodeError2(expected, classify_dynamic(found), toList([])) 2224 - ]); 2225 - } 2226 - function run_dynamic_function(data, name, f) { 2227 - let $ = f(data); 2228 - if ($ instanceof Ok) { 2229 - let data$1 = $[0]; 2230 - return [data$1, toList([])]; 2231 - } else { 2232 - let zero = $[0]; 2233 - return [ 2234 - zero, 2235 - toList([new DecodeError2(name, classify_dynamic(data), toList([]))]) 2236 - ]; 2237 - } 2238 - } 2239 - function decode_bool2(data) { 2240 - let $ = isEqual(identity(true), data); 2241 - if ($) { 2242 - return [true, toList([])]; 2243 - } else { 2244 - let $1 = isEqual(identity(false), data); 2245 - if ($1) { 2246 - return [false, toList([])]; 2247 - } else { 2248 - return [false, decode_error("Bool", data)]; 2249 - } 2250 - } 2251 - } 2252 - function decode_int2(data) { 2253 - return run_dynamic_function(data, "Int", int); 2254 - } 2255 - function failure(zero, expected) { 2256 - return new Decoder((d) => { 2257 - return [zero, decode_error(expected, d)]; 2258 - }); 2259 - } 2260 - function decode_string2(data) { 2261 - return run_dynamic_function(data, "String", string); 2262 - } 2263 - function list2(inner) { 2264 - return new Decoder((data) => { 2265 - return list(data, inner.function, (p, k) => { 2266 - return push_path(p, toList([k])); 2267 - }, 0, toList([])); 2268 - }); 2269 - } 2270 - function push_path(layer, path) { 2271 - let decoder = one_of(string2, toList([ 2272 - (() => { 2273 - let _pipe = int2; 2274 - return map4(_pipe, to_string); 2275 - })() 2276 - ])); 2277 - let path$1 = map2(path, (key) => { 2278 - let key$1 = identity(key); 2279 - let $ = run(key$1, decoder); 2280 - if ($ instanceof Ok) { 2281 - let key$2 = $[0]; 2282 - return key$2; 2283 - } else { 2284 - return "<" + classify_dynamic(key$1) + ">"; 2285 - } 2286 - }); 2287 - let errors = map2(layer[1], (error) => { 2288 - return new DecodeError2(error.expected, error.found, append(path$1, error.path)); 2289 - }); 2290 - return [layer[0], errors]; 2291 - } 2292 - function index3(loop$path, loop$position, loop$inner, loop$data, loop$handle_miss) { 2293 - while (true) { 2294 - let path = loop$path; 2295 - let position = loop$position; 2296 - let inner = loop$inner; 2297 - let data = loop$data; 2298 - let handle_miss = loop$handle_miss; 2299 - if (path instanceof Empty) { 2300 - let _pipe = inner(data); 2301 - return push_path(_pipe, reverse(position)); 2302 - } else { 2303 - let key = path.head; 2304 - let path$1 = path.tail; 2305 - let $ = index2(data, key); 2306 - if ($ instanceof Ok) { 2307 - let $1 = $[0]; 2308 - if ($1 instanceof Some) { 2309 - let data$1 = $1[0]; 2310 - loop$path = path$1; 2311 - loop$position = prepend(key, position); 2312 - loop$inner = inner; 2313 - loop$data = data$1; 2314 - loop$handle_miss = handle_miss; 2315 - } else { 2316 - return handle_miss(data, prepend(key, position)); 2317 - } 2318 - } else { 2319 - let kind = $[0]; 2320 - let $1 = inner(data); 2321 - let default$; 2322 - default$ = $1[0]; 2323 - let _pipe = [ 2324 - default$, 2325 - toList([new DecodeError2(kind, classify_dynamic(data), toList([]))]) 2326 - ]; 2327 - return push_path(_pipe, reverse(position)); 2328 - } 2329 - } 2330 - } 2331 - } 2332 - function subfield(field_path, field_decoder, next) { 2333 - return new Decoder((data) => { 2334 - let $ = index3(field_path, toList([]), field_decoder.function, data, (data2, position) => { 2335 - let $12 = field_decoder.function(data2); 2336 - let default$; 2337 - default$ = $12[0]; 2338 - let _pipe = [ 2339 - default$, 2340 - toList([new DecodeError2("Field", "Nothing", toList([]))]) 2341 - ]; 2342 - return push_path(_pipe, reverse(position)); 2343 - }); 2344 - let out; 2345 - let errors1; 2346 - out = $[0]; 2347 - errors1 = $[1]; 2348 - let $1 = next(out).function(data); 2349 - let out$1; 2350 - let errors2; 2351 - out$1 = $1[0]; 2352 - errors2 = $1[1]; 2353 - return [out$1, append(errors1, errors2)]; 2354 - }); 2355 - } 2356 - function field(field_name, field_decoder, next) { 2357 - return subfield(toList([field_name]), field_decoder, next); 2358 - } 2359 - function optional_field(key, default$, field_decoder, next) { 2360 - return new Decoder((data) => { 2361 - let _block; 2362 - let _block$1; 2363 - let $1 = index2(data, key); 2364 - if ($1 instanceof Ok) { 2365 - let $22 = $1[0]; 2366 - if ($22 instanceof Some) { 2367 - let data$1 = $22[0]; 2368 - _block$1 = field_decoder.function(data$1); 2369 - } else { 2370 - _block$1 = [default$, toList([])]; 2371 - } 2372 - } else { 2373 - let kind = $1[0]; 2374 - _block$1 = [ 2375 - default$, 2376 - toList([new DecodeError2(kind, classify_dynamic(data), toList([]))]) 2377 - ]; 2378 - } 2379 - let _pipe = _block$1; 2380 - _block = push_path(_pipe, toList([key])); 2381 - let $ = _block; 2382 - let out; 2383 - let errors1; 2384 - out = $[0]; 2385 - errors1 = $[1]; 2386 - let $2 = next(out).function(data); 2387 - let out$1; 2388 - let errors2; 2389 - out$1 = $2[0]; 2390 - errors2 = $2[1]; 2391 - return [out$1, append(errors1, errors2)]; 2392 - }); 2393 - } 2394 - // build/dev/javascript/gleam_json/gleam_json_ffi.mjs 2395 - function json_to_string(json) { 2396 - return JSON.stringify(json); 2397 - } 2398 - function object(entries) { 2399 - return Object.fromEntries(entries); 2400 - } 2401 - function identity2(x) { 2402 - return x; 2403 - } 2404 - function do_null() { 2405 - return null; 2406 - } 2407 - function decode(string3) { 2408 - try { 2409 - const result = JSON.parse(string3); 2410 - return new Ok(result); 2411 - } catch (err) { 2412 - return new Error(getJsonDecodeError(err, string3)); 2413 - } 2414 - } 2415 - function getJsonDecodeError(stdErr, json) { 2416 - if (isUnexpectedEndOfInput(stdErr)) 2417 - return new UnexpectedEndOfInput; 2418 - return toUnexpectedByteError(stdErr, json); 2419 - } 2420 - function isUnexpectedEndOfInput(err) { 2421 - const unexpectedEndOfInputRegex = /((unexpected (end|eof))|(end of data)|(unterminated string)|(json( parse error|\.parse)\: expected '(\:|\}|\])'))/i; 2422 - return unexpectedEndOfInputRegex.test(err.message); 2423 - } 2424 - function toUnexpectedByteError(err, json) { 2425 - let converters = [ 2426 - v8UnexpectedByteError, 2427 - oldV8UnexpectedByteError, 2428 - jsCoreUnexpectedByteError, 2429 - spidermonkeyUnexpectedByteError 2430 - ]; 2431 - for (let converter of converters) { 2432 - let result = converter(err, json); 2433 - if (result) 2434 - return result; 2435 - } 2436 - return new UnexpectedByte("", 0); 2437 - } 2438 - function v8UnexpectedByteError(err) { 2439 - const regex = /unexpected token '(.)', ".+" is not valid JSON/i; 2440 - const match = regex.exec(err.message); 2441 - if (!match) 2442 - return null; 2443 - const byte = toHex(match[1]); 2444 - return new UnexpectedByte(byte, -1); 2445 - } 2446 - function oldV8UnexpectedByteError(err) { 2447 - const regex = /unexpected token (.) in JSON at position (\d+)/i; 2448 - const match = regex.exec(err.message); 2449 - if (!match) 2450 - return null; 2451 - const byte = toHex(match[1]); 2452 - const position = Number(match[2]); 2453 - return new UnexpectedByte(byte, position); 2454 - } 2455 - function spidermonkeyUnexpectedByteError(err, json) { 2456 - const regex = /(unexpected character|expected .*) at line (\d+) column (\d+)/i; 2457 - const match = regex.exec(err.message); 2458 - if (!match) 2459 - return null; 2460 - const line = Number(match[2]); 2461 - const column = Number(match[3]); 2462 - const position = getPositionFromMultiline(line, column, json); 2463 - const byte = toHex(json[position]); 2464 - return new UnexpectedByte(byte, position); 2465 - } 2466 - function jsCoreUnexpectedByteError(err) { 2467 - const regex = /unexpected (identifier|token) "(.)"/i; 2468 - const match = regex.exec(err.message); 2469 - if (!match) 2470 - return null; 2471 - const byte = toHex(match[2]); 2472 - return new UnexpectedByte(byte, 0); 2473 - } 2474 - function toHex(char) { 2475 - return "0x" + char.charCodeAt(0).toString(16).toUpperCase(); 2476 - } 2477 - function getPositionFromMultiline(line, column, string3) { 2478 - if (line === 1) 2479 - return column - 1; 2480 - let currentLn = 1; 2481 - let position = 0; 2482 - string3.split("").find((char, idx) => { 2483 - if (char === ` 2484 - `) 2485 - currentLn += 1; 2486 - if (currentLn === line) { 2487 - position = idx + column; 2488 - return true; 2489 - } 2490 - return false; 2491 - }); 2492 - return position; 2493 - } 2494 - 2495 - // build/dev/javascript/gleam_json/gleam/json.mjs 2496 - class UnexpectedEndOfInput extends CustomType { 2497 - } 2498 - class UnexpectedByte extends CustomType { 2499 - constructor($0) { 2500 - super(); 2501 - this[0] = $0; 2502 - } 2503 - } 2504 - class UnableToDecode extends CustomType { 2505 - constructor($0) { 2506 - super(); 2507 - this[0] = $0; 2508 - } 2509 - } 2510 - function do_parse(json, decoder) { 2511 - return then$(decode(json), (dynamic_value) => { 2512 - let _pipe = run(dynamic_value, decoder); 2513 - return map_error(_pipe, (var0) => { 2514 - return new UnableToDecode(var0); 2515 - }); 2516 - }); 2517 - } 2518 - function parse(json, decoder) { 2519 - return do_parse(json, decoder); 2520 - } 2521 - function to_string2(json) { 2522 - return json_to_string(json); 2523 - } 2524 - function string3(input) { 2525 - return identity2(input); 2526 - } 2527 - function bool2(input) { 2528 - return identity2(input); 2529 - } 2530 - function int3(input) { 2531 - return identity2(input); 2532 - } 2533 - function null$() { 2534 - return do_null(); 2535 - } 2536 - function object2(entries) { 2537 - return object(entries); 2538 - } 2539 - 2540 - // build/dev/javascript/gleam_stdlib/gleam/bool.mjs 2541 - function negate2(bool3) { 2542 - return !bool3; 2543 - } 2544 - function to_string3(bool3) { 2545 - if (bool3) { 2546 - return "True"; 2547 - } else { 2548 - return "False"; 2549 - } 2550 - } 2551 - function guard(requirement, consequence, alternative) { 2552 - if (requirement) { 2553 - return consequence; 2554 - } else { 2555 - return alternative(); 2556 - } 2557 - } 2558 - function lazy_guard(requirement, consequence, alternative) { 2559 - if (requirement) { 2560 - return consequence(); 2561 - } else { 2562 - return alternative(); 2563 - } 2564 - } 2565 - // build/dev/javascript/gleam_time/gleam/time/duration.mjs 2566 - class Duration extends CustomType { 2567 - constructor(seconds, nanoseconds) { 2568 - super(); 2569 - this.seconds = seconds; 2570 - this.nanoseconds = nanoseconds; 2571 - } 2572 - } 2573 - function seconds(amount) { 2574 - return new Duration(amount, 0); 2575 - } 2576 - function to_seconds(duration) { 2577 - let seconds$1 = identity(duration.seconds); 2578 - let nanoseconds$1 = identity(duration.nanoseconds); 2579 - return seconds$1 + nanoseconds$1 / 1e9; 2580 - } 2581 - 2582 - // build/dev/javascript/gleam_time/gleam_time_ffi.mjs 2583 - function system_time() { 2584 - const now = Date.now(); 2585 - const milliseconds = now % 1000; 2586 - const nanoseconds = milliseconds * 1e6; 2587 - const seconds2 = (now - milliseconds) / 1000; 2588 - return [seconds2, nanoseconds]; 2589 - } 2590 - function local_time_offset_seconds() { 2591 - return new Date().getTimezoneOffset() * -60; 2592 - } 2593 - 2594 - // build/dev/javascript/gleam_time/gleam/time/calendar.mjs 2595 - class Date2 extends CustomType { 2596 - constructor(year, month, day) { 2597 - super(); 2598 - this.year = year; 2599 - this.month = month; 2600 - this.day = day; 2601 - } 2602 - } 2603 - class TimeOfDay extends CustomType { 2604 - constructor(hours, minutes, seconds2, nanoseconds) { 2605 - super(); 2606 - this.hours = hours; 2607 - this.minutes = minutes; 2608 - this.seconds = seconds2; 2609 - this.nanoseconds = nanoseconds; 2610 - } 2611 - } 2612 - class January extends CustomType { 2613 - } 2614 - class February extends CustomType { 2615 - } 2616 - class March extends CustomType { 2617 - } 2618 - class April extends CustomType { 2619 - } 2620 - class May extends CustomType { 2621 - } 2622 - class June extends CustomType { 2623 - } 2624 - class July extends CustomType { 2625 - } 2626 - class August extends CustomType { 2627 - } 2628 - class September extends CustomType { 2629 - } 2630 - class October extends CustomType { 2631 - } 2632 - class November extends CustomType { 2633 - } 2634 - class December extends CustomType { 2635 - } 2636 - function local_offset() { 2637 - return seconds(local_time_offset_seconds()); 2638 - } 2639 - 2640 - // build/dev/javascript/gleam_time/gleam/time/timestamp.mjs 2641 - class Timestamp extends CustomType { 2642 - constructor(seconds2, nanoseconds2) { 2643 - super(); 2644 - this.seconds = seconds2; 2645 - this.nanoseconds = nanoseconds2; 2646 - } 2647 - } 2648 - function normalise(timestamp) { 2649 - let multiplier = 1e9; 2650 - let nanoseconds2 = remainderInt(timestamp.nanoseconds, multiplier); 2651 - let overflow = timestamp.nanoseconds - nanoseconds2; 2652 - let seconds2 = timestamp.seconds + divideInt(overflow, multiplier); 2653 - let $ = nanoseconds2 >= 0; 2654 - if ($) { 2655 - return new Timestamp(seconds2, nanoseconds2); 2656 - } else { 2657 - return new Timestamp(seconds2 - 1, multiplier + nanoseconds2); 2658 - } 2659 - } 2660 - function system_time2() { 2661 - let $ = system_time(); 2662 - let seconds2; 2663 - let nanoseconds2; 2664 - seconds2 = $[0]; 2665 - nanoseconds2 = $[1]; 2666 - return normalise(new Timestamp(seconds2, nanoseconds2)); 2667 - } 2668 - function duration_to_minutes(duration) { 2669 - return round(to_seconds(duration) / 60); 2670 - } 2671 - function modulo2(n, m) { 2672 - let $ = modulo(n, m); 2673 - if ($ instanceof Ok) { 2674 - let n$1 = $[0]; 2675 - return n$1; 2676 - } else { 2677 - return 0; 2678 - } 2679 - } 2680 - function floored_div(numerator, denominator) { 2681 - let n = divideFloat(identity(numerator), denominator); 2682 - return round(floor(n)); 2683 - } 2684 - function to_civil(minutes) { 2685 - let raw_day = floored_div(minutes, 60 * 24) + 719468; 2686 - let _block; 2687 - let $ = raw_day >= 0; 2688 - if ($) { 2689 - _block = globalThis.Math.trunc(raw_day / 146097); 2690 - } else { 2691 - _block = globalThis.Math.trunc((raw_day - 146096) / 146097); 2692 - } 2693 - let era = _block; 2694 - let day_of_era = raw_day - era * 146097; 2695 - let year_of_era = globalThis.Math.trunc((day_of_era - globalThis.Math.trunc(day_of_era / 1460) + globalThis.Math.trunc(day_of_era / 36524) - globalThis.Math.trunc(day_of_era / 146096)) / 365); 2696 - let year = year_of_era + era * 400; 2697 - let day_of_year = day_of_era - (365 * year_of_era + globalThis.Math.trunc(year_of_era / 4) - globalThis.Math.trunc(year_of_era / 100)); 2698 - let mp = globalThis.Math.trunc((5 * day_of_year + 2) / 153); 2699 - let _block$1; 2700 - let $1 = mp < 10; 2701 - if ($1) { 2702 - _block$1 = mp + 3; 2703 - } else { 2704 - _block$1 = mp - 9; 2705 - } 2706 - let month = _block$1; 2707 - let day = day_of_year - globalThis.Math.trunc((153 * mp + 2) / 5) + 1; 2708 - let _block$2; 2709 - let $2 = month <= 2; 2710 - if ($2) { 2711 - _block$2 = year + 1; 2712 - } else { 2713 - _block$2 = year; 2714 - } 2715 - let year$1 = _block$2; 2716 - return [year$1, month, day]; 2717 - } 2718 - function to_calendar_from_offset(timestamp, offset) { 2719 - let total = timestamp.seconds + offset * 60; 2720 - let seconds2 = modulo2(total, 60); 2721 - let total_minutes = floored_div(total, 60); 2722 - let minutes = globalThis.Math.trunc(modulo2(total, 60 * 60) / 60); 2723 - let hours = divideInt(modulo2(total, 24 * 60 * 60), 60 * 60); 2724 - let $ = to_civil(total_minutes); 2725 - let year; 2726 - let month; 2727 - let day; 2728 - year = $[0]; 2729 - month = $[1]; 2730 - day = $[2]; 2731 - return [year, month, day, hours, minutes, seconds2]; 2732 - } 2733 - function to_calendar(timestamp, offset) { 2734 - let offset$1 = duration_to_minutes(offset); 2735 - let $ = to_calendar_from_offset(timestamp, offset$1); 2736 - let year; 2737 - let month; 2738 - let day; 2739 - let hours; 2740 - let minutes; 2741 - let seconds2; 2742 - year = $[0]; 2743 - month = $[1]; 2744 - day = $[2]; 2745 - hours = $[3]; 2746 - minutes = $[4]; 2747 - seconds2 = $[5]; 2748 - let _block; 2749 - if (month === 1) { 2750 - _block = new January; 2751 - } else if (month === 2) { 2752 - _block = new February; 2753 - } else if (month === 3) { 2754 - _block = new March; 2755 - } else if (month === 4) { 2756 - _block = new April; 2757 - } else if (month === 5) { 2758 - _block = new May; 2759 - } else if (month === 6) { 2760 - _block = new June; 2761 - } else if (month === 7) { 2762 - _block = new July; 2763 - } else if (month === 8) { 2764 - _block = new August; 2765 - } else if (month === 9) { 2766 - _block = new September; 2767 - } else if (month === 10) { 2768 - _block = new October; 2769 - } else if (month === 11) { 2770 - _block = new November; 2771 - } else { 2772 - _block = new December; 2773 - } 2774 - let month$1 = _block; 2775 - let nanoseconds2 = timestamp.nanoseconds; 2776 - let date = new Date2(year, month$1, day); 2777 - let time = new TimeOfDay(hours, minutes, seconds2, nanoseconds2); 2778 - return [date, time]; 2779 - } 2780 - function to_unix_seconds(timestamp) { 2781 - let seconds2 = identity(timestamp.seconds); 2782 - let nanoseconds2 = identity(timestamp.nanoseconds); 2783 - return seconds2 + nanoseconds2 / 1e9; 2784 - } 2785 - 2786 - // build/dev/javascript/gleamy_lights/ffi.mjs 2787 - function log2(str) { 2788 - console.log(...cstdoutln(str)); 2789 - } 2790 - function info(str) { 2791 - console.info(...cstdoutln(str)); 2792 - } 2793 - function error(str) { 2794 - console.error(...cstdoutln(str)); 2795 - } 2796 - function warn(str) { 2797 - console.warn(...cstdoutln(str)); 2798 - } 2799 - function cstdoutln(str) { 2800 - if (typeof process === "undefined") { 2801 - let parts = []; 2802 - str.split("\x1B[0m").map((part) => { 2803 - if (part.includes("\x1B") && !part.startsWith("\x1B")) { 2804 - part.replaceAll("\x1B", "\r.\r\x1B").split("\r.\r").map((part2) => { 2805 - parts.push(process_part(part2)); 2806 - }); 2807 - } else { 2808 - parts.push(process_part(part)); 2809 - } 2810 - }); 2811 - let msg = ""; 2812 - let styles = '"‎'.repeat(24).split('"'); 2813 - for (let partindex in parts) { 2814 - let part = parts[partindex]; 2815 - msg = `${msg}%c${part.text}`; 2816 - styles[partindex] = part.style; 2817 - } 2818 - return [msg, ...styles]; 2819 - } else { 2820 - return [str]; 2821 - } 2822 - } 2823 - function process_part(part) { 2824 - if (part.match(/\x1b\[38;2;(\d+);(\d+);(\d+)m(.+)/)) { 2825 - const match = part.match(/\x1b\[38;2;(\d+);(\d+);(\d+)m(.+)/); 2826 - const r = parseInt(match[1]); 2827 - const g = parseInt(match[2]); 2828 - const b = parseInt(match[3]); 2829 - const text = match[4]; 2830 - return { text, style: `color: rgb(${r}, ${g}, ${b})` }; 2831 - } else if (part.match(/\x1b\[48;2;(\d+);(\d+);(\d+)m(.+)/)) { 2832 - const match = part.match(/\x1b\[48;2;(\d+);(\d+);(\d+)m(.+)/); 2833 - const r = parseInt(match[1]); 2834 - const g = parseInt(match[2]); 2835 - const b = parseInt(match[3]); 2836 - const text = match[4]; 2837 - return { text, style: `background-color: rgb(${r}, ${g}, ${b})` }; 2838 - } else { 2839 - return { text: part, style: "color: inherit; background-color: inherit;" }; 2840 - } 2841 - } 2842 - // build/dev/javascript/envoy/envoy_ffi.mjs 2843 - function get(key) { 2844 - let value; 2845 - if (globalThis.Deno) { 2846 - value = Deno.env.get(key); 2847 - } else if (globalThis.process) { 2848 - value = process.env[key]; 2849 - } 2850 - if (value === undefined) { 2851 - return new Error(undefined); 2852 - } else { 2853 - return new Ok(value); 2854 - } 2855 - } 2856 - // build/dev/javascript/gleamy_lights/gleamy_lights.mjs 2857 - function by_rgb(msg, r, g, b) { 2858 - let f = () => { 2859 - return "\x1B[38;2;" + to_string(r) + ";" + to_string(g) + ";" + to_string(b) + "m" + msg + "\x1B[0m"; 2860 - }; 2861 - let $ = get("NO_COLOR"); 2862 - if ($ instanceof Ok) { 2863 - let $1 = $[0]; 2864 - if ($1 === "") { 2865 - return f(); 2866 - } else { 2867 - return msg; 2868 - } 2869 - } else { 2870 - return f(); 2871 - } 2872 - } 2873 - 2874 - // build/dev/javascript/gleamy_lights/gleamy_lights/premixed.mjs 2875 - function text_error_red(msg) { 2876 - let _pipe = msg; 2877 - return by_rgb(_pipe, 184, 28, 74); 2878 - } 2879 - function text_cyan(msg) { 2880 - let _pipe = msg; 2881 - return by_rgb(_pipe, 16, 227, 227); 2882 - } 2883 - // build/dev/javascript/gleam_stdlib/gleam/function.mjs 2884 - function identity3(x) { 2885 - return x; 2886 - } 2887 - // build/dev/javascript/gleam_stdlib/gleam/set.mjs 2888 - class Set2 extends CustomType { 2889 - constructor(dict2) { 2890 - super(); 2891 - this.dict = dict2; 2892 - } 2893 - } 2894 - var token = undefined; 2895 - function new$2() { 2896 - return new Set2(new_map()); 2897 - } 2898 - function contains(set2, member) { 2899 - let _pipe = set2.dict; 2900 - let _pipe$1 = map_get(_pipe, member); 2901 - return is_ok(_pipe$1); 2902 - } 2903 - function insert2(set2, member) { 2904 - return new Set2(insert(set2.dict, member, token)); 2905 - } 2906 - 2907 - // build/dev/javascript/lustre/lustre/internals/constants.ffi.mjs 2908 - var EMPTY_DICT = /* @__PURE__ */ Dict.new(); 2909 - function empty_dict() { 2910 - return EMPTY_DICT; 2911 - } 2912 - var EMPTY_SET = /* @__PURE__ */ new$2(); 2913 - function empty_set() { 2914 - return EMPTY_SET; 2915 - } 2916 - var document2 = globalThis?.document; 2917 - var NAMESPACE_HTML = "http://www.w3.org/1999/xhtml"; 2918 - var ELEMENT_NODE = 1; 2919 - var TEXT_NODE = 3; 2920 - var DOCUMENT_FRAGMENT_NODE = 11; 2921 - var SUPPORTS_MOVE_BEFORE = !!globalThis.HTMLElement?.prototype?.moveBefore; 2922 - 2923 - // build/dev/javascript/lustre/lustre/internals/constants.mjs 2924 - var empty_list = /* @__PURE__ */ toList([]); 2925 - var option_none = /* @__PURE__ */ new None; 2926 - 2927 - // build/dev/javascript/lustre/lustre/vdom/vattr.ffi.mjs 2928 - var GT = /* @__PURE__ */ new Gt; 2929 - var LT = /* @__PURE__ */ new Lt; 2930 - var EQ = /* @__PURE__ */ new Eq; 2931 - function compare3(a, b) { 2932 - if (a.name === b.name) { 2933 - return EQ; 2934 - } else if (a.name < b.name) { 2935 - return LT; 2936 - } else { 2937 - return GT; 2938 - } 2939 - } 2940 - 2941 - // build/dev/javascript/lustre/lustre/vdom/vattr.mjs 2942 - class Attribute extends CustomType { 2943 - constructor(kind, name, value) { 2944 - super(); 2945 - this.kind = kind; 2946 - this.name = name; 2947 - this.value = value; 2948 - } 2949 - } 2950 - class Property extends CustomType { 2951 - constructor(kind, name, value) { 2952 - super(); 2953 - this.kind = kind; 2954 - this.name = name; 2955 - this.value = value; 2956 - } 2957 - } 2958 - class Event2 extends CustomType { 2959 - constructor(kind, name, handler, include, prevent_default, stop_propagation, immediate2, limit) { 2960 - super(); 2961 - this.kind = kind; 2962 - this.name = name; 2963 - this.handler = handler; 2964 - this.include = include; 2965 - this.prevent_default = prevent_default; 2966 - this.stop_propagation = stop_propagation; 2967 - this.immediate = immediate2; 2968 - this.limit = limit; 2969 - } 2970 - } 2971 - class NoLimit extends CustomType { 2972 - constructor(kind) { 2973 - super(); 2974 - this.kind = kind; 2975 - } 2976 - } 2977 - class Debounce extends CustomType { 2978 - constructor(kind, delay) { 2979 - super(); 2980 - this.kind = kind; 2981 - this.delay = delay; 2982 - } 2983 - } 2984 - class Throttle extends CustomType { 2985 - constructor(kind, delay) { 2986 - super(); 2987 - this.kind = kind; 2988 - this.delay = delay; 2989 - } 2990 - } 2991 - var attribute_kind = 0; 2992 - var property_kind = 1; 2993 - var event_kind = 2; 2994 - var debounce_kind = 1; 2995 - var throttle_kind = 2; 2996 - function limit_equals(a, b) { 2997 - if (a instanceof NoLimit) { 2998 - if (b instanceof NoLimit) { 2999 - return true; 3000 - } else { 3001 - return false; 3002 - } 3003 - } else if (a instanceof Debounce) { 3004 - if (b instanceof Debounce) { 3005 - let d1 = a.delay; 3006 - let d2 = b.delay; 3007 - if (d1 === d2) { 3008 - return true; 3009 - } else { 3010 - return false; 3011 - } 3012 - } else { 3013 - return false; 3014 - } 3015 - } else if (b instanceof Throttle) { 3016 - let d1 = a.delay; 3017 - let d2 = b.delay; 3018 - if (d1 === d2) { 3019 - return true; 3020 - } else { 3021 - return false; 3022 - } 3023 - } else { 3024 - return false; 3025 - } 3026 - } 3027 - function merge(loop$attributes, loop$merged) { 3028 - while (true) { 3029 - let attributes = loop$attributes; 3030 - let merged = loop$merged; 3031 - if (attributes instanceof Empty) { 3032 - return merged; 3033 - } else { 3034 - let $ = attributes.tail; 3035 - if ($ instanceof Empty) { 3036 - let attribute$1 = attributes.head; 3037 - let rest2 = $; 3038 - loop$attributes = rest2; 3039 - loop$merged = prepend(attribute$1, merged); 3040 - } else { 3041 - let $1 = attributes.head; 3042 - if ($1 instanceof Attribute) { 3043 - let $2 = $.head; 3044 - if ($2 instanceof Attribute) { 3045 - let $3 = $1.name; 3046 - if ($3 === "class") { 3047 - let $4 = $2.name; 3048 - if ($4 === "class") { 3049 - let rest2 = $.tail; 3050 - let kind = $1.kind; 3051 - let class1 = $1.value; 3052 - let class2 = $2.value; 3053 - let value = class1 + " " + class2; 3054 - let attribute$1 = new Attribute(kind, "class", value); 3055 - loop$attributes = prepend(attribute$1, rest2); 3056 - loop$merged = merged; 3057 - } else { 3058 - let attribute$1 = $1; 3059 - let rest2 = $; 3060 - loop$attributes = rest2; 3061 - loop$merged = prepend(attribute$1, merged); 3062 - } 3063 - } else if ($3 === "style") { 3064 - let $4 = $2.name; 3065 - if ($4 === "style") { 3066 - let rest2 = $.tail; 3067 - let kind = $1.kind; 3068 - let style1 = $1.value; 3069 - let style2 = $2.value; 3070 - let value = style1 + ";" + style2; 3071 - let attribute$1 = new Attribute(kind, "style", value); 3072 - loop$attributes = prepend(attribute$1, rest2); 3073 - loop$merged = merged; 3074 - } else { 3075 - let attribute$1 = $1; 3076 - let rest2 = $; 3077 - loop$attributes = rest2; 3078 - loop$merged = prepend(attribute$1, merged); 3079 - } 3080 - } else { 3081 - let attribute$1 = $1; 3082 - let rest2 = $; 3083 - loop$attributes = rest2; 3084 - loop$merged = prepend(attribute$1, merged); 3085 - } 3086 - } else { 3087 - let attribute$1 = $1; 3088 - let rest2 = $; 3089 - loop$attributes = rest2; 3090 - loop$merged = prepend(attribute$1, merged); 3091 - } 3092 - } else { 3093 - let attribute$1 = $1; 3094 - let rest2 = $; 3095 - loop$attributes = rest2; 3096 - loop$merged = prepend(attribute$1, merged); 3097 - } 3098 - } 3099 - } 3100 - } 3101 - } 3102 - function prepare(attributes) { 3103 - if (attributes instanceof Empty) { 3104 - return attributes; 3105 - } else { 3106 - let $ = attributes.tail; 3107 - if ($ instanceof Empty) { 3108 - return attributes; 3109 - } else { 3110 - let _pipe = attributes; 3111 - let _pipe$1 = sort(_pipe, (a, b) => { 3112 - return compare3(b, a); 3113 - }); 3114 - return merge(_pipe$1, empty_list); 3115 - } 3116 - } 3117 - } 3118 - function attribute(name, value) { 3119 - return new Attribute(attribute_kind, name, value); 3120 - } 3121 - function property(name, value) { 3122 - return new Property(property_kind, name, value); 3123 - } 3124 - function event(name, handler, include, prevent_default, stop_propagation, immediate2, limit) { 3125 - return new Event2(event_kind, name, handler, include, prevent_default, stop_propagation, immediate2, limit); 3126 - } 3127 - 3128 - // build/dev/javascript/lustre/lustre/attribute.mjs 3129 - function attribute2(name, value) { 3130 - return attribute(name, value); 3131 - } 3132 - function property2(name, value) { 3133 - return property(name, value); 3134 - } 3135 - function boolean_attribute(name, value) { 3136 - if (value) { 3137 - return attribute2(name, ""); 3138 - } else { 3139 - return property2(name, bool2(false)); 3140 - } 3141 - } 3142 - function class$(name) { 3143 - return attribute2("class", name); 3144 - } 3145 - function none() { 3146 - return class$(""); 3147 - } 3148 - function id(value) { 3149 - return attribute2("id", value); 3150 - } 3151 - function style(property3, value) { 3152 - if (property3 === "") { 3153 - return class$(""); 3154 - } else if (value === "") { 3155 - return class$(""); 3156 - } else { 3157 - return attribute2("style", property3 + ":" + value + ";"); 3158 - } 3159 - } 3160 - function href(url) { 3161 - return attribute2("href", url); 3162 - } 3163 - function target(value) { 3164 - return attribute2("target", value); 3165 - } 3166 - function alt(text) { 3167 - return attribute2("alt", text); 3168 - } 3169 - function src(url) { 3170 - return attribute2("src", url); 3171 - } 3172 - function checked(is_checked) { 3173 - return boolean_attribute("checked", is_checked); 3174 - } 3175 - function disabled(is_disabled) { 3176 - return boolean_attribute("disabled", is_disabled); 3177 - } 3178 - function for$(id2) { 3179 - return attribute2("for", id2); 3180 - } 3181 - function name(element_name) { 3182 - return attribute2("name", element_name); 3183 - } 3184 - function placeholder(text) { 3185 - return attribute2("placeholder", text); 3186 - } 3187 - function type_(control_type) { 3188 - return attribute2("type", control_type); 3189 - } 3190 - function value(control_value) { 3191 - return attribute2("value", control_value); 3192 - } 3193 - function role(name2) { 3194 - return attribute2("role", name2); 3195 - } 3196 - 3197 - // build/dev/javascript/lustre/lustre/effect.mjs 3198 - class Effect extends CustomType { 3199 - constructor(synchronous, before_paint, after_paint) { 3200 - super(); 3201 - this.synchronous = synchronous; 3202 - this.before_paint = before_paint; 3203 - this.after_paint = after_paint; 3204 - } 3205 - } 3206 - var empty2 = /* @__PURE__ */ new Effect(/* @__PURE__ */ toList([]), /* @__PURE__ */ toList([]), /* @__PURE__ */ toList([])); 3207 - function none2() { 3208 - return empty2; 3209 - } 3210 - function from(effect) { 3211 - let task = (actions) => { 3212 - let dispatch = actions.dispatch; 3213 - return effect(dispatch); 3214 - }; 3215 - return new Effect(toList([task]), empty2.before_paint, empty2.after_paint); 3216 - } 3217 - function batch(effects) { 3218 - return fold2(effects, empty2, (acc, eff) => { 3219 - return new Effect(fold2(eff.synchronous, acc.synchronous, prepend2), fold2(eff.before_paint, acc.before_paint, prepend2), fold2(eff.after_paint, acc.after_paint, prepend2)); 3220 - }); 3221 - } 3222 - 3223 - // build/dev/javascript/lustre/lustre/internals/mutable_map.ffi.mjs 3224 - function empty3() { 3225 - return null; 3226 - } 3227 - function get2(map5, key) { 3228 - const value2 = map5?.get(key); 3229 - if (value2 != null) { 3230 - return new Ok(value2); 3231 - } else { 3232 - return new Error(undefined); 3233 - } 3234 - } 3235 - function insert3(map5, key, value2) { 3236 - map5 ??= new Map; 3237 - map5.set(key, value2); 3238 - return map5; 3239 - } 3240 - function remove(map5, key) { 3241 - map5?.delete(key); 3242 - return map5; 3243 - } 3244 - 3245 - // build/dev/javascript/lustre/lustre/vdom/path.mjs 3246 - class Root extends CustomType { 3247 - } 3248 - 3249 - class Key extends CustomType { 3250 - constructor(key, parent) { 3251 - super(); 3252 - this.key = key; 3253 - this.parent = parent; 3254 - } 3255 - } 3256 - 3257 - class Index extends CustomType { 3258 - constructor(index4, parent) { 3259 - super(); 3260 - this.index = index4; 3261 - this.parent = parent; 3262 - } 3263 - } 3264 - var root2 = /* @__PURE__ */ new Root; 3265 - var separator_index = ` 3266 - `; 3267 - var separator_key = "\t"; 3268 - var separator_event = "\f"; 3269 - function do_matches(loop$path, loop$candidates) { 3270 - while (true) { 3271 - let path = loop$path; 3272 - let candidates = loop$candidates; 3273 - if (candidates instanceof Empty) { 3274 - return false; 3275 - } else { 3276 - let candidate = candidates.head; 3277 - let rest2 = candidates.tail; 3278 - let $ = starts_with(path, candidate); 3279 - if ($) { 3280 - return $; 3281 - } else { 3282 - loop$path = path; 3283 - loop$candidates = rest2; 3284 - } 3285 - } 3286 - } 3287 - } 3288 - function add3(parent, index4, key) { 3289 - if (key === "") { 3290 - return new Index(index4, parent); 3291 - } else { 3292 - return new Key(key, parent); 3293 - } 3294 - } 3295 - function do_to_string(loop$path, loop$acc) { 3296 - while (true) { 3297 - let path = loop$path; 3298 - let acc = loop$acc; 3299 - if (path instanceof Root) { 3300 - if (acc instanceof Empty) { 3301 - return ""; 3302 - } else { 3303 - let segments = acc.tail; 3304 - return concat2(segments); 3305 - } 3306 - } else if (path instanceof Key) { 3307 - let key = path.key; 3308 - let parent = path.parent; 3309 - loop$path = parent; 3310 - loop$acc = prepend(separator_key, prepend(key, acc)); 3311 - } else { 3312 - let index4 = path.index; 3313 - let parent = path.parent; 3314 - loop$path = parent; 3315 - loop$acc = prepend(separator_index, prepend(to_string(index4), acc)); 3316 - } 3317 - } 3318 - } 3319 - function to_string4(path) { 3320 - return do_to_string(path, toList([])); 3321 - } 3322 - function matches(path, candidates) { 3323 - if (candidates instanceof Empty) { 3324 - return false; 3325 - } else { 3326 - return do_matches(to_string4(path), candidates); 3327 - } 3328 - } 3329 - function event2(path, event3) { 3330 - return do_to_string(path, toList([separator_event, event3])); 3331 - } 3332 - 3333 - // build/dev/javascript/lustre/lustre/vdom/vnode.mjs 3334 - class Fragment extends CustomType { 3335 - constructor(kind, key, mapper, children, keyed_children, children_count) { 3336 - super(); 3337 - this.kind = kind; 3338 - this.key = key; 3339 - this.mapper = mapper; 3340 - this.children = children; 3341 - this.keyed_children = keyed_children; 3342 - this.children_count = children_count; 3343 - } 3344 - } 3345 - class Element extends CustomType { 3346 - constructor(kind, key, mapper, namespace, tag, attributes, children, keyed_children, self_closing, void$) { 3347 - super(); 3348 - this.kind = kind; 3349 - this.key = key; 3350 - this.mapper = mapper; 3351 - this.namespace = namespace; 3352 - this.tag = tag; 3353 - this.attributes = attributes; 3354 - this.children = children; 3355 - this.keyed_children = keyed_children; 3356 - this.self_closing = self_closing; 3357 - this.void = void$; 3358 - } 3359 - } 3360 - class Text extends CustomType { 3361 - constructor(kind, key, mapper, content) { 3362 - super(); 3363 - this.kind = kind; 3364 - this.key = key; 3365 - this.mapper = mapper; 3366 - this.content = content; 3367 - } 3368 - } 3369 - class UnsafeInnerHtml extends CustomType { 3370 - constructor(kind, key, mapper, namespace, tag, attributes, inner_html) { 3371 - super(); 3372 - this.kind = kind; 3373 - this.key = key; 3374 - this.mapper = mapper; 3375 - this.namespace = namespace; 3376 - this.tag = tag; 3377 - this.attributes = attributes; 3378 - this.inner_html = inner_html; 3379 - } 3380 - } 3381 - var fragment_kind = 0; 3382 - var element_kind = 1; 3383 - var text_kind = 2; 3384 - var unsafe_inner_html_kind = 3; 3385 - function is_void_element(tag, namespace) { 3386 - if (namespace === "") { 3387 - if (tag === "area") { 3388 - return true; 3389 - } else if (tag === "base") { 3390 - return true; 3391 - } else if (tag === "br") { 3392 - return true; 3393 - } else if (tag === "col") { 3394 - return true; 3395 - } else if (tag === "embed") { 3396 - return true; 3397 - } else if (tag === "hr") { 3398 - return true; 3399 - } else if (tag === "img") { 3400 - return true; 3401 - } else if (tag === "input") { 3402 - return true; 3403 - } else if (tag === "link") { 3404 - return true; 3405 - } else if (tag === "meta") { 3406 - return true; 3407 - } else if (tag === "param") { 3408 - return true; 3409 - } else if (tag === "source") { 3410 - return true; 3411 - } else if (tag === "track") { 3412 - return true; 3413 - } else if (tag === "wbr") { 3414 - return true; 3415 - } else { 3416 - return false; 3417 - } 3418 - } else { 3419 - return false; 3420 - } 3421 - } 3422 - function advance(node) { 3423 - if (node instanceof Fragment) { 3424 - let children_count = node.children_count; 3425 - return 1 + children_count; 3426 - } else { 3427 - return 1; 3428 - } 3429 - } 3430 - function fragment(key, mapper, children, keyed_children, children_count) { 3431 - return new Fragment(fragment_kind, key, mapper, children, keyed_children, children_count); 3432 - } 3433 - function element(key, mapper, namespace, tag, attributes, children, keyed_children, self_closing, void$) { 3434 - return new Element(element_kind, key, mapper, namespace, tag, prepare(attributes), children, keyed_children, self_closing, void$ || is_void_element(tag, namespace)); 3435 - } 3436 - function text(key, mapper, content) { 3437 - return new Text(text_kind, key, mapper, content); 3438 - } 3439 - function set_fragment_key(loop$key, loop$children, loop$index, loop$new_children, loop$keyed_children) { 3440 - while (true) { 3441 - let key = loop$key; 3442 - let children = loop$children; 3443 - let index4 = loop$index; 3444 - let new_children = loop$new_children; 3445 - let keyed_children = loop$keyed_children; 3446 - if (children instanceof Empty) { 3447 - return [reverse(new_children), keyed_children]; 3448 - } else { 3449 - let $ = children.head; 3450 - if ($ instanceof Fragment) { 3451 - let node = $; 3452 - if (node.key === "") { 3453 - let children$1 = children.tail; 3454 - let child_key = key + "::" + to_string(index4); 3455 - let $1 = set_fragment_key(child_key, node.children, 0, empty_list, empty3()); 3456 - let node_children; 3457 - let node_keyed_children; 3458 - node_children = $1[0]; 3459 - node_keyed_children = $1[1]; 3460 - let new_node = new Fragment(node.kind, node.key, node.mapper, node_children, node_keyed_children, node.children_count); 3461 - let new_children$1 = prepend(new_node, new_children); 3462 - let index$1 = index4 + 1; 3463 - loop$key = key; 3464 - loop$children = children$1; 3465 - loop$index = index$1; 3466 - loop$new_children = new_children$1; 3467 - loop$keyed_children = keyed_children; 3468 - } else { 3469 - let node2 = $; 3470 - if (node2.key !== "") { 3471 - let children$1 = children.tail; 3472 - let child_key = key + "::" + node2.key; 3473 - let keyed_node = to_keyed(child_key, node2); 3474 - let new_children$1 = prepend(keyed_node, new_children); 3475 - let keyed_children$1 = insert3(keyed_children, child_key, keyed_node); 3476 - let index$1 = index4 + 1; 3477 - loop$key = key; 3478 - loop$children = children$1; 3479 - loop$index = index$1; 3480 - loop$new_children = new_children$1; 3481 - loop$keyed_children = keyed_children$1; 3482 - } else { 3483 - let node3 = $; 3484 - let children$1 = children.tail; 3485 - let new_children$1 = prepend(node3, new_children); 3486 - let index$1 = index4 + 1; 3487 - loop$key = key; 3488 - loop$children = children$1; 3489 - loop$index = index$1; 3490 - loop$new_children = new_children$1; 3491 - loop$keyed_children = keyed_children; 3492 - } 3493 - } 3494 - } else { 3495 - let node = $; 3496 - if (node.key !== "") { 3497 - let children$1 = children.tail; 3498 - let child_key = key + "::" + node.key; 3499 - let keyed_node = to_keyed(child_key, node); 3500 - let new_children$1 = prepend(keyed_node, new_children); 3501 - let keyed_children$1 = insert3(keyed_children, child_key, keyed_node); 3502 - let index$1 = index4 + 1; 3503 - loop$key = key; 3504 - loop$children = children$1; 3505 - loop$index = index$1; 3506 - loop$new_children = new_children$1; 3507 - loop$keyed_children = keyed_children$1; 3508 - } else { 3509 - let node2 = $; 3510 - let children$1 = children.tail; 3511 - let new_children$1 = prepend(node2, new_children); 3512 - let index$1 = index4 + 1; 3513 - loop$key = key; 3514 - loop$children = children$1; 3515 - loop$index = index$1; 3516 - loop$new_children = new_children$1; 3517 - loop$keyed_children = keyed_children; 3518 - } 3519 - } 3520 - } 3521 - } 3522 - } 3523 - function to_keyed(key, node) { 3524 - if (node instanceof Fragment) { 3525 - let children = node.children; 3526 - let $ = set_fragment_key(key, children, 0, empty_list, empty3()); 3527 - let children$1; 3528 - let keyed_children; 3529 - children$1 = $[0]; 3530 - keyed_children = $[1]; 3531 - return new Fragment(node.kind, key, node.mapper, children$1, keyed_children, node.children_count); 3532 - } else if (node instanceof Element) { 3533 - return new Element(node.kind, key, node.mapper, node.namespace, node.tag, node.attributes, node.children, node.keyed_children, node.self_closing, node.void); 3534 - } else if (node instanceof Text) { 3535 - return new Text(node.kind, key, node.mapper, node.content); 3536 - } else { 3537 - return new UnsafeInnerHtml(node.kind, key, node.mapper, node.namespace, node.tag, node.attributes, node.inner_html); 3538 - } 3539 - } 3540 - 3541 - // build/dev/javascript/lustre/lustre/vdom/patch.mjs 3542 - class Patch extends CustomType { 3543 - constructor(index4, removed, changes, children) { 3544 - super(); 3545 - this.index = index4; 3546 - this.removed = removed; 3547 - this.changes = changes; 3548 - this.children = children; 3549 - } 3550 - } 3551 - class ReplaceText extends CustomType { 3552 - constructor(kind, content) { 3553 - super(); 3554 - this.kind = kind; 3555 - this.content = content; 3556 - } 3557 - } 3558 - class ReplaceInnerHtml extends CustomType { 3559 - constructor(kind, inner_html) { 3560 - super(); 3561 - this.kind = kind; 3562 - this.inner_html = inner_html; 3563 - } 3564 - } 3565 - class Update extends CustomType { 3566 - constructor(kind, added, removed) { 3567 - super(); 3568 - this.kind = kind; 3569 - this.added = added; 3570 - this.removed = removed; 3571 - } 3572 - } 3573 - class Move extends CustomType { 3574 - constructor(kind, key, before, count) { 3575 - super(); 3576 - this.kind = kind; 3577 - this.key = key; 3578 - this.before = before; 3579 - this.count = count; 3580 - } 3581 - } 3582 - class RemoveKey extends CustomType { 3583 - constructor(kind, key, count) { 3584 - super(); 3585 - this.kind = kind; 3586 - this.key = key; 3587 - this.count = count; 3588 - } 3589 - } 3590 - class Replace extends CustomType { 3591 - constructor(kind, from2, count, with$) { 3592 - super(); 3593 - this.kind = kind; 3594 - this.from = from2; 3595 - this.count = count; 3596 - this.with = with$; 3597 - } 3598 - } 3599 - class Insert extends CustomType { 3600 - constructor(kind, children, before) { 3601 - super(); 3602 - this.kind = kind; 3603 - this.children = children; 3604 - this.before = before; 3605 - } 3606 - } 3607 - class Remove extends CustomType { 3608 - constructor(kind, from2, count) { 3609 - super(); 3610 - this.kind = kind; 3611 - this.from = from2; 3612 - this.count = count; 3613 - } 3614 - } 3615 - var replace_text_kind = 0; 3616 - var replace_inner_html_kind = 1; 3617 - var update_kind = 2; 3618 - var move_kind = 3; 3619 - var remove_key_kind = 4; 3620 - var replace_kind = 5; 3621 - var insert_kind = 6; 3622 - var remove_kind = 7; 3623 - function new$5(index4, removed, changes, children) { 3624 - return new Patch(index4, removed, changes, children); 3625 - } 3626 - function replace_text(content) { 3627 - return new ReplaceText(replace_text_kind, content); 3628 - } 3629 - function replace_inner_html(inner_html) { 3630 - return new ReplaceInnerHtml(replace_inner_html_kind, inner_html); 3631 - } 3632 - function update(added, removed) { 3633 - return new Update(update_kind, added, removed); 3634 - } 3635 - function move(key, before, count) { 3636 - return new Move(move_kind, key, before, count); 3637 - } 3638 - function remove_key(key, count) { 3639 - return new RemoveKey(remove_key_kind, key, count); 3640 - } 3641 - function replace2(from2, count, with$) { 3642 - return new Replace(replace_kind, from2, count, with$); 3643 - } 3644 - function insert4(children, before) { 3645 - return new Insert(insert_kind, children, before); 3646 - } 3647 - function remove2(from2, count) { 3648 - return new Remove(remove_kind, from2, count); 3649 - } 3650 - 3651 - // build/dev/javascript/lustre/lustre/vdom/diff.mjs 3652 - class Diff extends CustomType { 3653 - constructor(patch, events) { 3654 - super(); 3655 - this.patch = patch; 3656 - this.events = events; 3657 - } 3658 - } 3659 - class AttributeChange extends CustomType { 3660 - constructor(added, removed, events) { 3661 - super(); 3662 - this.added = added; 3663 - this.removed = removed; 3664 - this.events = events; 3665 - } 3666 - } 3667 - function is_controlled(events, namespace, tag, path) { 3668 - if (tag === "input" && namespace === "") { 3669 - return has_dispatched_events(events, path); 3670 - } else if (tag === "select" && namespace === "") { 3671 - return has_dispatched_events(events, path); 3672 - } else if (tag === "textarea" && namespace === "") { 3673 - return has_dispatched_events(events, path); 3674 - } else { 3675 - return false; 3676 - } 3677 - } 3678 - function diff_attributes(loop$controlled, loop$path, loop$mapper, loop$events, loop$old, loop$new, loop$added, loop$removed) { 3679 - while (true) { 3680 - let controlled = loop$controlled; 3681 - let path = loop$path; 3682 - let mapper = loop$mapper; 3683 - let events = loop$events; 3684 - let old = loop$old; 3685 - let new$6 = loop$new; 3686 - let added = loop$added; 3687 - let removed = loop$removed; 3688 - if (old instanceof Empty) { 3689 - if (new$6 instanceof Empty) { 3690 - return new AttributeChange(added, removed, events); 3691 - } else { 3692 - let $ = new$6.head; 3693 - if ($ instanceof Event2) { 3694 - let next = $; 3695 - let new$1 = new$6.tail; 3696 - let name2 = $.name; 3697 - let handler = $.handler; 3698 - let added$1 = prepend(next, added); 3699 - let events$1 = add_event(events, mapper, path, name2, handler); 3700 - loop$controlled = controlled; 3701 - loop$path = path; 3702 - loop$mapper = mapper; 3703 - loop$events = events$1; 3704 - loop$old = old; 3705 - loop$new = new$1; 3706 - loop$added = added$1; 3707 - loop$removed = removed; 3708 - } else { 3709 - let next = $; 3710 - let new$1 = new$6.tail; 3711 - let added$1 = prepend(next, added); 3712 - loop$controlled = controlled; 3713 - loop$path = path; 3714 - loop$mapper = mapper; 3715 - loop$events = events; 3716 - loop$old = old; 3717 - loop$new = new$1; 3718 - loop$added = added$1; 3719 - loop$removed = removed; 3720 - } 3721 - } 3722 - } else if (new$6 instanceof Empty) { 3723 - let $ = old.head; 3724 - if ($ instanceof Event2) { 3725 - let prev = $; 3726 - let old$1 = old.tail; 3727 - let name2 = $.name; 3728 - let removed$1 = prepend(prev, removed); 3729 - let events$1 = remove_event(events, path, name2); 3730 - loop$controlled = controlled; 3731 - loop$path = path; 3732 - loop$mapper = mapper; 3733 - loop$events = events$1; 3734 - loop$old = old$1; 3735 - loop$new = new$6; 3736 - loop$added = added; 3737 - loop$removed = removed$1; 3738 - } else { 3739 - let prev = $; 3740 - let old$1 = old.tail; 3741 - let removed$1 = prepend(prev, removed); 3742 - loop$controlled = controlled; 3743 - loop$path = path; 3744 - loop$mapper = mapper; 3745 - loop$events = events; 3746 - loop$old = old$1; 3747 - loop$new = new$6; 3748 - loop$added = added; 3749 - loop$removed = removed$1; 3750 - } 3751 - } else { 3752 - let prev = old.head; 3753 - let remaining_old = old.tail; 3754 - let next = new$6.head; 3755 - let remaining_new = new$6.tail; 3756 - let $ = compare3(prev, next); 3757 - if ($ instanceof Lt) { 3758 - if (prev instanceof Event2) { 3759 - let name2 = prev.name; 3760 - let removed$1 = prepend(prev, removed); 3761 - let events$1 = remove_event(events, path, name2); 3762 - loop$controlled = controlled; 3763 - loop$path = path; 3764 - loop$mapper = mapper; 3765 - loop$events = events$1; 3766 - loop$old = remaining_old; 3767 - loop$new = new$6; 3768 - loop$added = added; 3769 - loop$removed = removed$1; 3770 - } else { 3771 - let removed$1 = prepend(prev, removed); 3772 - loop$controlled = controlled; 3773 - loop$path = path; 3774 - loop$mapper = mapper; 3775 - loop$events = events; 3776 - loop$old = remaining_old; 3777 - loop$new = new$6; 3778 - loop$added = added; 3779 - loop$removed = removed$1; 3780 - } 3781 - } else if ($ instanceof Eq) { 3782 - if (prev instanceof Attribute) { 3783 - if (next instanceof Attribute) { 3784 - let _block; 3785 - let $1 = next.name; 3786 - if ($1 === "value") { 3787 - _block = controlled || prev.value !== next.value; 3788 - } else if ($1 === "checked") { 3789 - _block = controlled || prev.value !== next.value; 3790 - } else if ($1 === "selected") { 3791 - _block = controlled || prev.value !== next.value; 3792 - } else { 3793 - _block = prev.value !== next.value; 3794 - } 3795 - let has_changes = _block; 3796 - let _block$1; 3797 - if (has_changes) { 3798 - _block$1 = prepend(next, added); 3799 - } else { 3800 - _block$1 = added; 3801 - } 3802 - let added$1 = _block$1; 3803 - loop$controlled = controlled; 3804 - loop$path = path; 3805 - loop$mapper = mapper; 3806 - loop$events = events; 3807 - loop$old = remaining_old; 3808 - loop$new = remaining_new; 3809 - loop$added = added$1; 3810 - loop$removed = removed; 3811 - } else if (next instanceof Event2) { 3812 - let name2 = next.name; 3813 - let handler = next.handler; 3814 - let added$1 = prepend(next, added); 3815 - let removed$1 = prepend(prev, removed); 3816 - let events$1 = add_event(events, mapper, path, name2, handler); 3817 - loop$controlled = controlled; 3818 - loop$path = path; 3819 - loop$mapper = mapper; 3820 - loop$events = events$1; 3821 - loop$old = remaining_old; 3822 - loop$new = remaining_new; 3823 - loop$added = added$1; 3824 - loop$removed = removed$1; 3825 - } else { 3826 - let added$1 = prepend(next, added); 3827 - let removed$1 = prepend(prev, removed); 3828 - loop$controlled = controlled; 3829 - loop$path = path; 3830 - loop$mapper = mapper; 3831 - loop$events = events; 3832 - loop$old = remaining_old; 3833 - loop$new = remaining_new; 3834 - loop$added = added$1; 3835 - loop$removed = removed$1; 3836 - } 3837 - } else if (prev instanceof Property) { 3838 - if (next instanceof Property) { 3839 - let _block; 3840 - let $1 = next.name; 3841 - if ($1 === "scrollLeft") { 3842 - _block = true; 3843 - } else if ($1 === "scrollRight") { 3844 - _block = true; 3845 - } else if ($1 === "value") { 3846 - _block = controlled || !isEqual(prev.value, next.value); 3847 - } else if ($1 === "checked") { 3848 - _block = controlled || !isEqual(prev.value, next.value); 3849 - } else if ($1 === "selected") { 3850 - _block = controlled || !isEqual(prev.value, next.value); 3851 - } else { 3852 - _block = !isEqual(prev.value, next.value); 3853 - } 3854 - let has_changes = _block; 3855 - let _block$1; 3856 - if (has_changes) { 3857 - _block$1 = prepend(next, added); 3858 - } else { 3859 - _block$1 = added; 3860 - } 3861 - let added$1 = _block$1; 3862 - loop$controlled = controlled; 3863 - loop$path = path; 3864 - loop$mapper = mapper; 3865 - loop$events = events; 3866 - loop$old = remaining_old; 3867 - loop$new = remaining_new; 3868 - loop$added = added$1; 3869 - loop$removed = removed; 3870 - } else if (next instanceof Event2) { 3871 - let name2 = next.name; 3872 - let handler = next.handler; 3873 - let added$1 = prepend(next, added); 3874 - let removed$1 = prepend(prev, removed); 3875 - let events$1 = add_event(events, mapper, path, name2, handler); 3876 - loop$controlled = controlled; 3877 - loop$path = path; 3878 - loop$mapper = mapper; 3879 - loop$events = events$1; 3880 - loop$old = remaining_old; 3881 - loop$new = remaining_new; 3882 - loop$added = added$1; 3883 - loop$removed = removed$1; 3884 - } else { 3885 - let added$1 = prepend(next, added); 3886 - let removed$1 = prepend(prev, removed); 3887 - loop$controlled = controlled; 3888 - loop$path = path; 3889 - loop$mapper = mapper; 3890 - loop$events = events; 3891 - loop$old = remaining_old; 3892 - loop$new = remaining_new; 3893 - loop$added = added$1; 3894 - loop$removed = removed$1; 3895 - } 3896 - } else if (next instanceof Event2) { 3897 - let name2 = next.name; 3898 - let handler = next.handler; 3899 - let has_changes = prev.prevent_default !== next.prevent_default || prev.stop_propagation !== next.stop_propagation || prev.immediate !== next.immediate || !limit_equals(prev.limit, next.limit); 3900 - let _block; 3901 - if (has_changes) { 3902 - _block = prepend(next, added); 3903 - } else { 3904 - _block = added; 3905 - } 3906 - let added$1 = _block; 3907 - let events$1 = add_event(events, mapper, path, name2, handler); 3908 - loop$controlled = controlled; 3909 - loop$path = path; 3910 - loop$mapper = mapper; 3911 - loop$events = events$1; 3912 - loop$old = remaining_old; 3913 - loop$new = remaining_new; 3914 - loop$added = added$1; 3915 - loop$removed = removed; 3916 - } else { 3917 - let name2 = prev.name; 3918 - let added$1 = prepend(next, added); 3919 - let removed$1 = prepend(prev, removed); 3920 - let events$1 = remove_event(events, path, name2); 3921 - loop$controlled = controlled; 3922 - loop$path = path; 3923 - loop$mapper = mapper; 3924 - loop$events = events$1; 3925 - loop$old = remaining_old; 3926 - loop$new = remaining_new; 3927 - loop$added = added$1; 3928 - loop$removed = removed$1; 3929 - } 3930 - } else if (next instanceof Event2) { 3931 - let name2 = next.name; 3932 - let handler = next.handler; 3933 - let added$1 = prepend(next, added); 3934 - let events$1 = add_event(events, mapper, path, name2, handler); 3935 - loop$controlled = controlled; 3936 - loop$path = path; 3937 - loop$mapper = mapper; 3938 - loop$events = events$1; 3939 - loop$old = old; 3940 - loop$new = remaining_new; 3941 - loop$added = added$1; 3942 - loop$removed = removed; 3943 - } else { 3944 - let added$1 = prepend(next, added); 3945 - loop$controlled = controlled; 3946 - loop$path = path; 3947 - loop$mapper = mapper; 3948 - loop$events = events; 3949 - loop$old = old; 3950 - loop$new = remaining_new; 3951 - loop$added = added$1; 3952 - loop$removed = removed; 3953 - } 3954 - } 3955 - } 3956 - } 3957 - function do_diff(loop$old, loop$old_keyed, loop$new, loop$new_keyed, loop$moved, loop$moved_offset, loop$removed, loop$node_index, loop$patch_index, loop$path, loop$changes, loop$children, loop$mapper, loop$events) { 3958 - while (true) { 3959 - let old = loop$old; 3960 - let old_keyed = loop$old_keyed; 3961 - let new$6 = loop$new; 3962 - let new_keyed = loop$new_keyed; 3963 - let moved = loop$moved; 3964 - let moved_offset = loop$moved_offset; 3965 - let removed = loop$removed; 3966 - let node_index = loop$node_index; 3967 - let patch_index = loop$patch_index; 3968 - let path = loop$path; 3969 - let changes = loop$changes; 3970 - let children = loop$children; 3971 - let mapper = loop$mapper; 3972 - let events = loop$events; 3973 - if (old instanceof Empty) { 3974 - if (new$6 instanceof Empty) { 3975 - return new Diff(new Patch(patch_index, removed, changes, children), events); 3976 - } else { 3977 - let events$1 = add_children(events, mapper, path, node_index, new$6); 3978 - let insert5 = insert4(new$6, node_index - moved_offset); 3979 - let changes$1 = prepend(insert5, changes); 3980 - return new Diff(new Patch(patch_index, removed, changes$1, children), events$1); 3981 - } 3982 - } else if (new$6 instanceof Empty) { 3983 - let prev = old.head; 3984 - let old$1 = old.tail; 3985 - let _block; 3986 - let $ = prev.key === "" || !contains(moved, prev.key); 3987 - if ($) { 3988 - _block = removed + advance(prev); 3989 - } else { 3990 - _block = removed; 3991 - } 3992 - let removed$1 = _block; 3993 - let events$1 = remove_child(events, path, node_index, prev); 3994 - loop$old = old$1; 3995 - loop$old_keyed = old_keyed; 3996 - loop$new = new$6; 3997 - loop$new_keyed = new_keyed; 3998 - loop$moved = moved; 3999 - loop$moved_offset = moved_offset; 4000 - loop$removed = removed$1; 4001 - loop$node_index = node_index; 4002 - loop$patch_index = patch_index; 4003 - loop$path = path; 4004 - loop$changes = changes; 4005 - loop$children = children; 4006 - loop$mapper = mapper; 4007 - loop$events = events$1; 4008 - } else { 4009 - let prev = old.head; 4010 - let next = new$6.head; 4011 - if (prev.key !== next.key) { 4012 - let old_remaining = old.tail; 4013 - let new_remaining = new$6.tail; 4014 - let next_did_exist = get2(old_keyed, next.key); 4015 - let prev_does_exist = get2(new_keyed, prev.key); 4016 - let prev_has_moved = contains(moved, prev.key); 4017 - if (prev_does_exist instanceof Ok) { 4018 - if (next_did_exist instanceof Ok) { 4019 - if (prev_has_moved) { 4020 - loop$old = old_remaining; 4021 - loop$old_keyed = old_keyed; 4022 - loop$new = new$6; 4023 - loop$new_keyed = new_keyed; 4024 - loop$moved = moved; 4025 - loop$moved_offset = moved_offset - advance(prev); 4026 - loop$removed = removed; 4027 - loop$node_index = node_index; 4028 - loop$patch_index = patch_index; 4029 - loop$path = path; 4030 - loop$changes = changes; 4031 - loop$children = children; 4032 - loop$mapper = mapper; 4033 - loop$events = events; 4034 - } else { 4035 - let match = next_did_exist[0]; 4036 - let count = advance(next); 4037 - let before = node_index - moved_offset; 4038 - let move2 = move(next.key, before, count); 4039 - let changes$1 = prepend(move2, changes); 4040 - let moved$1 = insert2(moved, next.key); 4041 - let moved_offset$1 = moved_offset + count; 4042 - loop$old = prepend(match, old); 4043 - loop$old_keyed = old_keyed; 4044 - loop$new = new$6; 4045 - loop$new_keyed = new_keyed; 4046 - loop$moved = moved$1; 4047 - loop$moved_offset = moved_offset$1; 4048 - loop$removed = removed; 4049 - loop$node_index = node_index; 4050 - loop$patch_index = patch_index; 4051 - loop$path = path; 4052 - loop$changes = changes$1; 4053 - loop$children = children; 4054 - loop$mapper = mapper; 4055 - loop$events = events; 4056 - } 4057 - } else { 4058 - let before = node_index - moved_offset; 4059 - let count = advance(next); 4060 - let events$1 = add_child(events, mapper, path, node_index, next); 4061 - let insert5 = insert4(toList([next]), before); 4062 - let changes$1 = prepend(insert5, changes); 4063 - loop$old = old; 4064 - loop$old_keyed = old_keyed; 4065 - loop$new = new_remaining; 4066 - loop$new_keyed = new_keyed; 4067 - loop$moved = moved; 4068 - loop$moved_offset = moved_offset + count; 4069 - loop$removed = removed; 4070 - loop$node_index = node_index + count; 4071 - loop$patch_index = patch_index; 4072 - loop$path = path; 4073 - loop$changes = changes$1; 4074 - loop$children = children; 4075 - loop$mapper = mapper; 4076 - loop$events = events$1; 4077 - } 4078 - } else if (next_did_exist instanceof Ok) { 4079 - let count = advance(prev); 4080 - let moved_offset$1 = moved_offset - count; 4081 - let events$1 = remove_child(events, path, node_index, prev); 4082 - let remove3 = remove_key(prev.key, count); 4083 - let changes$1 = prepend(remove3, changes); 4084 - loop$old = old_remaining; 4085 - loop$old_keyed = old_keyed; 4086 - loop$new = new$6; 4087 - loop$new_keyed = new_keyed; 4088 - loop$moved = moved; 4089 - loop$moved_offset = moved_offset$1; 4090 - loop$removed = removed; 4091 - loop$node_index = node_index; 4092 - loop$patch_index = patch_index; 4093 - loop$path = path; 4094 - loop$changes = changes$1; 4095 - loop$children = children; 4096 - loop$mapper = mapper; 4097 - loop$events = events$1; 4098 - } else { 4099 - let prev_count = advance(prev); 4100 - let next_count = advance(next); 4101 - let change = replace2(node_index - moved_offset, prev_count, next); 4102 - let _block; 4103 - let _pipe = events; 4104 - let _pipe$1 = remove_child(_pipe, path, node_index, prev); 4105 - _block = add_child(_pipe$1, mapper, path, node_index, next); 4106 - let events$1 = _block; 4107 - loop$old = old_remaining; 4108 - loop$old_keyed = old_keyed; 4109 - loop$new = new_remaining; 4110 - loop$new_keyed = new_keyed; 4111 - loop$moved = moved; 4112 - loop$moved_offset = moved_offset - prev_count + next_count; 4113 - loop$removed = removed; 4114 - loop$node_index = node_index + next_count; 4115 - loop$patch_index = patch_index; 4116 - loop$path = path; 4117 - loop$changes = prepend(change, changes); 4118 - loop$children = children; 4119 - loop$mapper = mapper; 4120 - loop$events = events$1; 4121 - } 4122 - } else { 4123 - let $ = old.head; 4124 - if ($ instanceof Fragment) { 4125 - let $1 = new$6.head; 4126 - if ($1 instanceof Fragment) { 4127 - let prev2 = $; 4128 - let old$1 = old.tail; 4129 - let next2 = $1; 4130 - let new$1 = new$6.tail; 4131 - let node_index$1 = node_index + 1; 4132 - let prev_count = prev2.children_count; 4133 - let next_count = next2.children_count; 4134 - let composed_mapper = compose_mapper(mapper, next2.mapper); 4135 - let child = do_diff(prev2.children, prev2.keyed_children, next2.children, next2.keyed_children, empty_set(), moved_offset, 0, node_index$1, -1, path, empty_list, children, composed_mapper, events); 4136 - let _block; 4137 - let $2 = child.patch.removed > 0; 4138 - if ($2) { 4139 - let remove_from = node_index$1 + next_count - moved_offset; 4140 - let patch = remove2(remove_from, child.patch.removed); 4141 - _block = append(child.patch.changes, prepend(patch, changes)); 4142 - } else { 4143 - _block = append(child.patch.changes, changes); 4144 - } 4145 - let changes$1 = _block; 4146 - loop$old = old$1; 4147 - loop$old_keyed = old_keyed; 4148 - loop$new = new$1; 4149 - loop$new_keyed = new_keyed; 4150 - loop$moved = moved; 4151 - loop$moved_offset = moved_offset + next_count - prev_count; 4152 - loop$removed = removed; 4153 - loop$node_index = node_index$1 + next_count; 4154 - loop$patch_index = patch_index; 4155 - loop$path = path; 4156 - loop$changes = changes$1; 4157 - loop$children = child.patch.children; 4158 - loop$mapper = mapper; 4159 - loop$events = child.events; 4160 - } else { 4161 - let prev2 = $; 4162 - let old_remaining = old.tail; 4163 - let next2 = $1; 4164 - let new_remaining = new$6.tail; 4165 - let prev_count = advance(prev2); 4166 - let next_count = advance(next2); 4167 - let change = replace2(node_index - moved_offset, prev_count, next2); 4168 - let _block; 4169 - let _pipe = events; 4170 - let _pipe$1 = remove_child(_pipe, path, node_index, prev2); 4171 - _block = add_child(_pipe$1, mapper, path, node_index, next2); 4172 - let events$1 = _block; 4173 - loop$old = old_remaining; 4174 - loop$old_keyed = old_keyed; 4175 - loop$new = new_remaining; 4176 - loop$new_keyed = new_keyed; 4177 - loop$moved = moved; 4178 - loop$moved_offset = moved_offset - prev_count + next_count; 4179 - loop$removed = removed; 4180 - loop$node_index = node_index + next_count; 4181 - loop$patch_index = patch_index; 4182 - loop$path = path; 4183 - loop$changes = prepend(change, changes); 4184 - loop$children = children; 4185 - loop$mapper = mapper; 4186 - loop$events = events$1; 4187 - } 4188 - } else if ($ instanceof Element) { 4189 - let $1 = new$6.head; 4190 - if ($1 instanceof Element) { 4191 - let prev2 = $; 4192 - let next2 = $1; 4193 - if (prev2.namespace === next2.namespace && prev2.tag === next2.tag) { 4194 - let old$1 = old.tail; 4195 - let new$1 = new$6.tail; 4196 - let composed_mapper = compose_mapper(mapper, next2.mapper); 4197 - let child_path = add3(path, node_index, next2.key); 4198 - let controlled = is_controlled(events, next2.namespace, next2.tag, child_path); 4199 - let $2 = diff_attributes(controlled, child_path, composed_mapper, events, prev2.attributes, next2.attributes, empty_list, empty_list); 4200 - let added_attrs; 4201 - let removed_attrs; 4202 - let events$1; 4203 - added_attrs = $2.added; 4204 - removed_attrs = $2.removed; 4205 - events$1 = $2.events; 4206 - let _block; 4207 - if (added_attrs instanceof Empty && removed_attrs instanceof Empty) { 4208 - _block = empty_list; 4209 - } else { 4210 - _block = toList([update(added_attrs, removed_attrs)]); 4211 - } 4212 - let initial_child_changes = _block; 4213 - let child = do_diff(prev2.children, prev2.keyed_children, next2.children, next2.keyed_children, empty_set(), 0, 0, 0, node_index, child_path, initial_child_changes, empty_list, composed_mapper, events$1); 4214 - let _block$1; 4215 - let $3 = child.patch; 4216 - let $4 = $3.changes; 4217 - if ($4 instanceof Empty) { 4218 - let $5 = $3.children; 4219 - if ($5 instanceof Empty) { 4220 - let $6 = $3.removed; 4221 - if ($6 === 0) { 4222 - _block$1 = children; 4223 - } else { 4224 - _block$1 = prepend(child.patch, children); 4225 - } 4226 - } else { 4227 - _block$1 = prepend(child.patch, children); 4228 - } 4229 - } else { 4230 - _block$1 = prepend(child.patch, children); 4231 - } 4232 - let children$1 = _block$1; 4233 - loop$old = old$1; 4234 - loop$old_keyed = old_keyed; 4235 - loop$new = new$1; 4236 - loop$new_keyed = new_keyed; 4237 - loop$moved = moved; 4238 - loop$moved_offset = moved_offset; 4239 - loop$removed = removed; 4240 - loop$node_index = node_index + 1; 4241 - loop$patch_index = patch_index; 4242 - loop$path = path; 4243 - loop$changes = changes; 4244 - loop$children = children$1; 4245 - loop$mapper = mapper; 4246 - loop$events = child.events; 4247 - } else { 4248 - let prev3 = $; 4249 - let old_remaining = old.tail; 4250 - let next3 = $1; 4251 - let new_remaining = new$6.tail; 4252 - let prev_count = advance(prev3); 4253 - let next_count = advance(next3); 4254 - let change = replace2(node_index - moved_offset, prev_count, next3); 4255 - let _block; 4256 - let _pipe = events; 4257 - let _pipe$1 = remove_child(_pipe, path, node_index, prev3); 4258 - _block = add_child(_pipe$1, mapper, path, node_index, next3); 4259 - let events$1 = _block; 4260 - loop$old = old_remaining; 4261 - loop$old_keyed = old_keyed; 4262 - loop$new = new_remaining; 4263 - loop$new_keyed = new_keyed; 4264 - loop$moved = moved; 4265 - loop$moved_offset = moved_offset - prev_count + next_count; 4266 - loop$removed = removed; 4267 - loop$node_index = node_index + next_count; 4268 - loop$patch_index = patch_index; 4269 - loop$path = path; 4270 - loop$changes = prepend(change, changes); 4271 - loop$children = children; 4272 - loop$mapper = mapper; 4273 - loop$events = events$1; 4274 - } 4275 - } else { 4276 - let prev2 = $; 4277 - let old_remaining = old.tail; 4278 - let next2 = $1; 4279 - let new_remaining = new$6.tail; 4280 - let prev_count = advance(prev2); 4281 - let next_count = advance(next2); 4282 - let change = replace2(node_index - moved_offset, prev_count, next2); 4283 - let _block; 4284 - let _pipe = events; 4285 - let _pipe$1 = remove_child(_pipe, path, node_index, prev2); 4286 - _block = add_child(_pipe$1, mapper, path, node_index, next2); 4287 - let events$1 = _block; 4288 - loop$old = old_remaining; 4289 - loop$old_keyed = old_keyed; 4290 - loop$new = new_remaining; 4291 - loop$new_keyed = new_keyed; 4292 - loop$moved = moved; 4293 - loop$moved_offset = moved_offset - prev_count + next_count; 4294 - loop$removed = removed; 4295 - loop$node_index = node_index + next_count; 4296 - loop$patch_index = patch_index; 4297 - loop$path = path; 4298 - loop$changes = prepend(change, changes); 4299 - loop$children = children; 4300 - loop$mapper = mapper; 4301 - loop$events = events$1; 4302 - } 4303 - } else if ($ instanceof Text) { 4304 - let $1 = new$6.head; 4305 - if ($1 instanceof Text) { 4306 - let prev2 = $; 4307 - let next2 = $1; 4308 - if (prev2.content === next2.content) { 4309 - let old$1 = old.tail; 4310 - let new$1 = new$6.tail; 4311 - loop$old = old$1; 4312 - loop$old_keyed = old_keyed; 4313 - loop$new = new$1; 4314 - loop$new_keyed = new_keyed; 4315 - loop$moved = moved; 4316 - loop$moved_offset = moved_offset; 4317 - loop$removed = removed; 4318 - loop$node_index = node_index + 1; 4319 - loop$patch_index = patch_index; 4320 - loop$path = path; 4321 - loop$changes = changes; 4322 - loop$children = children; 4323 - loop$mapper = mapper; 4324 - loop$events = events; 4325 - } else { 4326 - let old$1 = old.tail; 4327 - let next3 = $1; 4328 - let new$1 = new$6.tail; 4329 - let child = new$5(node_index, 0, toList([replace_text(next3.content)]), empty_list); 4330 - loop$old = old$1; 4331 - loop$old_keyed = old_keyed; 4332 - loop$new = new$1; 4333 - loop$new_keyed = new_keyed; 4334 - loop$moved = moved; 4335 - loop$moved_offset = moved_offset; 4336 - loop$removed = removed; 4337 - loop$node_index = node_index + 1; 4338 - loop$patch_index = patch_index; 4339 - loop$path = path; 4340 - loop$changes = changes; 4341 - loop$children = prepend(child, children); 4342 - loop$mapper = mapper; 4343 - loop$events = events; 4344 - } 4345 - } else { 4346 - let prev2 = $; 4347 - let old_remaining = old.tail; 4348 - let next2 = $1; 4349 - let new_remaining = new$6.tail; 4350 - let prev_count = advance(prev2); 4351 - let next_count = advance(next2); 4352 - let change = replace2(node_index - moved_offset, prev_count, next2); 4353 - let _block; 4354 - let _pipe = events; 4355 - let _pipe$1 = remove_child(_pipe, path, node_index, prev2); 4356 - _block = add_child(_pipe$1, mapper, path, node_index, next2); 4357 - let events$1 = _block; 4358 - loop$old = old_remaining; 4359 - loop$old_keyed = old_keyed; 4360 - loop$new = new_remaining; 4361 - loop$new_keyed = new_keyed; 4362 - loop$moved = moved; 4363 - loop$moved_offset = moved_offset - prev_count + next_count; 4364 - loop$removed = removed; 4365 - loop$node_index = node_index + next_count; 4366 - loop$patch_index = patch_index; 4367 - loop$path = path; 4368 - loop$changes = prepend(change, changes); 4369 - loop$children = children; 4370 - loop$mapper = mapper; 4371 - loop$events = events$1; 4372 - } 4373 - } else { 4374 - let $1 = new$6.head; 4375 - if ($1 instanceof UnsafeInnerHtml) { 4376 - let prev2 = $; 4377 - let old$1 = old.tail; 4378 - let next2 = $1; 4379 - let new$1 = new$6.tail; 4380 - let composed_mapper = compose_mapper(mapper, next2.mapper); 4381 - let child_path = add3(path, node_index, next2.key); 4382 - let $2 = diff_attributes(false, child_path, composed_mapper, events, prev2.attributes, next2.attributes, empty_list, empty_list); 4383 - let added_attrs; 4384 - let removed_attrs; 4385 - let events$1; 4386 - added_attrs = $2.added; 4387 - removed_attrs = $2.removed; 4388 - events$1 = $2.events; 4389 - let _block; 4390 - if (added_attrs instanceof Empty && removed_attrs instanceof Empty) { 4391 - _block = empty_list; 4392 - } else { 4393 - _block = toList([update(added_attrs, removed_attrs)]); 4394 - } 4395 - let child_changes = _block; 4396 - let _block$1; 4397 - let $3 = prev2.inner_html === next2.inner_html; 4398 - if ($3) { 4399 - _block$1 = child_changes; 4400 - } else { 4401 - _block$1 = prepend(replace_inner_html(next2.inner_html), child_changes); 4402 - } 4403 - let child_changes$1 = _block$1; 4404 - let _block$2; 4405 - if (child_changes$1 instanceof Empty) { 4406 - _block$2 = children; 4407 - } else { 4408 - _block$2 = prepend(new$5(node_index, 0, child_changes$1, toList([])), children); 4409 - } 4410 - let children$1 = _block$2; 4411 - loop$old = old$1; 4412 - loop$old_keyed = old_keyed; 4413 - loop$new = new$1; 4414 - loop$new_keyed = new_keyed; 4415 - loop$moved = moved; 4416 - loop$moved_offset = moved_offset; 4417 - loop$removed = removed; 4418 - loop$node_index = node_index + 1; 4419 - loop$patch_index = patch_index; 4420 - loop$path = path; 4421 - loop$changes = changes; 4422 - loop$children = children$1; 4423 - loop$mapper = mapper; 4424 - loop$events = events$1; 4425 - } else { 4426 - let prev2 = $; 4427 - let old_remaining = old.tail; 4428 - let next2 = $1; 4429 - let new_remaining = new$6.tail; 4430 - let prev_count = advance(prev2); 4431 - let next_count = advance(next2); 4432 - let change = replace2(node_index - moved_offset, prev_count, next2); 4433 - let _block; 4434 - let _pipe = events; 4435 - let _pipe$1 = remove_child(_pipe, path, node_index, prev2); 4436 - _block = add_child(_pipe$1, mapper, path, node_index, next2); 4437 - let events$1 = _block; 4438 - loop$old = old_remaining; 4439 - loop$old_keyed = old_keyed; 4440 - loop$new = new_remaining; 4441 - loop$new_keyed = new_keyed; 4442 - loop$moved = moved; 4443 - loop$moved_offset = moved_offset - prev_count + next_count; 4444 - loop$removed = removed; 4445 - loop$node_index = node_index + next_count; 4446 - loop$patch_index = patch_index; 4447 - loop$path = path; 4448 - loop$changes = prepend(change, changes); 4449 - loop$children = children; 4450 - loop$mapper = mapper; 4451 - loop$events = events$1; 4452 - } 4453 - } 4454 - } 4455 - } 4456 - } 4457 - } 4458 - function diff(events, old, new$6) { 4459 - return do_diff(toList([old]), empty3(), toList([new$6]), empty3(), empty_set(), 0, 0, 0, 0, root2, empty_list, empty_list, identity3, tick(events)); 4460 - } 4461 - 4462 - // build/dev/javascript/lustre/lustre/vdom/reconciler.ffi.mjs 4463 - class Reconciler { 4464 - offset = 0; 4465 - #root = null; 4466 - #dispatch = () => {}; 4467 - #useServerEvents = false; 4468 - constructor(root3, dispatch, { useServerEvents = false } = {}) { 4469 - this.#root = root3; 4470 - this.#dispatch = dispatch; 4471 - this.#useServerEvents = useServerEvents; 4472 - } 4473 - mount(vdom) { 4474 - appendChild(this.#root, this.#createElement(vdom)); 4475 - } 4476 - #stack = []; 4477 - push(patch) { 4478 - const offset = this.offset; 4479 - if (offset) { 4480 - iterate(patch.changes, (change) => { 4481 - switch (change.kind) { 4482 - case insert_kind: 4483 - case move_kind: 4484 - change.before = (change.before | 0) + offset; 4485 - break; 4486 - case remove_kind: 4487 - case replace_kind: 4488 - change.from = (change.from | 0) + offset; 4489 - break; 4490 - } 4491 - }); 4492 - iterate(patch.children, (child) => { 4493 - child.index = (child.index | 0) + offset; 4494 - }); 4495 - } 4496 - this.#stack.push({ node: this.#root, patch }); 4497 - this.#reconcile(); 4498 - } 4499 - #reconcile() { 4500 - const self = this; 4501 - while (self.#stack.length) { 4502 - const { node, patch } = self.#stack.pop(); 4503 - iterate(patch.changes, (change) => { 4504 - switch (change.kind) { 4505 - case insert_kind: 4506 - self.#insert(node, change.children, change.before); 4507 - break; 4508 - case move_kind: 4509 - self.#move(node, change.key, change.before, change.count); 4510 - break; 4511 - case remove_key_kind: 4512 - self.#removeKey(node, change.key, change.count); 4513 - break; 4514 - case remove_kind: 4515 - self.#remove(node, change.from, change.count); 4516 - break; 4517 - case replace_kind: 4518 - self.#replace(node, change.from, change.count, change.with); 4519 - break; 4520 - case replace_text_kind: 4521 - self.#replaceText(node, change.content); 4522 - break; 4523 - case replace_inner_html_kind: 4524 - self.#replaceInnerHtml(node, change.inner_html); 4525 - break; 4526 - case update_kind: 4527 - self.#update(node, change.added, change.removed); 4528 - break; 4529 - } 4530 - }); 4531 - if (patch.removed) { 4532 - self.#remove(node, node.childNodes.length - patch.removed, patch.removed); 4533 - } 4534 - iterate(patch.children, (child) => { 4535 - self.#stack.push({ node: childAt(node, child.index), patch: child }); 4536 - }); 4537 - } 4538 - } 4539 - #insert(node, children, before) { 4540 - const fragment2 = createDocumentFragment(); 4541 - iterate(children, (child) => { 4542 - const el = this.#createElement(child); 4543 - addKeyedChild(node, el); 4544 - appendChild(fragment2, el); 4545 - }); 4546 - insertBefore(node, fragment2, childAt(node, before)); 4547 - } 4548 - #move(node, key, before, count) { 4549 - let el = getKeyedChild(node, key); 4550 - const beforeEl = childAt(node, before); 4551 - for (let i = 0;i < count && el !== null; ++i) { 4552 - const next = el.nextSibling; 4553 - if (SUPPORTS_MOVE_BEFORE) { 4554 - node.moveBefore(el, beforeEl); 4555 - } else { 4556 - insertBefore(node, el, beforeEl); 4557 - } 4558 - el = next; 4559 - } 4560 - } 4561 - #removeKey(node, key, count) { 4562 - this.#removeFromChild(node, getKeyedChild(node, key), count); 4563 - } 4564 - #remove(node, from2, count) { 4565 - this.#removeFromChild(node, childAt(node, from2), count); 4566 - } 4567 - #removeFromChild(parent, child, count) { 4568 - while (count-- > 0 && child !== null) { 4569 - const next = child.nextSibling; 4570 - const key = child[meta].key; 4571 - if (key) { 4572 - parent[meta].keyedChildren.delete(key); 4573 - } 4574 - for (const [_, { timeout }] of child[meta].debouncers) { 4575 - clearTimeout(timeout); 4576 - } 4577 - parent.removeChild(child); 4578 - child = next; 4579 - } 4580 - } 4581 - #replace(parent, from2, count, child) { 4582 - this.#remove(parent, from2, count); 4583 - const el = this.#createElement(child); 4584 - addKeyedChild(parent, el); 4585 - insertBefore(parent, el, childAt(parent, from2)); 4586 - } 4587 - #replaceText(node, content) { 4588 - node.data = content ?? ""; 4589 - } 4590 - #replaceInnerHtml(node, inner_html) { 4591 - node.innerHTML = inner_html ?? ""; 4592 - } 4593 - #update(node, added, removed) { 4594 - iterate(removed, (attribute3) => { 4595 - const name2 = attribute3.name; 4596 - if (node[meta].handlers.has(name2)) { 4597 - node.removeEventListener(name2, handleEvent); 4598 - node[meta].handlers.delete(name2); 4599 - if (node[meta].throttles.has(name2)) { 4600 - node[meta].throttles.delete(name2); 4601 - } 4602 - if (node[meta].debouncers.has(name2)) { 4603 - clearTimeout(node[meta].debouncers.get(name2).timeout); 4604 - node[meta].debouncers.delete(name2); 4605 - } 4606 - } else { 4607 - node.removeAttribute(name2); 4608 - ATTRIBUTE_HOOKS[name2]?.removed?.(node, name2); 4609 - } 4610 - }); 4611 - iterate(added, (attribute3) => { 4612 - this.#createAttribute(node, attribute3); 4613 - }); 4614 - } 4615 - #createElement(vnode) { 4616 - switch (vnode.kind) { 4617 - case element_kind: { 4618 - const node = createElement(vnode); 4619 - this.#createAttributes(node, vnode); 4620 - this.#insert(node, vnode.children, 0); 4621 - return node; 4622 - } 4623 - case text_kind: { 4624 - const node = createTextNode(vnode.content); 4625 - initialiseMetadata(node, vnode.key); 4626 - return node; 4627 - } 4628 - case fragment_kind: { 4629 - const node = createDocumentFragment(); 4630 - const head = createTextNode(); 4631 - initialiseMetadata(head, vnode.key); 4632 - appendChild(node, head); 4633 - iterate(vnode.children, (child) => { 4634 - appendChild(node, this.#createElement(child)); 4635 - }); 4636 - return node; 4637 - } 4638 - case unsafe_inner_html_kind: { 4639 - const node = createElement(vnode); 4640 - this.#createAttributes(node, vnode); 4641 - this.#replaceInnerHtml(node, vnode.inner_html); 4642 - return node; 4643 - } 4644 - } 4645 - } 4646 - #createAttributes(node, { attributes }) { 4647 - iterate(attributes, (attribute3) => this.#createAttribute(node, attribute3)); 4648 - } 4649 - #createAttribute(node, attribute3) { 4650 - const nodeMeta = node[meta]; 4651 - switch (attribute3.kind) { 4652 - case attribute_kind: { 4653 - const name2 = attribute3.name; 4654 - const value2 = attribute3.value ?? ""; 4655 - if (value2 !== node.getAttribute(name2)) { 4656 - node.setAttribute(name2, value2); 4657 - } 4658 - ATTRIBUTE_HOOKS[name2]?.added?.(node, value2); 4659 - break; 4660 - } 4661 - case property_kind: 4662 - node[attribute3.name] = attribute3.value; 4663 - break; 4664 - case event_kind: { 4665 - if (!nodeMeta.handlers.has(attribute3.name)) { 4666 - node.addEventListener(attribute3.name, handleEvent, { 4667 - passive: !attribute3.prevent_default 4668 - }); 4669 - } 4670 - const prevent = attribute3.prevent_default; 4671 - const stop = attribute3.stop_propagation; 4672 - const immediate2 = attribute3.immediate; 4673 - const include = Array.isArray(attribute3.include) ? attribute3.include : []; 4674 - if (attribute3.limit?.kind === throttle_kind) { 4675 - const throttle = nodeMeta.throttles.get(attribute3.name) ?? { 4676 - last: 0, 4677 - delay: attribute3.limit.delay 4678 - }; 4679 - nodeMeta.throttles.set(attribute3.name, throttle); 4680 - } 4681 - if (attribute3.limit?.kind === debounce_kind) { 4682 - const debounce = nodeMeta.debouncers.get(attribute3.name) ?? { 4683 - timeout: null, 4684 - delay: attribute3.limit.delay 4685 - }; 4686 - nodeMeta.debouncers.set(attribute3.name, debounce); 4687 - } 4688 - nodeMeta.handlers.set(attribute3.name, (event3) => { 4689 - if (prevent) 4690 - event3.preventDefault(); 4691 - if (stop) 4692 - event3.stopPropagation(); 4693 - const type = event3.type; 4694 - let path = ""; 4695 - let pathNode = event3.currentTarget; 4696 - while (pathNode !== this.#root) { 4697 - const key = pathNode[meta].key; 4698 - const parent = pathNode.parentNode; 4699 - if (key) { 4700 - path = `${separator_key}${key}${path}`; 4701 - } else { 4702 - const siblings = parent.childNodes; 4703 - let index4 = [].indexOf.call(siblings, pathNode); 4704 - if (parent === this.#root) { 4705 - index4 -= this.offset; 4706 - } 4707 - path = `${separator_index}${index4}${path}`; 4708 - } 4709 - pathNode = parent; 4710 - } 4711 - path = path.slice(1); 4712 - const data = this.#useServerEvents ? createServerEvent(event3, include) : event3; 4713 - if (nodeMeta.throttles.has(type)) { 4714 - const throttle = nodeMeta.throttles.get(type); 4715 - const now = Date.now(); 4716 - const last = throttle.last || 0; 4717 - if (now > last + throttle.delay) { 4718 - throttle.last = now; 4719 - this.#dispatch(data, path, type, immediate2); 4720 - } else { 4721 - event3.preventDefault(); 4722 - } 4723 - } else if (nodeMeta.debouncers.has(type)) { 4724 - const debounce = nodeMeta.debouncers.get(type); 4725 - clearTimeout(debounce.timeout); 4726 - debounce.timeout = setTimeout(() => { 4727 - this.#dispatch(data, path, type, immediate2); 4728 - }, debounce.delay); 4729 - } else { 4730 - this.#dispatch(data, path, type, immediate2); 4731 - } 4732 - }); 4733 - break; 4734 - } 4735 - } 4736 - } 4737 - } 4738 - var iterate = (list4, callback) => { 4739 - if (Array.isArray(list4)) { 4740 - for (let i = 0;i < list4.length; i++) { 4741 - callback(list4[i]); 4742 - } 4743 - } else if (list4) { 4744 - for (list4;list4.tail; list4 = list4.tail) { 4745 - callback(list4.head); 4746 - } 4747 - } 4748 - }; 4749 - var appendChild = (node, child) => node.appendChild(child); 4750 - var insertBefore = (parent, node, referenceNode) => parent.insertBefore(node, referenceNode ?? null); 4751 - var createElement = ({ key, tag, namespace }) => { 4752 - const node = document2.createElementNS(namespace || NAMESPACE_HTML, tag); 4753 - initialiseMetadata(node, key); 4754 - return node; 4755 - }; 4756 - var createTextNode = (text2) => document2.createTextNode(text2 ?? ""); 4757 - var createDocumentFragment = () => document2.createDocumentFragment(); 4758 - var childAt = (node, at) => node.childNodes[at | 0]; 4759 - var meta = Symbol("lustre"); 4760 - var initialiseMetadata = (node, key = "") => { 4761 - switch (node.nodeType) { 4762 - case ELEMENT_NODE: 4763 - case DOCUMENT_FRAGMENT_NODE: 4764 - node[meta] = { 4765 - key, 4766 - keyedChildren: new Map, 4767 - handlers: new Map, 4768 - throttles: new Map, 4769 - debouncers: new Map 4770 - }; 4771 - break; 4772 - case TEXT_NODE: 4773 - node[meta] = { key, debouncers: new Map }; 4774 - break; 4775 - } 4776 - }; 4777 - var addKeyedChild = (node, child) => { 4778 - if (child.nodeType === DOCUMENT_FRAGMENT_NODE) { 4779 - for (child = child.firstChild;child; child = child.nextSibling) { 4780 - addKeyedChild(node, child); 4781 - } 4782 - return; 4783 - } 4784 - const key = child[meta].key; 4785 - if (key) { 4786 - node[meta].keyedChildren.set(key, new WeakRef(child)); 4787 - } 4788 - }; 4789 - var getKeyedChild = (node, key) => node[meta].keyedChildren.get(key).deref(); 4790 - var handleEvent = (event3) => { 4791 - const target2 = event3.currentTarget; 4792 - const handler = target2[meta].handlers.get(event3.type); 4793 - if (event3.type === "submit") { 4794 - event3.detail ??= {}; 4795 - event3.detail.formData = [...new FormData(event3.target).entries()]; 4796 - } 4797 - handler(event3); 4798 - }; 4799 - var createServerEvent = (event3, include = []) => { 4800 - const data = {}; 4801 - if (event3.type === "input" || event3.type === "change") { 4802 - include.push("target.value"); 4803 - } 4804 - if (event3.type === "submit") { 4805 - include.push("detail.formData"); 4806 - } 4807 - for (const property3 of include) { 4808 - const path = property3.split("."); 4809 - for (let i = 0, input = event3, output = data;i < path.length; i++) { 4810 - if (i === path.length - 1) { 4811 - output[path[i]] = input[path[i]]; 4812 - break; 4813 - } 4814 - output = output[path[i]] ??= {}; 4815 - input = input[path[i]]; 4816 - } 4817 - } 4818 - return data; 4819 - }; 4820 - var syncedBooleanAttribute = (name2) => { 4821 - return { 4822 - added(node) { 4823 - node[name2] = true; 4824 - }, 4825 - removed(node) { 4826 - node[name2] = false; 4827 - } 4828 - }; 4829 - }; 4830 - var syncedAttribute = (name2) => { 4831 - return { 4832 - added(node, value2) { 4833 - node[name2] = value2; 4834 - } 4835 - }; 4836 - }; 4837 - var ATTRIBUTE_HOOKS = { 4838 - checked: syncedBooleanAttribute("checked"), 4839 - selected: syncedBooleanAttribute("selected"), 4840 - value: syncedAttribute("value"), 4841 - autofocus: { 4842 - added(node) { 4843 - queueMicrotask(() => node.focus?.()); 4844 - } 4845 - }, 4846 - autoplay: { 4847 - added(node) { 4848 - try { 4849 - node.play?.(); 4850 - } catch (e) { 4851 - console.error(e); 4852 - } 4853 - } 4854 - } 4855 - }; 4856 - 4857 - // build/dev/javascript/lustre/lustre/vdom/virtualise.ffi.mjs 4858 - var virtualise = (root3) => { 4859 - const vdom = virtualise_node(root3); 4860 - if (vdom === null || vdom.children instanceof Empty) { 4861 - const empty4 = empty_text_node(); 4862 - initialiseMetadata(empty4); 4863 - root3.appendChild(empty4); 4864 - return none3(); 4865 - } else if (vdom.children instanceof NonEmpty && vdom.children.tail instanceof Empty) { 4866 - return vdom.children.head; 4867 - } else { 4868 - const head = empty_text_node(); 4869 - initialiseMetadata(head); 4870 - root3.insertBefore(head, root3.firstChild); 4871 - return fragment2(vdom.children); 4872 - } 4873 - }; 4874 - var empty_text_node = () => { 4875 - return document2.createTextNode(""); 4876 - }; 4877 - var virtualise_node = (node) => { 4878 - switch (node.nodeType) { 4879 - case ELEMENT_NODE: { 4880 - const key = node.getAttribute("data-lustre-key"); 4881 - initialiseMetadata(node, key); 4882 - if (key) { 4883 - node.removeAttribute("data-lustre-key"); 4884 - } 4885 - const tag = node.localName; 4886 - const namespace = node.namespaceURI; 4887 - const isHtmlElement = !namespace || namespace === NAMESPACE_HTML; 4888 - if (isHtmlElement && input_elements.includes(tag)) { 4889 - virtualise_input_events(tag, node); 4890 - } 4891 - const attributes = virtualise_attributes(node); 4892 - const children = virtualise_child_nodes(node); 4893 - const vnode = isHtmlElement ? element2(tag, attributes, children) : namespaced(namespace, tag, attributes, children); 4894 - return key ? to_keyed(key, vnode) : vnode; 4895 - } 4896 - case TEXT_NODE: 4897 - initialiseMetadata(node); 4898 - return text2(node.data); 4899 - case DOCUMENT_FRAGMENT_NODE: 4900 - initialiseMetadata(node); 4901 - return node.childNodes.length > 0 ? fragment2(virtualise_child_nodes(node)) : null; 4902 - default: 4903 - return null; 4904 - } 4905 - }; 4906 - var input_elements = ["input", "select", "textarea"]; 4907 - var virtualise_input_events = (tag, node) => { 4908 - const value2 = node.value; 4909 - const checked2 = node.checked; 4910 - if (tag === "input" && node.type === "checkbox" && !checked2) 4911 - return; 4912 - if (tag === "input" && node.type === "radio" && !checked2) 4913 - return; 4914 - if (node.type !== "checkbox" && node.type !== "radio" && !value2) 4915 - return; 4916 - queueMicrotask(() => { 4917 - node.value = value2; 4918 - node.checked = checked2; 4919 - node.dispatchEvent(new Event("input", { bubbles: true })); 4920 - node.dispatchEvent(new Event("change", { bubbles: true })); 4921 - if (document2.activeElement !== node) { 4922 - node.dispatchEvent(new Event("blur", { bubbles: true })); 4923 - } 4924 - }); 4925 - }; 4926 - var virtualise_child_nodes = (node) => { 4927 - let children = empty_list; 4928 - let child = node.lastChild; 4929 - while (child) { 4930 - const vnode = virtualise_node(child); 4931 - const next = child.previousSibling; 4932 - if (vnode) { 4933 - children = new NonEmpty(vnode, children); 4934 - } else { 4935 - node.removeChild(child); 4936 - } 4937 - child = next; 4938 - } 4939 - return children; 4940 - }; 4941 - var virtualise_attributes = (node) => { 4942 - let index4 = node.attributes.length; 4943 - let attributes = empty_list; 4944 - while (index4-- > 0) { 4945 - attributes = new NonEmpty(virtualise_attribute(node.attributes[index4]), attributes); 4946 - } 4947 - return attributes; 4948 - }; 4949 - var virtualise_attribute = (attr) => { 4950 - const name2 = attr.localName; 4951 - const value2 = attr.value; 4952 - return attribute2(name2, value2); 4953 - }; 4954 - 4955 - // build/dev/javascript/lustre/lustre/runtime/client/runtime.ffi.mjs 4956 - var is_browser = () => !!document2; 4957 - var is_reference_equal = (a, b) => a === b; 4958 - class Runtime { 4959 - constructor(root3, [model, effects], view, update2) { 4960 - this.root = root3; 4961 - this.#model = model; 4962 - this.#view = view; 4963 - this.#update = update2; 4964 - this.#reconciler = new Reconciler(this.root, (event3, path, name2) => { 4965 - const [events, msg] = handle(this.#events, path, name2, event3); 4966 - this.#events = events; 4967 - if (msg.isOk()) { 4968 - this.dispatch(msg[0], false); 4969 - } 4970 - }); 4971 - this.#vdom = virtualise(this.root); 4972 - this.#events = new$6(); 4973 - this.#shouldFlush = true; 4974 - this.#tick(effects); 4975 - } 4976 - root = null; 4977 - set offset(offset) { 4978 - this.#reconciler.offset = offset; 4979 - } 4980 - dispatch(msg, immediate2 = false) { 4981 - this.#shouldFlush ||= immediate2; 4982 - if (this.#shouldQueue) { 4983 - this.#queue.push(msg); 4984 - } else { 4985 - const [model, effects] = this.#update(this.#model, msg); 4986 - this.#model = model; 4987 - this.#tick(effects); 4988 - } 4989 - } 4990 - emit(event3, data) { 4991 - const target2 = this.root.host ?? this.root; 4992 - target2.dispatchEvent(new CustomEvent(event3, { 4993 - detail: data, 4994 - bubbles: true, 4995 - composed: true 4996 - })); 4997 - } 4998 - #model; 4999 - #view; 5000 - #update; 5001 - #vdom; 5002 - #events; 5003 - #reconciler; 5004 - #shouldQueue = false; 5005 - #queue = []; 5006 - #beforePaint = empty_list; 5007 - #afterPaint = empty_list; 5008 - #renderTimer = null; 5009 - #shouldFlush = false; 5010 - #actions = { 5011 - dispatch: (msg, immediate2) => this.dispatch(msg, immediate2), 5012 - emit: (event3, data) => this.emit(event3, data), 5013 - select: () => {}, 5014 - root: () => this.root 5015 - }; 5016 - #tick(effects) { 5017 - this.#shouldQueue = true; 5018 - while (true) { 5019 - for (let list4 = effects.synchronous;list4.tail; list4 = list4.tail) { 5020 - list4.head(this.#actions); 5021 - } 5022 - this.#beforePaint = listAppend(this.#beforePaint, effects.before_paint); 5023 - this.#afterPaint = listAppend(this.#afterPaint, effects.after_paint); 5024 - if (!this.#queue.length) 5025 - break; 5026 - [this.#model, effects] = this.#update(this.#model, this.#queue.shift()); 5027 - } 5028 - this.#shouldQueue = false; 5029 - if (this.#shouldFlush) { 5030 - cancelAnimationFrame(this.#renderTimer); 5031 - this.#render(); 5032 - } else if (!this.#renderTimer) { 5033 - this.#renderTimer = requestAnimationFrame(() => { 5034 - this.#render(); 5035 - }); 5036 - } 5037 - } 5038 - #render() { 5039 - this.#shouldFlush = false; 5040 - this.#renderTimer = null; 5041 - const next = this.#view(this.#model); 5042 - const { patch, events } = diff(this.#events, this.#vdom, next); 5043 - this.#events = events; 5044 - this.#vdom = next; 5045 - this.#reconciler.push(patch); 5046 - if (this.#beforePaint instanceof NonEmpty) { 5047 - const effects = makeEffect(this.#beforePaint); 5048 - this.#beforePaint = empty_list; 5049 - queueMicrotask(() => { 5050 - this.#shouldFlush = true; 5051 - this.#tick(effects); 5052 - }); 5053 - } 5054 - if (this.#afterPaint instanceof NonEmpty) { 5055 - const effects = makeEffect(this.#afterPaint); 5056 - this.#afterPaint = empty_list; 5057 - requestAnimationFrame(() => { 5058 - this.#shouldFlush = true; 5059 - this.#tick(effects); 5060 - }); 5061 - } 5062 - } 5063 - } 5064 - function makeEffect(synchronous) { 5065 - return { 5066 - synchronous, 5067 - after_paint: empty_list, 5068 - before_paint: empty_list 5069 - }; 5070 - } 5071 - function listAppend(a, b) { 5072 - if (a instanceof Empty) { 5073 - return b; 5074 - } else if (b instanceof Empty) { 5075 - return a; 5076 - } else { 5077 - return append(a, b); 5078 - } 5079 - } 5080 - var copiedStyleSheets = new WeakMap; 5081 - 5082 - // build/dev/javascript/lustre/lustre/vdom/events.mjs 5083 - class Events extends CustomType { 5084 - constructor(handlers, dispatched_paths, next_dispatched_paths) { 5085 - super(); 5086 - this.handlers = handlers; 5087 - this.dispatched_paths = dispatched_paths; 5088 - this.next_dispatched_paths = next_dispatched_paths; 5089 - } 5090 - } 5091 - function new$6() { 5092 - return new Events(empty3(), empty_list, empty_list); 5093 - } 5094 - function tick(events) { 5095 - return new Events(events.handlers, events.next_dispatched_paths, empty_list); 5096 - } 5097 - function do_remove_event(handlers, path, name2) { 5098 - return remove(handlers, event2(path, name2)); 5099 - } 5100 - function remove_event(events, path, name2) { 5101 - let handlers = do_remove_event(events.handlers, path, name2); 5102 - return new Events(handlers, events.dispatched_paths, events.next_dispatched_paths); 5103 - } 5104 - function remove_attributes(handlers, path, attributes) { 5105 - return fold2(attributes, handlers, (events, attribute3) => { 5106 - if (attribute3 instanceof Event2) { 5107 - let name2 = attribute3.name; 5108 - return do_remove_event(events, path, name2); 5109 - } else { 5110 - return events; 5111 - } 5112 - }); 5113 - } 5114 - function handle(events, path, name2, event3) { 5115 - let next_dispatched_paths = prepend(path, events.next_dispatched_paths); 5116 - let events$1 = new Events(events.handlers, events.dispatched_paths, next_dispatched_paths); 5117 - let $ = get2(events$1.handlers, path + separator_event + name2); 5118 - if ($ instanceof Ok) { 5119 - let handler = $[0]; 5120 - return [events$1, run(event3, handler)]; 5121 - } else { 5122 - return [events$1, new Error(toList([]))]; 5123 - } 5124 - } 5125 - function has_dispatched_events(events, path) { 5126 - return matches(path, events.dispatched_paths); 5127 - } 5128 - function do_add_event(handlers, mapper, path, name2, handler) { 5129 - return insert3(handlers, event2(path, name2), map4(handler, identity3(mapper))); 5130 - } 5131 - function add_event(events, mapper, path, name2, handler) { 5132 - let handlers = do_add_event(events.handlers, mapper, path, name2, handler); 5133 - return new Events(handlers, events.dispatched_paths, events.next_dispatched_paths); 5134 - } 5135 - function add_attributes(handlers, mapper, path, attributes) { 5136 - return fold2(attributes, handlers, (events, attribute3) => { 5137 - if (attribute3 instanceof Event2) { 5138 - let name2 = attribute3.name; 5139 - let handler = attribute3.handler; 5140 - return do_add_event(events, mapper, path, name2, handler); 5141 - } else { 5142 - return events; 5143 - } 5144 - }); 5145 - } 5146 - function compose_mapper(mapper, child_mapper) { 5147 - let $ = is_reference_equal(mapper, identity3); 5148 - let $1 = is_reference_equal(child_mapper, identity3); 5149 - if ($1) { 5150 - return mapper; 5151 - } else if ($) { 5152 - return child_mapper; 5153 - } else { 5154 - return (msg) => { 5155 - return mapper(child_mapper(msg)); 5156 - }; 5157 - } 5158 - } 5159 - function do_remove_children(loop$handlers, loop$path, loop$child_index, loop$children) { 5160 - while (true) { 5161 - let handlers = loop$handlers; 5162 - let path = loop$path; 5163 - let child_index = loop$child_index; 5164 - let children = loop$children; 5165 - if (children instanceof Empty) { 5166 - return handlers; 5167 - } else { 5168 - let child = children.head; 5169 - let rest2 = children.tail; 5170 - let _pipe = handlers; 5171 - let _pipe$1 = do_remove_child(_pipe, path, child_index, child); 5172 - loop$handlers = _pipe$1; 5173 - loop$path = path; 5174 - loop$child_index = child_index + advance(child); 5175 - loop$children = rest2; 5176 - } 5177 - } 5178 - } 5179 - function do_remove_child(handlers, parent, child_index, child) { 5180 - if (child instanceof Fragment) { 5181 - let children = child.children; 5182 - return do_remove_children(handlers, parent, child_index + 1, children); 5183 - } else if (child instanceof Element) { 5184 - let attributes = child.attributes; 5185 - let children = child.children; 5186 - let path = add3(parent, child_index, child.key); 5187 - let _pipe = handlers; 5188 - let _pipe$1 = remove_attributes(_pipe, path, attributes); 5189 - return do_remove_children(_pipe$1, path, 0, children); 5190 - } else if (child instanceof Text) { 5191 - return handlers; 5192 - } else { 5193 - let attributes = child.attributes; 5194 - let path = add3(parent, child_index, child.key); 5195 - return remove_attributes(handlers, path, attributes); 5196 - } 5197 - } 5198 - function remove_child(events, parent, child_index, child) { 5199 - let handlers = do_remove_child(events.handlers, parent, child_index, child); 5200 - return new Events(handlers, events.dispatched_paths, events.next_dispatched_paths); 5201 - } 5202 - function do_add_children(loop$handlers, loop$mapper, loop$path, loop$child_index, loop$children) { 5203 - while (true) { 5204 - let handlers = loop$handlers; 5205 - let mapper = loop$mapper; 5206 - let path = loop$path; 5207 - let child_index = loop$child_index; 5208 - let children = loop$children; 5209 - if (children instanceof Empty) { 5210 - return handlers; 5211 - } else { 5212 - let child = children.head; 5213 - let rest2 = children.tail; 5214 - let _pipe = handlers; 5215 - let _pipe$1 = do_add_child(_pipe, mapper, path, child_index, child); 5216 - loop$handlers = _pipe$1; 5217 - loop$mapper = mapper; 5218 - loop$path = path; 5219 - loop$child_index = child_index + advance(child); 5220 - loop$children = rest2; 5221 - } 5222 - } 5223 - } 5224 - function do_add_child(handlers, mapper, parent, child_index, child) { 5225 - if (child instanceof Fragment) { 5226 - let children = child.children; 5227 - let composed_mapper = compose_mapper(mapper, child.mapper); 5228 - let child_index$1 = child_index + 1; 5229 - return do_add_children(handlers, composed_mapper, parent, child_index$1, children); 5230 - } else if (child instanceof Element) { 5231 - let attributes = child.attributes; 5232 - let children = child.children; 5233 - let path = add3(parent, child_index, child.key); 5234 - let composed_mapper = compose_mapper(mapper, child.mapper); 5235 - let _pipe = handlers; 5236 - let _pipe$1 = add_attributes(_pipe, composed_mapper, path, attributes); 5237 - return do_add_children(_pipe$1, composed_mapper, path, 0, children); 5238 - } else if (child instanceof Text) { 5239 - return handlers; 5240 - } else { 5241 - let attributes = child.attributes; 5242 - let path = add3(parent, child_index, child.key); 5243 - let composed_mapper = compose_mapper(mapper, child.mapper); 5244 - return add_attributes(handlers, composed_mapper, path, attributes); 5245 - } 5246 - } 5247 - function add_child(events, mapper, parent, index4, child) { 5248 - let handlers = do_add_child(events.handlers, mapper, parent, index4, child); 5249 - return new Events(handlers, events.dispatched_paths, events.next_dispatched_paths); 5250 - } 5251 - function from_node(root3) { 5252 - return add_child(new$6(), identity3, root2, 0, root3); 5253 - } 5254 - function add_children(events, mapper, path, child_index, children) { 5255 - let handlers = do_add_children(events.handlers, mapper, path, child_index, children); 5256 - return new Events(handlers, events.dispatched_paths, events.next_dispatched_paths); 5257 - } 5258 - 5259 - // build/dev/javascript/lustre/lustre/element.mjs 5260 - function element2(tag, attributes, children) { 5261 - return element("", identity3, "", tag, attributes, children, empty3(), false, false); 5262 - } 5263 - function namespaced(namespace, tag, attributes, children) { 5264 - return element("", identity3, namespace, tag, attributes, children, empty3(), false, false); 5265 - } 5266 - function text2(content) { 5267 - return text("", identity3, content); 5268 - } 5269 - function none3() { 5270 - return text("", identity3, ""); 5271 - } 5272 - function count_fragment_children(loop$children, loop$count) { 5273 - while (true) { 5274 - let children = loop$children; 5275 - let count = loop$count; 5276 - if (children instanceof Empty) { 5277 - return count; 5278 - } else { 5279 - let $ = children.head; 5280 - if ($ instanceof Fragment) { 5281 - let rest2 = children.tail; 5282 - let children_count = $.children_count; 5283 - loop$children = rest2; 5284 - loop$count = count + children_count; 5285 - } else { 5286 - let rest2 = children.tail; 5287 - loop$children = rest2; 5288 - loop$count = count + 1; 5289 - } 5290 - } 5291 - } 5292 - } 5293 - function fragment2(children) { 5294 - return fragment("", identity3, children, empty3(), count_fragment_children(children, 0)); 5295 - } 5296 - 5297 - // build/dev/javascript/lustre/lustre/element/html.mjs 5298 - function text3(content) { 5299 - return text2(content); 5300 - } 5301 - function footer(attrs, children) { 5302 - return element2("footer", attrs, children); 5303 - } 5304 - function h1(attrs, children) { 5305 - return element2("h1", attrs, children); 5306 - } 5307 - function h3(attrs, children) { 5308 - return element2("h3", attrs, children); 5309 - } 5310 - function h4(attrs, children) { 5311 - return element2("h4", attrs, children); 5312 - } 5313 - function h5(attrs, children) { 5314 - return element2("h5", attrs, children); 5315 - } 5316 - function main(attrs, children) { 5317 - return element2("main", attrs, children); 5318 - } 5319 - function section(attrs, children) { 5320 - return element2("section", attrs, children); 5321 - } 5322 - function div(attrs, children) { 5323 - return element2("div", attrs, children); 5324 - } 5325 - function li(attrs, children) { 5326 - return element2("li", attrs, children); 5327 - } 5328 - function p(attrs, children) { 5329 - return element2("p", attrs, children); 5330 - } 5331 - function ul(attrs, children) { 5332 - return element2("ul", attrs, children); 5333 - } 5334 - function a(attrs, children) { 5335 - return element2("a", attrs, children); 5336 - } 5337 - function small(attrs, children) { 5338 - return element2("small", attrs, children); 5339 - } 5340 - function span(attrs, children) { 5341 - return element2("span", attrs, children); 5342 - } 5343 - function img(attrs) { 5344 - return element2("img", attrs, empty_list); 5345 - } 5346 - function button(attrs, children) { 5347 - return element2("button", attrs, children); 5348 - } 5349 - function fieldset(attrs, children) { 5350 - return element2("fieldset", attrs, children); 5351 - } 5352 - function form(attrs, children) { 5353 - return element2("form", attrs, children); 5354 - } 5355 - function input(attrs) { 5356 - return element2("input", attrs, empty_list); 5357 - } 5358 - function label(attrs, children) { 5359 - return element2("label", attrs, children); 5360 - } 5361 - 5362 - // build/dev/javascript/lustre/lustre/runtime/transport.mjs 5363 - class Mount extends CustomType { 5364 - constructor(kind, open_shadow_root, will_adopt_styles, observed_attributes, observed_properties, vdom) { 5365 - super(); 5366 - this.kind = kind; 5367 - this.open_shadow_root = open_shadow_root; 5368 - this.will_adopt_styles = will_adopt_styles; 5369 - this.observed_attributes = observed_attributes; 5370 - this.observed_properties = observed_properties; 5371 - this.vdom = vdom; 5372 - } 5373 - } 5374 - class Reconcile extends CustomType { 5375 - constructor(kind, patch) { 5376 - super(); 5377 - this.kind = kind; 5378 - this.patch = patch; 5379 - } 5380 - } 5381 - class Emit extends CustomType { 5382 - constructor(kind, name2, data) { 5383 - super(); 5384 - this.kind = kind; 5385 - this.name = name2; 5386 - this.data = data; 5387 - } 5388 - } 5389 - class AttributeChanged extends CustomType { 5390 - constructor(kind, name2, value2) { 5391 - super(); 5392 - this.kind = kind; 5393 - this.name = name2; 5394 - this.value = value2; 5395 - } 5396 - } 5397 - class EventFired extends CustomType { 5398 - constructor(kind, path, name2, event3) { 5399 - super(); 5400 - this.kind = kind; 5401 - this.path = path; 5402 - this.name = name2; 5403 - this.event = event3; 5404 - } 5405 - } 5406 - 5407 - // build/dev/javascript/lustre/lustre/runtime/server/runtime.mjs 5408 - class ClientDispatchedMessage extends CustomType { 5409 - constructor(message) { 5410 - super(); 5411 - this.message = message; 5412 - } 5413 - } 5414 - class ClientRegisteredCallback extends CustomType { 5415 - constructor(callback) { 5416 - super(); 5417 - this.callback = callback; 5418 - } 5419 - } 5420 - class ClientDeregisteredCallback extends CustomType { 5421 - constructor(callback) { 5422 - super(); 5423 - this.callback = callback; 5424 - } 5425 - } 5426 - class EffectDispatchedMessage extends CustomType { 5427 - constructor(message) { 5428 - super(); 5429 - this.message = message; 5430 - } 5431 - } 5432 - class EffectEmitEvent extends CustomType { 5433 - constructor(name2, data) { 5434 - super(); 5435 - this.name = name2; 5436 - this.data = data; 5437 - } 5438 - } 5439 - class SelfDispatchedMessages extends CustomType { 5440 - constructor(messages, effect) { 5441 - super(); 5442 - this.messages = messages; 5443 - this.effect = effect; 5444 - } 5445 - } 5446 - class SystemRequestedShutdown extends CustomType { 5447 - } 5448 - 5449 - // build/dev/javascript/lustre/lustre/component.mjs 5450 - class Config2 extends CustomType { 5451 - constructor(open_shadow_root, adopt_styles, attributes, properties, is_form_associated, on_form_autofill, on_form_reset, on_form_restore) { 5452 - super(); 5453 - this.open_shadow_root = open_shadow_root; 5454 - this.adopt_styles = adopt_styles; 5455 - this.attributes = attributes; 5456 - this.properties = properties; 5457 - this.is_form_associated = is_form_associated; 5458 - this.on_form_autofill = on_form_autofill; 5459 - this.on_form_reset = on_form_reset; 5460 - this.on_form_restore = on_form_restore; 5461 - } 5462 - } 5463 - function new$7(options) { 5464 - let init = new Config2(false, true, empty_dict(), empty_dict(), false, option_none, option_none, option_none); 5465 - return fold2(options, init, (config, option) => { 5466 - return option.apply(config); 5467 - }); 5468 - } 5469 - 5470 - // build/dev/javascript/lustre/lustre/runtime/client/spa.ffi.mjs 5471 - class Spa { 5472 - static start({ init, update: update2, view }, selector, flags) { 5473 - if (!is_browser()) 5474 - return new Error(new NotABrowser); 5475 - const root3 = selector instanceof HTMLElement ? selector : document2.querySelector(selector); 5476 - if (!root3) 5477 - return new Error(new ElementNotFound(selector)); 5478 - return new Ok(new Spa(root3, init(flags), update2, view)); 5479 - } 5480 - #runtime; 5481 - constructor(root3, [init, effects], update2, view) { 5482 - this.#runtime = new Runtime(root3, [init, effects], view, update2); 5483 - } 5484 - send(message) { 5485 - switch (message.constructor) { 5486 - case EffectDispatchedMessage: { 5487 - this.dispatch(message.message, false); 5488 - break; 5489 - } 5490 - case EffectEmitEvent: { 5491 - this.emit(message.name, message.data); 5492 - break; 5493 - } 5494 - case SystemRequestedShutdown: 5495 - break; 5496 - } 5497 - } 5498 - dispatch(msg, immediate2) { 5499 - this.#runtime.dispatch(msg, immediate2); 5500 - } 5501 - emit(event3, data) { 5502 - this.#runtime.emit(event3, data); 5503 - } 5504 - } 5505 - var start = Spa.start; 5506 - 5507 - // build/dev/javascript/lustre/lustre/runtime/server/runtime.ffi.mjs 5508 - class Runtime2 { 5509 - #model; 5510 - #update; 5511 - #view; 5512 - #on_attribute_change; 5513 - #vdom; 5514 - #events; 5515 - #callbacks = new Set; 5516 - constructor([model, effects], view, update2, on_attribute_change) { 5517 - this.#model = model; 5518 - this.#update = update2; 5519 - this.#view = view; 5520 - this.#on_attribute_change = on_attribute_change; 5521 - this.#vdom = this.#view(this.#model); 5522 - this.#events = from_node(this.#vdom); 5523 - this.#tick(effects.all, false); 5524 - } 5525 - send(message) { 5526 - if (this.#model === null) 5527 - return; 5528 - switch (message.constructor) { 5529 - case ClientDispatchedMessage: 5530 - switch (message.message.constructor) { 5531 - case AttributeChanged: { 5532 - const { name: name2, value: value2 } = message.messgae; 5533 - let effects = []; 5534 - const decoder = this.#on_attribute_change.get(name2); 5535 - if (!decoder) 5536 - break; 5537 - const result = run(value2, decoder); 5538 - if (result.constructor !== Ok) 5539 - break; 5540 - const [model, more_effects] = this.#update(this.#model, result[0]); 5541 - this.#model = model; 5542 - effects.push(more_effects); 5543 - while (effects.length) { 5544 - this.#tick(effects.shift().all); 5545 - } 5546 - } 5547 - case EventFired: { 5548 - const { path, name: name2, event: event3 } = message.message; 5549 - const [events, result] = handle(this.#events, path, name2, event3); 5550 - this.#events = events; 5551 - if (result.constructor === Ok) { 5552 - this.dispatch(result[0]); 5553 - } 5554 - return; 5555 - } 5556 - } 5557 - case ClientRegisteredCallback: { 5558 - if (this.#callbacks.has(message.callback)) 5559 - return; 5560 - const mount = new Mount(this.#vdom); 5561 - this.#callbacks.add(message.callback); 5562 - message.callback(mount); 5563 - return; 5564 - } 5565 - case ClientDeregisteredCallback: { 5566 - this.#callbacks.delete(message.callback); 5567 - return; 5568 - } 5569 - case EffectDispatchedMessage: { 5570 - this.dispatch(message.message); 5571 - return; 5572 - } 5573 - case EffectEmitEvent: { 5574 - const event3 = new Emit(message.name, message.data); 5575 - for (const callback of this.#callbacks) { 5576 - callback(event3); 5577 - } 5578 - return; 5579 - } 5580 - case SelfDispatchedMessages: { 5581 - let messages = message.messages; 5582 - let effects = [message.effect]; 5583 - for (let list4 = messages;messages.tail; list4 = list4.tail) { 5584 - const [model, more_effects] = this.#update(this.#model, list4.head); 5585 - this.#model = model; 5586 - effects.push(more_effects); 5587 - } 5588 - while (effects.length) { 5589 - this.#tick(effects.shift().all); 5590 - } 5591 - return; 5592 - } 5593 - case SystemRequestedShutdown: { 5594 - this.#model = null; 5595 - this.#update = null; 5596 - this.#view = null; 5597 - this.#on_attribute_change = null; 5598 - this.#events = new$6(); 5599 - this.#callbacks.clear(); 5600 - } 5601 - } 5602 - } 5603 - dispatch(msg) { 5604 - const [model, effects] = this.#update(this.#model, msg); 5605 - this.#model = model; 5606 - this.#tick(effects.all, immediate); 5607 - } 5608 - #tick(effects) { 5609 - const queue = []; 5610 - const effect_params = { 5611 - root: null, 5612 - emit: (event3, data) => this.#emit(event3, data), 5613 - dispatch: (msg) => queue.push(msg), 5614 - select: () => {} 5615 - }; 5616 - while (true) { 5617 - for (let list4 = effects;list4.tail; list4 = list4.tail) { 5618 - list4.head(effect_params); 5619 - } 5620 - if (!queue.length) { 5621 - break; 5622 - } 5623 - const msg = queue.shift(); 5624 - [this.#model, effects] = this.#update(this.#model, msg); 5625 - } 5626 - this.#render(); 5627 - } 5628 - #render() { 5629 - const next = this.#view(this.#model); 5630 - const { patch, events } = diff(this.#events, this.#vdom, next); 5631 - this.#events = events; 5632 - this.#vdom = next; 5633 - const reconcile = new Reconcile(patch); 5634 - for (const callback of this.#callbacks) { 5635 - callback(reconcile); 5636 - } 5637 - } 5638 - #emit(event3, data) { 5639 - const message = new Emit(event3, data); 5640 - for (const callback of this.#callbacks) { 5641 - callback(message); 5642 - } 5643 - } 5644 - } 5645 - 5646 - // build/dev/javascript/lustre/lustre.mjs 5647 - class App extends CustomType { 5648 - constructor(init, update2, view, config) { 5649 - super(); 5650 - this.init = init; 5651 - this.update = update2; 5652 - this.view = view; 5653 - this.config = config; 5654 - } 5655 - } 5656 - class ElementNotFound extends CustomType { 5657 - constructor(selector) { 5658 - super(); 5659 - this.selector = selector; 5660 - } 5661 - } 5662 - class NotABrowser extends CustomType { 5663 - } 5664 - function application(init, update2, view) { 5665 - return new App(init, update2, view, new$7(empty_list)); 5666 - } 5667 - function start3(app, selector, start_args) { 5668 - return guard(!is_browser(), new Error(new NotABrowser), () => { 5669 - return start(app, selector, start_args); 5670 - }); 5671 - } 5672 - 5673 - // build/dev/javascript/gleam_stdlib/gleam/uri.mjs 5674 - class Uri extends CustomType { 5675 - constructor(scheme, userinfo, host, port, path, query, fragment3) { 5676 - super(); 5677 - this.scheme = scheme; 5678 - this.userinfo = userinfo; 5679 - this.host = host; 5680 - this.port = port; 5681 - this.path = path; 5682 - this.query = query; 5683 - this.fragment = fragment3; 5684 - } 5685 - } 5686 - var empty4 = /* @__PURE__ */ new Uri(/* @__PURE__ */ new None, /* @__PURE__ */ new None, /* @__PURE__ */ new None, /* @__PURE__ */ new None, "", /* @__PURE__ */ new None, /* @__PURE__ */ new None); 5687 - function is_valid_host_within_brackets_char(char) { 5688 - return 48 >= char && char <= 57 || 65 >= char && char <= 90 || 97 >= char && char <= 122 || char === 58 || char === 46; 5689 - } 5690 - function parse_fragment(rest2, pieces) { 5691 - return new Ok(new Uri(pieces.scheme, pieces.userinfo, pieces.host, pieces.port, pieces.path, pieces.query, new Some(rest2))); 5692 - } 5693 - function parse_query_with_question_mark_loop(loop$original, loop$uri_string, loop$pieces, loop$size) { 5694 - while (true) { 5695 - let original = loop$original; 5696 - let uri_string = loop$uri_string; 5697 - let pieces = loop$pieces; 5698 - let size2 = loop$size; 5699 - if (uri_string.startsWith("#")) { 5700 - if (size2 === 0) { 5701 - let rest2 = uri_string.slice(1); 5702 - return parse_fragment(rest2, pieces); 5703 - } else { 5704 - let rest2 = uri_string.slice(1); 5705 - let query = string_codeunit_slice(original, 0, size2); 5706 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, pieces.host, pieces.port, pieces.path, new Some(query), pieces.fragment); 5707 - return parse_fragment(rest2, pieces$1); 5708 - } 5709 - } else if (uri_string === "") { 5710 - return new Ok(new Uri(pieces.scheme, pieces.userinfo, pieces.host, pieces.port, pieces.path, new Some(original), pieces.fragment)); 5711 - } else { 5712 - let $ = pop_codeunit(uri_string); 5713 - let rest2; 5714 - rest2 = $[1]; 5715 - loop$original = original; 5716 - loop$uri_string = rest2; 5717 - loop$pieces = pieces; 5718 - loop$size = size2 + 1; 5719 - } 5720 - } 5721 - } 5722 - function parse_query_with_question_mark(uri_string, pieces) { 5723 - return parse_query_with_question_mark_loop(uri_string, uri_string, pieces, 0); 5724 - } 5725 - function parse_path_loop(loop$original, loop$uri_string, loop$pieces, loop$size) { 5726 - while (true) { 5727 - let original = loop$original; 5728 - let uri_string = loop$uri_string; 5729 - let pieces = loop$pieces; 5730 - let size2 = loop$size; 5731 - if (uri_string.startsWith("?")) { 5732 - let rest2 = uri_string.slice(1); 5733 - let path = string_codeunit_slice(original, 0, size2); 5734 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, pieces.host, pieces.port, path, pieces.query, pieces.fragment); 5735 - return parse_query_with_question_mark(rest2, pieces$1); 5736 - } else if (uri_string.startsWith("#")) { 5737 - let rest2 = uri_string.slice(1); 5738 - let path = string_codeunit_slice(original, 0, size2); 5739 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, pieces.host, pieces.port, path, pieces.query, pieces.fragment); 5740 - return parse_fragment(rest2, pieces$1); 5741 - } else if (uri_string === "") { 5742 - return new Ok(new Uri(pieces.scheme, pieces.userinfo, pieces.host, pieces.port, original, pieces.query, pieces.fragment)); 5743 - } else { 5744 - let $ = pop_codeunit(uri_string); 5745 - let rest2; 5746 - rest2 = $[1]; 5747 - loop$original = original; 5748 - loop$uri_string = rest2; 5749 - loop$pieces = pieces; 5750 - loop$size = size2 + 1; 5751 - } 5752 - } 5753 - } 5754 - function parse_path(uri_string, pieces) { 5755 - return parse_path_loop(uri_string, uri_string, pieces, 0); 5756 - } 5757 - function parse_port_loop(loop$uri_string, loop$pieces, loop$port) { 5758 - while (true) { 5759 - let uri_string = loop$uri_string; 5760 - let pieces = loop$pieces; 5761 - let port = loop$port; 5762 - if (uri_string.startsWith("0")) { 5763 - let rest2 = uri_string.slice(1); 5764 - loop$uri_string = rest2; 5765 - loop$pieces = pieces; 5766 - loop$port = port * 10; 5767 - } else if (uri_string.startsWith("1")) { 5768 - let rest2 = uri_string.slice(1); 5769 - loop$uri_string = rest2; 5770 - loop$pieces = pieces; 5771 - loop$port = port * 10 + 1; 5772 - } else if (uri_string.startsWith("2")) { 5773 - let rest2 = uri_string.slice(1); 5774 - loop$uri_string = rest2; 5775 - loop$pieces = pieces; 5776 - loop$port = port * 10 + 2; 5777 - } else if (uri_string.startsWith("3")) { 5778 - let rest2 = uri_string.slice(1); 5779 - loop$uri_string = rest2; 5780 - loop$pieces = pieces; 5781 - loop$port = port * 10 + 3; 5782 - } else if (uri_string.startsWith("4")) { 5783 - let rest2 = uri_string.slice(1); 5784 - loop$uri_string = rest2; 5785 - loop$pieces = pieces; 5786 - loop$port = port * 10 + 4; 5787 - } else if (uri_string.startsWith("5")) { 5788 - let rest2 = uri_string.slice(1); 5789 - loop$uri_string = rest2; 5790 - loop$pieces = pieces; 5791 - loop$port = port * 10 + 5; 5792 - } else if (uri_string.startsWith("6")) { 5793 - let rest2 = uri_string.slice(1); 5794 - loop$uri_string = rest2; 5795 - loop$pieces = pieces; 5796 - loop$port = port * 10 + 6; 5797 - } else if (uri_string.startsWith("7")) { 5798 - let rest2 = uri_string.slice(1); 5799 - loop$uri_string = rest2; 5800 - loop$pieces = pieces; 5801 - loop$port = port * 10 + 7; 5802 - } else if (uri_string.startsWith("8")) { 5803 - let rest2 = uri_string.slice(1); 5804 - loop$uri_string = rest2; 5805 - loop$pieces = pieces; 5806 - loop$port = port * 10 + 8; 5807 - } else if (uri_string.startsWith("9")) { 5808 - let rest2 = uri_string.slice(1); 5809 - loop$uri_string = rest2; 5810 - loop$pieces = pieces; 5811 - loop$port = port * 10 + 9; 5812 - } else if (uri_string.startsWith("?")) { 5813 - let rest2 = uri_string.slice(1); 5814 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, pieces.host, new Some(port), pieces.path, pieces.query, pieces.fragment); 5815 - return parse_query_with_question_mark(rest2, pieces$1); 5816 - } else if (uri_string.startsWith("#")) { 5817 - let rest2 = uri_string.slice(1); 5818 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, pieces.host, new Some(port), pieces.path, pieces.query, pieces.fragment); 5819 - return parse_fragment(rest2, pieces$1); 5820 - } else if (uri_string.startsWith("/")) { 5821 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, pieces.host, new Some(port), pieces.path, pieces.query, pieces.fragment); 5822 - return parse_path(uri_string, pieces$1); 5823 - } else if (uri_string === "") { 5824 - return new Ok(new Uri(pieces.scheme, pieces.userinfo, pieces.host, new Some(port), pieces.path, pieces.query, pieces.fragment)); 5825 - } else { 5826 - return new Error(undefined); 5827 - } 5828 - } 5829 - } 5830 - function parse_port(uri_string, pieces) { 5831 - if (uri_string.startsWith(":0")) { 5832 - let rest2 = uri_string.slice(2); 5833 - return parse_port_loop(rest2, pieces, 0); 5834 - } else if (uri_string.startsWith(":1")) { 5835 - let rest2 = uri_string.slice(2); 5836 - return parse_port_loop(rest2, pieces, 1); 5837 - } else if (uri_string.startsWith(":2")) { 5838 - let rest2 = uri_string.slice(2); 5839 - return parse_port_loop(rest2, pieces, 2); 5840 - } else if (uri_string.startsWith(":3")) { 5841 - let rest2 = uri_string.slice(2); 5842 - return parse_port_loop(rest2, pieces, 3); 5843 - } else if (uri_string.startsWith(":4")) { 5844 - let rest2 = uri_string.slice(2); 5845 - return parse_port_loop(rest2, pieces, 4); 5846 - } else if (uri_string.startsWith(":5")) { 5847 - let rest2 = uri_string.slice(2); 5848 - return parse_port_loop(rest2, pieces, 5); 5849 - } else if (uri_string.startsWith(":6")) { 5850 - let rest2 = uri_string.slice(2); 5851 - return parse_port_loop(rest2, pieces, 6); 5852 - } else if (uri_string.startsWith(":7")) { 5853 - let rest2 = uri_string.slice(2); 5854 - return parse_port_loop(rest2, pieces, 7); 5855 - } else if (uri_string.startsWith(":8")) { 5856 - let rest2 = uri_string.slice(2); 5857 - return parse_port_loop(rest2, pieces, 8); 5858 - } else if (uri_string.startsWith(":9")) { 5859 - let rest2 = uri_string.slice(2); 5860 - return parse_port_loop(rest2, pieces, 9); 5861 - } else if (uri_string.startsWith(":")) { 5862 - return new Error(undefined); 5863 - } else if (uri_string.startsWith("?")) { 5864 - let rest2 = uri_string.slice(1); 5865 - return parse_query_with_question_mark(rest2, pieces); 5866 - } else if (uri_string.startsWith("#")) { 5867 - let rest2 = uri_string.slice(1); 5868 - return parse_fragment(rest2, pieces); 5869 - } else if (uri_string.startsWith("/")) { 5870 - return parse_path(uri_string, pieces); 5871 - } else if (uri_string === "") { 5872 - return new Ok(pieces); 5873 - } else { 5874 - return new Error(undefined); 5875 - } 5876 - } 5877 - function parse_host_outside_of_brackets_loop(loop$original, loop$uri_string, loop$pieces, loop$size) { 5878 - while (true) { 5879 - let original = loop$original; 5880 - let uri_string = loop$uri_string; 5881 - let pieces = loop$pieces; 5882 - let size2 = loop$size; 5883 - if (uri_string === "") { 5884 - return new Ok(new Uri(pieces.scheme, pieces.userinfo, new Some(original), pieces.port, pieces.path, pieces.query, pieces.fragment)); 5885 - } else if (uri_string.startsWith(":")) { 5886 - let host = string_codeunit_slice(original, 0, size2); 5887 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, new Some(host), pieces.port, pieces.path, pieces.query, pieces.fragment); 5888 - return parse_port(uri_string, pieces$1); 5889 - } else if (uri_string.startsWith("/")) { 5890 - let host = string_codeunit_slice(original, 0, size2); 5891 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, new Some(host), pieces.port, pieces.path, pieces.query, pieces.fragment); 5892 - return parse_path(uri_string, pieces$1); 5893 - } else if (uri_string.startsWith("?")) { 5894 - let rest2 = uri_string.slice(1); 5895 - let host = string_codeunit_slice(original, 0, size2); 5896 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, new Some(host), pieces.port, pieces.path, pieces.query, pieces.fragment); 5897 - return parse_query_with_question_mark(rest2, pieces$1); 5898 - } else if (uri_string.startsWith("#")) { 5899 - let rest2 = uri_string.slice(1); 5900 - let host = string_codeunit_slice(original, 0, size2); 5901 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, new Some(host), pieces.port, pieces.path, pieces.query, pieces.fragment); 5902 - return parse_fragment(rest2, pieces$1); 5903 - } else { 5904 - let $ = pop_codeunit(uri_string); 5905 - let rest2; 5906 - rest2 = $[1]; 5907 - loop$original = original; 5908 - loop$uri_string = rest2; 5909 - loop$pieces = pieces; 5910 - loop$size = size2 + 1; 5911 - } 5912 - } 5913 - } 5914 - function parse_host_within_brackets_loop(loop$original, loop$uri_string, loop$pieces, loop$size) { 5915 - while (true) { 5916 - let original = loop$original; 5917 - let uri_string = loop$uri_string; 5918 - let pieces = loop$pieces; 5919 - let size2 = loop$size; 5920 - if (uri_string === "") { 5921 - return new Ok(new Uri(pieces.scheme, pieces.userinfo, new Some(uri_string), pieces.port, pieces.path, pieces.query, pieces.fragment)); 5922 - } else if (uri_string.startsWith("]")) { 5923 - if (size2 === 0) { 5924 - let rest2 = uri_string.slice(1); 5925 - return parse_port(rest2, pieces); 5926 - } else { 5927 - let rest2 = uri_string.slice(1); 5928 - let host = string_codeunit_slice(original, 0, size2 + 1); 5929 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, new Some(host), pieces.port, pieces.path, pieces.query, pieces.fragment); 5930 - return parse_port(rest2, pieces$1); 5931 - } 5932 - } else if (uri_string.startsWith("/")) { 5933 - if (size2 === 0) { 5934 - return parse_path(uri_string, pieces); 5935 - } else { 5936 - let host = string_codeunit_slice(original, 0, size2); 5937 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, new Some(host), pieces.port, pieces.path, pieces.query, pieces.fragment); 5938 - return parse_path(uri_string, pieces$1); 5939 - } 5940 - } else if (uri_string.startsWith("?")) { 5941 - if (size2 === 0) { 5942 - let rest2 = uri_string.slice(1); 5943 - return parse_query_with_question_mark(rest2, pieces); 5944 - } else { 5945 - let rest2 = uri_string.slice(1); 5946 - let host = string_codeunit_slice(original, 0, size2); 5947 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, new Some(host), pieces.port, pieces.path, pieces.query, pieces.fragment); 5948 - return parse_query_with_question_mark(rest2, pieces$1); 5949 - } 5950 - } else if (uri_string.startsWith("#")) { 5951 - if (size2 === 0) { 5952 - let rest2 = uri_string.slice(1); 5953 - return parse_fragment(rest2, pieces); 5954 - } else { 5955 - let rest2 = uri_string.slice(1); 5956 - let host = string_codeunit_slice(original, 0, size2); 5957 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, new Some(host), pieces.port, pieces.path, pieces.query, pieces.fragment); 5958 - return parse_fragment(rest2, pieces$1); 5959 - } 5960 - } else { 5961 - let $ = pop_codeunit(uri_string); 5962 - let char; 5963 - let rest2; 5964 - char = $[0]; 5965 - rest2 = $[1]; 5966 - let $1 = is_valid_host_within_brackets_char(char); 5967 - if ($1) { 5968 - loop$original = original; 5969 - loop$uri_string = rest2; 5970 - loop$pieces = pieces; 5971 - loop$size = size2 + 1; 5972 - } else { 5973 - return parse_host_outside_of_brackets_loop(original, original, pieces, 0); 5974 - } 5975 - } 5976 - } 5977 - } 5978 - function parse_host_within_brackets(uri_string, pieces) { 5979 - return parse_host_within_brackets_loop(uri_string, uri_string, pieces, 0); 5980 - } 5981 - function parse_host_outside_of_brackets(uri_string, pieces) { 5982 - return parse_host_outside_of_brackets_loop(uri_string, uri_string, pieces, 0); 5983 - } 5984 - function parse_host(uri_string, pieces) { 5985 - if (uri_string.startsWith("[")) { 5986 - return parse_host_within_brackets(uri_string, pieces); 5987 - } else if (uri_string.startsWith(":")) { 5988 - let pieces$1 = new Uri(pieces.scheme, pieces.userinfo, new Some(""), pieces.port, pieces.path, pieces.query, pieces.fragment); 5989 - return parse_port(uri_string, pieces$1); 5990 - } else if (uri_string === "") { 5991 - return new Ok(new Uri(pieces.scheme, pieces.userinfo, new Some(""), pieces.port, pieces.path, pieces.query, pieces.fragment)); 5992 - } else { 5993 - return parse_host_outside_of_brackets(uri_string, pieces); 5994 - } 5995 - } 5996 - function parse_userinfo_loop(loop$original, loop$uri_string, loop$pieces, loop$size) { 5997 - while (true) { 5998 - let original = loop$original; 5999 - let uri_string = loop$uri_string; 6000 - let pieces = loop$pieces; 6001 - let size2 = loop$size; 6002 - if (uri_string.startsWith("@")) { 6003 - if (size2 === 0) { 6004 - let rest2 = uri_string.slice(1); 6005 - return parse_host(rest2, pieces); 6006 - } else { 6007 - let rest2 = uri_string.slice(1); 6008 - let userinfo = string_codeunit_slice(original, 0, size2); 6009 - let pieces$1 = new Uri(pieces.scheme, new Some(userinfo), pieces.host, pieces.port, pieces.path, pieces.query, pieces.fragment); 6010 - return parse_host(rest2, pieces$1); 6011 - } 6012 - } else if (uri_string === "") { 6013 - return parse_host(original, pieces); 6014 - } else if (uri_string.startsWith("/")) { 6015 - return parse_host(original, pieces); 6016 - } else if (uri_string.startsWith("?")) { 6017 - return parse_host(original, pieces); 6018 - } else if (uri_string.startsWith("#")) { 6019 - return parse_host(original, pieces); 6020 - } else { 6021 - let $ = pop_codeunit(uri_string); 6022 - let rest2; 6023 - rest2 = $[1]; 6024 - loop$original = original; 6025 - loop$uri_string = rest2; 6026 - loop$pieces = pieces; 6027 - loop$size = size2 + 1; 6028 - } 6029 - } 6030 - } 6031 - function parse_authority_pieces(string5, pieces) { 6032 - return parse_userinfo_loop(string5, string5, pieces, 0); 6033 - } 6034 - function parse_authority_with_slashes(uri_string, pieces) { 6035 - if (uri_string === "//") { 6036 - return new Ok(new Uri(pieces.scheme, pieces.userinfo, new Some(""), pieces.port, pieces.path, pieces.query, pieces.fragment)); 6037 - } else if (uri_string.startsWith("//")) { 6038 - let rest2 = uri_string.slice(2); 6039 - return parse_authority_pieces(rest2, pieces); 6040 - } else { 6041 - return parse_path(uri_string, pieces); 6042 - } 6043 - } 6044 - function parse_scheme_loop(loop$original, loop$uri_string, loop$pieces, loop$size) { 6045 - while (true) { 6046 - let original = loop$original; 6047 - let uri_string = loop$uri_string; 6048 - let pieces = loop$pieces; 6049 - let size2 = loop$size; 6050 - if (uri_string.startsWith("/")) { 6051 - if (size2 === 0) { 6052 - return parse_authority_with_slashes(uri_string, pieces); 6053 - } else { 6054 - let scheme = string_codeunit_slice(original, 0, size2); 6055 - let pieces$1 = new Uri(new Some(lowercase(scheme)), pieces.userinfo, pieces.host, pieces.port, pieces.path, pieces.query, pieces.fragment); 6056 - return parse_authority_with_slashes(uri_string, pieces$1); 6057 - } 6058 - } else if (uri_string.startsWith("?")) { 6059 - if (size2 === 0) { 6060 - let rest2 = uri_string.slice(1); 6061 - return parse_query_with_question_mark(rest2, pieces); 6062 - } else { 6063 - let rest2 = uri_string.slice(1); 6064 - let scheme = string_codeunit_slice(original, 0, size2); 6065 - let pieces$1 = new Uri(new Some(lowercase(scheme)), pieces.userinfo, pieces.host, pieces.port, pieces.path, pieces.query, pieces.fragment); 6066 - return parse_query_with_question_mark(rest2, pieces$1); 6067 - } 6068 - } else if (uri_string.startsWith("#")) { 6069 - if (size2 === 0) { 6070 - let rest2 = uri_string.slice(1); 6071 - return parse_fragment(rest2, pieces); 6072 - } else { 6073 - let rest2 = uri_string.slice(1); 6074 - let scheme = string_codeunit_slice(original, 0, size2); 6075 - let pieces$1 = new Uri(new Some(lowercase(scheme)), pieces.userinfo, pieces.host, pieces.port, pieces.path, pieces.query, pieces.fragment); 6076 - return parse_fragment(rest2, pieces$1); 6077 - } 6078 - } else if (uri_string.startsWith(":")) { 6079 - if (size2 === 0) { 6080 - return new Error(undefined); 6081 - } else { 6082 - let rest2 = uri_string.slice(1); 6083 - let scheme = string_codeunit_slice(original, 0, size2); 6084 - let pieces$1 = new Uri(new Some(lowercase(scheme)), pieces.userinfo, pieces.host, pieces.port, pieces.path, pieces.query, pieces.fragment); 6085 - return parse_authority_with_slashes(rest2, pieces$1); 6086 - } 6087 - } else if (uri_string === "") { 6088 - return new Ok(new Uri(pieces.scheme, pieces.userinfo, pieces.host, pieces.port, original, pieces.query, pieces.fragment)); 6089 - } else { 6090 - let $ = pop_codeunit(uri_string); 6091 - let rest2; 6092 - rest2 = $[1]; 6093 - loop$original = original; 6094 - loop$uri_string = rest2; 6095 - loop$pieces = pieces; 6096 - loop$size = size2 + 1; 6097 - } 6098 - } 6099 - } 6100 - function remove_dot_segments_loop(loop$input, loop$accumulator) { 6101 - while (true) { 6102 - let input2 = loop$input; 6103 - let accumulator = loop$accumulator; 6104 - if (input2 instanceof Empty) { 6105 - return reverse(accumulator); 6106 - } else { 6107 - let segment = input2.head; 6108 - let rest2 = input2.tail; 6109 - let _block; 6110 - if (segment === "") { 6111 - _block = accumulator; 6112 - } else if (segment === ".") { 6113 - _block = accumulator; 6114 - } else if (segment === "..") { 6115 - if (accumulator instanceof Empty) { 6116 - _block = accumulator; 6117 - } else { 6118 - let accumulator$12 = accumulator.tail; 6119 - _block = accumulator$12; 6120 - } 6121 - } else { 6122 - let segment$1 = segment; 6123 - let accumulator$12 = accumulator; 6124 - _block = prepend(segment$1, accumulator$12); 6125 - } 6126 - let accumulator$1 = _block; 6127 - loop$input = rest2; 6128 - loop$accumulator = accumulator$1; 6129 - } 6130 - } 6131 - } 6132 - function remove_dot_segments(input2) { 6133 - return remove_dot_segments_loop(input2, toList([])); 6134 - } 6135 - function to_string6(uri) { 6136 - let _block; 6137 - let $ = uri.fragment; 6138 - if ($ instanceof Some) { 6139 - let fragment3 = $[0]; 6140 - _block = toList(["#", fragment3]); 6141 - } else { 6142 - _block = toList([]); 6143 - } 6144 - let parts = _block; 6145 - let _block$1; 6146 - let $1 = uri.query; 6147 - if ($1 instanceof Some) { 6148 - let query = $1[0]; 6149 - _block$1 = prepend("?", prepend(query, parts)); 6150 - } else { 6151 - _block$1 = parts; 6152 - } 6153 - let parts$1 = _block$1; 6154 - let parts$2 = prepend(uri.path, parts$1); 6155 - let _block$2; 6156 - let $2 = uri.host; 6157 - let $3 = starts_with(uri.path, "/"); 6158 - if ($2 instanceof Some && !$3) { 6159 - let host = $2[0]; 6160 - if (host !== "") { 6161 - _block$2 = prepend("/", parts$2); 6162 - } else { 6163 - _block$2 = parts$2; 6164 - } 6165 - } else { 6166 - _block$2 = parts$2; 6167 - } 6168 - let parts$3 = _block$2; 6169 - let _block$3; 6170 - let $4 = uri.host; 6171 - let $5 = uri.port; 6172 - if ($4 instanceof Some && $5 instanceof Some) { 6173 - let port = $5[0]; 6174 - _block$3 = prepend(":", prepend(to_string(port), parts$3)); 6175 - } else { 6176 - _block$3 = parts$3; 6177 - } 6178 - let parts$4 = _block$3; 6179 - let _block$4; 6180 - let $6 = uri.scheme; 6181 - let $7 = uri.userinfo; 6182 - let $8 = uri.host; 6183 - if ($6 instanceof Some) { 6184 - if ($7 instanceof Some) { 6185 - if ($8 instanceof Some) { 6186 - let s = $6[0]; 6187 - let u = $7[0]; 6188 - let h = $8[0]; 6189 - _block$4 = prepend(s, prepend("://", prepend(u, prepend("@", prepend(h, parts$4))))); 6190 - } else { 6191 - let s = $6[0]; 6192 - _block$4 = prepend(s, prepend(":", parts$4)); 6193 - } 6194 - } else if ($8 instanceof Some) { 6195 - let s = $6[0]; 6196 - let h = $8[0]; 6197 - _block$4 = prepend(s, prepend("://", prepend(h, parts$4))); 6198 - } else { 6199 - let s = $6[0]; 6200 - _block$4 = prepend(s, prepend(":", parts$4)); 6201 - } 6202 - } else if ($7 instanceof None && $8 instanceof Some) { 6203 - let h = $8[0]; 6204 - _block$4 = prepend("//", prepend(h, parts$4)); 6205 - } else { 6206 - _block$4 = parts$4; 6207 - } 6208 - let parts$5 = _block$4; 6209 - return concat2(parts$5); 6210 - } 6211 - function drop_last(elements) { 6212 - return take(elements, length(elements) - 1); 6213 - } 6214 - function join_segments(segments) { 6215 - return join(prepend("", segments), "/"); 6216 - } 6217 - function merge2(base, relative) { 6218 - let $ = base.scheme; 6219 - if ($ instanceof Some) { 6220 - let $1 = base.host; 6221 - if ($1 instanceof Some) { 6222 - let $2 = relative.host; 6223 - if ($2 instanceof Some) { 6224 - let _block; 6225 - let _pipe = split2(relative.path, "/"); 6226 - let _pipe$1 = remove_dot_segments(_pipe); 6227 - _block = join_segments(_pipe$1); 6228 - let path = _block; 6229 - let resolved = new Uri(or(relative.scheme, base.scheme), new None, relative.host, or(relative.port, base.port), path, relative.query, relative.fragment); 6230 - return new Ok(resolved); 6231 - } else { 6232 - let _block; 6233 - let $4 = relative.path; 6234 - if ($4 === "") { 6235 - _block = [base.path, or(relative.query, base.query)]; 6236 - } else { 6237 - let _block$1; 6238 - let $5 = starts_with(relative.path, "/"); 6239 - if ($5) { 6240 - _block$1 = split2(relative.path, "/"); 6241 - } else { 6242 - let _pipe2 = split2(base.path, "/"); 6243 - let _pipe$12 = drop_last(_pipe2); 6244 - _block$1 = append(_pipe$12, split2(relative.path, "/")); 6245 - } 6246 - let path_segments$1 = _block$1; 6247 - let _block$2; 6248 - let _pipe = path_segments$1; 6249 - let _pipe$1 = remove_dot_segments(_pipe); 6250 - _block$2 = join_segments(_pipe$1); 6251 - let path = _block$2; 6252 - _block = [path, relative.query]; 6253 - } 6254 - let $3 = _block; 6255 - let new_path; 6256 - let new_query; 6257 - new_path = $3[0]; 6258 - new_query = $3[1]; 6259 - let resolved = new Uri(base.scheme, new None, base.host, base.port, new_path, new_query, relative.fragment); 6260 - return new Ok(resolved); 6261 - } 6262 - } else { 6263 - return new Error(undefined); 6264 - } 6265 - } else { 6266 - return new Error(undefined); 6267 - } 6268 - } 6269 - function parse2(uri_string) { 6270 - return parse_scheme_loop(uri_string, uri_string, empty4, 0); 6271 - } 6272 - 6273 - // build/dev/javascript/lustre_websocket/ffi.mjs 6274 - var init_websocket = (url, on_open, on_text, on_binary, on_close) => { 6275 - let ws; 6276 - if (typeof WebSocket === "function") { 6277 - ws = new WebSocket(url); 6278 - } else { 6279 - ws = {}; 6280 - } 6281 - ws.onopen = (_) => on_open(ws); 6282 - ws.onmessage = (event3) => { 6283 - if (typeof event3.data === "string") { 6284 - on_text(event3.data); 6285 - } else { 6286 - on_binary(event3.data); 6287 - } 6288 - }; 6289 - ws.onclose = (event3) => on_close(event3.code); 6290 - }; 6291 - var send_over_websocket = (ws, msg) => ws.send(msg); 6292 - var get_page_url = () => document.URL; 6293 - // build/dev/javascript/lustre_websocket/lustre_websocket.mjs 6294 - class Normal extends CustomType { 6295 - } 6296 - class GoingAway extends CustomType { 6297 - } 6298 - class ProtocolError extends CustomType { 6299 - } 6300 - class UnexpectedTypeOfData extends CustomType { 6301 - } 6302 - class NoCodeFromServer extends CustomType { 6303 - } 6304 - class AbnormalClose extends CustomType { 6305 - } 6306 - class IncomprehensibleFrame extends CustomType { 6307 - } 6308 - class PolicyViolated extends CustomType { 6309 - } 6310 - class MessageTooBig extends CustomType { 6311 - } 6312 - class FailedExtensionNegotation extends CustomType { 6313 - } 6314 - class UnexpectedFailure extends CustomType { 6315 - } 6316 - class FailedTLSHandshake extends CustomType { 6317 - } 6318 - class OtherCloseReason extends CustomType { 6319 - } 6320 - class InvalidUrl extends CustomType { 6321 - } 6322 - class OnOpen extends CustomType { 6323 - constructor($0) { 6324 - super(); 6325 - this[0] = $0; 6326 - } 6327 - } 6328 - class OnTextMessage extends CustomType { 6329 - constructor($0) { 6330 - super(); 6331 - this[0] = $0; 6332 - } 6333 - } 6334 - class OnBinaryMessage extends CustomType { 6335 - constructor($0) { 6336 - super(); 6337 - this[0] = $0; 6338 - } 6339 - } 6340 - class OnClose extends CustomType { 6341 - constructor($0) { 6342 - super(); 6343 - this[0] = $0; 6344 - } 6345 - } 6346 - function code_to_reason(code) { 6347 - if (code === 1000) { 6348 - return new Normal; 6349 - } else if (code === 1001) { 6350 - return new GoingAway; 6351 - } else if (code === 1002) { 6352 - return new ProtocolError; 6353 - } else if (code === 1003) { 6354 - return new UnexpectedTypeOfData; 6355 - } else if (code === 1005) { 6356 - return new NoCodeFromServer; 6357 - } else if (code === 1006) { 6358 - return new AbnormalClose; 6359 - } else if (code === 1007) { 6360 - return new IncomprehensibleFrame; 6361 - } else if (code === 1008) { 6362 - return new PolicyViolated; 6363 - } else if (code === 1009) { 6364 - return new MessageTooBig; 6365 - } else if (code === 1010) { 6366 - return new FailedExtensionNegotation; 6367 - } else if (code === 1011) { 6368 - return new UnexpectedFailure; 6369 - } else if (code === 1015) { 6370 - return new FailedTLSHandshake; 6371 - } else { 6372 - return new OtherCloseReason; 6373 - } 6374 - } 6375 - function convert_scheme(scheme) { 6376 - if (scheme === "https") { 6377 - return new Ok("wss"); 6378 - } else if (scheme === "http") { 6379 - return new Ok("ws"); 6380 - } else if (scheme === "ws") { 6381 - return new Ok(scheme); 6382 - } else if (scheme === "wss") { 6383 - return new Ok(scheme); 6384 - } else { 6385 - return new Error(undefined); 6386 - } 6387 - } 6388 - function do_get_websocket_path(path, page_uri) { 6389 - let _block; 6390 - let _pipe = parse2(path); 6391 - _block = unwrap2(_pipe, new Uri(new None, new None, new None, new None, path, new None, new None)); 6392 - let path_uri = _block; 6393 - return try$(merge2(page_uri, path_uri), (merged) => { 6394 - return try$(to_result(merged.scheme, undefined), (merged_scheme) => { 6395 - return try$(convert_scheme(merged_scheme), (ws_scheme) => { 6396 - let _pipe$1 = new Uri(new Some(ws_scheme), merged.userinfo, merged.host, merged.port, merged.path, merged.query, merged.fragment); 6397 - let _pipe$2 = to_string6(_pipe$1); 6398 - return new Ok(_pipe$2); 6399 - }); 6400 - }); 6401 - }); 6402 - } 6403 - function send2(ws, msg) { 6404 - return from((_) => { 6405 - return send_over_websocket(ws, msg); 6406 - }); 6407 - } 6408 - function page_uri() { 6409 - let _pipe = get_page_url(); 6410 - return parse2(_pipe); 6411 - } 6412 - function get_websocket_path(path) { 6413 - let _pipe = page_uri(); 6414 - return try$(_pipe, (_capture) => { 6415 - return do_get_websocket_path(path, _capture); 6416 - }); 6417 - } 6418 - function init(path, wrapper) { 6419 - let _pipe = (dispatch) => { 6420 - let $ = get_websocket_path(path); 6421 - if ($ instanceof Ok) { 6422 - let url = $[0]; 6423 - return init_websocket(url, (ws) => { 6424 - return dispatch(wrapper(new OnOpen(ws))); 6425 - }, (text4) => { 6426 - return dispatch(wrapper(new OnTextMessage(text4))); 6427 - }, (data) => { 6428 - return dispatch(wrapper(new OnBinaryMessage(data))); 6429 - }, (code) => { 6430 - let _pipe2 = code; 6431 - let _pipe$1 = code_to_reason(_pipe2); 6432 - let _pipe$2 = new OnClose(_pipe$1); 6433 - let _pipe$3 = wrapper(_pipe$2); 6434 - return dispatch(_pipe$3); 6435 - }); 6436 - } else { 6437 - let _pipe2 = new InvalidUrl; 6438 - let _pipe$1 = wrapper(_pipe2); 6439 - return dispatch(_pipe$1); 6440 - } 6441 - }; 6442 - return from(_pipe); 6443 - } 6444 - // build/dev/javascript/plinth/storage_ffi.mjs 6445 - function localStorage() { 6446 - try { 6447 - if (globalThis.Storage && globalThis.localStorage instanceof globalThis.Storage) { 6448 - return new Ok(globalThis.localStorage); 6449 - } else { 6450 - return new Error(null); 6451 - } 6452 - } catch { 6453 - return new Error(null); 6454 - } 6455 - } 6456 - function getItem(storage, keyName) { 6457 - return null_or(storage.getItem(keyName)); 6458 - } 6459 - function setItem(storage, keyName, keyValue) { 6460 - try { 6461 - storage.setItem(keyName, keyValue); 6462 - return new Ok(null); 6463 - } catch { 6464 - return new Error(null); 6465 - } 6466 - } 6467 - function clear(storage) { 6468 - storage.clear(); 6469 - } 6470 - function null_or(val) { 6471 - if (val !== null) { 6472 - return new Ok(val); 6473 - } else { 6474 - return new Error(null); 6475 - } 6476 - } 6477 - // build/dev/javascript/lumina_client/lumina_client/model_type.mjs 6478 - class WSTryReconnect extends CustomType { 6479 - } 6480 - class EffectPast150ms extends CustomType { 6481 - } 6482 - class UpdateLastRefreshRequestTime extends CustomType { 6483 - constructor($0) { 6484 - super(); 6485 - this[0] = $0; 6486 - } 6487 - } 6488 - class WsDisconnectDefinitive extends CustomType { 6489 - } 6490 - class WebSocketIncomingMessage extends CustomType { 6491 - constructor($0) { 6492 - super(); 6493 - this[0] = $0; 6494 - } 6495 - } 6496 - class UserNavigatedToLoginPage extends CustomType { 6497 - } 6498 - class UserNavigatedToRegisterPage extends CustomType { 6499 - } 6500 - class UserNavigatedToLandingPage extends CustomType { 6501 - } 6502 - class UserSubmittedLogin extends CustomType { 6503 - constructor($0) { 6504 - super(); 6505 - this[0] = $0; 6506 - } 6507 - } 6508 - class UserSubmittedSignup extends CustomType { 6509 - constructor($0) { 6510 - super(); 6511 - this[0] = $0; 6512 - } 6513 - } 6514 - class UserUpdatedControlledEmailField extends CustomType { 6515 - constructor($0) { 6516 - super(); 6517 - this[0] = $0; 6518 - } 6519 - } 6520 - class UserUpdatedControlledPasswordField extends CustomType { 6521 - constructor($0) { 6522 - super(); 6523 - this[0] = $0; 6524 - } 6525 - } 6526 - class UserUpdatedControlledUsernameField extends CustomType { 6527 - constructor($0) { 6528 - super(); 6529 - this[0] = $0; 6530 - } 6531 - } 6532 - class UserUpdatedControlledPasswordConfirmField extends CustomType { 6533 - constructor($0) { 6534 - super(); 6535 - this[0] = $0; 6536 - } 6537 - } 6538 - class EmailFieldLostFocus extends CustomType { 6539 - } 6540 - class UserSwitchedTimeLineTo extends CustomType { 6541 - constructor($0) { 6542 - super(); 6543 - this[0] = $0; 6544 - } 6545 - } 6546 - class LoadMorePosts extends CustomType { 6547 - constructor($0) { 6548 - super(); 6549 - this[0] = $0; 6550 - } 6551 - } 6552 - class UserClickedLogout extends CustomType { 6553 - } 6554 - class UserClosedModal extends CustomType { 6555 - } 6556 - class SetModal extends CustomType { 6557 - constructor($0) { 6558 - super(); 6559 - this[0] = $0; 6560 - } 6561 - } 6562 - class StartDraggingModalBox extends CustomType { 6563 - constructor($0, $1) { 6564 - super(); 6565 - this[0] = $0; 6566 - this[1] = $1; 6567 - } 6568 - } 6569 - class MoveModalBoxTo extends CustomType { 6570 - constructor($0, $1) { 6571 - super(); 6572 - this[0] = $0; 6573 - this[1] = $1; 6574 - } 6575 - } 6576 - class Landing extends CustomType { 6577 - } 6578 - class Register extends CustomType { 6579 - constructor(fields, ready) { 6580 - super(); 6581 - this.fields = fields; 6582 - this.ready = ready; 6583 - } 6584 - } 6585 - class Login extends CustomType { 6586 - constructor(fields, success2) { 6587 - super(); 6588 - this.fields = fields; 6589 - this.success = success2; 6590 - } 6591 - } 6592 - class HomeTimeline extends CustomType { 6593 - constructor(timeline_name, modal) { 6594 - super(); 6595 - this.timeline_name = timeline_name; 6596 - this.modal = modal; 6597 - } 6598 - } 6599 - class Licence extends CustomType { 6600 - } 6601 - class Model extends CustomType { 6602 - constructor(page, user, ws, token2, status, cache, has_been_running_for_150ms, last_refresh_request_time) { 6603 - super(); 6604 - this.page = page; 6605 - this.user = user; 6606 - this.ws = ws; 6607 - this.token = token2; 6608 - this.status = status; 6609 - this.cache = cache; 6610 - this.has_been_running_for_150ms = has_been_running_for_150ms; 6611 - this.last_refresh_request_time = last_refresh_request_time; 6612 - } 6613 - } 6614 - class NotificationsSubModel extends CustomType { 6615 - constructor(unread_count, cached_notifications) { 6616 - super(); 6617 - this.unread_count = unread_count; 6618 - this.cached_notifications = cached_notifications; 6619 - } 6620 - } 6621 - class WsConnectionInitial extends CustomType { 6622 - } 6623 - class WsConnectionConnected extends CustomType { 6624 - constructor($0) { 6625 - super(); 6626 - this[0] = $0; 6627 - } 6628 - } 6629 - class WsConnectionDisconnected extends CustomType { 6630 - } 6631 - class WsConnectionUnsure extends CustomType { 6632 - } 6633 - class WsConnectionRetrying extends CustomType { 6634 - } 6635 - class Cached extends CustomType { 6636 - constructor(cached_posts, cached_users, cached_timelines) { 6637 - super(); 6638 - this.cached_posts = cached_posts; 6639 - this.cached_users = cached_users; 6640 - this.cached_timelines = cached_timelines; 6641 - } 6642 - } 6643 - class CachedUser extends CustomType { 6644 - constructor(source_instance, username, avatar, last_updated) { 6645 - super(); 6646 - this.source_instance = source_instance; 6647 - this.username = username; 6648 - this.avatar = avatar; 6649 - this.last_updated = last_updated; 6650 - } 6651 - } 6652 - class CachedTimeline extends CustomType { 6653 - constructor(id2, pages, total_count, current_page, has_more, last_updated) { 6654 - super(); 6655 - this.id = id2; 6656 - this.pages = pages; 6657 - this.total_count = total_count; 6658 - this.current_page = current_page; 6659 - this.has_more = has_more; 6660 - this.last_updated = last_updated; 6661 - } 6662 - } 6663 - class RegisterPageFields extends CustomType { 6664 - constructor(usernamefield, emailfield, passwordfield, passwordconfirmfield) { 6665 - super(); 6666 - this.usernamefield = usernamefield; 6667 - this.emailfield = emailfield; 6668 - this.passwordfield = passwordfield; 6669 - this.passwordconfirmfield = passwordconfirmfield; 6670 - } 6671 - } 6672 - class LoginFields extends CustomType { 6673 - constructor(emailfield, passwordfield) { 6674 - super(); 6675 - this.emailfield = emailfield; 6676 - this.passwordfield = passwordfield; 6677 - } 6678 - } 6679 - class UserSubmodel extends CustomType { 6680 - constructor(uid, username, email, avatar, notifs) { 6681 - super(); 6682 - this.uid = uid; 6683 - this.username = username; 6684 - this.email = email; 6685 - this.avatar = avatar; 6686 - this.notifs = notifs; 6687 - } 6688 - } 6689 - class SerializableModel extends CustomType { 6690 - constructor(page, token2) { 6691 - super(); 6692 - this.page = page; 6693 - this.token = token2; 6694 - } 6695 - } 6696 - function encode_page(page) { 6697 - if (page instanceof Landing) { 6698 - return object2(toList([["type", string3("landing")]])); 6699 - } else if (page instanceof Register) { 6700 - let fields = page.fields; 6701 - let ready = page.ready; 6702 - return object2(toList([ 6703 - ["type", string3("register")], 6704 - [ 6705 - "fields", 6706 - (() => { 6707 - let usernamefield; 6708 - let emailfield; 6709 - let passwordfield; 6710 - let passwordconfirmfield; 6711 - usernamefield = fields.usernamefield; 6712 - emailfield = fields.emailfield; 6713 - passwordfield = fields.passwordfield; 6714 - passwordconfirmfield = fields.passwordconfirmfield; 6715 - return object2(toList([ 6716 - ["usernamefield", string3(usernamefield)], 6717 - ["emailfield", string3(emailfield)], 6718 - ["passwordfield", string3(passwordfield)], 6719 - ["passwordconfirmfield", string3(passwordconfirmfield)] 6720 - ])); 6721 - })() 6722 - ], 6723 - [ 6724 - "ready", 6725 - (() => { 6726 - return null$(); 6727 - })() 6728 - ] 6729 - ])); 6730 - } else if (page instanceof Login) { 6731 - let fields = page.fields; 6732 - return object2(toList([ 6733 - ["type", string3("login")], 6734 - [ 6735 - "fields", 6736 - (() => { 6737 - let emailfield; 6738 - let passwordfield; 6739 - emailfield = fields.emailfield; 6740 - passwordfield = fields.passwordfield; 6741 - return object2(toList([ 6742 - ["emailfield", string3(emailfield)], 6743 - ["passwordfield", string3(passwordfield)] 6744 - ])); 6745 - })() 6746 - ] 6747 - ])); 6748 - } else if (page instanceof HomeTimeline) { 6749 - let timeline_name = page.timeline_name; 6750 - let modal = page.modal; 6751 - return object2((() => { 6752 - let _pipe = toList([["type", string3("home_timeline")]]); 6753 - let _pipe$1 = append(_pipe, (() => { 6754 - if (timeline_name instanceof Some) { 6755 - let i = timeline_name[0]; 6756 - return toList([["timeline_name", string3(i)]]); 6757 - } else { 6758 - return toList([]); 6759 - } 6760 - })()); 6761 - return append(_pipe$1, (() => { 6762 - if (modal instanceof Some) { 6763 - let i = modal[0]; 6764 - return toList([["modal", string3(i[0])]]); 6765 - } else { 6766 - return toList([]); 6767 - } 6768 - })()); 6769 - })()); 6770 - } else if (page instanceof Licence) { 6771 - return object2(toList([["type", string3("licence")]])); 6772 - } else { 6773 - return object2(toList([["type", string3("landing")]])); 6774 - } 6775 - } 6776 - function page_decoder() { 6777 - return field("type", string2, (variant) => { 6778 - if (variant === "landing") { 6779 - return success(new Landing); 6780 - } else if (variant === "licence") { 6781 - return success(new Licence); 6782 - } else if (variant === "register") { 6783 - return field("fields", field("usernamefield", string2, (usernamefield) => { 6784 - return field("emailfield", string2, (emailfield) => { 6785 - return field("passwordfield", string2, (passwordfield) => { 6786 - return field("passwordconfirmfield", string2, (passwordconfirmfield) => { 6787 - return success(new RegisterPageFields(usernamefield, emailfield, passwordfield, passwordconfirmfield)); 6788 - }); 6789 - }); 6790 - }); 6791 - }), (fields) => { 6792 - let ready = new None; 6793 - return success(new Register(fields, ready)); 6794 - }); 6795 - } else if (variant === "login") { 6796 - return field("fields", field("emailfield", string2, (emailfield) => { 6797 - return field("passwordfield", string2, (passwordfield) => { 6798 - return success(new LoginFields(emailfield, passwordfield)); 6799 - }); 6800 - }), (fields) => { 6801 - return success(new Login(fields, new None)); 6802 - }); 6803 - } else if (variant === "home_timeline") { 6804 - return optional_field("timeline_name", new None, optional(string2), (timeline_name) => { 6805 - return optional_field("modal", new None, optional(string2), (modal_n) => { 6806 - let _block; 6807 - let _pipe = modal_n; 6808 - _block = map(_pipe, (m) => { 6809 - return [m, new_map()]; 6810 - }); 6811 - let modal = _block; 6812 - return success(new HomeTimeline(timeline_name, modal)); 6813 - }); 6814 - }); 6815 - } else { 6816 - return failure(new Landing, "Page"); 6817 - } 6818 - }); 6819 - } 6820 - function serialize_serializable_model(serializable_model) { 6821 - let page; 6822 - let token2; 6823 - page = serializable_model.page; 6824 - token2 = serializable_model.token; 6825 - return object2(toList([ 6826 - ["page", encode_page(page)], 6827 - [ 6828 - "token", 6829 - (() => { 6830 - if (token2 instanceof Some) { 6831 - let value2 = token2[0]; 6832 - return string3(value2); 6833 - } else { 6834 - return null$(); 6835 - } 6836 - })() 6837 - ] 6838 - ])); 6839 - } 6840 - function serializable_model_decoder() { 6841 - return field("page", page_decoder(), (page) => { 6842 - return field("token", optional(string2), (token2) => { 6843 - return success(new SerializableModel(page, token2)); 6844 - }); 6845 - }); 6846 - } 6847 - function deserialize_serializable_model(jsod) { 6848 - return parse(jsod, serializable_model_decoder()); 6849 - } 6850 - function serialize(normal_model) { 6851 - let page; 6852 - let token2; 6853 - page = normal_model.page; 6854 - token2 = normal_model.token; 6855 - let _pipe = new SerializableModel(page, token2); 6856 - let _pipe$1 = serialize_serializable_model(_pipe); 6857 - return to_string2(_pipe$1); 6858 - } 6859 - 6860 - // build/dev/javascript/lumina_client/lumina_client/dom_ffi.mjs 6861 - function classfoundintree(starting_element, className) { 6862 - let element3 = starting_element; 6863 - do { 6864 - if (element3.classList && element3.classList.contains(className)) { 6865 - return true; 6866 - } 6867 - element3 = element3.parentElement; 6868 - } while (element3); 6869 - return false; 6870 - } 6871 - function start_dragging_modal_box(start_x, start_y, constructor, dispatcher) { 6872 - let current_x = start_x; 6873 - let current_y = start_y; 6874 - const dispatchnewlocation = () => { 6875 - const msg = constructor(current_x, current_y); 6876 - dispatcher(msg); 6877 - }; 6878 - const on_mouse_move = (event3) => { 6879 - current_x += event3.movementX; 6880 - current_y += event3.movementY; 6881 - dispatchnewlocation(); 6882 - }; 6883 - const on_mouse_up = () => { 6884 - window.removeEventListener("mousemove", on_mouse_move); 6885 - window.removeEventListener("mouseup", on_mouse_up); 6886 - }; 6887 - window.addEventListener("mousemove", on_mouse_move); 6888 - window.addEventListener("mouseup", on_mouse_up); 6889 - return; 6890 - } 6891 - function get_window_dimensions_px() { 6892 - return [window.innerWidth, window.innerHeight]; 6893 - } 6894 - 6895 - // build/dev/javascript/plinth/global_ffi.mjs 6896 - function setTimeout2(delay, callback) { 6897 - return globalThis.setTimeout(callback, delay); 6898 - } 6899 - 6900 - // build/dev/javascript/lumina_client/lumina_client/helpers.mjs 6901 - var model_local_storage_key = "luminaModelJSOB"; 6902 - function get_color_scheme2(_) { 6903 - return none(); 6904 - } 6905 - function login_view_checker(fieldvalues) { 6906 - let _pipe = toList([ 6907 - fieldvalues.passwordfield !== "", 6908 - fieldvalues.emailfield !== "" 6909 - ]); 6910 - return all(_pipe, (x) => { 6911 - return x; 6912 - }); 6913 - } 6914 - function set_timeout_nilled(delay, cb) { 6915 - setTimeout2(delay, cb); 6916 - return; 6917 - } 6918 - function get_center_positioned_style_px() { 6919 - let _block; 6920 - let _pipe = get_window_dimensions_px(); 6921 - _block = echo(_pipe, undefined, "src/lumina_client/helpers.gleam", 51); 6922 - let $ = _block; 6923 - let window_w; 6924 - let window_h; 6925 - window_w = $[0]; 6926 - window_h = $[1]; 6927 - let x_int = globalThis.Math.trunc(window_h / 2); 6928 - let y_int = globalThis.Math.trunc(window_w / 2); 6929 - let x = identity(x_int); 6930 - let y = identity(y_int); 6931 - return [x, y]; 6932 - } 6933 - function echo(value2, message, file, line) { 6934 - const grey = "\x1B[90m"; 6935 - const reset_color = "\x1B[39m"; 6936 - const file_line = `${file}:${line}`; 6937 - const inspector = new Echo$Inspector; 6938 - const string_value = inspector.inspect(value2); 6939 - const string_message = message === undefined ? "" : " " + message; 6940 - if (globalThis.process?.stderr?.write) { 6941 - const string5 = `${grey}${file_line}${reset_color}${string_message} 6942 - ${string_value} 6943 - `; 6944 - globalThis.process.stderr.write(string5); 6945 - } else if (globalThis.Deno) { 6946 - const string5 = `${grey}${file_line}${reset_color}${string_message} 6947 - ${string_value} 6948 - `; 6949 - globalThis.Deno.stderr.writeSync(new TextEncoder().encode(string5)); 6950 - } else { 6951 - const string5 = `${file_line}${string_message} 6952 - ${string_value}`; 6953 - globalThis.console.log(string5); 6954 - } 6955 - return value2; 6956 - } 6957 - 6958 - class Echo$Inspector { 6959 - #references = new globalThis.Set; 6960 - #isDict(value2) { 6961 - try { 6962 - const empty_dict2 = new_map(); 6963 - const dict_class = empty_dict2.constructor; 6964 - return value2 instanceof dict_class; 6965 - } catch { 6966 - return false; 6967 - } 6968 - } 6969 - #float(float4) { 6970 - const string5 = float4.toString().replace("+", ""); 6971 - if (string5.indexOf(".") >= 0) { 6972 - return string5; 6973 - } else { 6974 - const index4 = string5.indexOf("e"); 6975 - if (index4 >= 0) { 6976 - return string5.slice(0, index4) + ".0" + string5.slice(index4); 6977 - } else { 6978 - return string5 + ".0"; 6979 - } 6980 - } 6981 - } 6982 - inspect(v) { 6983 - const t = typeof v; 6984 - if (v === true) 6985 - return "True"; 6986 - if (v === false) 6987 - return "False"; 6988 - if (v === null) 6989 - return "//js(null)"; 6990 - if (v === undefined) 6991 - return "Nil"; 6992 - if (t === "string") 6993 - return this.#string(v); 6994 - if (t === "bigint" || globalThis.Number.isInteger(v)) 6995 - return v.toString(); 6996 - if (t === "number") 6997 - return this.#float(v); 6998 - if (v instanceof UtfCodepoint) 6999 - return this.#utfCodepoint(v); 7000 - if (v instanceof BitArray) 7001 - return this.#bit_array(v); 7002 - if (v instanceof globalThis.RegExp) 7003 - return `//js(${v})`; 7004 - if (v instanceof globalThis.Date) 7005 - return `//js(Date("${v.toISOString()}"))`; 7006 - if (v instanceof globalThis.Error) 7007 - return `//js(${v.toString()})`; 7008 - if (v instanceof globalThis.Function) { 7009 - const args = []; 7010 - for (const i of globalThis.Array(v.length).keys()) 7011 - args.push(globalThis.String.fromCharCode(i + 97)); 7012 - return `//fn(${args.join(", ")}) { ... }`; 7013 - } 7014 - if (this.#references.size === this.#references.add(v).size) { 7015 - return "//js(circular reference)"; 7016 - } 7017 - let printed; 7018 - if (globalThis.Array.isArray(v)) { 7019 - printed = `#(${v.map((v2) => this.inspect(v2)).join(", ")})`; 7020 - } else if (v instanceof List) { 7021 - printed = this.#list(v); 7022 - } else if (v instanceof CustomType) { 7023 - printed = this.#customType(v); 7024 - } else if (this.#isDict(v)) { 7025 - printed = this.#dict(v); 7026 - } else if (v instanceof Set) { 7027 - return `//js(Set(${[...v].map((v2) => this.inspect(v2)).join(", ")}))`; 7028 - } else { 7029 - printed = this.#object(v); 7030 - } 7031 - this.#references.delete(v); 7032 - return printed; 7033 - } 7034 - #object(v) { 7035 - const name2 = globalThis.Object.getPrototypeOf(v)?.constructor?.name || "Object"; 7036 - const props = []; 7037 - for (const k of globalThis.Object.keys(v)) { 7038 - props.push(`${this.inspect(k)}: ${this.inspect(v[k])}`); 7039 - } 7040 - const body = props.length ? " " + props.join(", ") + " " : ""; 7041 - const head = name2 === "Object" ? "" : name2 + " "; 7042 - return `//js(${head}{${body}})`; 7043 - } 7044 - #dict(map5) { 7045 - let body = "dict.from_list(["; 7046 - let first2 = true; 7047 - let key_value_pairs = fold(map5, [], (pairs, key2, value2) => { 7048 - pairs.push([key2, value2]); 7049 - return pairs; 7050 - }); 7051 - key_value_pairs.sort(); 7052 - key_value_pairs.forEach(([key2, value2]) => { 7053 - if (!first2) 7054 - body = body + ", "; 7055 - body = body + "#(" + this.inspect(key2) + ", " + this.inspect(value2) + ")"; 7056 - first2 = false; 7057 - }); 7058 - return body + "])"; 7059 - } 7060 - #customType(record) { 7061 - const props = globalThis.Object.keys(record).map((label2) => { 7062 - const value2 = this.inspect(record[label2]); 7063 - return isNaN(parseInt(label2)) ? `${label2}: ${value2}` : value2; 7064 - }).join(", "); 7065 - return props ? `${record.constructor.name}(${props})` : record.constructor.name; 7066 - } 7067 - #list(list4) { 7068 - if (list4 instanceof Empty) { 7069 - return "[]"; 7070 - } 7071 - let char_out = 'charlist.from_string("'; 7072 - let list_out = "["; 7073 - let current = list4; 7074 - while (current instanceof NonEmpty) { 7075 - let element3 = current.head; 7076 - current = current.tail; 7077 - if (list_out !== "[") { 7078 - list_out += ", "; 7079 - } 7080 - list_out += this.inspect(element3); 7081 - if (char_out) { 7082 - if (globalThis.Number.isInteger(element3) && element3 >= 32 && element3 <= 126) { 7083 - char_out += globalThis.String.fromCharCode(element3); 7084 - } else { 7085 - char_out = null; 7086 - } 7087 - } 7088 - } 7089 - if (char_out) { 7090 - return char_out + '")'; 7091 - } else { 7092 - return list_out + "]"; 7093 - } 7094 - } 7095 - #string(str) { 7096 - let new_str = '"'; 7097 - for (let i = 0;i < str.length; i++) { 7098 - const char = str[i]; 7099 - switch (char) { 7100 - case ` 7101 - `: 7102 - new_str += "\\n"; 7103 - break; 7104 - case "\r": 7105 - new_str += "\\r"; 7106 - break; 7107 - case "\t": 7108 - new_str += "\\t"; 7109 - break; 7110 - case "\f": 7111 - new_str += "\\f"; 7112 - break; 7113 - case "\\": 7114 - new_str += "\\\\"; 7115 - break; 7116 - case '"': 7117 - new_str += "\\\""; 7118 - break; 7119 - default: 7120 - if (char < " " || char > "~" && char < " ") { 7121 - new_str += "\\u{" + char.charCodeAt(0).toString(16).toUpperCase().padStart(4, "0") + "}"; 7122 - } else { 7123 - new_str += char; 7124 - } 7125 - } 7126 - } 7127 - new_str += '"'; 7128 - return new_str; 7129 - } 7130 - #utfCodepoint(codepoint2) { 7131 - return `//utfcodepoint(${globalThis.String.fromCodePoint(codepoint2.value)})`; 7132 - } 7133 - #bit_array(bits) { 7134 - if (bits.bitSize === 0) { 7135 - return "<<>>"; 7136 - } 7137 - let acc = "<<"; 7138 - for (let i = 0;i < bits.byteSize - 1; i++) { 7139 - acc += bits.byteAt(i).toString(); 7140 - acc += ", "; 7141 - } 7142 - if (bits.byteSize * 8 === bits.bitSize) { 7143 - acc += bits.byteAt(bits.byteSize - 1).toString(); 7144 - } else { 7145 - const trailingBitsCount = bits.bitSize % 8; 7146 - acc += bits.byteAt(bits.byteSize - 1) >> 8 - trailingBitsCount; 7147 - acc += `:size(${trailingBitsCount})`; 7148 - } 7149 - acc += ">>"; 7150 - return acc; 7151 - } 7152 - } 7153 - 7154 - // build/dev/javascript/lustre/lustre/event.mjs 7155 - function is_immediate_event(name2) { 7156 - if (name2 === "input") { 7157 - return true; 7158 - } else if (name2 === "change") { 7159 - return true; 7160 - } else if (name2 === "focus") { 7161 - return true; 7162 - } else if (name2 === "focusin") { 7163 - return true; 7164 - } else if (name2 === "focusout") { 7165 - return true; 7166 - } else if (name2 === "blur") { 7167 - return true; 7168 - } else if (name2 === "select") { 7169 - return true; 7170 - } else { 7171 - return false; 7172 - } 7173 - } 7174 - function on(name2, handler) { 7175 - return event(name2, handler, empty_list, false, false, is_immediate_event(name2), new NoLimit(0)); 7176 - } 7177 - function prevent_default(event4) { 7178 - if (event4 instanceof Event2) { 7179 - return new Event2(event4.kind, event4.name, event4.handler, event4.include, true, event4.stop_propagation, event4.immediate, event4.limit); 7180 - } else { 7181 - return event4; 7182 - } 7183 - } 7184 - function on_click(msg) { 7185 - return on("click", success(msg)); 7186 - } 7187 - function on_mouse_down(msg) { 7188 - return on("mousedown", success(msg)); 7189 - } 7190 - function on_input(msg) { 7191 - return on("input", subfield(toList(["target", "value"]), string2, (value2) => { 7192 - return success(msg(value2)); 7193 - })); 7194 - } 7195 - function formdata_decoder() { 7196 - let string_value_decoder = field(0, string2, (key2) => { 7197 - return field(1, one_of(map4(string2, (var0) => { 7198 - return new Ok(var0); 7199 - }), toList([success(new Error(undefined))])), (value2) => { 7200 - let _pipe2 = value2; 7201 - let _pipe$12 = map3(_pipe2, (_capture) => { 7202 - return new$(key2, _capture); 7203 - }); 7204 - return success(_pipe$12); 7205 - }); 7206 - }); 7207 - let _pipe = string_value_decoder; 7208 - let _pipe$1 = list2(_pipe); 7209 - return map4(_pipe$1, values2); 7210 - } 7211 - function on_submit(msg) { 7212 - let _pipe = on("submit", subfield(toList(["detail", "formData"]), formdata_decoder(), (formdata) => { 7213 - let _pipe2 = formdata; 7214 - let _pipe$1 = msg(_pipe2); 7215 - return success(_pipe$1); 7216 - })); 7217 - return prevent_default(_pipe); 7218 - } 7219 - 7220 - // build/dev/javascript/lumina_client/lumina_client/view/common_view_parts.mjs 7221 - function common_view_parts(main_body, menuitems) { 7222 - return div(toList([class$("font-sans")]), toList([ 7223 - div(toList([ 7224 - class$("navbar bg-base-100 dark:bg-neutral-800 shadow-sm") 7225 - ]), toList([ 7226 - div(toList([class$("flex-none")]), toList([ 7227 - button(toList([class$("")]), toList([ 7228 - img(toList([ 7229 - src("/static/logo.svg"), 7230 - alt("Lumina logo"), 7231 - class$("h-8") 7232 - ])) 7233 - ])) 7234 - ])), 7235 - div(toList([class$("flex-1")]), toList([ 7236 - a(toList([class$("btn btn-ghost text-xl font-logo")]), toList([text2("Lumina")])) 7237 - ])), 7238 - div(toList([class$("flex-none")]), toList([ 7239 - ul(toList([ 7240 - class$("menu menu-horizontal px-1 font-menuitems") 7241 - ]), menuitems) 7242 - ])) 7243 - ])), 7244 - div(toList([ 7245 - class$("bg-base-200 h-screen max-h-[calc(100vh-4rem)]") 7246 - ]), main_body) 7247 - ])); 7248 - } 7249 - 7250 - // build/dev/javascript/lustre/lustre/element/svg.mjs 7251 - var namespace = "http://www.w3.org/2000/svg"; 7252 - function circle(attrs) { 7253 - return namespaced(namespace, "circle", attrs, empty_list); 7254 - } 7255 - function svg(attrs, children) { 7256 - return namespaced(namespace, "svg", attrs, children); 7257 - } 7258 - function path(attrs) { 7259 - return namespaced(namespace, "path", attrs, empty_list); 7260 - } 7261 - 7262 - // build/dev/javascript/lumina_client/lumina_client/view/common_view_parts/svgs.mjs 7263 - var sourcelist_solar_linear = /* @__PURE__ */ toList([ 7264 - [globe, "https://www.svgrepo.com/svg/524520/earth"], 7265 - [pen, "https://www.svgrepo.com/svg/524793/pen-2"], 7266 - [camera, "https://www.svgrepo.com/svg/524361/camera"], 7267 - [pen_paper, "https://www.svgrepo.com/svg/524800/pen-new-square"], 7268 - [hashtag_square, "https://www.svgrepo.com/svg/524621/hashtag-square"], 7269 - [add_square, "https://www.svgrepo.com/svg/524223/add-square"], 7270 - [archive_box, "https://www.svgrepo.com/svg/523982/archive"] 7271 - ]); 7272 - function globe(classes) { 7273 - return svg(toList([ 7274 - attribute2("xmlns", "http://www.w3.org/2000/svg"), 7275 - class$(classes), 7276 - attribute2("fill", "none"), 7277 - attribute2("viewBox", "0 0 24 24") 7278 - ]), toList([ 7279 - circle(toList([ 7280 - attribute2("stroke-width", "1.5"), 7281 - attribute2("stroke", "currentColor"), 7282 - attribute2("r", "10"), 7283 - attribute2("cy", "12"), 7284 - attribute2("cx", "12") 7285 - ])), 7286 - path(toList([ 7287 - attribute2("stroke-width", "1.5"), 7288 - attribute2("stroke", "currentColor"), 7289 - attribute2("d", "M6 4.71053C6.78024 5.42105 8.38755 7.36316 8.57481 9.44737C8.74984 11.3955 10.0357 12.9786 12 13C12.7549 13.0082 13.5183 12.4629 13.5164 11.708C13.5158 11.4745 13.4773 11.2358 13.417 11.0163C13.3331 10.7108 13.3257 10.3595 13.5 10C14.1099 8.74254 15.3094 8.40477 16.2599 7.72186C16.6814 7.41898 17.0659 7.09947 17.2355 6.84211C17.7037 6.13158 18.1718 4.71053 17.9377 4") 7290 - ])), 7291 - path(toList([ 7292 - attribute2("stroke-width", "1.5"), 7293 - attribute2("stroke", "currentColor"), 7294 - attribute2("d", "M22 13C21.6706 13.931 21.4375 16.375 17.7182 16.4138C17.7182 16.4138 14.4246 16.4138 13.4365 18.2759C12.646 19.7655 13.1071 21.3793 13.4365 22") 7295 - ])) 7296 - ])); 7297 - } 7298 - function follows(classes) { 7299 - return svg(toList([ 7300 - class$(classes), 7301 - attribute2("fill", "none"), 7302 - attribute2("stroke", "currentColor"), 7303 - attribute2("viewBox", "0 0 24 24"), 7304 - attribute2("xmlns", "http://www.w3.org/2000/svg") 7305 - ]), toList([ 7306 - circle(toList([ 7307 - attribute2("cx", "8"), 7308 - attribute2("cy", "8"), 7309 - attribute2("r", "3"), 7310 - attribute2("opacity", "0.6"), 7311 - attribute2("stroke-width", "2") 7312 - ])), 7313 - circle(toList([ 7314 - attribute2("cx", "16"), 7315 - attribute2("cy", "8"), 7316 - attribute2("r", "3"), 7317 - attribute2("opacity", "0.6"), 7318 - attribute2("stroke-width", "2") 7319 - ])), 7320 - path(toList([ 7321 - attribute2("stroke-width", "2"), 7322 - attribute2("stroke-linecap", "round"), 7323 - attribute2("opacity", "0.6"), 7324 - attribute2("stroke-linejoin", "round"), 7325 - attribute2("d", "M2 20v-1a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v1") 7326 - ])), 7327 - path(toList([ 7328 - attribute2("stroke-width", "2"), 7329 - attribute2("opacity", "0.6"), 7330 - attribute2("stroke-linecap", "round"), 7331 - attribute2("stroke-linejoin", "round"), 7332 - attribute2("d", "M14 20v-1a4 4 0 0 1 4-4h0a4 4 0 0 1 4 4v1") 7333 - ])) 7334 - ])); 7335 - } 7336 - function mutuals(classes) { 7337 - return svg(toList([ 7338 - class$(classes), 7339 - attribute2("fill", "none"), 7340 - attribute2("stroke", "currentColor"), 7341 - attribute2("viewBox", "0 0 24 24"), 7342 - attribute2("xmlns", "http://www.w3.org/2000/svg") 7343 - ]), toList([ 7344 - path(toList([ 7345 - attribute2("stroke-width", "2"), 7346 - attribute2("stroke-linecap", "round"), 7347 - attribute2("stroke-linejoin", "round"), 7348 - attribute2("d", "M9 19C5 15 2 12.5 2 9.5C2 7 4 5 6.5 5C8 5 9 6.5 9 6.5C9 6.5 10 5 11.5 5C14 5 16 7 16 9.5C16 12.5 13 15 9 19Z"), 7349 - attribute2("opacity", "0.6") 7350 - ])), 7351 - path(toList([ 7352 - attribute2("stroke-width", "2"), 7353 - attribute2("stroke-linecap", "round"), 7354 - attribute2("stroke-linejoin", "round"), 7355 - attribute2("d", "M15 4.5l2.09 4.24 4.68.68-3.39 3.3.8 4.63L15 15.77l-4.18 2.18.8-4.63-3.39-3.3 4.68-.68L15 4.5z"), 7356 - attribute2("opacity", "0.6") 7357 - ])) 7358 - ])); 7359 - } 7360 - function pen(classes) { 7361 - return svg(toList([ 7362 - attribute2("xmlns", "http://www.w3.org/2000/svg"), 7363 - attribute2("fill", "none"), 7364 - attribute2("viewBox", "0 0 24 24"), 7365 - class$(classes) 7366 - ]), toList([ 7367 - path(toList([ 7368 - attribute2("stroke-linecap", "round"), 7369 - attribute2("stroke-width", "1.5"), 7370 - attribute2("stroke", "currentColor"), 7371 - attribute2("d", "M4 22H20") 7372 - ])), 7373 - path(toList([ 7374 - attribute2("stroke-width", "1.5"), 7375 - attribute2("stroke", "currentColor"), 7376 - attribute2("d", "M13.8881 3.66293L14.6296 2.92142C15.8581 1.69286 17.85 1.69286 19.0786 2.92142C20.3071 4.14999 20.3071 6.14188 19.0786 7.37044L18.3371 8.11195M13.8881 3.66293C13.8881 3.66293 13.9807 5.23862 15.3711 6.62894C16.7614 8.01926 18.3371 8.11195 18.3371 8.11195M13.8881 3.66293L7.07106 10.4799C6.60933 10.9416 6.37846 11.1725 6.17992 11.4271C5.94571 11.7273 5.74491 12.0522 5.58107 12.396C5.44219 12.6874 5.33894 12.9972 5.13245 13.6167L4.25745 16.2417M18.3371 8.11195L11.5201 14.9289C11.0584 15.3907 10.8275 15.6215 10.5729 15.8201C10.2727 16.0543 9.94775 16.2551 9.60398 16.4189C9.31256 16.5578 9.00282 16.6611 8.38334 16.8675L5.75834 17.7426M5.75834 17.7426L5.11667 17.9564C4.81182 18.0581 4.47573 17.9787 4.2485 17.7515C4.02128 17.5243 3.94194 17.1882 4.04356 16.8833L4.25745 16.2417M5.75834 17.7426L4.25745 16.2417") 7377 - ])) 7378 - ])); 7379 - } 7380 - function camera(classes) { 7381 - return svg(toList([ 7382 - attribute2("xmlns", "http://www.w3.org/2000/svg"), 7383 - attribute2("fill", "none"), 7384 - attribute2("viewBox", "0 0 24 24"), 7385 - class$(classes) 7386 - ]), toList([ 7387 - circle(toList([ 7388 - attribute2("stroke-width", "1.5"), 7389 - attribute2("stroke", "currentColor"), 7390 - attribute2("r", "3"), 7391 - attribute2("cy", "13"), 7392 - attribute2("cx", "12") 7393 - ])), 7394 - path(toList([ 7395 - attribute2("stroke-width", "1.5"), 7396 - attribute2("stroke", "currentColor"), 7397 - attribute2("d", "M9.77778 21H14.2222C17.3433 21 18.9038 21 20.0248 20.2646C20.51 19.9462 20.9267 19.5371 21.251 19.0607C22 17.9601 22 16.4279 22 13.3636C22 10.2994 22 8.76721 21.251 7.6666C20.9267 7.19014 20.51 6.78104 20.0248 6.46268C19.3044 5.99013 18.4027 5.82123 17.022 5.76086C16.3631 5.76086 15.7959 5.27068 15.6667 4.63636C15.4728 3.68489 14.6219 3 13.6337 3H10.3663C9.37805 3 8.52715 3.68489 8.33333 4.63636C8.20412 5.27068 7.63685 5.76086 6.978 5.76086C5.59733 5.82123 4.69555 5.99013 3.97524 6.46268C3.48995 6.78104 3.07328 7.19014 2.74902 7.6666C2 8.76721 2 10.2994 2 13.3636C2 16.4279 2 17.9601 2.74902 19.0607C3.07328 19.5371 3.48995 19.9462 3.97524 20.2646C5.09624 21 6.65675 21 9.77778 21Z") 7398 - ])), 7399 - path(toList([ 7400 - attribute2("stroke-linecap", "round"), 7401 - attribute2("stroke-width", "1.5"), 7402 - attribute2("stroke", "currentColor"), 7403 - attribute2("d", "M19 10H18") 7404 - ])) 7405 - ])); 7406 - } 7407 - function pen_paper(classes) { 7408 - return svg(toList([ 7409 - attribute2("xmlns", "http://www.w3.org/2000/svg"), 7410 - attribute2("fill", "none"), 7411 - attribute2("viewBox", "0 0 24 24"), 7412 - class$(classes) 7413 - ]), toList([ 7414 - path(toList([ 7415 - attribute2("stroke-linecap", "round"), 7416 - attribute2("stroke-width", "1.5"), 7417 - attribute2("stroke", "currentColor"), 7418 - attribute2("d", "M22 10.5V12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2H13.5") 7419 - ])), 7420 - path(toList([ 7421 - attribute2("stroke-width", "1.5"), 7422 - attribute2("stroke", "currentColor"), 7423 - attribute2("d", "M16.652 3.45506L17.3009 2.80624C18.3759 1.73125 20.1188 1.73125 21.1938 2.80624C22.2687 3.88124 22.2687 5.62415 21.1938 6.69914L20.5449 7.34795M16.652 3.45506C16.652 3.45506 16.7331 4.83379 17.9497 6.05032C19.1662 7.26685 20.5449 7.34795 20.5449 7.34795M16.652 3.45506L10.6872 9.41993C10.2832 9.82394 10.0812 10.0259 9.90743 10.2487C9.70249 10.5114 9.52679 10.7957 9.38344 11.0965C9.26191 11.3515 9.17157 11.6225 8.99089 12.1646L8.41242 13.9M20.5449 7.34795L14.5801 13.3128C14.1761 13.7168 13.9741 13.9188 13.7513 14.0926C13.4886 14.2975 13.2043 14.4732 12.9035 14.6166C12.6485 14.7381 12.3775 14.8284 11.8354 15.0091L10.1 15.5876M10.1 15.5876L8.97709 15.9619C8.71035 16.0508 8.41626 15.9814 8.21744 15.7826C8.01862 15.5837 7.9492 15.2897 8.03811 15.0229L8.41242 13.9M10.1 15.5876L8.41242 13.9") 7424 - ])) 7425 - ])); 7426 - } 7427 - function hashtag_square(classes) { 7428 - return svg(toList([ 7429 - attribute2("xmlns", "http://www.w3.org/2000/svg"), 7430 - attribute2("fill", "none"), 7431 - attribute2("viewBox", "0 0 24 24"), 7432 - class$(classes) 7433 - ]), toList([ 7434 - path(toList([ 7435 - attribute2("stroke-linejoin", "round"), 7436 - attribute2("stroke-linecap", "round"), 7437 - attribute2("stroke-width", "1.5"), 7438 - attribute2("stroke", "currentColor"), 7439 - attribute2("d", "M11 7L8 17") 7440 - ])), 7441 - path(toList([ 7442 - attribute2("stroke-linejoin", "round"), 7443 - attribute2("stroke-linecap", "round"), 7444 - attribute2("stroke-width", "1.5"), 7445 - attribute2("stroke", "currentColor"), 7446 - attribute2("d", "M16 7L13 17") 7447 - ])), 7448 - path(toList([ 7449 - attribute2("stroke-linejoin", "round"), 7450 - attribute2("stroke-linecap", "round"), 7451 - attribute2("stroke-width", "1.5"), 7452 - attribute2("stroke", "currentColor"), 7453 - attribute2("d", "M18 10H7") 7454 - ])), 7455 - path(toList([ 7456 - attribute2("stroke-linejoin", "round"), 7457 - attribute2("stroke-linecap", "round"), 7458 - attribute2("stroke-width", "1.5"), 7459 - attribute2("stroke", "currentColor"), 7460 - attribute2("d", "M17 14H6") 7461 - ])), 7462 - path(toList([ 7463 - attribute2("stroke-width", "1.5"), 7464 - attribute2("stroke", "currentColor"), 7465 - attribute2("d", "M2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2C16.714 2 19.0711 2 20.5355 3.46447C22 4.92893 22 7.28595 22 12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12Z") 7466 - ])) 7467 - ])); 7468 - } 7469 - function add_square(classes) { 7470 - return svg(toList([ 7471 - attribute2("xmlns", "http://www.w3.org/2000/svg"), 7472 - attribute2("fill", "none"), 7473 - attribute2("viewBox", "0 0 24 24"), 7474 - class$(classes) 7475 - ]), toList([ 7476 - path(toList([ 7477 - attribute2("stroke-width", "1.5"), 7478 - attribute2("stroke", "currentColor"), 7479 - attribute2("d", "M2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2C16.714 2 19.0711 2 20.5355 3.46447C22 4.92893 22 7.28595 22 12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12Z") 7480 - ])), 7481 - path(toList([ 7482 - attribute2("stroke-linecap", "round"), 7483 - attribute2("stroke-width", "1.5"), 7484 - attribute2("stroke", "currentColor"), 7485 - attribute2("d", "M15 12L12 12M12 12L9 12M12 12L12 9M12 12L12 15") 7486 - ])) 7487 - ])); 7488 - } 7489 - function archive_box(classes) { 7490 - return svg(toList([ 7491 - attribute2("xmlns", "http://www.w3.org/2000/svg"), 7492 - attribute2("fill", "none"), 7493 - attribute2("viewBox", "0 0 24 24"), 7494 - class$(classes) 7495 - ]), toList([ 7496 - path(toList([ 7497 - attribute2("stroke-width", "1.5"), 7498 - attribute2("stroke", "currentColor"), 7499 - attribute2("d", "M9 12C9 11.5341 9 11.3011 9.07612 11.1173C9.17761 10.8723 9.37229 10.6776 9.61732 10.5761C9.80109 10.5 10.0341 10.5 10.5 10.5H13.5C13.9659 10.5 14.1989 10.5 14.3827 10.5761C14.6277 10.6776 14.8224 10.8723 14.9239 11.1173C15 11.3011 15 11.5341 15 12C15 12.4659 15 12.6989 14.9239 12.8827C14.8224 13.1277 14.6277 13.3224 14.3827 13.4239C14.1989 13.5 13.9659 13.5 13.5 13.5H10.5C10.0341 13.5 9.80109 13.5 9.61732 13.4239C9.37229 13.3224 9.17761 13.1277 9.07612 12.8827C9 12.6989 9 12.4659 9 12Z") 7500 - ])), 7501 - path(toList([ 7502 - attribute2("stroke-linecap", "round"), 7503 - attribute2("stroke-width", "1.5"), 7504 - attribute2("stroke", "currentColor"), 7505 - attribute2("d", "M20.5 7V13C20.5 16.7712 20.5 18.6569 19.3284 19.8284C18.1569 21 16.2712 21 12.5 21H11.5C7.72876 21 5.84315 21 4.67157 19.8284C3.5 18.6569 3.5 16.7712 3.5 13V7") 7506 - ])), 7507 - path(toList([ 7508 - attribute2("stroke-width", "1.5"), 7509 - attribute2("stroke", "currentColor"), 7510 - attribute2("d", "M2 5C2 4.05719 2 3.58579 2.29289 3.29289C2.58579 3 3.05719 3 4 3H20C20.9428 3 21.4142 3 21.7071 3.29289C22 3.58579 22 4.05719 22 5C22 5.94281 22 6.41421 21.7071 6.70711C21.4142 7 20.9428 7 20 7H4C3.05719 7 2.58579 7 2.29289 6.70711C2 6.41421 2 5.94281 2 5Z") 7511 - ])) 7512 - ])); 7513 - } 7514 - function sources_solar_linear() { 7515 - let _pipe = sourcelist_solar_linear; 7516 - return shuffle(_pipe); 7517 - } 7518 - 7519 - // build/dev/javascript/lumina_client/lumina_client/view/homepage/post_editor.mjs 7520 - function text_post_editor(params, _) { 7521 - return div(toList([]), toList([text3("This is the text post editor!")])); 7522 - } 7523 - function media_post_editor(params, _) { 7524 - return div(toList([]), toList([text3("This is the media post editor!")])); 7525 - } 7526 - function article_post_editor(params, _) { 7527 - return div(toList([]), toList([text3("This is the article post editor!")])); 7528 - } 7529 - function main2(params, model) { 7530 - return div(toList([class$("tabs tabs-lift h-full")]), toList([ 7531 - label(toList([class$("tab")]), toList([ 7532 - input(toList([ 7533 - name("editortypeswitch"), 7534 - type_("radio") 7535 - ])), 7536 - camera("class size-4 me-2"), 7537 - text3(" Snap ") 7538 - ])), 7539 - label(toList([class$("tab")]), toList([ 7540 - input(toList([ 7541 - name("editortypeswitch"), 7542 - type_("radio"), 7543 - checked(true) 7544 - ])), 7545 - pen("class size-4 me-2"), 7546 - text3(" Jot ") 7547 - ])), 7548 - div(toList([ 7549 - class$("tab-content bg-base-100 border-base-300 p-6") 7550 - ]), toList([text_post_editor(params, model)])), 7551 - div(toList([ 7552 - class$("tab-content bg-base-100 border-base-300 p-6") 7553 - ]), toList([media_post_editor(params, model)])), 7554 - label(toList([class$("tab")]), toList([ 7555 - input(toList([ 7556 - name("editortypeswitch"), 7557 - type_("radio") 7558 - ])), 7559 - pen_paper("class size-4 me-2"), 7560 - text3(" Compose ") 7561 - ])), 7562 - div(toList([ 7563 - class$("tab-content bg-base-100 border-base-300 p-6") 7564 - ]), toList([article_post_editor(params, model)])) 7565 - ])); 7566 - } 7567 - 7568 - // build/dev/javascript/lumina_client/lumina_client/view/homepage/posts.mjs 7569 - var FILEPATH = "src/lumina_client/view/homepage/posts.gleam"; 7570 - function element_from_id(model, post_id) { 7571 - let post = map_get(model.cache.cached_posts, post_id); 7572 - return div(toList([ 7573 - class$("flex flex-col gap-2 p-4 m-8 bg-base-300 text-base-300-content rounded-md w-full bg-opacity-25 font-content") 7574 - ]), (() => { 7575 - let _block; 7576 - if (post instanceof Ok) { 7577 - throw makeError("todo", FILEPATH, "lumina_client/view/homepage/posts", 41, "element_from_id", "Post rendering not yet implemented", {}); 7578 - } else { 7579 - _block = toList([ 7580 - p(toList([]), toList([ 7581 - text2("Loading post..."), 7582 - span(toList([ 7583 - class$("loading loading-spinner loading-md float-right") 7584 - ]), toList([])) 7585 - ])) 7586 - ]); 7587 - } 7588 - let _pipe = _block; 7589 - return append(_pipe, toList([ 7590 - small(toList([class$("opacity-50 text-xs font-script")]), toList([text2("ID:" + post_id)])) 7591 - ])); 7592 - })()); 7593 - } 7594 - 7595 - // build/dev/javascript/lumina_client/lumina_client/view/homepage.mjs 7596 - var FILEPATH2 = "src/lumina_client/view/homepage.gleam"; 7597 - 7598 - class Right extends CustomType { 7599 - } 7600 - class CentralBig extends CustomType { 7601 - constructor($0) { 7602 - super(); 7603 - this[0] = $0; 7604 - } 7605 - } 7606 - 7607 - class CentralSmall extends CustomType { 7608 - constructor(id2, title, containing, closeable, params) { 7609 - super(); 7610 - this.id = id2; 7611 - this.title = title; 7612 - this.containing = containing; 7613 - this.closeable = closeable; 7614 - this.params = params; 7615 - } 7616 - } 7617 - 7618 - class SideOrCentral extends CustomType { 7619 - constructor($0, $1) { 7620 - super(); 7621 - this[0] = $0; 7622 - this[1] = $1; 7623 - } 7624 - } 7625 - 7626 - class NoModal extends CustomType { 7627 - } 7628 - function closemodal_not_for_modal_box() { 7629 - return field("target", dynamic, (target2) => { 7630 - let $ = negate2(classfoundintree(target2, "modal-box")); 7631 - if ($) { 7632 - return success(new UserClosedModal); 7633 - } else { 7634 - return failure(new UserClosedModal, "Clicked inside modal-box, ignoring"); 7635 - } 7636 - }); 7637 - } 7638 - function get_all_posts(timeline) { 7639 - let _pipe = timeline.pages; 7640 - let _pipe$1 = map_to_list(_pipe); 7641 - let _pipe$2 = sort(_pipe$1, (a2, b) => { 7642 - let page_a; 7643 - page_a = a2[0]; 7644 - let page_b; 7645 - page_b = b[0]; 7646 - let $ = page_a < page_b; 7647 - if ($) { 7648 - return new Lt; 7649 - } else { 7650 - let $1 = page_a === page_b; 7651 - if ($1) { 7652 - return new Eq; 7653 - } else { 7654 - return new Gt; 7655 - } 7656 - } 7657 - }); 7658 - let _pipe$3 = map2(_pipe$2, (x) => { 7659 - let posts; 7660 - posts = x[1]; 7661 - return posts; 7662 - }); 7663 - return flatten(_pipe$3); 7664 - } 7665 - function timeline(model) { 7666 - let timeline_name; 7667 - let cache; 7668 - let $ = model.page; 7669 - if ($ instanceof HomeTimeline) { 7670 - cache = model.cache; 7671 - timeline_name = $.timeline_name; 7672 - } else { 7673 - throw makeError("let_assert", FILEPATH2, "lumina_client/view/homepage", 473, "timeline", "Pattern match failed, no pattern matched the value.", { 7674 - value: model, 7675 - start: 16385, 7676 - end: 16506, 7677 - pattern_start: 16396, 7678 - pattern_end: 16498 7679 - }); 7680 - } 7681 - let timeline_name$1 = unwrap(timeline_name, "global"); 7682 - let timeline_posts = map_get(cache.cached_timelines, timeline_name$1); 7683 - if (timeline_posts instanceof Ok) { 7684 - let cached_timeline = timeline_posts[0]; 7685 - let post_ids = get_all_posts(cached_timeline); 7686 - let show_load_more = cached_timeline.has_more; 7687 - return div(toList([class$("flex w-4/6 flex-col gap-4 items-start")]), (() => { 7688 - if (post_ids instanceof Empty) { 7689 - return toList([ 7690 - div(toList([class$("justify-center p-4")]), toList([ 7691 - text2("This timeline is empty! Make sure to fill it!") 7692 - ])) 7693 - ]); 7694 - } else { 7695 - let post_elements = map2(post_ids, (_capture) => { 7696 - return element_from_id(model, _capture); 7697 - }); 7698 - if (show_load_more) { 7699 - return append(post_elements, toList([ 7700 - div(toList([class$("flex justify-center p-4")]), toList([ 7701 - button(toList([ 7702 - class$("btn btn-primary font-menuitems"), 7703 - on_click(new LoadMorePosts(timeline_name$1)) 7704 - ]), toList([text2("Load More Posts")])) 7705 - ])) 7706 - ])); 7707 - } else { 7708 - return post_elements; 7709 - } 7710 - } 7711 - })()); 7712 - } else { 7713 - return div(toList([class$("flex w-4/6 flex-col gap-4 items-start")]), toList([ 7714 - text2('Loading timeline "' + timeline_name$1 + '" ...'), 7715 - div(toList([class$("skeleton h-32 w-full")]), toList([])), 7716 - div(toList([class$("skeleton h-4 w-28")]), toList([])), 7717 - div(toList([class$("skeleton h-4 w-full")]), toList([])), 7718 - div(toList([class$("skeleton h-32 w-full")]), toList([])), 7719 - div(toList([class$("skeleton h-4 w-28")]), toList([])), 7720 - div(toList([class$("skeleton h-4 w-full")]), toList([])), 7721 - div(toList([class$("skeleton h-4 w-full")]), toList([])), 7722 - div(toList([class$("skeleton h-32 w-full")]), toList([])), 7723 - div(toList([class$("skeleton h-4 w-28")]), toList([])), 7724 - div(toList([class$("skeleton h-4 w-full")]), toList([])), 7725 - div(toList([class$("skeleton h-32 w-full")]), toList([])), 7726 - div(toList([class$("skeleton h-4 w-28")]), toList([])), 7727 - div(toList([class$("skeleton h-4 w-full")]), toList([])), 7728 - text2("Skeleton should be remodeled after the actual post view later.") 7729 - ])); 7730 - } 7731 - } 7732 - function get_highest_cached_page(timeline2) { 7733 - let _pipe = timeline2.pages; 7734 - let _pipe$1 = keys(_pipe); 7735 - return fold2(_pipe$1, 0, (max2, page) => { 7736 - let $ = page > max2; 7737 - if ($) { 7738 - return page; 7739 - } else { 7740 - return max2; 7741 - } 7742 - }); 7743 - } 7744 - function get_cached_posts_count(timeline2) { 7745 - let _pipe = timeline2.pages; 7746 - let _pipe$1 = values(_pipe); 7747 - let _pipe$2 = map2(_pipe$1, length); 7748 - return fold2(_pipe$2, 0, (acc, count) => { 7749 - return acc + count; 7750 - }); 7751 - } 7752 - function should_load_more(timeline2, position, lookahead) { 7753 - let cached_count = get_cached_posts_count(timeline2); 7754 - let needs_more = position + lookahead >= cached_count; 7755 - return needs_more && timeline2.has_more; 7756 - } 7757 - function create_empty_timeline() { 7758 - return new CachedTimeline("", new_map(), 0, 0, false, 0); 7759 - } 7760 - function add_page_to_timeline(timeline2, tlid, page, posts, total_count, has_more) { 7761 - return new CachedTimeline(tlid, (() => { 7762 - let _pipe = timeline2.pages; 7763 - return insert(_pipe, page, posts); 7764 - })(), total_count, page, has_more, truncate(to_unix_seconds(system_time2()))); 7765 - } 7766 - function get_next_page_to_load(timeline2) { 7767 - let $ = timeline2.has_more; 7768 - if ($) { 7769 - let highest_page = get_highest_cached_page(timeline2); 7770 - return new Some(highest_page + 1); 7771 - } else { 7772 - return new None; 7773 - } 7774 - } 7775 - function timeline_info_string(timeline2, timeline_name) { 7776 - let cached_count = get_cached_posts_count(timeline2); 7777 - let highest_page = get_highest_cached_page(timeline2); 7778 - return "Timeline '" + timeline_name + "': " + to_string(cached_count) + "/" + to_string(timeline2.total_count) + " posts cached, pages 0-" + to_string(highest_page) + ", has_more: " + to_string3(timeline2.has_more); 7779 - } 7780 - function modal_by_id(f, model) { 7781 - let id2; 7782 - let params; 7783 - id2 = f[0]; 7784 - params = f[1]; 7785 - let user; 7786 - let $ = model.user; 7787 - if ($ instanceof Some) { 7788 - let $1 = model.page; 7789 - if ($1 instanceof HomeTimeline) { 7790 - user = $[0]; 7791 - } else { 7792 - throw makeError("let_assert", FILEPATH2, "lumina_client/view/homepage", 761, "modal_by_id", "Pattern match failed, no pattern matched the value.", { 7793 - value: model, 7794 - start: 24954, 7795 - end: 25094, 7796 - pattern_start: 24965, 7797 - pattern_end: 25079 7798 - }); 7799 - } 7800 - } else { 7801 - throw makeError("let_assert", FILEPATH2, "lumina_client/view/homepage", 761, "modal_by_id", "Pattern match failed, no pattern matched the value.", { 7802 - value: model, 7803 - start: 24954, 7804 - end: 25094, 7805 - pattern_start: 24965, 7806 - pattern_end: 25079 7807 - }); 7808 - } 7809 - if (id2 === "test") { 7810 - return new CentralBig(div(toList([]), toList([ 7811 - text2("Welcome to Lumina! This is a test modal screen.") 7812 - ]))); 7813 - } else if (id2 === "selfmenu") { 7814 - return new SideOrCentral(new Right, ul(toList([ 7815 - class$("menu menu-xl rounded-box w-2/3 justify-center text-center items-center space-y-4") 7816 - ]), toList([ 7817 - li(toList([class$("menu-title")]), toList([text2("Hi, @" + user.username)])), 7818 - li(toList([]), toList([text2("There's not much in this menu as of yet.")])), 7819 - li(toList([class$("md:hidden")]), toList([ 7820 - a(toList([ 7821 - class$("btn btn-info font-menuitems"), 7822 - on_click(new SetModal("selfsettings")) 7823 - ]), toList([text2("Settings")])) 7824 - ])), 7825 - li(toList([]), toList([ 7826 - a(toList([ 7827 - class$("btn btn-warn font-menuitems"), 7828 - on_click(new UserClickedLogout) 7829 - ]), toList([text2("Log out")])) 7830 - ])) 7831 - ]))); 7832 - } else if (id2 === "selfsettings") { 7833 - return new CentralBig(div(toList([]), toList([text2("User settings will be here eventually.")]))); 7834 - } else if (id2 === "mdl-postedit") { 7835 - return new CentralSmall("mdl-postedit", "New Post", main2(params, model), true, params); 7836 - } else { 7837 - return new NoModal; 7838 - } 7839 - } 7840 - function view(model) { 7841 - let timeline_name; 7842 - let modal; 7843 - let user; 7844 - let $ = model.page; 7845 - if ($ instanceof HomeTimeline) { 7846 - user = model.user; 7847 - timeline_name = $.timeline_name; 7848 - modal = $.modal; 7849 - } else { 7850 - throw makeError("let_assert", FILEPATH2, "lumina_client/view/homepage", 57, "view", "Pattern match failed, no pattern matched the value.", { 7851 - value: model, 7852 - start: 2141, 7853 - end: 2259, 7854 - pattern_start: 2152, 7855 - pattern_end: 2251 7856 - }); 7857 - } 7858 - return ((_capture) => { 7859 - return lazy_guard(is_some(user), _capture, () => { 7860 - return text2("Loading user..."); 7861 - }); 7862 - })(() => { 7863 - let user$1; 7864 - if (user instanceof Some) { 7865 - user$1 = user[0]; 7866 - } else { 7867 - throw makeError("let_assert", FILEPATH2, "lumina_client/view/homepage", 66, "view", "User must be logged in to see homepage, got None from model where a user-submodel was expected. (Got past a guard?)", { 7868 - value: user, 7869 - start: 2368, 7870 - end: 2396, 7871 - pattern_start: 2379, 7872 - pattern_end: 2389 7873 - }); 7874 - } 7875 - let timeline_name$1 = unwrap(timeline_name, "global"); 7876 - let _block; 7877 - let $1 = (() => { 7878 - let _pipe2 = modal; 7879 - let _pipe$1 = map(_pipe2, (_capture) => { 7880 - return modal_by_id(_capture, model); 7881 - }); 7882 - return unwrap(_pipe$1, new NoModal); 7883 - })(); 7884 - if ($1 instanceof CentralBig) { 7885 - let mod = $1[0]; 7886 - _block = div(toList([ 7887 - class$("modal modal-open fixed inset-0 flex items-center justify-center z-50 bg-black bg-opacity-50 w-screen h-screen"), 7888 - on("click", closemodal_not_for_modal_box()) 7889 - ]), toList([ 7890 - div(toList([ 7891 - class$("modal-box w-[99vw] lg:w-[80vw] max-w-[unset] h-[80lvh] flex flex-col justify-center items-center bg-base-100 shadow-2xl relative") 7892 - ]), toList([ 7893 - button(toList([ 7894 - class$("btn rounded-none rounded-bl-sm btn-error absolute top-0 right-0 text-2xl"), 7895 - on_click(new UserClosedModal) 7896 - ]), toList([text2("×")])), 7897 - mod, 7898 - div(toList([class$("modal-action")]), toList([])) 7899 - ])) 7900 - ])); 7901 - } else if ($1 instanceof CentralSmall) { 7902 - let id2 = $1.id; 7903 - let title = $1.title; 7904 - let mod = $1.containing; 7905 - let closable = $1.closeable; 7906 - let params = $1.params; 7907 - let def_x = get_center_positioned_style_px()[1]; 7908 - let def_y = get_center_positioned_style_px()[0]; 7909 - let set_x = map_get(params, "pos_x"); 7910 - let set_y = map_get(params, "pos_y"); 7911 - let _block$1; 7912 - if (set_x instanceof Ok) { 7913 - let v = set_x[0]; 7914 - let _pipe2 = parse_float(v); 7915 - _block$1 = unwrap2(_pipe2, def_x); 7916 - } else { 7917 - _block$1 = def_x; 7918 - } 7919 - let pos_x = _block$1; 7920 - let _block$2; 7921 - if (set_y instanceof Ok) { 7922 - let v = set_y[0]; 7923 - let _pipe2 = parse_float(v); 7924 - _block$2 = unwrap2(_pipe2, def_y); 7925 - } else { 7926 - _block$2 = def_y; 7927 - } 7928 - let pos_y = _block$2; 7929 - _block = div(toList([ 7930 - class$("modal modal-open fixed inset-0 flex items-center justify-center z-50 bg-black bg-opacity-50 w-screen h-screen"), 7931 - on("click", closemodal_not_for_modal_box()) 7932 - ]), toList([ 7933 - div(toList([ 7934 - id(id2), 7935 - class$("modal-box lg:freeroam flex flex-col justify-center items-center bg-base-100 shadow-2xl w-[99vw] lg:w-[32rem] max-w-[unset] lg:max-w-[99vw] h-[80lvh] lg:h-[80lvh] lg:max-h-[90vh] relative lg:absolute"), 7936 - style("--left", (() => { 7937 - let _pipe2 = pos_x; 7938 - return float_to_string(_pipe2); 7939 - })() + "px"), 7940 - style("--top", (() => { 7941 - let _pipe2 = pos_y; 7942 - return float_to_string(_pipe2); 7943 - })() + "px"), 7944 - style("--transform", "translate(-50%, -50%)") 7945 - ]), toList([ 7946 - section(toList([ 7947 - class$("w-full h-10 absolute top-0 left-0 bg-transparent cursor-move bg-info text-info-content rounded-t-xl flex items-center justify-center"), 7948 - on_mouse_down(new StartDraggingModalBox(pos_x, pos_y)) 7949 - ]), toList([text2(title)])), 7950 - (() => { 7951 - if (closable) { 7952 - return button(toList([ 7953 - class$("btn rounded-none rounded-bl-sm btn-error absolute top-0 right-0 text-2xl"), 7954 - on_click(new UserClosedModal) 7955 - ]), toList([text2("×")])); 7956 - } else { 7957 - return none3(); 7958 - } 7959 - })(), 7960 - div(toList([class$("w-full h-full mt-10")]), toList([mod])) 7961 - ])) 7962 - ])); 7963 - } else if ($1 instanceof SideOrCentral) { 7964 - let $2 = $1[0]; 7965 - if ($2 instanceof Right) { 7966 - let mod = $1[1]; 7967 - _block = div(toList([ 7968 - class$("modal modal-open fixed top-[4rem] right-0 left-0 bottom-0 flex items-end justify-end z-50 bg-black bg-opacity-50 w-screen max-h-[calc(100vh-4rem)]"), 7969 - on("click", closemodal_not_for_modal_box()) 7970 - ]), toList([ 7971 - div(toList([ 7972 - class$("modal-box w-[24rem] lg:max-h-[calc(100vh-4rem)] flex flex-col justify-start items-center bg-base-100 shadow-2xl relative rounded-xl md:max-h-[calc(100vh-4rem)] h-[60vh] max-h-[60vh] mb-[20vh]") 7973 - ]), toList([ 7974 - button(toList([ 7975 - class$("btn rounded-none rounded-bl-sm btn-error absolute top-0 right-0 text-2xl"), 7976 - on_click(new UserClosedModal) 7977 - ]), toList([text2("×")])), 7978 - mod, 7979 - div(toList([class$("modal-action")]), toList([])) 7980 - ])) 7981 - ])); 7982 - } else { 7983 - let mod = $1[1]; 7984 - _block = div(toList([ 7985 - class$("modal modal-open fixed top-[4rem] right-0 left-0 bottom-0 flex items-end justify-start z-50 bg-black bg-opacity-50 w-screen max-h-[calc(100vh-4rem)]"), 7986 - on("click", closemodal_not_for_modal_box()) 7987 - ]), toList([ 7988 - div(toList([ 7989 - class$("modal-box w-[24rem] lg:max-h-[calc(100vh-4rem)] flex flex-col justify-start items-center bg-base-100 shadow-2xl relative rounded-xl md:max-h-[calc(100vh-4rem)] h-[60vh] max-h-[60vh] mb-[20vh]") 7990 - ]), toList([ 7991 - button(toList([ 7992 - class$("btn btn-circle btn-error absolute top-4 right-4 text-2xl"), 7993 - on_click(new UserClosedModal) 7994 - ]), toList([text2("×")])), 7995 - mod, 7996 - div(toList([class$("modal-action")]), toList([])) 7997 - ])) 7998 - ])); 7999 - } 8000 - } else { 8001 - _block = div(toList([class$("items")]), toList([ 8002 - div(toList([class$("dock lg:hidden")]), toList([ 8003 - label(toList([ 8004 - class$("drawer-button"), 8005 - for$("timelineswitcher") 8006 - ]), toList([ 8007 - hashtag_square("size-[1.2em]"), 8008 - span(toList([class$("dock-label")]), toList([text3("Switch")])) 8009 - ])), 8010 - button(toList([ 8011 - class$(""), 8012 - on_click(new SetModal("mdl-postedit")) 8013 - ]), toList([ 8014 - add_square("size-[1.2em]"), 8015 - span(toList([class$("dock-label")]), toList([text3("Create")])) 8016 - ])), 8017 - button(toList([]), toList([ 8018 - div(toList([class$("indicator")]), toList([ 8019 - (() => { 8020 - let $2 = user$1.notifs.unread_count; 8021 - if ($2 === 0) { 8022 - return none3(); 8023 - } else { 8024 - let n = $2; 8025 - return span(toList([ 8026 - class$("indicator-item badge badge-secondary") 8027 - ]), toList([text3(to_string(n))])); 8028 - } 8029 - })(), 8030 - archive_box("size-[1.2em]") 8031 - ])), 8032 - span(toList([class$("dock-label")]), toList([text3("Notifications")])) 8033 - ])) 8034 - ])), 8035 - div(toList([ 8036 - class$("absolute bottom-4 right-4 p-4 z-50 hidden lg:block") 8037 - ]), toList([ 8038 - button(toList([ 8039 - class$("btn btn-circle btn-success btn-lg text-3xl"), 8040 - id("btn-new-post"), 8041 - on_click(new SetModal("mdl-postedit")) 8042 - ]), toList([text2("+")])) 8043 - ])), 8044 - div(toList([class$("fixed bottom-20 right-4 p-4 z-50 ")]), toList([])) 8045 - ])); 8046 - } 8047 - let modal_element = _block; 8048 - let _pipe = toList([ 8049 - modal_element, 8050 - div(toList([ 8051 - class$("drawer lg:drawer-open max-h-[calc(100vh-4rem)]") 8052 - ]), toList([ 8053 - input(toList([ 8054 - class$("drawer-toggle"), 8055 - type_("checkbox"), 8056 - id("timelineswitcher") 8057 - ])), 8058 - main(toList([ 8059 - class$("drawer-content items-center flex flex-col bg-neutral text-neutral-content h-screen max-h-[calc(100vh-4rem)] overflow-y-auto" + (() => { 8060 - let rn = system_time2(); 8061 - let $2 = to_calendar(rn, local_offset()); 8062 - let year; 8063 - let month; 8064 - let day; 8065 - year = $2[0].year; 8066 - month = $2[0].month; 8067 - day = $2[0].day; 8068 - return " " + ("yearclass-" + to_string(year)) + " " + (() => { 8069 - if (month instanceof January) { 8070 - return "monthclass-1"; 8071 - } else if (month instanceof February) { 8072 - return "monthclass-2"; 8073 - } else if (month instanceof March) { 8074 - return "monthclass-3"; 8075 - } else if (month instanceof April) { 8076 - return "monthclass-4"; 8077 - } else if (month instanceof May) { 8078 - return "monthclass-5"; 8079 - } else if (month instanceof June) { 8080 - return "monthclass-6"; 8081 - } else if (month instanceof July) { 8082 - return "monthclass-7"; 8083 - } else if (month instanceof August) { 8084 - return "monthclass-8"; 8085 - } else if (month instanceof September) { 8086 - return "monthclass-9"; 8087 - } else if (month instanceof October) { 8088 - return "monthclass-10"; 8089 - } else if (month instanceof November) { 8090 - return "monthclass-11"; 8091 - } else { 8092 - return "monthclass-12"; 8093 - } 8094 - })() + " " + ("dayclass-" + to_string(day)); 8095 - })()) 8096 - ]), toList([timeline(model)])), 8097 - div(toList([class$("drawer-side font-menuitems")]), toList([ 8098 - label(toList([ 8099 - class$("drawer-overlay"), 8100 - attribute2("aria-label", "close sidebar"), 8101 - for$("timelineswitcher") 8102 - ]), toList([])), 8103 - ul(toList([ 8104 - class$("menu bg-base-200 bg-opacity-75 text-base-content h-screen lg:max-h-[calc(100vh-4rem)] w-80 p-4") 8105 - ]), toList([ 8106 - li(toList([class$("menu-title font-sans")]), toList([text2("Timeline")])), 8107 - ul(toList([]), toList([ 8108 - li(toList([]), toList([ 8109 - a(toList([ 8110 - lazy_guard(timeline_name$1 === "global", () => { 8111 - return class$("menu-active"); 8112 - }, () => { 8113 - return none(); 8114 - }), 8115 - on_click(new UserSwitchedTimeLineTo("global")) 8116 - ]), toList([ 8117 - globe("inline h-5 w-5 mr-2"), 8118 - text2("Global") 8119 - ])) 8120 - ])), 8121 - li(toList([]), toList([ 8122 - a(toList([ 8123 - lazy_guard(timeline_name$1 === "following", () => { 8124 - return class$("menu-active"); 8125 - }, () => { 8126 - return none(); 8127 - }), 8128 - on_click(new UserSwitchedTimeLineTo("following")) 8129 - ]), toList([ 8130 - follows("inline h-5 w-5 mr-2"), 8131 - text2("Following") 8132 - ])) 8133 - ])), 8134 - li(toList([]), toList([ 8135 - a(toList([ 8136 - lazy_guard(timeline_name$1 === "mutuals", () => { 8137 - return class$("menu-active"); 8138 - }, () => { 8139 - return none(); 8140 - }), 8141 - on_click(new UserSwitchedTimeLineTo("mutuals")) 8142 - ]), toList([ 8143 - mutuals("inline h-5 w-5 mr-2"), 8144 - text2("Mutuals") 8145 - ])) 8146 - ])) 8147 - ])) 8148 - ])) 8149 - ])) 8150 - ])) 8151 - ]); 8152 - return common_view_parts(_pipe, toList([ 8153 - li(toList([ 8154 - class$("hidden md:flex"), 8155 - on_click(new SetModal("selfsettings")) 8156 - ]), toList([ 8157 - button(toList([class$("btn md:btn-neutral btn-ghost")]), toList([text2("Settings")])) 8158 - ])), 8159 - li(toList([]), toList([ 8160 - button(toList([ 8161 - class$("btn md:btn-neutral btn-ghost"), 8162 - on_click(new SetModal("selfmenu")) 8163 - ]), toList([ 8164 - span(toList([class$("hidden md:inline")]), toList([text2("@" + user$1.username)])), 8165 - div(toList([class$("avatar")]), toList([ 8166 - div(toList([class$("h-8 w-8 mask-squircle mask")]), toList([ 8167 - img(toList([ 8168 - src(user$1.avatar), 8169 - alt(user$1.username) 8170 - ])) 8171 - ])) 8172 - ])) 8173 - ])) 8174 - ])) 8175 - ])); 8176 - }); 8177 - } 8178 - 8179 - // build/dev/javascript/lumina_client/lumina_client/view.mjs 8180 - var FILEPATH3 = "src/lumina_client/view.gleam"; 8181 - function attributions() { 8182 - return div(toList([class$("overflow-y-auto max-h-[45vh]")]), toList([ 8183 - ul(toList([]), toList([ 8184 - li(toList([ 8185 - class$("card block bg-neutral p-4 mb-4 rounded-lg") 8186 - ]), toList([ 8187 - h4(toList([class$("text-lg font-bold mb-2")]), toList([text3("Icons from SVGrepo.com")])), 8188 - h5(toList([class$("text-[1.100rem] font-bold mb-2")]), toList([text3("Solar Linear icon set")])), 8189 - div(toList([class$("flex flex-row items-center w-full")]), (() => { 8190 - let _pipe = sources_solar_linear(); 8191 - return map2(_pipe, (am) => { 8192 - let svg_fn; 8193 - let link; 8194 - svg_fn = am[0]; 8195 - link = am[1]; 8196 - return a(toList([href(link)]), toList([svg_fn("w-6 h-6 me-2 hover:scale-110")])); 8197 - }); 8198 - })()), 8199 - text3("Vectors and icons by "), 8200 - a(toList([ 8201 - target("_blank"), 8202 - class$("link"), 8203 - href("https://www.figma.com/community/file/1166831539721848736?ref=svgrepo.com") 8204 - ]), toList([text3("Solar Icons")])), 8205 - text3(" in CC Attribution License via "), 8206 - a(toList([ 8207 - class$("link"), 8208 - target("_blank"), 8209 - href("https://www.svgrepo.com/") 8210 - ]), toList([text3("SVG Repo")])) 8211 - ])), 8212 - li(toList([ 8213 - class$("card block bg-neutral p-4 mb-4 rounded-lg") 8214 - ]), toList([ 8215 - h4(toList([class$("text-lg font-bold mb-2")]), toList([ 8216 - img(toList([ 8217 - src("https://gleam.run/images/lucy/lucy.svg"), 8218 - class$("inline-block w-5 h-auto ms-2 align-middle") 8219 - ])), 8220 - text3("Gleam") 8221 - ])), 8222 - text2("Much thanks to the "), 8223 - a(toList([ 8224 - href("https://gleam.run/"), 8225 - class$("link ") 8226 - ]), toList([text3("Gleam programming language")])), 8227 - text2(" and its community!") 8228 - ])), 8229 - li(toList([ 8230 - class$("card block bg-neutral p-4 mb-4 rounded-lg") 8231 - ]), toList([ 8232 - h4(toList([class$("text-lg font-bold mb-2")]), toList([text3("Fonts used")])), 8233 - ul(toList([class$("list-disc list-inside")]), toList([ 8234 - li(toList([]), toList([ 8235 - span(toList([]), toList([ 8236 - a(toList([ 8237 - href("https://fonts.google.com/specimen/Vend+Sans"), 8238 - class$("link font-sans") 8239 - ]), toList([text3("Vend Sans")])), 8240 - text2(" "), 8241 - span(toList([ 8242 - class$("badge badge-xs badge-soft badge-secondary text-xs") 8243 - ]), toList([text2("font-sans")])) 8244 - ])), 8245 - p(toList([class$("text-xs")]), toList([ 8246 - text2("Designed by Bloom Type Foundry and Baptiste Guesnon under SIL Open Font License.") 8247 - ])) 8248 - ])), 8249 - li(toList([]), toList([ 8250 - span(toList([]), toList([ 8251 - a(toList([ 8252 - href("https://fonts.google.com/specimen/Gantari"), 8253 - class$("link font-logo") 8254 - ]), toList([text3("Gantari")])), 8255 - text2(" "), 8256 - span(toList([ 8257 - class$("badge badge-xs badge-soft badge-secondary text-xs") 8258 - ]), toList([text2("font-logo")])) 8259 - ])), 8260 - p(toList([class$("text-xs")]), toList([text2("Designed by Lafontype")])) 8261 - ])), 8262 - li(toList([]), toList([ 8263 - span(toList([]), toList([ 8264 - a(toList([ 8265 - href("https://fonts.google.com/specimen/Elms+Sans"), 8266 - class$("link font-content") 8267 - ]), toList([text3("Elms Sans")])), 8268 - text2(" "), 8269 - span(toList([ 8270 - class$("badge badge-xs badge-soft badge-secondary text-xs") 8271 - ]), toList([text2("font-content")])) 8272 - ])), 8273 - p(toList([class$("text-xs")]), toList([ 8274 - text2("Designed by Amarachi Nwauwa under SIL Open Font License") 8275 - ])) 8276 - ])), 8277 - li(toList([]), toList([ 8278 - span(toList([]), toList([ 8279 - a(toList([ 8280 - href("https://fonts.google.com/specimen/Josefin+Sans"), 8281 - class$("link font-menuitems") 8282 - ]), toList([text3("Josefin Sans")])), 8283 - text2(" "), 8284 - span(toList([ 8285 - class$("badge badge-xs badge-soft badge-secondary text-xs") 8286 - ]), toList([text2("font-menuitems")])) 8287 - ])), 8288 - p(toList([class$("text-xs")]), toList([ 8289 - text2("Designed by Santiago Orozco under SIL Open Font License") 8290 - ])) 8291 - ])), 8292 - li(toList([]), toList([ 8293 - span(toList([]), toList([ 8294 - a(toList([ 8295 - href("https://fonts.google.com/specimen/DM+Mono"), 8296 - class$("link font-script") 8297 - ]), toList([text3("DM Mono")])), 8298 - text2(" "), 8299 - span(toList([ 8300 - class$("badge badge-xs badge-soft badge-secondary text-xs") 8301 - ]), toList([text2("font-script")])) 8302 - ])), 8303 - p(toList([class$("text-xs")]), toList([ 8304 - text2("Designed by Colophon Foundry under SIL Open Font License") 8305 - ])) 8306 - ])) 8307 - ])) 8308 - ])) 8309 - ])) 8310 - ])); 8311 - } 8312 - function view_landing() { 8313 - let _pipe = toList([ 8314 - div(toList([ 8315 - class$("hero h-screen max-h-[calc(100vh-4rem)] overflow-auto") 8316 - ]), toList([ 8317 - div(toList([class$("hero-content text-center")]), toList([ 8318 - div(toList([class$("max-w-md")]), toList([ 8319 - h1(toList([class$("text-5xl font-bold")]), toList([text2("Welcome to Lumina!")])), 8320 - p(toList([class$("py-6")]), toList([ 8321 - text2("This should be a nice landing page, but I don't know what to put here right now. Go away! Skram!") 8322 - ])), 8323 - button(toList([ 8324 - class$("btn btn-primary font-menuitems"), 8325 - on_click(new UserNavigatedToLoginPage) 8326 - ]), toList([text2("Login")])), 8327 - button(toList([ 8328 - class$("btn btn-secondary font-menuitems"), 8329 - on_click(new UserNavigatedToRegisterPage) 8330 - ]), toList([text2("Register")])) 8331 - ])) 8332 - ])) 8333 - ])), 8334 - input(toList([ 8335 - class$("modal-toggle"), 8336 - id("landing-attributions-show"), 8337 - type_("checkbox") 8338 - ])), 8339 - div(toList([role("dialog"), class$("modal")]), toList([ 8340 - div(toList([class$("modal-box max-h-[70VH] overflow-y-clip")]), toList([ 8341 - h3(toList([class$("text-lg font-bold")]), toList([text3("Attributions")])), 8342 - p(toList([class$("py-4")]), toList([attributions()])), 8343 - div(toList([class$("modal-action")]), toList([ 8344 - label(toList([ 8345 - class$("btn btn-error font-menuitems"), 8346 - for$("landing-attributions-show") 8347 - ]), toList([text3("Close")])) 8348 - ])) 8349 - ])) 8350 - ])), 8351 - footer(toList([ 8352 - class$("absolute footer footer-center p-4 bg-base-300 text-base-content bottom-0") 8353 - ]), toList([ 8354 - div(toList([]), toList([ 8355 - p(toList([]), toList([ 8356 - text2("The Lumina/Peonies project, by MLC 'Strawmelonjuice' Bloeiman and contributors. "), 8357 - a(toList([ 8358 - href("/licence"), 8359 - class$("link link-neutral-content") 8360 - ]), toList([ 8361 - text2("Licensed under the European Union Public Licence, with special notice for AI usage.") 8362 - ])), 8363 - text2(".") 8364 - ])), 8365 - p(toList([]), toList([ 8366 - text2("Also uses some CC-BY and other open-source assets, "), 8367 - label(toList([ 8368 - class$("link link-neutral-content"), 8369 - for$("landing-attributions-show") 8370 - ]), toList([text3("see attributions")])), 8371 - text2(".") 8372 - ])) 8373 - ])) 8374 - ])) 8375 - ]); 8376 - return common_view_parts(_pipe, toList([])); 8377 - } 8378 - function view_login(model) { 8379 - let $ = model.page; 8380 - let fieldvalues; 8381 - let successful; 8382 - if ($ instanceof Login) { 8383 - fieldvalues = $.fields; 8384 - successful = $.success; 8385 - } else { 8386 - throw makeError("let_assert", FILEPATH3, "lumina_client/view", 477, "view_login", "Pattern match failed, no pattern matched the value.", { 8387 - value: $, 8388 - start: 15758, 8389 - end: 15812, 8390 - pattern_start: 15769, 8391 - pattern_end: 15799 8392 - }); 8393 - } 8394 - let values_ok = login_view_checker(fieldvalues); 8395 - let _pipe = toList([ 8396 - div(toList([ 8397 - class$("hero h-screen max-h-[calc(100vh-4rem)] overflow-auto") 8398 - ]), toList([ 8399 - div(toList([ 8400 - class$("hero-content flex-col lg:flex-row-reverse") 8401 - ]), toList([ 8402 - div(toList([class$("text-center lg:text-left")]), toList([ 8403 - h1(toList([class$("text-5xl font-bold")]), toList([text2("Log in to Lumina!")])), 8404 - p(toList([class$("py-6")]), toList([ 8405 - text2("And we have boiling water. I REALLY don't know what to put here right now.") 8406 - ])) 8407 - ])), 8408 - div(toList([ 8409 - class$("card w-full max-w-sm shrink-0 shadow-2xl transition-colors bg-neutral") 8410 - ]), toList([ 8411 - form(toList([ 8412 - class$("card-body m-4 transition-[height] duration-300 ease-in-out transition"), 8413 - on_submit((var0) => { 8414 - return new UserSubmittedLogin(var0); 8415 - }) 8416 - ]), toList([ 8417 - fieldset(toList([class$("fieldset")]), toList([ 8418 - label(toList([class$("fieldset-label")]), toList([text2("Email or username")])), 8419 - input(toList([ 8420 - placeholder("me@mymail.com"), 8421 - class$("input input-primary bg-primary font-content"), 8422 - type_("text"), 8423 - value(fieldvalues.emailfield), 8424 - on_input((var0) => { 8425 - return new UserUpdatedControlledEmailField(var0); 8426 - }), 8427 - on("focusout", success(new EmailFieldLostFocus)) 8428 - ])), 8429 - label(toList([class$("fieldset-label")]), toList([text2("Password")])), 8430 - input(toList([ 8431 - value(fieldvalues.passwordfield), 8432 - on_input((var0) => { 8433 - return new UserUpdatedControlledPasswordField(var0); 8434 - }), 8435 - placeholder("Password"), 8436 - class$("input input-primary bg-primary font-content"), 8437 - type_("password") 8438 - ])), 8439 - div(toList([]), toList([ 8440 - a(toList([class$("link link-hover")]), toList([text2("Forgot password?")])) 8441 - ])), 8442 - (() => { 8443 - if (successful instanceof Some) { 8444 - let $1 = successful[0]; 8445 - if (!$1) { 8446 - return div(toList([ 8447 - class$("text-error-content bg-error p-3 rounded-lg") 8448 - ]), toList([ 8449 - text2("Incorrect password and/or username!") 8450 - ])); 8451 - } else { 8452 - return none3(); 8453 - } 8454 - } else { 8455 - return none3(); 8456 - } 8457 - })(), 8458 - button((() => { 8459 - if (values_ok) { 8460 - return toList([ 8461 - class$("btn btn-accent w-full mt-4 font-menuitems"), 8462 - type_("submit") 8463 - ]); 8464 - } else { 8465 - return toList([ 8466 - class$("btn btn-accent w-full mt-4 btn-disabled font-menuitems bg-accent hidden"), 8467 - disabled(true) 8468 - ]); 8469 - } 8470 - })(), toList([text2("Login")])) 8471 - ])) 8472 - ])) 8473 - ])) 8474 - ])) 8475 - ])) 8476 - ]); 8477 - return common_view_parts(_pipe, toList([ 8478 - li(toList([on_click(new UserNavigatedToLandingPage)]), toList([a(toList([]), toList([text2("Back")]))])), 8479 - li(toList([on_click(new UserNavigatedToRegisterPage)]), toList([a(toList([]), toList([text2("Register")]))])), 8480 - li(toList([on_click(new UserNavigatedToLoginPage)]), toList([ 8481 - a(toList([class$("bg-primary text-primary-content")]), toList([text2("Login")])) 8482 - ])) 8483 - ])); 8484 - } 8485 - function view_register(model_) { 8486 - let $ = model_.page; 8487 - let fieldvalues; 8488 - let ready; 8489 - if ($ instanceof Register) { 8490 - fieldvalues = $.fields; 8491 - ready = $.ready; 8492 - } else { 8493 - throw makeError("let_assert", FILEPATH3, "lumina_client/view", 604, "view_register", "Pattern match failed, no pattern matched the value.", { 8494 - value: $, 8495 - start: 20770, 8496 - end: 20840, 8497 - pattern_start: 20781, 8498 - pattern_end: 20809 8499 - }); 8500 - } 8501 - let _pipe = toList([ 8502 - div(toList([ 8503 - class$("hero h-screen max-h-[calc(100vh-4rem)] overflow-auto") 8504 - ]), toList([ 8505 - div(toList([ 8506 - class$("hero-content flex-col lg:flex-row-reverse") 8507 - ]), toList([ 8508 - div(toList([ 8509 - class$("card bg-neutral w-full max-w-sm shrink-0 shadow-2xl") 8510 - ]), toList([ 8511 - form(toList([ 8512 - class$("card-body m-4 delay-150 duration-300 ease-in-out transition-[height]"), 8513 - on_submit((var0) => { 8514 - return new UserSubmittedSignup(var0); 8515 - }) 8516 - ]), toList([ 8517 - fieldset(toList([class$("fieldset")]), toList([ 8518 - label(toList([class$("fieldset-label")]), toList([text2("Email")])), 8519 - input(toList([ 8520 - placeholder("Email"), 8521 - class$("input input-primary bg-primary font-content"), 8522 - type_("email"), 8523 - value(fieldvalues.emailfield), 8524 - on_input((var0) => { 8525 - return new UserUpdatedControlledEmailField(var0); 8526 - }) 8527 - ])), 8528 - label(toList([class$("fieldset-label")]), toList([text2("Username")])), 8529 - input(toList([ 8530 - placeholder("Username"), 8531 - class$("input input-primary bg-primary font-content"), 8532 - type_("string"), 8533 - value(fieldvalues.usernamefield), 8534 - on_input((var0) => { 8535 - return new UserUpdatedControlledUsernameField(var0); 8536 - }) 8537 - ])), 8538 - label(toList([class$("fieldset-label")]), toList([text2("Password")])), 8539 - input(toList([ 8540 - value(fieldvalues.passwordfield), 8541 - on_input((var0) => { 8542 - return new UserUpdatedControlledPasswordField(var0); 8543 - }), 8544 - placeholder("Password"), 8545 - class$("input input-primary bg-primary font-content"), 8546 - type_("password") 8547 - ])), 8548 - label(toList([class$("fieldset-label")]), toList([text2("Confirm Password")])), 8549 - input(toList([ 8550 - value(fieldvalues.passwordconfirmfield), 8551 - on_input((var0) => { 8552 - return new UserUpdatedControlledPasswordConfirmField(var0); 8553 - }), 8554 - placeholder("Re-type password"), 8555 - class$("input input-primary bg-primary font-content"), 8556 - type_("password") 8557 - ])), 8558 - (() => { 8559 - let $1 = (() => { 8560 - let _pipe2 = ready; 8561 - return is_some(_pipe2); 8562 - })() && (() => { 8563 - let _pipe2 = ready; 8564 - let _pipe$1 = unwrap(_pipe2, new Error("")); 8565 - return is_ok(_pipe$1); 8566 - })() && fieldvalues.passwordfield === fieldvalues.passwordconfirmfield; 8567 - if ($1) { 8568 - return button(toList([ 8569 - class$("btn btn-accent font-menuitems w-full m-0 p-0 mt-2"), 8570 - type_("submit") 8571 - ]), toList([ 8572 - text3((() => { 8573 - let $2 = (() => { 8574 - let _pipe2 = ready; 8575 - return is_some(_pipe2); 8576 - })() && (() => { 8577 - let _pipe2 = ready; 8578 - let _pipe$1 = unwrap(_pipe2, new Error("")); 8579 - return is_ok(_pipe$1); 8580 - })(); 8581 - if ($2) { 8582 - return "Sign up as " + fieldvalues.usernamefield; 8583 - } else { 8584 - return "Sign up"; 8585 - } 8586 - })()) 8587 - ])); 8588 - } else { 8589 - return div(toList([ 8590 - class$((() => { 8591 - let $2 = (() => { 8592 - let _pipe2 = ready; 8593 - return is_some(_pipe2); 8594 - })(); 8595 - if ($2) { 8596 - return "btn bg-base-200 hover:bg-base-200 text-warning-content font-menuitems w-full m-0 p-0 rounded-lg mt-2 opacity-80 hover:opacity-80 cursor-default no-animation disabled"; 8597 - } else { 8598 - return "hidden"; 8599 - } 8600 - })()) 8601 - ]), toList([ 8602 - (() => { 8603 - let $2 = (() => { 8604 - let _pipe2 = ready; 8605 - return unwrap(_pipe2, new Ok(undefined)); 8606 - })(); 8607 - let $3 = fieldvalues.passwordfield === fieldvalues.passwordconfirmfield; 8608 - if ($2 instanceof Ok) { 8609 - if ($3) { 8610 - return none3(); 8611 - } else { 8612 - return div(toList([class$("")]), toList([ 8613 - text2("Passwords don't match!") 8614 - ])); 8615 - } 8616 - } else { 8617 - let why = $2[0]; 8618 - return div(toList([class$("")]), toList([ 8619 - span(toList([]), (() => { 8620 - let $4 = contains_string(why, "in use"); 8621 - if ($4) { 8622 - return toList([ 8623 - text2(" " + why + ", do you want to "), 8624 - a(toList([ 8625 - on_click(new UserNavigatedToLoginPage), 8626 - class$("link link-primary") 8627 - ]), toList([ 8628 - text2("log in instead") 8629 - ])), 8630 - text2("?") 8631 - ]); 8632 - } else { 8633 - return toList([ 8634 - text2(" " + why) 8635 - ]); 8636 - } 8637 - })()) 8638 - ])); 8639 - } 8640 - })() 8641 - ])); 8642 - } 8643 - })() 8644 - ])) 8645 - ])) 8646 - ])), 8647 - div(toList([class$("text-center lg:text-left")]), toList([ 8648 - h1(toList([class$("text-5xl font-bold")]), toList([text2("Sign up for Lumina!")])), 8649 - p(toList([class$("py-6")]), toList([ 8650 - text2("We have real good food, I don't know what to put here right now.") 8651 - ])) 8652 - ])) 8653 - ])) 8654 - ])) 8655 - ]); 8656 - return common_view_parts(_pipe, toList([ 8657 - li(toList([on_click(new UserNavigatedToLandingPage)]), toList([a(toList([]), toList([text2("Back")]))])), 8658 - li(toList([on_click(new UserNavigatedToRegisterPage)]), toList([ 8659 - a(toList([class$("bg-primary text-primary-content")]), toList([text2("Register")])) 8660 - ])), 8661 - li(toList([on_click(new UserNavigatedToLoginPage)]), toList([a(toList([]), toList([text2("Login")]))])) 8662 - ])); 8663 - } 8664 - function view2(model) { 8665 - let $ = localStorage(); 8666 - let localstorage; 8667 - if ($ instanceof Ok) { 8668 - localstorage = $[0]; 8669 - } else { 8670 - throw makeError("let_assert", FILEPATH3, "lumina_client/view", 45, "view", "localstorage should be available on ALL major browsers.", { 8671 - value: $, 8672 - start: 1839, 8673 - end: 1884, 8674 - pattern_start: 1850, 8675 - pattern_end: 1866 8676 - }); 8677 - } 8678 - let $1 = setItem(localstorage, model_local_storage_key, serialize(model)); 8679 - let _block; 8680 - let $2 = model.page; 8681 - if ($2 instanceof Landing) { 8682 - _block = view_landing(); 8683 - } else if ($2 instanceof Register) { 8684 - _block = view_register(model); 8685 - } else if ($2 instanceof Login) { 8686 - _block = view_login(model); 8687 - } else if ($2 instanceof HomeTimeline) { 8688 - _block = view(model); 8689 - } else if ($2 instanceof Licence) { 8690 - throw makeError("todo", FILEPATH3, "lumina_client/view", 60, "view", "Licence should be shown by the client if it's not shown by the server.", {}); 8691 - } else { 8692 - let uri = $2.uri; 8693 - throw makeError("todo", FILEPATH3, "lumina_client/view", 58, "view", "No 404 page yet.", {}); 8694 - } 8695 - let content = _block; 8696 - return div(toList([ 8697 - get_color_scheme2(model), 8698 - class$("w-screen h-screen content") 8699 - ]), toList([ 8700 - (() => { 8701 - let $3 = model.ws; 8702 - if ($3 instanceof WsConnectionInitial) { 8703 - return div(toList([ 8704 - attribute2("open", ""), 8705 - class$("modal modal-bottom sm:modal-middle") 8706 - ]), toList([ 8707 - div(toList([class$("modal-box")]), toList([ 8708 - text2("Connecting to server..."), 8709 - div(toList([class$("float-right")]), toList([ 8710 - span(toList([ 8711 - class$("loading loading-spinner loading-xl") 8712 - ]), toList([])) 8713 - ])) 8714 - ])) 8715 - ])); 8716 - } else if ($3 instanceof WsConnectionConnected) { 8717 - return none3(); 8718 - } else if ($3 instanceof WsConnectionDisconnected) { 8719 - return div(toList([ 8720 - attribute2("open", ""), 8721 - class$("toast toast-top toast-center z-100") 8722 - ]), toList([ 8723 - div(toList([class$("alert alert-info")]), toList([ 8724 - text2("Connection to server ended! "), 8725 - button(toList([ 8726 - class$("btn btn-primary font-menuitems"), 8727 - on_click(new WSTryReconnect) 8728 - ]), toList([text2("Reconnect")])) 8729 - ])) 8730 - ])); 8731 - } else if ($3 instanceof WsConnectionUnsure) { 8732 - return none3(); 8733 - } else { 8734 - return div(toList([ 8735 - attribute2("open", ""), 8736 - class$("toast toast-top toast-center z-100") 8737 - ]), toList([ 8738 - div(toList([class$("alert alert-info")]), toList([ 8739 - text2("Connection to server ended! Reconnecting..."), 8740 - div(toList([class$("float-right")]), toList([ 8741 - span(toList([ 8742 - class$("loading loading-spinner loading-lg") 8743 - ]), toList([])) 8744 - ])) 8745 - ])) 8746 - ])); 8747 - } 8748 - })(), 8749 - content 8750 - ])); 8751 - } 8752 - 8753 - // build/dev/javascript/lumina_client/lumina_client.mjs 8754 - var FILEPATH4 = "src/lumina_client.gleam"; 8755 - 8756 - class Greeting extends CustomType { 8757 - constructor(greeting) { 8758 - super(); 8759 - this.greeting = greeting; 8760 - } 8761 - } 8762 - 8763 - class RegisterPrecheckResponse extends CustomType { 8764 - constructor(ok, why) { 8765 - super(); 8766 - this.ok = ok; 8767 - this.why = why; 8768 - } 8769 - } 8770 - 8771 - class AuthenticationSuccess extends CustomType { 8772 - constructor(username, token2) { 8773 - super(); 8774 - this.username = username; 8775 - this.token = token2; 8776 - } 8777 - } 8778 - 8779 - class AuthenticationFailure extends CustomType { 8780 - } 8781 - 8782 - class TimeLineResponse extends CustomType { 8783 - constructor(timeline_name, timeline_id, items, total_count, page, has_more) { 8784 - super(); 8785 - this.timeline_name = timeline_name; 8786 - this.timeline_id = timeline_id; 8787 - this.items = items; 8788 - this.total_count = total_count; 8789 - this.page = page; 8790 - this.has_more = has_more; 8791 - } 8792 - } 8793 - 8794 - class OwnUserInformationResponse extends CustomType { 8795 - constructor(username, email, avatar, uuid, unread_notifications) { 8796 - super(); 8797 - this.username = username; 8798 - this.email = email; 8799 - this.avatar = avatar; 8800 - this.uuid = uuid; 8801 - this.unread_notifications = unread_notifications; 8802 - } 8803 - } 8804 - 8805 - class Undecodable extends CustomType { 8806 - } 8807 - 8808 - class OwnUserInformationRequest extends CustomType { 8809 - } 8810 - 8811 - class LoginAuthenticationRequest extends CustomType { 8812 - constructor(email_username, password) { 8813 - super(); 8814 - this.email_username = email_username; 8815 - this.password = password; 8816 - } 8817 - } 8818 - 8819 - class RegisterRequest extends CustomType { 8820 - constructor(email, username, password) { 8821 - super(); 8822 - this.email = email; 8823 - this.username = username; 8824 - this.password = password; 8825 - } 8826 - } 8827 - 8828 - class TimeLineRequest extends CustomType { 8829 - constructor(timeline_name, page) { 8830 - super(); 8831 - this.timeline_name = timeline_name; 8832 - this.page = page; 8833 - } 8834 - } 8835 - 8836 - class RegisterPrecheck extends CustomType { 8837 - constructor(email, username, password) { 8838 - super(); 8839 - this.email = email; 8840 - this.username = username; 8841 - this.password = password; 8842 - } 8843 - } 8844 - 8845 - class PostContentRequest extends CustomType { 8846 - constructor(post_id) { 8847 - super(); 8848 - this.post_id = post_id; 8849 - } 8850 - } 8851 - function start_tracking_mouse_movements(x, y) { 8852 - return from((dispatcher) => { 8853 - return start_dragging_modal_box(x, y, (var0, var1) => { 8854 - return new MoveModalBoxTo(var0, var1); 8855 - }, dispatcher); 8856 - }); 8857 - } 8858 - function count_to_150() { 8859 - return from((dispatch) => { 8860 - return set_timeout_nilled(150, () => { 8861 - return dispatch(new EffectPast150ms); 8862 - }); 8863 - }); 8864 - } 8865 - function init2(rerun) { 8866 - let $ = localStorage(); 8867 - let localstorage; 8868 - if ($ instanceof Ok) { 8869 - localstorage = $[0]; 8870 - } else { 8871 - throw makeError("let_assert", FILEPATH4, "lumina_client", 115, "init", "localstorage should be available on ALL major browsers.", { 8872 - value: $, 8873 - start: 4002, 8874 - end: 4047, 8875 - pattern_start: 4013, 8876 - pattern_end: 4029 8877 - }); 8878 - } 8879 - let empty_model = new Model(new Landing, new None, new WsConnectionInitial, new None, new Ok(undefined), new Cached(new_map(), new_map(), new_map()), rerun, truncate(to_unix_seconds(system_time2()))); 8880 - return [ 8881 - (() => { 8882 - let $1 = getItem(localstorage, model_local_storage_key); 8883 - if ($1 instanceof Ok) { 8884 - let l = $1[0]; 8885 - let $2 = deserialize_serializable_model(l); 8886 - if ($2 instanceof Ok) { 8887 - let loadable_model = $2[0]; 8888 - return new Model(loadable_model.page, new None, (() => { 8889 - if (rerun) { 8890 - return new WsConnectionRetrying; 8891 - } else { 8892 - return new WsConnectionInitial; 8893 - } 8894 - })(), loadable_model.token, new Ok(undefined), new Cached(new_map(), new_map(), new_map()), rerun, truncate(to_unix_seconds(system_time2()))); 8895 - } else { 8896 - error("Could not deserialise last saved model."); 8897 - return empty_model; 8898 - } 8899 - } else { 8900 - log2("No model to restore"); 8901 - return empty_model; 8902 - } 8903 - })(), 8904 - batch(toList([ 8905 - init("/connection", (var0) => { 8906 - return new WebSocketIncomingMessage(var0); 8907 - }), 8908 - count_to_150() 8909 - ])) 8910 - ]; 8911 - } 8912 - function let_definitely_disconnect(model) { 8913 - return from((dispatch) => { 8914 - let $ = model.ws; 8915 - let $1 = model.has_been_running_for_150ms; 8916 - if ($1) { 8917 - if ($ instanceof WsConnectionInitial) { 8918 - return; 8919 - } else if ($ instanceof WsConnectionConnected) { 8920 - return; 8921 - } else if ($ instanceof WsConnectionDisconnected) { 8922 - return; 8923 - } else if ($ instanceof WsConnectionUnsure) { 8924 - return dispatch(new WsDisconnectDefinitive); 8925 - } else { 8926 - return; 8927 - } 8928 - } else if ($ instanceof WsConnectionInitial) { 8929 - return; 8930 - } else if ($ instanceof WsConnectionConnected) { 8931 - return; 8932 - } else if ($ instanceof WsConnectionDisconnected) { 8933 - return; 8934 - } else if ($ instanceof WsConnectionUnsure) { 8935 - return; 8936 - } else { 8937 - return; 8938 - } 8939 - }); 8940 - } 8941 - function encode_ws_msg(message) { 8942 - if (message instanceof OwnUserInformationRequest) { 8943 - return object2(toList([["type", string3("own_user_information_request")]])); 8944 - } else if (message instanceof LoginAuthenticationRequest) { 8945 - let email_username = message.email_username; 8946 - let password = message.password; 8947 - return object2(toList([ 8948 - ["type", string3("login_authentication_request")], 8949 - ["email_username", string3(email_username)], 8950 - ["password", string3(password)] 8951 - ])); 8952 - } else if (message instanceof RegisterRequest) { 8953 - let email = message.email; 8954 - let username = message.username; 8955 - let password = message.password; 8956 - return object2(toList([ 8957 - ["type", string3("register_request")], 8958 - ["email", string3(email)], 8959 - ["username", string3(username)], 8960 - ["password", string3(password)] 8961 - ])); 8962 - } else if (message instanceof TimeLineRequest) { 8963 - let timeline_name = message.timeline_name; 8964 - let page = message.page; 8965 - return object2(toList([ 8966 - ["type", string3("timeline_request")], 8967 - ["by_name", string3(timeline_name)], 8968 - ["page", int3(page)] 8969 - ])); 8970 - } else if (message instanceof RegisterPrecheck) { 8971 - let email = message.email; 8972 - let username = message.username; 8973 - let password = message.password; 8974 - return object2(toList([ 8975 - ["type", string3("register_precheck")], 8976 - ["email", string3(email)], 8977 - ["username", string3(username)], 8978 - ["password", string3(password)] 8979 - ])); 8980 - } else { 8981 - let post_id = message.post_id; 8982 - return object2(toList([ 8983 - ["type", string3("post_view_request")], 8984 - ["post_id", string3(post_id)] 8985 - ])); 8986 - } 8987 - } 8988 - function request_next_timeline_page(model, timeline_name) { 8989 - let $ = model.ws; 8990 - let socket; 8991 - if ($ instanceof WsConnectionConnected) { 8992 - socket = $[0]; 8993 - } else { 8994 - throw makeError("let_assert", FILEPATH4, "lumina_client", 83, "request_next_timeline_page", "Socket not connected", { 8995 - value: $, 8996 - start: 3053, 8997 - end: 3115, 8998 - pattern_start: 3064, 8999 - pattern_end: 3104 9000 - }); 9001 - } 9002 - let $1 = (() => { 9003 - let _pipe = model.cache.cached_timelines; 9004 - return map_get(_pipe, timeline_name); 9005 - })(); 9006 - if ($1 instanceof Ok) { 9007 - let timeline2 = $1[0]; 9008 - let $2 = get_next_page_to_load(timeline2); 9009 - if ($2 instanceof Some) { 9010 - let next_page = $2[0]; 9011 - let _pipe = new TimeLineRequest(timeline_name, next_page); 9012 - let _pipe$1 = encode_ws_msg(_pipe); 9013 - let _pipe$2 = to_string2(_pipe$1); 9014 - return ((_capture) => { 9015 - return send2(socket, _capture); 9016 - })(_pipe$2); 9017 - } else { 9018 - return none2(); 9019 - } 9020 - } else { 9021 - let _pipe = new TimeLineRequest(timeline_name, 0); 9022 - let _pipe$1 = encode_ws_msg(_pipe); 9023 - let _pipe$2 = to_string2(_pipe$1); 9024 - return ((_capture) => { 9025 - return send2(socket, _capture); 9026 - })(_pipe$2); 9027 - } 9028 - } 9029 - function ws_msg_decoder(variant) { 9030 - if (variant === "auth_success") { 9031 - return field("username", string2, (username) => { 9032 - return field("token", string2, (token2) => { 9033 - return success(new AuthenticationSuccess(username, token2)); 9034 - }); 9035 - }); 9036 - } else if (variant === "auth_failure") { 9037 - return success(new AuthenticationFailure); 9038 - } else if (variant === "unknown") { 9039 - return success(new Undecodable); 9040 - } else if (variant === "register_precheck_response") { 9041 - return field("ok", bool, (ok) => { 9042 - return field("why", string2, (why) => { 9043 - return success(new RegisterPrecheckResponse(ok, why)); 9044 - }); 9045 - }); 9046 - } else if (variant === "greeting") { 9047 - return field("greeting", string2, (greeting) => { 9048 - return success(new Greeting(greeting)); 9049 - }); 9050 - } else if (variant === "timeline_response") { 9051 - log2("Decoding timeline response: " + variant); 9052 - return field("timeline_name", string2, (timeline_name) => { 9053 - return field("timeline_id", string2, (timeline_id) => { 9054 - return field("post_ids", list2(string2), (items) => { 9055 - return field("total_count", int2, (total_count) => { 9056 - return field("page", int2, (page) => { 9057 - return field("has_more", bool, (has_more) => { 9058 - return success(new TimeLineResponse(timeline_name, timeline_id, items, total_count, page, has_more)); 9059 - }); 9060 - }); 9061 - }); 9062 - }); 9063 - }); 9064 - }); 9065 - } else if (variant === "own_user_information_response") { 9066 - return field("username", string2, (username) => { 9067 - return field("email", string2, (email) => { 9068 - return field("unread_notifications", int2, (unread_notifications) => { 9069 - return field("avatar", optional(list2(string2)), (avatar_list_opt) => { 9070 - let _block; 9071 - if (avatar_list_opt instanceof Some) { 9072 - let list4 = avatar_list_opt[0]; 9073 - if (list4 instanceof Empty) { 9074 - _block = new None; 9075 - } else { 9076 - let $ = list4.tail; 9077 - if ($ instanceof Empty) { 9078 - _block = new None; 9079 - } else { 9080 - let $1 = $.tail; 9081 - if ($1 instanceof Empty) { 9082 - let mime = list4.head; 9083 - let b64 = $.head; 9084 - _block = new Some([mime, b64]); 9085 - } else { 9086 - _block = new None; 9087 - } 9088 - } 9089 - } 9090 - } else { 9091 - _block = avatar_list_opt; 9092 - } 9093 - let avatar = _block; 9094 - return field("uuid", string2, (uuid) => { 9095 - return success(new OwnUserInformationResponse(username, email, avatar, uuid, unread_notifications)); 9096 - }); 9097 - }); 9098 - }); 9099 - }); 9100 - }); 9101 - } else { 9102 - let g = variant; 9103 - error("Unknown message type: " + g); 9104 - return failure(new Undecodable, g); 9105 - } 9106 - } 9107 - function ws_msg_typedefiner() { 9108 - return field("type", string2, (variant) => { 9109 - return success(variant); 9110 - }); 9111 - } 9112 - function session_destroy() { 9113 - info("Destroying session."); 9114 - let $ = localStorage(); 9115 - let s; 9116 - if ($ instanceof Ok) { 9117 - s = $[0]; 9118 - } else { 9119 - throw makeError("let_assert", FILEPATH4, "lumina_client", 1049, "session_destroy", "Pattern match failed, no pattern matched the value.", { 9120 - value: $, 9121 - start: 34306, 9122 - end: 34340, 9123 - pattern_start: 34317, 9124 - pattern_end: 34322 9125 - }); 9126 - } 9127 - clear(s); 9128 - info("Recreating model."); 9129 - return init2(false); 9130 - } 9131 - function update_ws(model, wsevent) { 9132 - echo2(wsevent, undefined, "src/lumina_client.gleam", 590); 9133 - if (wsevent instanceof InvalidUrl) { 9134 - throw makeError("panic", FILEPATH4, "lumina_client", 592, "update_ws", "`panic` expression evaluated.", {}); 9135 - } else if (wsevent instanceof OnOpen) { 9136 - let socket = wsevent[0]; 9137 - return [ 9138 - new Model(model.page, model.user, new WsConnectionConnected(socket), model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9139 - send2(socket, (() => { 9140 - let _block; 9141 - { 9142 - let x = toList([ 9143 - ["type", string3("introduction")], 9144 - ["client_kind", string3("web")] 9145 - ]); 9146 - _block = object2((() => { 9147 - let $ = model.user; 9148 - let $1 = model.token; 9149 - if ($ instanceof None && $1 instanceof Some) { 9150 - let token2 = $1[0]; 9151 - return append(x, toList([["try_revive", string3(token2)]])); 9152 - } else { 9153 - return x; 9154 - } 9155 - })()); 9156 - } 9157 - let _pipe = _block; 9158 - return to_string2(_pipe); 9159 - })()) 9160 - ]; 9161 - } else if (wsevent instanceof OnTextMessage) { 9162 - let notice = wsevent[0]; 9163 - let $ = parse(notice, ws_msg_decoder((() => { 9164 - let _pipe = parse(notice, ws_msg_typedefiner()); 9165 - return unwrap2(_pipe, "Unparsable message"); 9166 - })())); 9167 - if ($ instanceof Ok) { 9168 - let $1 = $[0]; 9169 - if ($1 instanceof Greeting) { 9170 - let m = $1.greeting; 9171 - log2("The server says hi! '" + m + "'"); 9172 - return [model, none2()]; 9173 - } else if ($1 instanceof RegisterPrecheckResponse) { 9174 - let ok = $1.ok; 9175 - let why = $1.why; 9176 - log2("Register precheck response: " + inspect2(ok)); 9177 - let _block; 9178 - let _block$1; 9179 - if (ok) { 9180 - _block$1 = new Ok(undefined); 9181 - } else { 9182 - _block$1 = new Error(why); 9183 - } 9184 - let _pipe = _block$1; 9185 - _block = new Some(_pipe); 9186 - let ready = _block; 9187 - let $2 = model.page; 9188 - if ($2 instanceof Register) { 9189 - let fields = $2.fields; 9190 - return [ 9191 - new Model(new Register(fields, ready), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9192 - none2() 9193 - ]; 9194 - } else { 9195 - return [model, none2()]; 9196 - } 9197 - } else if ($1 instanceof AuthenticationSuccess) { 9198 - let token2 = $1.token; 9199 - let $2 = model.ws; 9200 - let socket; 9201 - if ($2 instanceof WsConnectionConnected) { 9202 - socket = $2[0]; 9203 - } else { 9204 - throw makeError("let_assert", FILEPATH4, "lumina_client", 667, "update_ws", "Socket not connected", { 9205 - value: $2, 9206 - start: 21412, 9207 - end: 21474, 9208 - pattern_start: 21423, 9209 - pattern_end: 21463 9210 - }); 9211 - } 9212 - return [ 9213 - new Model(new HomeTimeline(new None, new None), model.user, model.ws, new Some(token2), model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9214 - batch(toList([ 9215 - (() => { 9216 - let _pipe = new OwnUserInformationRequest; 9217 - let _pipe$1 = encode_ws_msg(_pipe); 9218 - let _pipe$2 = to_string2(_pipe$1); 9219 - return ((_capture) => { 9220 - return send2(socket, _capture); 9221 - })(_pipe$2); 9222 - })(), 9223 - (() => { 9224 - let _pipe = new TimeLineRequest("global", 0); 9225 - let _pipe$1 = encode_ws_msg(_pipe); 9226 - let _pipe$2 = to_string2(_pipe$1); 9227 - return ((_capture) => { 9228 - return send2(socket, _capture); 9229 - })(_pipe$2); 9230 - })() 9231 - ])) 9232 - ]; 9233 - } else if ($1 instanceof AuthenticationFailure) { 9234 - let $2 = model.page; 9235 - if ($2 instanceof Landing) { 9236 - return session_destroy(); 9237 - } else if ($2 instanceof Register) { 9238 - return [model, none2()]; 9239 - } else if ($2 instanceof Login) { 9240 - let fields = $2.fields; 9241 - return [ 9242 - new Model(new Login(fields, new Some(false)), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9243 - none2() 9244 - ]; 9245 - } else if ($2 instanceof HomeTimeline) { 9246 - return session_destroy(); 9247 - } else if ($2 instanceof Licence) { 9248 - return session_destroy(); 9249 - } else { 9250 - return session_destroy(); 9251 - } 9252 - } else if ($1 instanceof TimeLineResponse) { 9253 - let timeline_name = $1.timeline_name; 9254 - let timeline_id = $1.timeline_id; 9255 - let items = $1.items; 9256 - let total_count = $1.total_count; 9257 - let page = $1.page; 9258 - let has_more = $1.has_more; 9259 - log2("Received timeline response for " + timeline_name + " (id: " + timeline_id + ")" + " with " + to_string(length(items)) + " items (page " + to_string(page) + " of " + to_string(total_count) + " total, has_more: " + to_string3(has_more) + ")."); 9260 - let $2 = model.ws; 9261 - let socket; 9262 - if ($2 instanceof WsConnectionConnected) { 9263 - socket = $2[0]; 9264 - } else { 9265 - throw makeError("let_assert", FILEPATH4, "lumina_client", 725, "update_ws", "Socket not connected", { 9266 - value: $2, 9267 - start: 23474, 9268 - end: 23536, 9269 - pattern_start: 23485, 9270 - pattern_end: 23525 9271 - }); 9272 - } 9273 - let posts_fetches = batch(map2(items, (post_id) => { 9274 - let _pipe2 = new PostContentRequest(post_id); 9275 - let _pipe$1 = encode_ws_msg(_pipe2); 9276 - let _pipe$2 = to_string2(_pipe$1); 9277 - return ((_capture) => { 9278 - return send2(socket, _capture); 9279 - })(_pipe$2); 9280 - })); 9281 - let _block; 9282 - let $3 = (() => { 9283 - let _pipe2 = model.cache.cached_timelines; 9284 - return map_get(_pipe2, timeline_name); 9285 - })(); 9286 - if ($3 instanceof Ok) { 9287 - let existing = $3[0]; 9288 - _block = add_page_to_timeline(existing, timeline_id, page, items, total_count, has_more); 9289 - } else { 9290 - let _pipe2 = create_empty_timeline(); 9291 - _block = add_page_to_timeline(_pipe2, timeline_id, page, items, total_count, has_more); 9292 - } 9293 - let cached_timeline = _block; 9294 - log2(timeline_info_string(cached_timeline, timeline_name)); 9295 - let _block$1; 9296 - let _pipe = model.cache.cached_timelines; 9297 - _block$1 = insert(_pipe, timeline_name, cached_timeline); 9298 - let cached_timelines = _block$1; 9299 - return [ 9300 - new Model(model.page, model.user, model.ws, model.token, model.status, (() => { 9301 - let _record = model.cache; 9302 - return new Cached(_record.cached_posts, _record.cached_users, cached_timelines); 9303 - })(), model.has_been_running_for_150ms, model.last_refresh_request_time), 9304 - posts_fetches 9305 - ]; 9306 - } else if ($1 instanceof OwnUserInformationResponse) { 9307 - let username = $1.username; 9308 - let email = $1.email; 9309 - let avatar = $1.avatar; 9310 - let uuid = $1.uuid; 9311 - let unread_notifications = $1.unread_notifications; 9312 - let _block; 9313 - if (avatar instanceof Some) { 9314 - let mime = avatar[0][0]; 9315 - let b64 = avatar[0][1]; 9316 - _block = "data:" + mime + ";base64," + b64; 9317 - } else { 9318 - _block = ""; 9319 - } 9320 - let avatar_string = _block; 9321 - let _block$1; 9322 - let _pipe = model.cache.cached_users; 9323 - _block$1 = insert(_pipe, uuid, new CachedUser("local", username, avatar_string, truncate(to_unix_seconds(system_time2())))); 9324 - let new_users = _block$1; 9325 - return [ 9326 - new Model(model.page, new Some(new UserSubmodel(uuid, username, email, avatar_string, new NotificationsSubModel(unread_notifications, toList([])))), model.ws, model.token, model.status, (() => { 9327 - let _record = model.cache; 9328 - return new Cached(_record.cached_posts, new_users, _record.cached_timelines); 9329 - })(), model.has_been_running_for_150ms, model.last_refresh_request_time), 9330 - none2() 9331 - ]; 9332 - } else { 9333 - throw makeError("panic", FILEPATH4, "lumina_client", 790, "update_ws", `Received message that was explicitly marked as undecodable, this should not happen 9334 - as the decoder should have returned an error instead of Undecodable. Check the decoder implementation and the logs 9335 - for the raw message.`, {}); 9336 - } 9337 - } else { 9338 - let err = $[0]; 9339 - error("Message could not be parsed:" + text_error_red(inspect2(err)) + ` 9340 - in: 9341 - ` + text_error_red(notice)); 9342 - return [model, none2()]; 9343 - } 9344 - } else if (wsevent instanceof OnBinaryMessage) { 9345 - let msg = wsevent[0]; 9346 - warn("Received unexpected: " + text_cyan(inspect2(msg))); 9347 - return [model, none2()]; 9348 - } else { 9349 - let reason = wsevent[0]; 9350 - warn("Given close reason: " + text_cyan((() => { 9351 - if (reason instanceof Normal) { 9352 - return "Normal close"; 9353 - } else if (reason instanceof GoingAway) { 9354 - return "Going away"; 9355 - } else if (reason instanceof ProtocolError) { 9356 - return "Protocol error"; 9357 - } else if (reason instanceof UnexpectedTypeOfData) { 9358 - return "Unexpected type of data"; 9359 - } else if (reason instanceof NoCodeFromServer) { 9360 - return "No code from server"; 9361 - } else if (reason instanceof AbnormalClose) { 9362 - return "Abnormal close (no close frame was received)"; 9363 - } else if (reason instanceof IncomprehensibleFrame) { 9364 - return "Incomprehensible frame"; 9365 - } else if (reason instanceof PolicyViolated) { 9366 - return "Policy violation"; 9367 - } else if (reason instanceof MessageTooBig) { 9368 - return "Message was too big"; 9369 - } else if (reason instanceof FailedExtensionNegotation) { 9370 - return "Failed extension negotation"; 9371 - } else if (reason instanceof UnexpectedFailure) { 9372 - return "Unexpected faillure"; 9373 - } else if (reason instanceof FailedTLSHandshake) { 9374 - return "Failed TLS handshake"; 9375 - } else { 9376 - return "Other close reason (unknown)"; 9377 - } 9378 - })())); 9379 - let $ = model.ws; 9380 - if ($ instanceof WsConnectionInitial) { 9381 - return [model, none2()]; 9382 - } else if ($ instanceof WsConnectionRetrying) { 9383 - return [ 9384 - new Model(model.page, model.user, new WsConnectionDisconnected, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9385 - none2() 9386 - ]; 9387 - } else { 9388 - let new_model = new Model(model.page, model.user, new WsConnectionUnsure, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time); 9389 - return [new_model, let_definitely_disconnect(new_model)]; 9390 - } 9391 - } 9392 - } 9393 - function update2(model, msg) { 9394 - if (msg instanceof WSTryReconnect) { 9395 - let $ = model.ws; 9396 - if ($ instanceof WsConnectionDisconnected) { 9397 - return init2(model.has_been_running_for_150ms); 9398 - } else { 9399 - return [model, none2()]; 9400 - } 9401 - } else if (msg instanceof EffectPast150ms) { 9402 - return [ 9403 - new Model(model.page, model.user, model.ws, model.token, model.status, model.cache, true, model.last_refresh_request_time), 9404 - none2() 9405 - ]; 9406 - } else if (msg instanceof UpdateLastRefreshRequestTime) { 9407 - let new_time = msg[0]; 9408 - return [ 9409 - new Model(model.page, model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, new_time), 9410 - none2() 9411 - ]; 9412 - } else if (msg instanceof WsDisconnectDefinitive) { 9413 - let timed_trigger_to_retry_connect = (h) => { 9414 - return from((dispatch) => { 9415 - return set_timeout_nilled(h, () => { 9416 - return dispatch(new WSTryReconnect); 9417 - }); 9418 - }); 9419 - }; 9420 - return [ 9421 - new Model(model.page, model.user, new WsConnectionDisconnected, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9422 - batch(toList([ 9423 - timed_trigger_to_retry_connect(1500), 9424 - timed_trigger_to_retry_connect(3000), 9425 - timed_trigger_to_retry_connect(6000), 9426 - timed_trigger_to_retry_connect(12000), 9427 - timed_trigger_to_retry_connect(24000) 9428 - ])) 9429 - ]; 9430 - } else if (msg instanceof WebSocketIncomingMessage) { 9431 - let event4 = msg[0]; 9432 - return update_ws(model, event4); 9433 - } else if (msg instanceof UserNavigatedToLoginPage) { 9434 - return [ 9435 - new Model(new Login(new LoginFields("", ""), new None), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9436 - none2() 9437 - ]; 9438 - } else if (msg instanceof UserNavigatedToRegisterPage) { 9439 - return [ 9440 - new Model(new Register(new RegisterPageFields("", "", "", ""), new None), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9441 - none2() 9442 - ]; 9443 - } else if (msg instanceof UserNavigatedToLandingPage) { 9444 - return [ 9445 - new Model(new Landing, model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9446 - none2() 9447 - ]; 9448 - } else if (msg instanceof UserSubmittedLogin) { 9449 - let $ = model.page; 9450 - let fields; 9451 - if ($ instanceof Login) { 9452 - fields = $.fields; 9453 - } else { 9454 - throw makeError("let_assert", FILEPATH4, "lumina_client", 445, "update", "Pattern match failed, no pattern matched the value.", { 9455 - value: $, 9456 - start: 14400, 9457 - end: 14440, 9458 - pattern_start: 14411, 9459 - pattern_end: 14427 9460 - }); 9461 - } 9462 - let values_ok = login_view_checker(fields); 9463 - if (values_ok) { 9464 - log2("Submitting login form"); 9465 - let _block; 9466 - let _pipe = encode_ws_msg(new LoginAuthenticationRequest(fields.emailfield, fields.passwordfield)); 9467 - _block = to_string2(_pipe); 9468 - let json2 = _block; 9469 - let $1 = model.ws; 9470 - let socket; 9471 - if ($1 instanceof WsConnectionConnected) { 9472 - socket = $1[0]; 9473 - } else { 9474 - throw makeError("let_assert", FILEPATH4, "lumina_client", 456, "update", "Socket not connected", { 9475 - value: $1, 9476 - start: 14779, 9477 - end: 14841, 9478 - pattern_start: 14790, 9479 - pattern_end: 14830 9480 - }); 9481 - } 9482 - return [ 9483 - new Model(model.page, model.user, new WsConnectionConnected(socket), model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9484 - send2(socket, json2) 9485 - ]; 9486 - } else { 9487 - error("Form not ready to submit"); 9488 - return [model, none2()]; 9489 - } 9490 - } else if (msg instanceof UserSubmittedSignup) { 9491 - let $ = model.page; 9492 - let fields; 9493 - let ready; 9494 - if ($ instanceof Register) { 9495 - fields = $.fields; 9496 - ready = $.ready; 9497 - } else { 9498 - throw makeError("let_assert", FILEPATH4, "lumina_client", 470, "update", "Pattern match failed, no pattern matched the value.", { 9499 - value: $, 9500 - start: 15205, 9501 - end: 15252, 9502 - pattern_start: 15216, 9503 - pattern_end: 15239 9504 - }); 9505 - } 9506 - let $1 = (() => { 9507 - let _pipe = ready; 9508 - return is_some(_pipe); 9509 - })() && (() => { 9510 - let _pipe = ready; 9511 - let _pipe$1 = unwrap(_pipe, new Error("")); 9512 - return is_ok(_pipe$1); 9513 - })() && fields.passwordfield === fields.passwordconfirmfield; 9514 - if ($1) { 9515 - log2("Submitting signup form"); 9516 - let _block; 9517 - let _pipe = encode_ws_msg(new RegisterRequest(fields.emailfield, fields.usernamefield, fields.passwordfield)); 9518 - _block = to_string2(_pipe); 9519 - let json2 = _block; 9520 - let $2 = model.ws; 9521 - let socket; 9522 - if ($2 instanceof WsConnectionConnected) { 9523 - socket = $2[0]; 9524 - } else { 9525 - throw makeError("let_assert", FILEPATH4, "lumina_client", 488, "update", "Socket not connected", { 9526 - value: $2, 9527 - start: 15763, 9528 - end: 15825, 9529 - pattern_start: 15774, 9530 - pattern_end: 15814 9531 - }); 9532 - } 9533 - return [ 9534 - new Model(model.page, model.user, new WsConnectionConnected(socket), model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9535 - send2(socket, json2) 9536 - ]; 9537 - } else { 9538 - error("Form not ready to submit"); 9539 - return [model, none2()]; 9540 - } 9541 - } else if (msg instanceof UserUpdatedControlledEmailField) { 9542 - let new_email = msg[0]; 9543 - let $ = model.page; 9544 - if ($ instanceof Register) { 9545 - let fields = $.fields; 9546 - let ready = $.ready; 9547 - return [ 9548 - new Model(new Register(new RegisterPageFields(fields.usernamefield, new_email, fields.passwordfield, fields.passwordconfirmfield), ready), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9549 - (() => { 9550 - let $1 = model.ws; 9551 - let socket; 9552 - if ($1 instanceof WsConnectionConnected) { 9553 - socket = $1[0]; 9554 - } else { 9555 - throw makeError("let_assert", FILEPATH4, "lumina_client", 266, "update", "Socket not connected", { 9556 - value: $1, 9557 - start: 8791, 9558 - end: 8853, 9559 - pattern_start: 8802, 9560 - pattern_end: 8842 9561 - }); 9562 - } 9563 - let _pipe = encode_ws_msg(new RegisterPrecheck(fields.emailfield, fields.usernamefield, fields.passwordfield)); 9564 - let _pipe$1 = to_string2(_pipe); 9565 - return ((_capture) => { 9566 - return send2(socket, _capture); 9567 - })(_pipe$1); 9568 - })() 9569 - ]; 9570 - } else if ($ instanceof Login) { 9571 - let fields = $.fields; 9572 - return [ 9573 - new Model(new Login(new LoginFields(new_email, fields.passwordfield), new None), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9574 - none2() 9575 - ]; 9576 - } else { 9577 - return [model, none2()]; 9578 - } 9579 - } else if (msg instanceof UserUpdatedControlledPasswordField) { 9580 - let new_password = msg[0]; 9581 - let $ = model.page; 9582 - if ($ instanceof Register) { 9583 - let fields = $.fields; 9584 - let ready = $.ready; 9585 - return [ 9586 - new Model(new Register(new RegisterPageFields(fields.usernamefield, fields.emailfield, new_password, fields.passwordconfirmfield), ready), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9587 - (() => { 9588 - let $1 = model.ws; 9589 - let socket; 9590 - if ($1 instanceof WsConnectionConnected) { 9591 - socket = $1[0]; 9592 - } else { 9593 - throw makeError("let_assert", FILEPATH4, "lumina_client", 302, "update", "Socket not connected", { 9594 - value: $1, 9595 - start: 9888, 9596 - end: 9950, 9597 - pattern_start: 9899, 9598 - pattern_end: 9939 9599 - }); 9600 - } 9601 - let _pipe = encode_ws_msg(new RegisterPrecheck(fields.emailfield, fields.usernamefield, fields.passwordfield)); 9602 - let _pipe$1 = to_string2(_pipe); 9603 - return ((_capture) => { 9604 - return send2(socket, _capture); 9605 - })(_pipe$1); 9606 - })() 9607 - ]; 9608 - } else if ($ instanceof Login) { 9609 - let fields = $.fields; 9610 - let _block; 9611 - let $1 = starts_with(fields.emailfield, "@"); 9612 - if ($1) { 9613 - _block = drop_start(fields.emailfield, 1); 9614 - } else { 9615 - _block = fields.emailfield; 9616 - } 9617 - let username_email = _block; 9618 - let _block$1; 9619 - let $2 = contains_string(username_email, "@"); 9620 - if ($2) { 9621 - _block$1 = username_email; 9622 - } else { 9623 - let _pipe = trim(username_email); 9624 - let _pipe$1 = replace(_pipe, " ", ""); 9625 - let _pipe$2 = lowercase(_pipe$1); 9626 - let _pipe$3 = replace(_pipe$2, "@", ""); 9627 - _block$1 = replace(_pipe$3, ".", ""); 9628 - } 9629 - let new_username_email = _block$1; 9630 - return [ 9631 - new Model(new Login(new LoginFields(new_username_email, new_password), new None), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9632 - none2() 9633 - ]; 9634 - } else { 9635 - return [model, none2()]; 9636 - } 9637 - } else if (msg instanceof UserUpdatedControlledUsernameField) { 9638 - let new_username = msg[0]; 9639 - let $ = model.page; 9640 - if ($ instanceof Register) { 9641 - let fields = $.fields; 9642 - let ready = $.ready; 9643 - return [ 9644 - new Model(new Register(new RegisterPageFields((() => { 9645 - let _block; 9646 - let $1 = starts_with(new_username, "@"); 9647 - if ($1) { 9648 - _block = drop_start(new_username, 1); 9649 - } else { 9650 - _block = new_username; 9651 - } 9652 - let _pipe = _block; 9653 - let _pipe$1 = trim(_pipe); 9654 - let _pipe$2 = replace(_pipe$1, " ", ""); 9655 - let _pipe$3 = lowercase(_pipe$2); 9656 - let _pipe$4 = replace(_pipe$3, "@", ""); 9657 - return replace(_pipe$4, ".", ""); 9658 - })(), fields.emailfield, fields.passwordfield, fields.passwordconfirmfield), ready), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9659 - (() => { 9660 - let $1 = model.ws; 9661 - let socket; 9662 - if ($1 instanceof WsConnectionConnected) { 9663 - socket = $1[0]; 9664 - } else { 9665 - throw makeError("let_assert", FILEPATH4, "lumina_client", 398, "update", "Socket not connected", { 9666 - value: $1, 9667 - start: 12985, 9668 - end: 13047, 9669 - pattern_start: 12996, 9670 - pattern_end: 13036 9671 - }); 9672 - } 9673 - let _pipe = encode_ws_msg(new RegisterPrecheck(fields.emailfield, fields.usernamefield, fields.passwordfield)); 9674 - let _pipe$1 = to_string2(_pipe); 9675 - return ((_capture) => { 9676 - return send2(socket, _capture); 9677 - })(_pipe$1); 9678 - })() 9679 - ]; 9680 - } else { 9681 - return [model, none2()]; 9682 - } 9683 - } else if (msg instanceof UserUpdatedControlledPasswordConfirmField) { 9684 - let new_password_confirmation = msg[0]; 9685 - let $ = model.page; 9686 - if ($ instanceof Register) { 9687 - let fields = $.fields; 9688 - let ready = $.ready; 9689 - return [ 9690 - new Model(new Register(new RegisterPageFields(fields.usernamefield, fields.emailfield, fields.passwordfield, new_password_confirmation), ready), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9691 - (() => { 9692 - let $1 = model.ws; 9693 - let socket; 9694 - if ($1 instanceof WsConnectionConnected) { 9695 - socket = $1[0]; 9696 - } else { 9697 - throw makeError("let_assert", FILEPATH4, "lumina_client", 363, "update", "Socket not connected", { 9698 - value: $1, 9699 - start: 11838, 9700 - end: 11900, 9701 - pattern_start: 11849, 9702 - pattern_end: 11889 9703 - }); 9704 - } 9705 - let _pipe = encode_ws_msg(new RegisterPrecheck(fields.emailfield, fields.usernamefield, fields.passwordfield)); 9706 - let _pipe$1 = to_string2(_pipe); 9707 - return ((_capture) => { 9708 - return send2(socket, _capture); 9709 - })(_pipe$1); 9710 - })() 9711 - ]; 9712 - } else { 9713 - return [model, none2()]; 9714 - } 9715 - } else if (msg instanceof EmailFieldLostFocus) { 9716 - let $ = model.page; 9717 - let fields; 9718 - if ($ instanceof Login) { 9719 - fields = $.fields; 9720 - } else { 9721 - throw makeError("let_assert", FILEPATH4, "lumina_client", 414, "update", "Pattern match failed, no pattern matched the value.", { 9722 - value: $, 9723 - start: 13539, 9724 - end: 13586, 9725 - pattern_start: 13550, 9726 - pattern_end: 13573 9727 - }); 9728 - } 9729 - let _block; 9730 - let $1 = starts_with(fields.emailfield, "@"); 9731 - if ($1) { 9732 - _block = drop_start(fields.emailfield, 1); 9733 - } else { 9734 - _block = fields.emailfield; 9735 - } 9736 - let value2 = _block; 9737 - let _block$1; 9738 - let $2 = contains_string(value2, "@"); 9739 - if ($2) { 9740 - _block$1 = value2; 9741 - } else { 9742 - let _pipe = trim(value2); 9743 - let _pipe$1 = replace(_pipe, " ", ""); 9744 - let _pipe$2 = lowercase(_pipe$1); 9745 - let _pipe$3 = replace(_pipe$2, "@", ""); 9746 - _block$1 = replace(_pipe$3, ".", ""); 9747 - } 9748 - let new_value = _block$1; 9749 - return [ 9750 - new Model(new Login(new LoginFields(new_value, fields.passwordfield), new None), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9751 - none2() 9752 - ]; 9753 - } else if (msg instanceof UserSwitchedTimeLineTo) { 9754 - let tid = msg[0]; 9755 - let $ = model.ws; 9756 - let socket; 9757 - if ($ instanceof WsConnectionConnected) { 9758 - socket = $[0]; 9759 - } else { 9760 - throw makeError("let_assert", FILEPATH4, "lumina_client", 502, "update", "Socket not connected", { 9761 - value: $, 9762 - start: 16205, 9763 - end: 16267, 9764 - pattern_start: 16216, 9765 - pattern_end: 16256 9766 - }); 9767 - } 9768 - let _block; 9769 - let $1 = model.page; 9770 - if ($1 instanceof HomeTimeline) { 9771 - let modal = $1.modal; 9772 - _block = new Model(new HomeTimeline(new Some(tid), modal), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time); 9773 - } else { 9774 - _block = model; 9775 - } 9776 - let model$1 = _block; 9777 - let _block$1; 9778 - let $2 = (() => { 9779 - let _pipe = model$1.cache.cached_timelines; 9780 - return map_get(_pipe, tid); 9781 - })(); 9782 - if ($2 instanceof Ok) { 9783 - let timeline2 = $2[0]; 9784 - let $3 = should_load_more(timeline2, 20, 10); 9785 - if ($3) { 9786 - let $4 = get_next_page_to_load(timeline2); 9787 - if ($4 instanceof Some) { 9788 - let next_page = $4[0]; 9789 - let _pipe = new TimeLineRequest(tid, next_page); 9790 - let _pipe$1 = encode_ws_msg(_pipe); 9791 - let _pipe$2 = to_string2(_pipe$1); 9792 - _block$1 = ((_capture) => { 9793 - return send2(socket, _capture); 9794 - })(_pipe$2); 9795 - } else { 9796 - _block$1 = none2(); 9797 - } 9798 - } else { 9799 - _block$1 = none2(); 9800 - } 9801 - } else { 9802 - let _pipe = new TimeLineRequest(tid, 0); 9803 - let _pipe$1 = encode_ws_msg(_pipe); 9804 - let _pipe$2 = to_string2(_pipe$1); 9805 - _block$1 = ((_capture) => { 9806 - return send2(socket, _capture); 9807 - })(_pipe$2); 9808 - } 9809 - let requ = _block$1; 9810 - return [model$1, requ]; 9811 - } else if (msg instanceof LoadMorePosts) { 9812 - let timeline_name = msg[0]; 9813 - let effect = request_next_timeline_page(model, timeline_name); 9814 - return [model, effect]; 9815 - } else if (msg instanceof UserClickedLogout) { 9816 - return session_destroy(); 9817 - } else if (msg instanceof UserClosedModal) { 9818 - let $ = model.page; 9819 - if ($ instanceof HomeTimeline) { 9820 - let timeline_name = $.timeline_name; 9821 - return [ 9822 - new Model(new HomeTimeline(timeline_name, new None), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9823 - none2() 9824 - ]; 9825 - } else { 9826 - return [model, none2()]; 9827 - } 9828 - } else if (msg instanceof SetModal) { 9829 - let to = msg[0]; 9830 - let $ = model.page; 9831 - if ($ instanceof HomeTimeline) { 9832 - let timeline_name = $.timeline_name; 9833 - return [ 9834 - new Model(new HomeTimeline(timeline_name, new Some([to, new_map()])), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9835 - none2() 9836 - ]; 9837 - } else { 9838 - return [model, none2()]; 9839 - } 9840 - } else if (msg instanceof StartDraggingModalBox) { 9841 - let x = msg[0]; 9842 - let y = msg[1]; 9843 - return [model, start_tracking_mouse_movements(x, y)]; 9844 - } else { 9845 - let x = msg[0]; 9846 - let y = msg[1]; 9847 - let $ = model.page; 9848 - if ($ instanceof HomeTimeline) { 9849 - let $1 = $.modal; 9850 - if ($1 instanceof Some) { 9851 - let $2 = $1[0][0]; 9852 - if ($2 === "mdl-postedit") { 9853 - let timeline_name = $.timeline_name; 9854 - let params = $1[0][1]; 9855 - let _block; 9856 - let _pipe = params; 9857 - let _pipe$1 = insert(_pipe, "pos_x", float_to_string(x)); 9858 - _block = insert(_pipe$1, "pos_y", float_to_string(y)); 9859 - let new_params = _block; 9860 - return [ 9861 - new Model(new HomeTimeline(timeline_name, new Some(["mdl-postedit", new_params])), model.user, model.ws, model.token, model.status, model.cache, model.has_been_running_for_150ms, model.last_refresh_request_time), 9862 - none2() 9863 - ]; 9864 - } else { 9865 - return [model, none2()]; 9866 - } 9867 - } else { 9868 - return [model, none2()]; 9869 - } 9870 - } else { 9871 - return [model, none2()]; 9872 - } 9873 - } 9874 - } 9875 - function main3() { 9876 - let app = application(init2, update2, view2); 9877 - let $ = start3(app, "#app", false); 9878 - if (!($ instanceof Ok)) { 9879 - throw makeError("let_assert", FILEPATH4, "lumina_client", 109, "main", "Pattern match failed, no pattern matched the value.", { 9880 - value: $, 9881 - start: 3815, 9882 - end: 3866, 9883 - pattern_start: 3826, 9884 - pattern_end: 3831 9885 - }); 9886 - } 9887 - return $; 9888 - } 9889 - function echo2(value2, message, file, line) { 9890 - const grey = "\x1B[90m"; 9891 - const reset_color = "\x1B[39m"; 9892 - const file_line = `${file}:${line}`; 9893 - const inspector = new Echo$Inspector2; 9894 - const string_value = inspector.inspect(value2); 9895 - const string_message = message === undefined ? "" : " " + message; 9896 - if (globalThis.process?.stderr?.write) { 9897 - const string5 = `${grey}${file_line}${reset_color}${string_message} 9898 - ${string_value} 9899 - `; 9900 - globalThis.process.stderr.write(string5); 9901 - } else if (globalThis.Deno) { 9902 - const string5 = `${grey}${file_line}${reset_color}${string_message} 9903 - ${string_value} 9904 - `; 9905 - globalThis.Deno.stderr.writeSync(new TextEncoder().encode(string5)); 9906 - } else { 9907 - const string5 = `${file_line}${string_message} 9908 - ${string_value}`; 9909 - globalThis.console.log(string5); 9910 - } 9911 - return value2; 9912 - } 9913 - 9914 - class Echo$Inspector2 { 9915 - #references = new globalThis.Set; 9916 - #isDict(value2) { 9917 - try { 9918 - const empty_dict2 = new_map(); 9919 - const dict_class = empty_dict2.constructor; 9920 - return value2 instanceof dict_class; 9921 - } catch { 9922 - return false; 9923 - } 9924 - } 9925 - #float(float4) { 9926 - const string5 = float4.toString().replace("+", ""); 9927 - if (string5.indexOf(".") >= 0) { 9928 - return string5; 9929 - } else { 9930 - const index4 = string5.indexOf("e"); 9931 - if (index4 >= 0) { 9932 - return string5.slice(0, index4) + ".0" + string5.slice(index4); 9933 - } else { 9934 - return string5 + ".0"; 9935 - } 9936 - } 9937 - } 9938 - inspect(v) { 9939 - const t = typeof v; 9940 - if (v === true) 9941 - return "True"; 9942 - if (v === false) 9943 - return "False"; 9944 - if (v === null) 9945 - return "//js(null)"; 9946 - if (v === undefined) 9947 - return "Nil"; 9948 - if (t === "string") 9949 - return this.#string(v); 9950 - if (t === "bigint" || globalThis.Number.isInteger(v)) 9951 - return v.toString(); 9952 - if (t === "number") 9953 - return this.#float(v); 9954 - if (v instanceof UtfCodepoint) 9955 - return this.#utfCodepoint(v); 9956 - if (v instanceof BitArray) 9957 - return this.#bit_array(v); 9958 - if (v instanceof globalThis.RegExp) 9959 - return `//js(${v})`; 9960 - if (v instanceof globalThis.Date) 9961 - return `//js(Date("${v.toISOString()}"))`; 9962 - if (v instanceof globalThis.Error) 9963 - return `//js(${v.toString()})`; 9964 - if (v instanceof globalThis.Function) { 9965 - const args = []; 9966 - for (const i of globalThis.Array(v.length).keys()) 9967 - args.push(globalThis.String.fromCharCode(i + 97)); 9968 - return `//fn(${args.join(", ")}) { ... }`; 9969 - } 9970 - if (this.#references.size === this.#references.add(v).size) { 9971 - return "//js(circular reference)"; 9972 - } 9973 - let printed; 9974 - if (globalThis.Array.isArray(v)) { 9975 - printed = `#(${v.map((v2) => this.inspect(v2)).join(", ")})`; 9976 - } else if (v instanceof List) { 9977 - printed = this.#list(v); 9978 - } else if (v instanceof CustomType) { 9979 - printed = this.#customType(v); 9980 - } else if (this.#isDict(v)) { 9981 - printed = this.#dict(v); 9982 - } else if (v instanceof Set) { 9983 - return `//js(Set(${[...v].map((v2) => this.inspect(v2)).join(", ")}))`; 9984 - } else { 9985 - printed = this.#object(v); 9986 - } 9987 - this.#references.delete(v); 9988 - return printed; 9989 - } 9990 - #object(v) { 9991 - const name2 = globalThis.Object.getPrototypeOf(v)?.constructor?.name || "Object"; 9992 - const props = []; 9993 - for (const k of globalThis.Object.keys(v)) { 9994 - props.push(`${this.inspect(k)}: ${this.inspect(v[k])}`); 9995 - } 9996 - const body = props.length ? " " + props.join(", ") + " " : ""; 9997 - const head = name2 === "Object" ? "" : name2 + " "; 9998 - return `//js(${head}{${body}})`; 9999 - } 10000 - #dict(map5) { 10001 - let body = "dict.from_list(["; 10002 - let first2 = true; 10003 - let key_value_pairs = fold(map5, [], (pairs, key2, value2) => { 10004 - pairs.push([key2, value2]); 10005 - return pairs; 10006 - }); 10007 - key_value_pairs.sort(); 10008 - key_value_pairs.forEach(([key2, value2]) => { 10009 - if (!first2) 10010 - body = body + ", "; 10011 - body = body + "#(" + this.inspect(key2) + ", " + this.inspect(value2) + ")"; 10012 - first2 = false; 10013 - }); 10014 - return body + "])"; 10015 - } 10016 - #customType(record) { 10017 - const props = globalThis.Object.keys(record).map((label2) => { 10018 - const value2 = this.inspect(record[label2]); 10019 - return isNaN(parseInt(label2)) ? `${label2}: ${value2}` : value2; 10020 - }).join(", "); 10021 - return props ? `${record.constructor.name}(${props})` : record.constructor.name; 10022 - } 10023 - #list(list4) { 10024 - if (list4 instanceof Empty) { 10025 - return "[]"; 10026 - } 10027 - let char_out = 'charlist.from_string("'; 10028 - let list_out = "["; 10029 - let current = list4; 10030 - while (current instanceof NonEmpty) { 10031 - let element3 = current.head; 10032 - current = current.tail; 10033 - if (list_out !== "[") { 10034 - list_out += ", "; 10035 - } 10036 - list_out += this.inspect(element3); 10037 - if (char_out) { 10038 - if (globalThis.Number.isInteger(element3) && element3 >= 32 && element3 <= 126) { 10039 - char_out += globalThis.String.fromCharCode(element3); 10040 - } else { 10041 - char_out = null; 10042 - } 10043 - } 10044 - } 10045 - if (char_out) { 10046 - return char_out + '")'; 10047 - } else { 10048 - return list_out + "]"; 10049 - } 10050 - } 10051 - #string(str) { 10052 - let new_str = '"'; 10053 - for (let i = 0;i < str.length; i++) { 10054 - const char = str[i]; 10055 - switch (char) { 10056 - case ` 10057 - `: 10058 - new_str += "\\n"; 10059 - break; 10060 - case "\r": 10061 - new_str += "\\r"; 10062 - break; 10063 - case "\t": 10064 - new_str += "\\t"; 10065 - break; 10066 - case "\f": 10067 - new_str += "\\f"; 10068 - break; 10069 - case "\\": 10070 - new_str += "\\\\"; 10071 - break; 10072 - case '"': 10073 - new_str += "\\\""; 10074 - break; 10075 - default: 10076 - if (char < " " || char > "~" && char < " ") { 10077 - new_str += "\\u{" + char.charCodeAt(0).toString(16).toUpperCase().padStart(4, "0") + "}"; 10078 - } else { 10079 - new_str += char; 10080 - } 10081 - } 10082 - } 10083 - new_str += '"'; 10084 - return new_str; 10085 - } 10086 - #utfCodepoint(codepoint2) { 10087 - return `//utfcodepoint(${globalThis.String.fromCodePoint(codepoint2.value)})`; 10088 - } 10089 - #bit_array(bits) { 10090 - if (bits.bitSize === 0) { 10091 - return "<<>>"; 10092 - } 10093 - let acc = "<<"; 10094 - for (let i = 0;i < bits.byteSize - 1; i++) { 10095 - acc += bits.byteAt(i).toString(); 10096 - acc += ", "; 10097 - } 10098 - if (bits.byteSize * 8 === bits.bitSize) { 10099 - acc += bits.byteAt(bits.byteSize - 1).toString(); 10100 - } else { 10101 - const trailingBitsCount = bits.bitSize % 8; 10102 - acc += bits.byteAt(bits.byteSize - 1) >> 8 - trailingBitsCount; 10103 - acc += `:size(${trailingBitsCount})`; 10104 - } 10105 - acc += ">>"; 10106 - return acc; 10107 - } 10108 - } 10109 - 10110 - // build/dev/javascript/lumina_client/lumina_client.ts 10111 - document.addEventListener("DOMContentLoaded", main3());