@mateosuarezdev/flash 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/server-context-C7Uxb3AS.cjs +11 -0
- package/dist/server-context-CJbtcTMO.js +59 -0
- package/dist/server.cjs +7 -7
- package/dist/server.js +170 -153
- package/package.json +1 -1
- package/dist/server-context-EvJ6E74m.js +0 -54
- package/dist/server-context-TAJ6UxWy.cjs +0 -11
package/dist/index.cjs
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* See LICENSE file for full terms.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./jsx-dev-runtime-C5Q23IsT.cjs"),L=require("./server-context-TAJ6UxWy.cjs");var z=Symbol.for("preact-signals");function E(){if(y>1)y--;else{for(var t,e=!1;S!==void 0;){var n=S;for(S=void 0,A++;n!==void 0;){var i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&K(n))try{n.c()}catch(r){e||(t=r,e=!0)}n=i}}if(A=0,y--,e)throw t}}function R(t){if(y>0)return t();y++;try{return t()}finally{E()}}var c=void 0;function H(t){var e=c;c=void 0;try{return t()}finally{c=e}}var S=void 0,y=0,A=0,w=0;function I(t){if(c!==void 0){var e=t.n;if(e===void 0||e.t!==c)return e={i:0,S:t,p:c.s,n:void 0,t:c,e:void 0,x:void 0,r:e},c.s!==void 0&&(c.s.n=e),c.s=e,t.n=e,32&c.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=c.s,e.n=void 0,c.s.n=e,c.s=e),e}}function u(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}u.prototype.brand=z;u.prototype.h=function(){return!0};u.prototype.S=function(t){var e=this,n=this.t;n!==t&&t.e===void 0&&(t.x=n,this.t=t,n!==void 0?n.e=t:H(function(){var i;(i=e.W)==null||i.call(e)}))};u.prototype.U=function(t){var e=this;if(this.t!==void 0){var n=t.e,i=t.x;n!==void 0&&(n.x=i,t.e=void 0),i!==void 0&&(i.e=n,t.x=void 0),t===this.t&&(this.t=i,i===void 0&&H(function(){var r;(r=e.Z)==null||r.call(e)}))}};u.prototype.subscribe=function(t){var e=this;return g(function(){var n=e.value,i=c;c=void 0;try{t(n)}finally{c=i}},{name:"sub"})};u.prototype.valueOf=function(){return this.value};u.prototype.toString=function(){return this.value+""};u.prototype.toJSON=function(){return this.value};u.prototype.peek=function(){var t=c;c=void 0;try{return this.value}finally{c=t}};Object.defineProperty(u.prototype,"value",{get:function(){var t=I(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(A>100)throw new Error("Cycle detected");this.v=t,this.i++,w++,y++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{E()}}}});function q(t,e){return new u(t,e)}function K(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function V(t){for(var e=t.s;e!==void 0;e=e.n){var n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function G(t){for(var e=t.s,n=void 0;e!==void 0;){var i=e.p;e.i===-1?(e.S.U(e),i!==void 0&&(i.n=e.n),e.n!==void 0&&(e.n.p=i)):n=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=i}t.s=n}function m(t,e){u.call(this,void 0),this.x=t,this.s=void 0,this.g=w-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}m.prototype=new u;m.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===w))return!0;if(this.g=w,this.f|=1,this.i>0&&!K(this))return this.f&=-2,!0;var t=c;try{V(this),c=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return c=t,G(this),this.f&=-2,!0};m.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}u.prototype.S.call(this,t)};m.prototype.U=function(t){if(this.t!==void 0&&(u.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};m.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(m.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=I(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Z(t,e){return new m(t,e)}function j(t){var e=t.u;if(t.u=void 0,typeof e=="function"){y++;var n=c;c=void 0;try{e()}catch(i){throw t.f&=-2,t.f|=8,x(t),i}finally{c=n,E()}}}function x(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,j(t)}function J(t){if(c!==this)throw new Error("Out-of-order effect");G(this),c=t,this.f&=-2,8&this.f&&x(this),E()}function b(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e?.name}b.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};b.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,j(this),V(this),y++;var t=c;return c=this,J.bind(this,t)};b.prototype.N=function(){2&this.f||(this.f|=2,this.o=S,S=this)};b.prototype.d=function(){this.f|=8,1&this.f||x(this)};b.prototype.dispose=function(){this.d()};function g(t,e){var n=new b(t,e);try{n.c()}catch(r){throw n.d(),r}var i=n.d.bind(n);return i[Symbol.dispose]=i,i}function Q(t){return t instanceof u?t.peek():t}function ee(t){return t instanceof u?t.value:t}function te(t,e){typeof e=="function"?t.value=e():t.value=e}function ne(t){return t instanceof u?()=>t.value:t}function ie(t,e,n=!1){const i=[];for(const[r,s]of Object.entries(e))if(s!=null&&!(r==="children"||r==="key"||r==="autoanimate"||r==="innerHTML")){if(typeof s=="function"&&r!=="ref"&&!r.startsWith("on")&&r!=="viewTransitionName"){const o=g(()=>{const a=s();D(t,r,a,n)});i.push(o);continue}D(t,r,s,n)}return()=>i.forEach(r=>r())}function D(t,e,n,i){if(e==="ref"&&typeof n=="function"){n(t);return}if(e.startsWith("on")&&typeof n=="function"){const r=e.slice(2).toLowerCase();t.addEventListener(r,n);return}if(e==="class"||e==="className"){const r=typeof n=="string"?n:Array.isArray(n)?n.filter(Boolean).join(" "):typeof n=="object"?Object.entries(n).filter(([s,o])=>o).map(([s])=>s).join(" "):"";i?t.setAttribute("class",r):t.className=r;return}if(e==="style"){typeof n=="string"?t.setAttribute("style",n):typeof n=="object"&&n&&Object.assign(t.style,n);return}if(e==="viewTransitionName"){t.style.viewTransitionName=n;return}if(!i&&typeof n=="boolean"){n?t.setAttribute(e,""):t.removeAttribute(e);return}t.setAttribute(e,String(n))}function re(t,e){const n=document.createTextNode(String(e));t.appendChild(n)}function X(t){return{type:"reactive",kind:"ReactiveVNode",fn:t,_id:d.newVNodeId(),_dispose:null,_currentChild:null,_currentDom:null,_placeholder:null,_parent:null,_renderedChildren:[]}}function k(t,e){if(!t&&t!==0)return{vnode:null,dom:null};if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return{vnode:null,dom:document.createTextNode(String(t))};if(t instanceof Node)return{vnode:null,dom:t};if(typeof t=="object"&&"type"in t){const n=t;n.type!=="reactive"&&(n._parent=e),e._renderedChildren.push(n);const i=_(n);return{vnode:n,dom:i}}return{vnode:null,dom:null}}class M{_cancelled=!1;_cancelCallbacks=[];get cancelled(){return this._cancelled}cancel(){this._cancelled||(this._cancelled=!0,this._cancelCallbacks.forEach(e=>{try{e()}catch(n){console.error("Cancel callback error:",n)}}),this._cancelCallbacks=[])}onCancel(e){this._cancelled?e():this._cancelCallbacks.push(e)}throwIfCancelled(){if(this._cancelled)throw new Error("Operation cancelled")}}async function Y(t,e){if(!t)return;const n=t,i=e||new M;if("_onBeforeExitCallbacks"in n&&n._onBeforeExitCallbacks.length>0)for(const r of n._onBeforeExitCallbacks)try{if(i.cancelled)break;await r(i)}catch(s){console.error("onBeforeExit error:",s)}if("_onUnmountCallbacks"in n&&n._onUnmountCallbacks.length>0&&n._onUnmountCallbacks.forEach(r=>{try{r()}catch(s){console.error("onUnmount error:",s)}}),n.type==="reactive"){const r=n;r._dispose&&(r._dispose(),r._dispose=null)}"_renderedChildren"in n&&n._renderedChildren.forEach(r=>{U(r)})}function U(t){if(!t)return;const e=t,n=new M;if(n.cancel(),"_onBeforeExitCallbacks"in e&&e._onBeforeExitCallbacks.length>0&&e._onBeforeExitCallbacks.forEach(i=>{try{const r=i(n);r instanceof Promise&&r.catch(s=>console.error("onBeforeExit error:",s))}catch(r){console.error("onBeforeExit error:",r)}}),"_onUnmountCallbacks"in e&&e._onUnmountCallbacks.length>0&&e._onUnmountCallbacks.forEach(i=>{try{i()}catch(r){console.error("onUnmount error:",r)}}),e.type==="reactive"){const i=e;i._dispose&&(i._dispose(),i._dispose=null)}"_renderedChildren"in e&&e._renderedChildren.forEach(i=>{U(i)})}let se=0;const p=new WeakMap;async function O(t,e,n){const i=t._placeholder;if(!i?.parentNode)return;const r=t._currentChild,s=t._currentDom;if(oe(r,e)){const f=p.get(t);f&&(f.token.cancel(),p.delete(t)),r&&"_lifecycleState"in r&&(r._lifecycleState="mounted");return}if(s instanceof Text&&n instanceof Text){s.nodeValue!==n.nodeValue&&(s.nodeValue=n.nodeValue),t._currentDom=s,t._currentChild=e,e&&"_lifecycleState"in e&&(e._lifecycleState="mounted"),p.delete(t);return}const o=++se,a=p.get(t);a&&a.token.cancel();const l=new M;if(p.set(t,{id:o,token:l}),r&&"_lifecycleState"in r&&(r._lifecycleState="exiting"),r)try{await Y(r,l)}catch(f){console.error(`ReactiveVNode ${t._id}: Unmount threw:`,f)}const h=p.get(t);if(!(!h||h.id!==o)){if(l.cancelled){p.delete(t);return}r&&"_lifecycleState"in r&&(r._lifecycleState="exited"),s&&s.remove(),n&&i.parentNode.insertBefore(n,i.nextSibling),e&&"_lifecycleState"in e&&(e._lifecycleState="mounted"),t._currentChild=e,t._currentDom=n,p.delete(t)}}function oe(t,e){if(!t||!e||typeof t!="object"||typeof e!="object"||!("type"in t)||!("type"in e))return!1;if(typeof t.type=="function"&&typeof e.type=="function"){if(t.type!==e.type)return!1}else if(typeof t.type=="string"&&typeof e.type=="string"){if(t.type!==e.type)return!1}else return!1;const n="props"in t?t.props?.key:void 0,i="props"in e?e.props?.key:void 0;return n!==i?!1:"_lifecycleState"in t&&t._lifecycleState==="exiting"}function ae(t,e){const n=t._listState;n?ce(t,e,n):le(t,e)}function le(t,e){const n=t._placeholder;if(!n?.parentNode)return;const i=[];for(let r=0;r<e.length;r++){const s=e[r],o=P(s,r),{vnode:a,dom:l}=k(s,t);l&&n.parentNode.appendChild(l),i.push({key:o,vnode:a,dom:l})}t._listState={items:i}}function ce(t,e,n){const i=t._placeholder;if(!i?.parentNode)return;const r=new Map;for(const a of n.items)r.set(a.key,a);const s=new Set,o=[];for(let a=0;a<e.length;a++){const l=e[a],h=P(l,a);s.add(h);const f=r.get(h);f?(o.push(f),r.delete(h)):ue(t,l,o)}r.size>0&&fe(r),de(i,o),t._listState={items:o}}function ue(t,e,n){const i=P(e,n.length),{vnode:r,dom:s}=k(e,t);n.push({key:i,vnode:r,dom:s})}function fe(t){for(const[e,n]of t)n.vnode&&Y(n.vnode),n.dom?.parentNode&&n.dom.parentNode.removeChild(n.dom)}function de(t,e){const n=t.parentNode;if(!n)return;let i=t;for(const r of e)r.dom&&(i.nextSibling!==r.dom&&n.insertBefore(r.dom,i.nextSibling),i=r.dom)}function P(t,e){return t&&typeof t=="object"&&"key"in t?t.key??e:e}function $(t,e,n=null,i=!1){if(!e)return;(Array.isArray(e)?e:[e]).forEach(s=>{if(s){if(Array.isArray(s)&&$(t,s,n,i),typeof s=="string"||typeof s=="number")re(t,s);else if(typeof s=="function"){const o=X(s);o._parent=n,n&&n._renderedChildren.push(o);const a=document.createComment("reactive");t.appendChild(a),o._placeholder=a;const l=g(()=>{const h=s();if(Array.isArray(h))ae(o,h);else{const{vnode:f,dom:T}=k(h,o);O(o,f,T)}});o._dispose=l}else if(s instanceof Node)t.append(s);else if(s&&typeof s=="object"&&"type"in s){const o=s;"type"in o&&o.type!=="reactive"&&(o._parent=n),n&&n._renderedChildren.push(o);const a=_(o,i);a&&t.append(a)}}})}const he="http://www.w3.org/2000/svg";function B(t,e=!1){if(t._dom)return t._dom;const n=e||t.type==="svg",i=n?document.createElementNS(he,t.type):document.createElement(t.type),r=ie(i,t.props,n);return t._onUnmountCallbacks.push(r),t.props.innerHTML!==void 0?i.innerHTML=typeof t.props.innerHTML=="object"?JSON.stringify(t.props.innerHTML):t.props.innerHTML:t.props.children&&$(i,t.props.children,t,n),t._dom=i,t._lifecycleState="mounted",t._onMountCallbacks.length>0&&t._onMountCallbacks.forEach(s=>s()),i}function _(t,e=!1){if("type"in t&&t.type==="reactive")return t._placeholder;if(typeof t.type=="string")return B(t,e);const n=t;d.setCurrentVNode(n);const i=n.type(n.props);if(d.setCurrentVNode(null),!i)return null;let r=null;if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")r=document.createTextNode(String(i));else if(i instanceof Node)n._element=i,r=i;else if(i&&typeof i=="object"&&"type"in i){const s=i;"type"in s&&s.type!=="reactive"&&(s._parent=n,n._renderedChildren.push(s));const o=_(s,e);o&&(n._element=o),r=o}return r&&n._onMountCallbacks.length>0&&n._onMountCallbacks.forEach(s=>{s()}),r&&(n._lifecycleState="mounted"),r}function pe(t,e){const n=t instanceof Node?t:_(t);n&&e.append(n)}function ye(t){return document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null)}function me(t,e="self"){const n=ye(t);return e==="children"&&n.firstChild(),{walker:n,isSVG:!1}}function be(t,e,n,i){if(e==="class"||e==="className"){const r=typeof n=="string"?n:Array.isArray(n)?n.filter(Boolean).join(" "):typeof n=="object"?Object.entries(n).filter(([s,o])=>o).map(([s])=>s).join(" "):"";i?t.setAttribute("class",r):t.className=r;return}if(e==="style"){typeof n=="string"?t.setAttribute("style",n):typeof n=="object"&&n&&Object.assign(t.style,n);return}if(e==="viewTransitionName"){t.style.viewTransitionName=n;return}if(!i&&typeof n=="boolean"){n?t.setAttribute(e,""):t.removeAttribute(e);return}t.setAttribute(e,String(n))}function ge(t,e,n=!1,i){const r=[];for(const[s,o]of Object.entries(e))if(o!=null&&!(s==="children"||s==="key"||s==="autoanimate")){if(s==="ref"&&typeof o=="function"){i&&console.log("→ Attaching ref"),o(t);continue}if(s.startsWith("on")&&typeof o=="function"){const a=s.slice(2).toLowerCase();i&&console.log(`→ Attaching event: ${a}`),t.addEventListener(a,o);continue}if(typeof o=="function"&&s!=="ref"&&s!=="viewTransitionName"){i&&console.log(`→ Reactive prop: ${s}`);const a=g(()=>{const l=o();be(t,s,l,n)});r.push(a);continue}}return()=>r.forEach(s=>s())}function ve(t,e,n=null,i){if(!e)return;const r=Array.isArray(e)?e:[e];if(!i.walker.firstChild()&&r.length>0){console.warn("Hydration mismatch: VNode has children but DOM is empty");return}for(const o of r)!o&&o!==0||_e(o,t,n,i);i.walker.parentNode()}function _e(t,e,n,i){if(!(!t&&t!==0)){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"){const r=i.walker.currentNode;r.nodeType===Node.TEXT_NODE?(i.debug&&console.log("→ Hydrated text node"),i.walker.nextSibling()):console.warn(`Hydration mismatch: expected text node but found ${r.nodeName}`);return}if(typeof t=="function"){i.debug&&console.log("→ Hydrating reactive child");const r=X(t);r._parent=n,n&&n._renderedChildren.push(r);const s=i.walker.currentNode,o=t();if(o&&typeof o=="object"&&"type"in o){const f=o;v(f,i),r._currentChild=f,r._currentDom=f._dom??f._element}else(typeof o=="string"||typeof o=="number"||typeof o=="boolean")&&(r._currentDom=s),i.walker.nextSibling();const a=document.createComment("reactive");r._currentDom?.parentNode&&r._currentDom.parentNode.insertBefore(a,r._currentDom),r._placeholder=a;let l=!0;const h=g(()=>{const f=t();if(l){l=!1;return}const{vnode:T,dom:W}=k(f,r);O(r,T,W)});r._dispose=h;return}if(t instanceof Node){i.walker.nextSibling();return}if(t&&typeof t=="object"&&"type"in t){const r=t;"type"in r&&r.type!=="reactive"&&r.type!=="suspended"&&(r._parent=n),n&&n._renderedChildren.push(r),v(r,i)}}}function Se(t,e){const n=e.walker.currentNode;if(n.nodeType!==Node.ELEMENT_NODE)return console.warn(`Hydration mismatch: expected element <${t.type}> but found ${n.nodeName}`),F(t,n,e);const i=n,r=i.tagName.toLowerCase();if(r!==t.type.toLowerCase())return console.warn(`Hydration mismatch: expected <${t.type}> but found <${r}>`),F(t,n,e);const s=e.isSVG||t.type==="svg",o=e.isSVG;e.isSVG=s,t._dom=i,e.debug&&console.log(`→ Attached existing <${t.type}> DOM`);const a=ge(i,t.props,s,e.debug);return t._onUnmountCallbacks.push(a),t.props.children&&ve(i,t.props.children,t,e),t._lifecycleState="mounted",t._onMountCallbacks.length>0&&t._onMountCallbacks.forEach(l=>l()),e.isSVG=o,e.walker.nextSibling(),i}function F(t,e,n){n.debug&&console.log(`→ Fallback: rendering <${t.type}> fresh`);const i=e.parentNode,r=e.nextSibling;i?.removeChild(e);const s=B(t,n.isSVG);return i&&(r?i.insertBefore(s,r):i.appendChild(s)),n.walker.nextSibling(),s}function v(t,e){if("type"in t&&t.type==="reactive")return e.debug&&console.log(`Hydrating ReactiveVNode #${t._id}`),Ce(t,e);if("type"in t&&t.type==="suspended")return e.debug&&console.log(`Hydrating SuspendedVNode: ${t._componentName}`),we(t,e);if(typeof t.type=="string")return e.debug&&console.log(`Hydrating <${t.type}>`),Se(t,e);const n=t.type.name||"Anonymous";return e.debug&&console.log(`Hydrating Component: ${n}`),ke(t,e)}function ke(t,e){d.setCurrentVNode(t);const n=t.type(t.props);if(d.setCurrentVNode(null),!n)return null;if(typeof n=="object"&&"type"in n&&n.type==="suspended")return v(n,e);let i=null;if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"){const r=e.walker.currentNode;r.nodeType===Node.TEXT_NODE&&(t._element=r,i=r,e.walker.nextSibling())}else if(n instanceof Node)t._element=n,i=n,e.walker.nextSibling();else if(n&&typeof n=="object"&&"type"in n){const r=n;"type"in r&&r.type!=="reactive"&&(r._parent=t,t._renderedChildren.push(r));const s=v(r,e);s&&(t._element=s),i=s}return i&&t._onMountCallbacks.length>0&&(e.debug&&console.log(`→ Firing ${t._onMountCallbacks.length} onMount callback(s)`),t._onMountCallbacks.forEach(r=>r())),i&&(t._lifecycleState="mounted"),i}function Ce(t,e){const n=t.fn(),i=e.walker.currentNode,r=document.createComment("reactive");if(i.parentNode?.insertBefore(r,i),t._placeholder=r,n&&typeof n=="object"&&"type"in n){const a=n;v(a,e),t._currentChild=a,t._currentDom=a._dom??a._element}else(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&(t._currentDom=i),e.walker.nextSibling();let s=!0;const o=g(()=>{const a=t.fn();if(s){s=!1,e.debug&&console.log("→ Reactive effect setup (skipping initial)");return}const{vnode:l,dom:h}=k(a,t);O(t,l,h)});return t._dispose=o,t._currentDom}function we(t,e){const n=e.walker.currentNode;if(n.nodeType===Node.ELEMENT_NODE&&n.hasAttribute("data-suspended")){const r=n;return r.getAttribute("data-suspended-state")==="resolved"?(t._state="resolved",e.walker.firstChild(),t.promise.then(o=>{t._state="resolved"}).catch(o=>{t._state="error";const a=typeof t.errorFallback=="function"?t.errorFallback(o):t.errorFallback;r.innerHTML="";const l=C(a,e.isSVG);l&&r.appendChild(l)}),e.walker.parentNode(),e.walker.nextSibling(),r):(t._state="pending",t.promise.then(o=>{t._state="resolved",r.innerHTML="";const a=C(o,e.isSVG);a&&r.appendChild(a)}).catch(o=>{t._state="error";const a=typeof t.errorFallback=="function"?t.errorFallback(o):t.errorFallback;r.innerHTML="";const l=C(a,e.isSVG);l&&r.appendChild(l)}),e.walker.nextSibling(),r)}console.warn("Hydration mismatch: expected suspended container");const i=_(t,e.isSVG);return e.walker.nextSibling(),i}function C(t,e){return!t&&t!==0?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?document.createTextNode(String(t)):t instanceof Node?t:typeof t=="object"&&"type"in t?_(t,e):typeof t=="function"?C(t(),e):null}function Ee(t,e,n="self"){const i=me(e,n);v(t,i)}function Te(t,e="Loading...",n="Error"){return i=>({type:"suspended",kind:"SuspendedVNode",promise:t(i),fallback:e,errorFallback:n,_id:d.newVNodeId(),_componentName:t.name||"AsyncComponent",_parent:null,_renderedChildren:[],_currentChild:null,_state:"pending"})}function Ne(t){const e=Symbol("context");return{_id:e,_defaultValue:t,provide(n){if(typeof document>"u"){L.provideServerContext(e,n);return}const i=d.getCurrentVNode();if(!i)throw new Error("context.provide() called outside of component render");i._contextMap||(i._contextMap=new Map),i._contextMap.set(e,n)}}}function Ae(t){if(typeof document>"u")return L.consumeServerContext(t._id,t._defaultValue);const e=d.getCurrentVNode();if(!e)throw new Error("useContext called outside of component render");let n=e;for(;n;){if(n.kind==="VNode"&&n._contextMap?.has(t._id))return n._contextMap.get(t._id);n=n._parent}return t._defaultValue}function xe(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onMount must be called inside a component during render");d.currentVNode._onMountCallbacks.push(t)}}function Me(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onUnmount must be called inside a component during render");d.currentVNode._onUnmountCallbacks.push(t)}}function Oe(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onBeforeExit must be called inside a component during render");d.currentVNode._onBeforeExitCallbacks.push(t)}}function Pe(t){if(!(typeof document>"u"))try{t()}catch(e){console.error(e)}}class De{readCallbacks=new Set;updateCallbacks=new Set;renderCallbacks=new Set;readKeepAlive=new Set;updateKeepAlive=new Set;renderKeepAlive=new Set;isProcessing=!1;frameScheduled=!1;frameId=null;lastTimestamp=0;currentDelta=0;trackFPS;fpsHistorySize;fpsHistory=[];constructor(e={}){this.trackFPS=e.trackFPS??!1,this.fpsHistorySize=e.fpsHistorySize??60}read(e,n=!1){return n?this.readKeepAlive.add(e):this.readCallbacks.add(e),this.scheduleFrame(),e}update(e,n=!1){return n?this.updateKeepAlive.add(e):this.updateCallbacks.add(e),this.scheduleFrame(),e}render(e,n=!1){return n?this.renderKeepAlive.add(e):this.renderCallbacks.add(e),this.scheduleFrame(),e}chain(e){let n,i;"read"in e&&this.readCallbacks.add(r=>{n=e.read(r)}),"update"in e?(this.updateCallbacks.add(r=>{i=e.update(n,r)}),this.renderCallbacks.add(r=>{e.render(i,r)})):this.renderCallbacks.add(r=>{e.render(n,r)}),this.scheduleFrame()}cancel(e){this.readCallbacks.delete(e),this.updateCallbacks.delete(e),this.renderCallbacks.delete(e),this.readKeepAlive.delete(e),this.updateKeepAlive.delete(e),this.renderKeepAlive.delete(e)}cancelAll(){this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null),this.readCallbacks.clear(),this.updateCallbacks.clear(),this.renderCallbacks.clear(),this.readKeepAlive.clear(),this.updateKeepAlive.clear(),this.renderKeepAlive.clear(),this.isProcessing=!1,this.frameScheduled=!1,this.lastTimestamp=0,this.currentDelta=0,this.trackFPS&&(this.fpsHistory=[])}get data(){return{timestamp:this.lastTimestamp,delta:this.currentDelta||16.67}}get isRunning(){return this.isProcessing||this.readKeepAlive.size>0||this.updateKeepAlive.size>0||this.renderKeepAlive.size>0}get fps(){return this.trackFPS?this.currentDelta>0?1e3/this.currentDelta:0:(console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0)}get averageFps(){if(!this.trackFPS)return console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0;if(this.fpsHistory.length===0)return 0;const e=this.fpsHistory.reduce((n,i)=>n+i,0);return Math.round(e/this.fpsHistory.length)}get refreshRate(){return this.trackFPS?Math.round(this.averageFps):(console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0)}scheduleFrame(){this.frameScheduled||this.isProcessing||(this.frameScheduled=!0,this.frameId=requestAnimationFrame(e=>{this.processFrame(e)}))}processFrame(e){this.isProcessing=!0,this.frameScheduled=!1,this.lastTimestamp===0?this.currentDelta=16.67:this.currentDelta=e-this.lastTimestamp,this.lastTimestamp=e,this.trackFPS&&this.currentDelta>0&&(this.fpsHistory.push(1e3/this.currentDelta),this.fpsHistory.length>this.fpsHistorySize&&this.fpsHistory.shift());const n=this.data;this.executeCallbacks(this.readCallbacks,n),this.executeCallbacks(this.readKeepAlive,n),this.executeCallbacks(this.updateCallbacks,n),this.executeCallbacks(this.updateKeepAlive,n),this.executeCallbacks(this.renderCallbacks,n),this.executeCallbacks(this.renderKeepAlive,n),this.isProcessing=!1,this.hasKeepAliveCallbacks()&&this.scheduleFrame()}executeCallbacks(e,n){e.forEach(i=>{try{i(n)}catch(r){console.error("Frame callback error:",r)}}),this.isKeepAliveSet(e)||e.clear()}hasKeepAliveCallbacks(){return this.readKeepAlive.size>0||this.updateKeepAlive.size>0||this.renderKeepAlive.size>0}isKeepAliveSet(e){return e===this.readKeepAlive||e===this.updateKeepAlive||e===this.renderKeepAlive}}class Fe{gestureId=0;activeGestures=new Map;disabledGestures=new Map;capturedId;gestureWithPriority=new Map;maxPriority=-1/0;newId(){return++this.gestureId}canStart(e){if(this.capturedId!==void 0)return!1;const n=this.disabledGestures.get(e);return!(n&&n.size>0)}start(e,n,i){return this.canStart(n)?(this.activeGestures.set(e,n),this.gestureWithPriority.set(e,i),this.maxPriority=Math.max(this.maxPriority,i),!0):!1}capture(e,n,i){return!this.activeGestures.has(e)&&!this.start(e,n,i)?!1:i>=this.maxPriority?(this.capturedId=e,this.activeGestures.forEach((r,s)=>{s!==e&&this.release(s)}),!0):(this.release(e),!1)}release(e){const n=this.activeGestures.get(e);this.activeGestures.delete(e);const i=this.gestureWithPriority.get(e);if(this.gestureWithPriority.delete(e),this.capturedId===e&&(this.capturedId=void 0),i===this.maxPriority&&(this.maxPriority=-1/0,this.gestureWithPriority.forEach(r=>{this.maxPriority=Math.max(this.maxPriority,r)})),n){const r=this.disabledGestures.get(n);r&&(r.delete(e),r.size===0&&this.disabledGestures.delete(n))}}disableGesture(e,n){let i=this.disabledGestures.get(e);i||(i=new Set,this.disabledGestures.set(e,i)),i.add(n)}enableGesture(e,n){const i=this.disabledGestures.get(e);i&&(i.delete(n),i.size===0&&this.disabledGestures.delete(e))}createGesture(e,n){const i=this.newId(),r=n.name||"gesture-"+i,s=n.priority??0;return new Le(this,i,e,r,s,n)}}class Le{el;options;details;minTouches;maxTouches;threshold;direction;lastMoveTime=0;prevX=0;prevY=0;initialDistance=0;initialAngle=0;boundOnStart;boundOnMove;boundOnEnd;passive;hasPassedThreshold=!1;controller;id;name;priority;useThreshold;constructor(e,n,i,r,s,o){this.controller=e,this.id=n,this.el=i,this.options=o,this.name=r,this.priority=s*1e3+n,this.minTouches=o.minTouches??1,this.maxTouches=o.maxTouches??1/0,this.passive=o.passive??!0,this.threshold=o.threshold??0,this.direction=o.direction??"all",this.useThreshold=this.threshold>0,this.details={type:this.name,isTracking:!1,startX:0,startY:0,currentX:0,currentY:0,deltaX:0,deltaY:0,velocityX:0,velocityY:0,touchCount:0,scale:1,rotation:0},this.boundOnStart=this.onStart.bind(this),this.boundOnMove=this.onMove.bind(this),this.boundOnEnd=this.onEnd.bind(this)}getDistance(e){if(e.length<2)return 0;const n=e[0].clientX-e[1].clientX,i=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+i*i)}getAngle(e){if(e.length<2)return 0;const n=e[1].clientX-e[0].clientX,i=e[1].clientY-e[0].clientY;return Math.atan2(i,n)*180/Math.PI}getCenter(e){if("touches"in e){if(e.touches.length===0)return{x:0,y:0};let n=0,i=0;for(let r=0;r<e.touches.length;r++)n+=e.touches[r].clientX,i+=e.touches[r].clientY;return{x:n/e.touches.length,y:i/e.touches.length}}else return{x:e.clientX,y:e.clientY}}canStart(e){const i="touches"in e?e.touches.length:1;return i>=this.minTouches&&i<=this.maxTouches&&this.controller.canStart(this.name)}checkThreshold(){if(!this.useThreshold)return!0;const{deltaX:e,deltaY:n}=this.details;return this.direction==="x"?Math.abs(e)>=this.threshold:this.direction==="y"?Math.abs(n)>=this.threshold:Math.sqrt(e*e+n*n)>=this.threshold}onStart(e){if(!this.canStart(e))return;const n="touches"in e,i=this.getCenter(e);this.details.startX=i.x,this.details.startY=i.y,this.details.currentX=i.x,this.details.currentY=i.y,this.details.touchCount=n?e.touches.length:1,this.details.event=e,n&&e.touches.length>=2?(this.initialDistance=this.getDistance(e.touches),this.initialAngle=this.getAngle(e.touches)):(this.initialDistance=0,this.initialAngle=0),!(this.options.canStart&&!this.options.canStart(this.details))&&(this.passive||e.preventDefault(),this.details.isTracking=!0,this.details.deltaX=0,this.details.deltaY=0,this.details.velocityX=0,this.details.velocityY=0,this.details.scale=1,this.details.rotation=0,this.hasPassedThreshold=!this.useThreshold,this.lastMoveTime=Date.now(),this.prevX=i.x,this.prevY=i.y,this.controller.start(this.id,this.name,this.priority),this.useThreshold||this.tryCapture())}onMove(e){if(!this.details.isTracking)return;this.passive||e.preventDefault();const n="touches"in e,i=this.getCenter(e),r=Date.now(),s=r-this.lastMoveTime;if(this.details.currentX=i.x,this.details.currentY=i.y,this.details.deltaX=this.details.currentX-this.details.startX,this.details.deltaY=this.details.currentY-this.details.startY,this.details.touchCount=n?e.touches.length:1,this.details.event=e,n&&e.touches.length>=2){const o=this.getDistance(e.touches),a=this.getAngle(e.touches);this.initialDistance>0&&(this.details.scale=o/this.initialDistance);let l=a-this.initialAngle;l>180&&(l-=360),l<-180&&(l+=360),this.details.rotation=l}else this.details.scale=1,this.details.rotation=0;if(s>0&&(this.details.velocityX=(this.details.currentX-this.prevX)/s,this.details.velocityY=(this.details.currentY-this.prevY)/s),this.prevX=this.details.currentX,this.prevY=this.details.currentY,this.lastMoveTime=r,!this.hasPassedThreshold&&this.checkThreshold()){this.hasPassedThreshold=!0,this.tryCapture();return}this.hasPassedThreshold&&this.options.onMove&&this.options.onMove(this.details)}tryCapture(){this.controller.capture(this.id,this.name,this.priority)&&this.options.onStart&&this.options.onStart(this.details)}onEnd(e){if(!this.details.isTracking)return;this.passive||e.preventDefault();const n="touches"in e;this.details.touchCount=n?e.touches.length:0,this.details.event=e,this.controller.release(this.id),this.details.isTracking=!1,this.hasPassedThreshold=!this.useThreshold,this.options.onEnd&&this.options.onEnd(this.details)}init(){if(!this.el)return;const e={passive:this.passive},n={passive:this.passive},i={passive:this.passive};this.el.addEventListener("touchstart",this.boundOnStart,e),document.addEventListener("touchmove",this.boundOnMove,n),document.addEventListener("touchend",this.boundOnEnd,i),document.addEventListener("touchcancel",this.boundOnEnd,i),this.el.addEventListener("mousedown",this.boundOnStart,e),document.addEventListener("mousemove",this.boundOnMove,n),document.addEventListener("mouseup",this.boundOnEnd,i),document.addEventListener("mouseleave",this.boundOnEnd,i)}destroy(){this.el&&(this.el.removeEventListener("touchstart",this.boundOnStart),document.removeEventListener("touchmove",this.boundOnMove),document.removeEventListener("touchend",this.boundOnEnd),document.removeEventListener("touchcancel",this.boundOnEnd),this.el.removeEventListener("mousedown",this.boundOnStart),document.removeEventListener("mousemove",this.boundOnMove),document.removeEventListener("mouseup",this.boundOnEnd),document.removeEventListener("mouseleave",this.boundOnEnd),this.controller.release(this.id))}}let N;function He(){return N||(N=new Fe),N}function Ie(t,e){return He().createGesture(t,e)}function Ke(t){typeof document>"u"||(document.startViewTransition?document.startViewTransition(t):t())}let Ve=0;function Ge(t,e=[],n={duration:500,namePrefix:"vt"}){if(!document.startViewTransition){t();return}const i=e.map((s,o)=>`${n.namePrefix}-${++Ve}-${o}`);e.forEach((s,o)=>{s.style.viewTransitionName=i[o]}),document.startViewTransition(()=>{t()}).finished.finally(()=>{e.forEach(s=>{s.style.viewTransitionName=""})}),document.documentElement.style.setProperty("--vt-duration",`${n.duration}ms`)}exports.Fragment=d.Fragment;exports.Computed=m;exports.Effect=b;exports.FrameScheduler=De;exports.Signal=u;exports.batch=R;exports.computed=Z;exports.createContext=Ne;exports.createGesture=Ie;exports.effect=g;exports.get=ee;exports.hydrate=Ee;exports.link=ne;exports.onBeforeExit=Oe;exports.onLoad=Pe;exports.onMount=xe;exports.onUnmount=Me;exports.peek=Q;exports.render=pe;exports.set=te;exports.signal=q;exports.startViewTransition=Ke;exports.suspend=Te;exports.useContext=Ae;exports.withViewTransition=Ge;
|
|
11
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./jsx-dev-runtime-C5Q23IsT.cjs"),L=require("./server-context-C7Uxb3AS.cjs");var z=Symbol.for("preact-signals");function E(){if(y>1)y--;else{for(var t,e=!1;S!==void 0;){var n=S;for(S=void 0,A++;n!==void 0;){var i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&K(n))try{n.c()}catch(r){e||(t=r,e=!0)}n=i}}if(A=0,y--,e)throw t}}function R(t){if(y>0)return t();y++;try{return t()}finally{E()}}var c=void 0;function H(t){var e=c;c=void 0;try{return t()}finally{c=e}}var S=void 0,y=0,A=0,w=0;function I(t){if(c!==void 0){var e=t.n;if(e===void 0||e.t!==c)return e={i:0,S:t,p:c.s,n:void 0,t:c,e:void 0,x:void 0,r:e},c.s!==void 0&&(c.s.n=e),c.s=e,t.n=e,32&c.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=c.s,e.n=void 0,c.s.n=e,c.s=e),e}}function u(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}u.prototype.brand=z;u.prototype.h=function(){return!0};u.prototype.S=function(t){var e=this,n=this.t;n!==t&&t.e===void 0&&(t.x=n,this.t=t,n!==void 0?n.e=t:H(function(){var i;(i=e.W)==null||i.call(e)}))};u.prototype.U=function(t){var e=this;if(this.t!==void 0){var n=t.e,i=t.x;n!==void 0&&(n.x=i,t.e=void 0),i!==void 0&&(i.e=n,t.x=void 0),t===this.t&&(this.t=i,i===void 0&&H(function(){var r;(r=e.Z)==null||r.call(e)}))}};u.prototype.subscribe=function(t){var e=this;return g(function(){var n=e.value,i=c;c=void 0;try{t(n)}finally{c=i}},{name:"sub"})};u.prototype.valueOf=function(){return this.value};u.prototype.toString=function(){return this.value+""};u.prototype.toJSON=function(){return this.value};u.prototype.peek=function(){var t=c;c=void 0;try{return this.value}finally{c=t}};Object.defineProperty(u.prototype,"value",{get:function(){var t=I(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(A>100)throw new Error("Cycle detected");this.v=t,this.i++,w++,y++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{E()}}}});function q(t,e){return new u(t,e)}function K(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function V(t){for(var e=t.s;e!==void 0;e=e.n){var n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function G(t){for(var e=t.s,n=void 0;e!==void 0;){var i=e.p;e.i===-1?(e.S.U(e),i!==void 0&&(i.n=e.n),e.n!==void 0&&(e.n.p=i)):n=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=i}t.s=n}function m(t,e){u.call(this,void 0),this.x=t,this.s=void 0,this.g=w-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}m.prototype=new u;m.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===w))return!0;if(this.g=w,this.f|=1,this.i>0&&!K(this))return this.f&=-2,!0;var t=c;try{V(this),c=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return c=t,G(this),this.f&=-2,!0};m.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}u.prototype.S.call(this,t)};m.prototype.U=function(t){if(this.t!==void 0&&(u.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};m.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(m.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=I(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Z(t,e){return new m(t,e)}function j(t){var e=t.u;if(t.u=void 0,typeof e=="function"){y++;var n=c;c=void 0;try{e()}catch(i){throw t.f&=-2,t.f|=8,x(t),i}finally{c=n,E()}}}function x(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,j(t)}function J(t){if(c!==this)throw new Error("Out-of-order effect");G(this),c=t,this.f&=-2,8&this.f&&x(this),E()}function b(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e?.name}b.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};b.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,j(this),V(this),y++;var t=c;return c=this,J.bind(this,t)};b.prototype.N=function(){2&this.f||(this.f|=2,this.o=S,S=this)};b.prototype.d=function(){this.f|=8,1&this.f||x(this)};b.prototype.dispose=function(){this.d()};function g(t,e){var n=new b(t,e);try{n.c()}catch(r){throw n.d(),r}var i=n.d.bind(n);return i[Symbol.dispose]=i,i}function Q(t){return t instanceof u?t.peek():t}function ee(t){return t instanceof u?t.value:t}function te(t,e){typeof e=="function"?t.value=e():t.value=e}function ne(t){return t instanceof u?()=>t.value:t}function ie(t,e,n=!1){const i=[];for(const[r,s]of Object.entries(e))if(s!=null&&!(r==="children"||r==="key"||r==="autoanimate"||r==="innerHTML")){if(typeof s=="function"&&r!=="ref"&&!r.startsWith("on")&&r!=="viewTransitionName"){const o=g(()=>{const a=s();D(t,r,a,n)});i.push(o);continue}D(t,r,s,n)}return()=>i.forEach(r=>r())}function D(t,e,n,i){if(e==="ref"&&typeof n=="function"){n(t);return}if(e.startsWith("on")&&typeof n=="function"){const r=e.slice(2).toLowerCase();t.addEventListener(r,n);return}if(e==="class"||e==="className"){const r=typeof n=="string"?n:Array.isArray(n)?n.filter(Boolean).join(" "):typeof n=="object"?Object.entries(n).filter(([s,o])=>o).map(([s])=>s).join(" "):"";i?t.setAttribute("class",r):t.className=r;return}if(e==="style"){typeof n=="string"?t.setAttribute("style",n):typeof n=="object"&&n&&Object.assign(t.style,n);return}if(e==="viewTransitionName"){t.style.viewTransitionName=n;return}if(!i&&typeof n=="boolean"){n?t.setAttribute(e,""):t.removeAttribute(e);return}t.setAttribute(e,String(n))}function re(t,e){const n=document.createTextNode(String(e));t.appendChild(n)}function X(t){return{type:"reactive",kind:"ReactiveVNode",fn:t,_id:d.newVNodeId(),_dispose:null,_currentChild:null,_currentDom:null,_placeholder:null,_parent:null,_renderedChildren:[]}}function k(t,e){if(!t&&t!==0)return{vnode:null,dom:null};if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return{vnode:null,dom:document.createTextNode(String(t))};if(t instanceof Node)return{vnode:null,dom:t};if(typeof t=="object"&&"type"in t){const n=t;n.type!=="reactive"&&(n._parent=e),e._renderedChildren.push(n);const i=_(n);return{vnode:n,dom:i}}return{vnode:null,dom:null}}class M{_cancelled=!1;_cancelCallbacks=[];get cancelled(){return this._cancelled}cancel(){this._cancelled||(this._cancelled=!0,this._cancelCallbacks.forEach(e=>{try{e()}catch(n){console.error("Cancel callback error:",n)}}),this._cancelCallbacks=[])}onCancel(e){this._cancelled?e():this._cancelCallbacks.push(e)}throwIfCancelled(){if(this._cancelled)throw new Error("Operation cancelled")}}async function Y(t,e){if(!t)return;const n=t,i=e||new M;if("_onBeforeExitCallbacks"in n&&n._onBeforeExitCallbacks.length>0)for(const r of n._onBeforeExitCallbacks)try{if(i.cancelled)break;await r(i)}catch(s){console.error("onBeforeExit error:",s)}if("_onUnmountCallbacks"in n&&n._onUnmountCallbacks.length>0&&n._onUnmountCallbacks.forEach(r=>{try{r()}catch(s){console.error("onUnmount error:",s)}}),n.type==="reactive"){const r=n;r._dispose&&(r._dispose(),r._dispose=null)}"_renderedChildren"in n&&n._renderedChildren.forEach(r=>{U(r)})}function U(t){if(!t)return;const e=t,n=new M;if(n.cancel(),"_onBeforeExitCallbacks"in e&&e._onBeforeExitCallbacks.length>0&&e._onBeforeExitCallbacks.forEach(i=>{try{const r=i(n);r instanceof Promise&&r.catch(s=>console.error("onBeforeExit error:",s))}catch(r){console.error("onBeforeExit error:",r)}}),"_onUnmountCallbacks"in e&&e._onUnmountCallbacks.length>0&&e._onUnmountCallbacks.forEach(i=>{try{i()}catch(r){console.error("onUnmount error:",r)}}),e.type==="reactive"){const i=e;i._dispose&&(i._dispose(),i._dispose=null)}"_renderedChildren"in e&&e._renderedChildren.forEach(i=>{U(i)})}let se=0;const p=new WeakMap;async function O(t,e,n){const i=t._placeholder;if(!i?.parentNode)return;const r=t._currentChild,s=t._currentDom;if(oe(r,e)){const f=p.get(t);f&&(f.token.cancel(),p.delete(t)),r&&"_lifecycleState"in r&&(r._lifecycleState="mounted");return}if(s instanceof Text&&n instanceof Text){s.nodeValue!==n.nodeValue&&(s.nodeValue=n.nodeValue),t._currentDom=s,t._currentChild=e,e&&"_lifecycleState"in e&&(e._lifecycleState="mounted"),p.delete(t);return}const o=++se,a=p.get(t);a&&a.token.cancel();const l=new M;if(p.set(t,{id:o,token:l}),r&&"_lifecycleState"in r&&(r._lifecycleState="exiting"),r)try{await Y(r,l)}catch(f){console.error(`ReactiveVNode ${t._id}: Unmount threw:`,f)}const h=p.get(t);if(!(!h||h.id!==o)){if(l.cancelled){p.delete(t);return}r&&"_lifecycleState"in r&&(r._lifecycleState="exited"),s&&s.remove(),n&&i.parentNode.insertBefore(n,i.nextSibling),e&&"_lifecycleState"in e&&(e._lifecycleState="mounted"),t._currentChild=e,t._currentDom=n,p.delete(t)}}function oe(t,e){if(!t||!e||typeof t!="object"||typeof e!="object"||!("type"in t)||!("type"in e))return!1;if(typeof t.type=="function"&&typeof e.type=="function"){if(t.type!==e.type)return!1}else if(typeof t.type=="string"&&typeof e.type=="string"){if(t.type!==e.type)return!1}else return!1;const n="props"in t?t.props?.key:void 0,i="props"in e?e.props?.key:void 0;return n!==i?!1:"_lifecycleState"in t&&t._lifecycleState==="exiting"}function ae(t,e){const n=t._listState;n?ce(t,e,n):le(t,e)}function le(t,e){const n=t._placeholder;if(!n?.parentNode)return;const i=[];for(let r=0;r<e.length;r++){const s=e[r],o=P(s,r),{vnode:a,dom:l}=k(s,t);l&&n.parentNode.appendChild(l),i.push({key:o,vnode:a,dom:l})}t._listState={items:i}}function ce(t,e,n){const i=t._placeholder;if(!i?.parentNode)return;const r=new Map;for(const a of n.items)r.set(a.key,a);const s=new Set,o=[];for(let a=0;a<e.length;a++){const l=e[a],h=P(l,a);s.add(h);const f=r.get(h);f?(o.push(f),r.delete(h)):ue(t,l,o)}r.size>0&&fe(r),de(i,o),t._listState={items:o}}function ue(t,e,n){const i=P(e,n.length),{vnode:r,dom:s}=k(e,t);n.push({key:i,vnode:r,dom:s})}function fe(t){for(const[e,n]of t)n.vnode&&Y(n.vnode),n.dom?.parentNode&&n.dom.parentNode.removeChild(n.dom)}function de(t,e){const n=t.parentNode;if(!n)return;let i=t;for(const r of e)r.dom&&(i.nextSibling!==r.dom&&n.insertBefore(r.dom,i.nextSibling),i=r.dom)}function P(t,e){return t&&typeof t=="object"&&"key"in t?t.key??e:e}function $(t,e,n=null,i=!1){if(!e)return;(Array.isArray(e)?e:[e]).forEach(s=>{if(s){if(Array.isArray(s)&&$(t,s,n,i),typeof s=="string"||typeof s=="number")re(t,s);else if(typeof s=="function"){const o=X(s);o._parent=n,n&&n._renderedChildren.push(o);const a=document.createComment("reactive");t.appendChild(a),o._placeholder=a;const l=g(()=>{const h=s();if(Array.isArray(h))ae(o,h);else{const{vnode:f,dom:T}=k(h,o);O(o,f,T)}});o._dispose=l}else if(s instanceof Node)t.append(s);else if(s&&typeof s=="object"&&"type"in s){const o=s;"type"in o&&o.type!=="reactive"&&(o._parent=n),n&&n._renderedChildren.push(o);const a=_(o,i);a&&t.append(a)}}})}const he="http://www.w3.org/2000/svg";function B(t,e=!1){if(t._dom)return t._dom;const n=e||t.type==="svg",i=n?document.createElementNS(he,t.type):document.createElement(t.type),r=ie(i,t.props,n);return t._onUnmountCallbacks.push(r),t.props.innerHTML!==void 0?i.innerHTML=typeof t.props.innerHTML=="object"?JSON.stringify(t.props.innerHTML):t.props.innerHTML:t.props.children&&$(i,t.props.children,t,n),t._dom=i,t._lifecycleState="mounted",t._onMountCallbacks.length>0&&t._onMountCallbacks.forEach(s=>s()),i}function _(t,e=!1){if("type"in t&&t.type==="reactive")return t._placeholder;if(typeof t.type=="string")return B(t,e);const n=t;d.setCurrentVNode(n);const i=n.type(n.props);if(d.setCurrentVNode(null),!i)return null;let r=null;if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")r=document.createTextNode(String(i));else if(i instanceof Node)n._element=i,r=i;else if(i&&typeof i=="object"&&"type"in i){const s=i;"type"in s&&s.type!=="reactive"&&(s._parent=n,n._renderedChildren.push(s));const o=_(s,e);o&&(n._element=o),r=o}return r&&n._onMountCallbacks.length>0&&n._onMountCallbacks.forEach(s=>{s()}),r&&(n._lifecycleState="mounted"),r}function pe(t,e){const n=t instanceof Node?t:_(t);n&&e.append(n)}function ye(t){return document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null)}function me(t,e="self"){const n=ye(t);return e==="children"&&n.firstChild(),{walker:n,isSVG:!1}}function be(t,e,n,i){if(e==="class"||e==="className"){const r=typeof n=="string"?n:Array.isArray(n)?n.filter(Boolean).join(" "):typeof n=="object"?Object.entries(n).filter(([s,o])=>o).map(([s])=>s).join(" "):"";i?t.setAttribute("class",r):t.className=r;return}if(e==="style"){typeof n=="string"?t.setAttribute("style",n):typeof n=="object"&&n&&Object.assign(t.style,n);return}if(e==="viewTransitionName"){t.style.viewTransitionName=n;return}if(!i&&typeof n=="boolean"){n?t.setAttribute(e,""):t.removeAttribute(e);return}t.setAttribute(e,String(n))}function ge(t,e,n=!1,i){const r=[];for(const[s,o]of Object.entries(e))if(o!=null&&!(s==="children"||s==="key"||s==="autoanimate")){if(s==="ref"&&typeof o=="function"){i&&console.log("→ Attaching ref"),o(t);continue}if(s.startsWith("on")&&typeof o=="function"){const a=s.slice(2).toLowerCase();i&&console.log(`→ Attaching event: ${a}`),t.addEventListener(a,o);continue}if(typeof o=="function"&&s!=="ref"&&s!=="viewTransitionName"){i&&console.log(`→ Reactive prop: ${s}`);const a=g(()=>{const l=o();be(t,s,l,n)});r.push(a);continue}}return()=>r.forEach(s=>s())}function ve(t,e,n=null,i){if(!e)return;const r=Array.isArray(e)?e:[e];if(!i.walker.firstChild()&&r.length>0){console.warn("Hydration mismatch: VNode has children but DOM is empty");return}for(const o of r)!o&&o!==0||_e(o,t,n,i);i.walker.parentNode()}function _e(t,e,n,i){if(!(!t&&t!==0)){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"){const r=i.walker.currentNode;r.nodeType===Node.TEXT_NODE?(i.debug&&console.log("→ Hydrated text node"),i.walker.nextSibling()):console.warn(`Hydration mismatch: expected text node but found ${r.nodeName}`);return}if(typeof t=="function"){i.debug&&console.log("→ Hydrating reactive child");const r=X(t);r._parent=n,n&&n._renderedChildren.push(r);const s=i.walker.currentNode,o=t();if(o&&typeof o=="object"&&"type"in o){const f=o;v(f,i),r._currentChild=f,r._currentDom=f._dom??f._element}else(typeof o=="string"||typeof o=="number"||typeof o=="boolean")&&(r._currentDom=s),i.walker.nextSibling();const a=document.createComment("reactive");r._currentDom?.parentNode&&r._currentDom.parentNode.insertBefore(a,r._currentDom),r._placeholder=a;let l=!0;const h=g(()=>{const f=t();if(l){l=!1;return}const{vnode:T,dom:W}=k(f,r);O(r,T,W)});r._dispose=h;return}if(t instanceof Node){i.walker.nextSibling();return}if(t&&typeof t=="object"&&"type"in t){const r=t;"type"in r&&r.type!=="reactive"&&r.type!=="suspended"&&(r._parent=n),n&&n._renderedChildren.push(r),v(r,i)}}}function Se(t,e){const n=e.walker.currentNode;if(n.nodeType!==Node.ELEMENT_NODE)return console.warn(`Hydration mismatch: expected element <${t.type}> but found ${n.nodeName}`),F(t,n,e);const i=n,r=i.tagName.toLowerCase();if(r!==t.type.toLowerCase())return console.warn(`Hydration mismatch: expected <${t.type}> but found <${r}>`),F(t,n,e);const s=e.isSVG||t.type==="svg",o=e.isSVG;e.isSVG=s,t._dom=i,e.debug&&console.log(`→ Attached existing <${t.type}> DOM`);const a=ge(i,t.props,s,e.debug);return t._onUnmountCallbacks.push(a),t.props.children&&ve(i,t.props.children,t,e),t._lifecycleState="mounted",t._onMountCallbacks.length>0&&t._onMountCallbacks.forEach(l=>l()),e.isSVG=o,e.walker.nextSibling(),i}function F(t,e,n){n.debug&&console.log(`→ Fallback: rendering <${t.type}> fresh`);const i=e.parentNode,r=e.nextSibling;i?.removeChild(e);const s=B(t,n.isSVG);return i&&(r?i.insertBefore(s,r):i.appendChild(s)),n.walker.nextSibling(),s}function v(t,e){if("type"in t&&t.type==="reactive")return e.debug&&console.log(`Hydrating ReactiveVNode #${t._id}`),Ce(t,e);if("type"in t&&t.type==="suspended")return e.debug&&console.log(`Hydrating SuspendedVNode: ${t._componentName}`),we(t,e);if(typeof t.type=="string")return e.debug&&console.log(`Hydrating <${t.type}>`),Se(t,e);const n=t.type.name||"Anonymous";return e.debug&&console.log(`Hydrating Component: ${n}`),ke(t,e)}function ke(t,e){d.setCurrentVNode(t);const n=t.type(t.props);if(d.setCurrentVNode(null),!n)return null;if(typeof n=="object"&&"type"in n&&n.type==="suspended")return v(n,e);let i=null;if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"){const r=e.walker.currentNode;r.nodeType===Node.TEXT_NODE&&(t._element=r,i=r,e.walker.nextSibling())}else if(n instanceof Node)t._element=n,i=n,e.walker.nextSibling();else if(n&&typeof n=="object"&&"type"in n){const r=n;"type"in r&&r.type!=="reactive"&&(r._parent=t,t._renderedChildren.push(r));const s=v(r,e);s&&(t._element=s),i=s}return i&&t._onMountCallbacks.length>0&&(e.debug&&console.log(`→ Firing ${t._onMountCallbacks.length} onMount callback(s)`),t._onMountCallbacks.forEach(r=>r())),i&&(t._lifecycleState="mounted"),i}function Ce(t,e){const n=t.fn(),i=e.walker.currentNode,r=document.createComment("reactive");if(i.parentNode?.insertBefore(r,i),t._placeholder=r,n&&typeof n=="object"&&"type"in n){const a=n;v(a,e),t._currentChild=a,t._currentDom=a._dom??a._element}else(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&(t._currentDom=i),e.walker.nextSibling();let s=!0;const o=g(()=>{const a=t.fn();if(s){s=!1,e.debug&&console.log("→ Reactive effect setup (skipping initial)");return}const{vnode:l,dom:h}=k(a,t);O(t,l,h)});return t._dispose=o,t._currentDom}function we(t,e){const n=e.walker.currentNode;if(n.nodeType===Node.ELEMENT_NODE&&n.hasAttribute("data-suspended")){const r=n;return r.getAttribute("data-suspended-state")==="resolved"?(t._state="resolved",e.walker.firstChild(),t.promise.then(o=>{t._state="resolved"}).catch(o=>{t._state="error";const a=typeof t.errorFallback=="function"?t.errorFallback(o):t.errorFallback;r.innerHTML="";const l=C(a,e.isSVG);l&&r.appendChild(l)}),e.walker.parentNode(),e.walker.nextSibling(),r):(t._state="pending",t.promise.then(o=>{t._state="resolved",r.innerHTML="";const a=C(o,e.isSVG);a&&r.appendChild(a)}).catch(o=>{t._state="error";const a=typeof t.errorFallback=="function"?t.errorFallback(o):t.errorFallback;r.innerHTML="";const l=C(a,e.isSVG);l&&r.appendChild(l)}),e.walker.nextSibling(),r)}console.warn("Hydration mismatch: expected suspended container");const i=_(t,e.isSVG);return e.walker.nextSibling(),i}function C(t,e){return!t&&t!==0?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?document.createTextNode(String(t)):t instanceof Node?t:typeof t=="object"&&"type"in t?_(t,e):typeof t=="function"?C(t(),e):null}function Ee(t,e,n="self"){const i=me(e,n);v(t,i)}function Te(t,e="Loading...",n="Error"){return i=>({type:"suspended",kind:"SuspendedVNode",promise:t(i),fallback:e,errorFallback:n,_id:d.newVNodeId(),_componentName:t.name||"AsyncComponent",_parent:null,_renderedChildren:[],_currentChild:null,_state:"pending"})}function Ne(t){const e=Symbol("context");return{_id:e,_defaultValue:t,provide(n){if(typeof document>"u"){L.provideServerContext(e,n);return}const i=d.getCurrentVNode();if(!i)throw new Error("context.provide() called outside of component render");i._contextMap||(i._contextMap=new Map),i._contextMap.set(e,n)}}}function Ae(t){if(typeof document>"u")return L.consumeServerContext(t._id,t._defaultValue);const e=d.getCurrentVNode();if(!e)throw new Error("useContext called outside of component render");let n=e;for(;n;){if(n.kind==="VNode"&&n._contextMap?.has(t._id))return n._contextMap.get(t._id);n=n._parent}return t._defaultValue}function xe(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onMount must be called inside a component during render");d.currentVNode._onMountCallbacks.push(t)}}function Me(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onUnmount must be called inside a component during render");d.currentVNode._onUnmountCallbacks.push(t)}}function Oe(t){if(!(typeof document>"u")){if(d.currentVNode===null)throw new Error("onBeforeExit must be called inside a component during render");d.currentVNode._onBeforeExitCallbacks.push(t)}}function Pe(t){if(!(typeof document>"u"))try{t()}catch(e){console.error(e)}}class De{readCallbacks=new Set;updateCallbacks=new Set;renderCallbacks=new Set;readKeepAlive=new Set;updateKeepAlive=new Set;renderKeepAlive=new Set;isProcessing=!1;frameScheduled=!1;frameId=null;lastTimestamp=0;currentDelta=0;trackFPS;fpsHistorySize;fpsHistory=[];constructor(e={}){this.trackFPS=e.trackFPS??!1,this.fpsHistorySize=e.fpsHistorySize??60}read(e,n=!1){return n?this.readKeepAlive.add(e):this.readCallbacks.add(e),this.scheduleFrame(),e}update(e,n=!1){return n?this.updateKeepAlive.add(e):this.updateCallbacks.add(e),this.scheduleFrame(),e}render(e,n=!1){return n?this.renderKeepAlive.add(e):this.renderCallbacks.add(e),this.scheduleFrame(),e}chain(e){let n,i;"read"in e&&this.readCallbacks.add(r=>{n=e.read(r)}),"update"in e?(this.updateCallbacks.add(r=>{i=e.update(n,r)}),this.renderCallbacks.add(r=>{e.render(i,r)})):this.renderCallbacks.add(r=>{e.render(n,r)}),this.scheduleFrame()}cancel(e){this.readCallbacks.delete(e),this.updateCallbacks.delete(e),this.renderCallbacks.delete(e),this.readKeepAlive.delete(e),this.updateKeepAlive.delete(e),this.renderKeepAlive.delete(e)}cancelAll(){this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null),this.readCallbacks.clear(),this.updateCallbacks.clear(),this.renderCallbacks.clear(),this.readKeepAlive.clear(),this.updateKeepAlive.clear(),this.renderKeepAlive.clear(),this.isProcessing=!1,this.frameScheduled=!1,this.lastTimestamp=0,this.currentDelta=0,this.trackFPS&&(this.fpsHistory=[])}get data(){return{timestamp:this.lastTimestamp,delta:this.currentDelta||16.67}}get isRunning(){return this.isProcessing||this.readKeepAlive.size>0||this.updateKeepAlive.size>0||this.renderKeepAlive.size>0}get fps(){return this.trackFPS?this.currentDelta>0?1e3/this.currentDelta:0:(console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0)}get averageFps(){if(!this.trackFPS)return console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0;if(this.fpsHistory.length===0)return 0;const e=this.fpsHistory.reduce((n,i)=>n+i,0);return Math.round(e/this.fpsHistory.length)}get refreshRate(){return this.trackFPS?Math.round(this.averageFps):(console.warn("FPS tracking is disabled. Enable with { trackFPS: true }"),0)}scheduleFrame(){this.frameScheduled||this.isProcessing||(this.frameScheduled=!0,this.frameId=requestAnimationFrame(e=>{this.processFrame(e)}))}processFrame(e){this.isProcessing=!0,this.frameScheduled=!1,this.lastTimestamp===0?this.currentDelta=16.67:this.currentDelta=e-this.lastTimestamp,this.lastTimestamp=e,this.trackFPS&&this.currentDelta>0&&(this.fpsHistory.push(1e3/this.currentDelta),this.fpsHistory.length>this.fpsHistorySize&&this.fpsHistory.shift());const n=this.data;this.executeCallbacks(this.readCallbacks,n),this.executeCallbacks(this.readKeepAlive,n),this.executeCallbacks(this.updateCallbacks,n),this.executeCallbacks(this.updateKeepAlive,n),this.executeCallbacks(this.renderCallbacks,n),this.executeCallbacks(this.renderKeepAlive,n),this.isProcessing=!1,this.hasKeepAliveCallbacks()&&this.scheduleFrame()}executeCallbacks(e,n){e.forEach(i=>{try{i(n)}catch(r){console.error("Frame callback error:",r)}}),this.isKeepAliveSet(e)||e.clear()}hasKeepAliveCallbacks(){return this.readKeepAlive.size>0||this.updateKeepAlive.size>0||this.renderKeepAlive.size>0}isKeepAliveSet(e){return e===this.readKeepAlive||e===this.updateKeepAlive||e===this.renderKeepAlive}}class Fe{gestureId=0;activeGestures=new Map;disabledGestures=new Map;capturedId;gestureWithPriority=new Map;maxPriority=-1/0;newId(){return++this.gestureId}canStart(e){if(this.capturedId!==void 0)return!1;const n=this.disabledGestures.get(e);return!(n&&n.size>0)}start(e,n,i){return this.canStart(n)?(this.activeGestures.set(e,n),this.gestureWithPriority.set(e,i),this.maxPriority=Math.max(this.maxPriority,i),!0):!1}capture(e,n,i){return!this.activeGestures.has(e)&&!this.start(e,n,i)?!1:i>=this.maxPriority?(this.capturedId=e,this.activeGestures.forEach((r,s)=>{s!==e&&this.release(s)}),!0):(this.release(e),!1)}release(e){const n=this.activeGestures.get(e);this.activeGestures.delete(e);const i=this.gestureWithPriority.get(e);if(this.gestureWithPriority.delete(e),this.capturedId===e&&(this.capturedId=void 0),i===this.maxPriority&&(this.maxPriority=-1/0,this.gestureWithPriority.forEach(r=>{this.maxPriority=Math.max(this.maxPriority,r)})),n){const r=this.disabledGestures.get(n);r&&(r.delete(e),r.size===0&&this.disabledGestures.delete(n))}}disableGesture(e,n){let i=this.disabledGestures.get(e);i||(i=new Set,this.disabledGestures.set(e,i)),i.add(n)}enableGesture(e,n){const i=this.disabledGestures.get(e);i&&(i.delete(n),i.size===0&&this.disabledGestures.delete(e))}createGesture(e,n){const i=this.newId(),r=n.name||"gesture-"+i,s=n.priority??0;return new Le(this,i,e,r,s,n)}}class Le{el;options;details;minTouches;maxTouches;threshold;direction;lastMoveTime=0;prevX=0;prevY=0;initialDistance=0;initialAngle=0;boundOnStart;boundOnMove;boundOnEnd;passive;hasPassedThreshold=!1;controller;id;name;priority;useThreshold;constructor(e,n,i,r,s,o){this.controller=e,this.id=n,this.el=i,this.options=o,this.name=r,this.priority=s*1e3+n,this.minTouches=o.minTouches??1,this.maxTouches=o.maxTouches??1/0,this.passive=o.passive??!0,this.threshold=o.threshold??0,this.direction=o.direction??"all",this.useThreshold=this.threshold>0,this.details={type:this.name,isTracking:!1,startX:0,startY:0,currentX:0,currentY:0,deltaX:0,deltaY:0,velocityX:0,velocityY:0,touchCount:0,scale:1,rotation:0},this.boundOnStart=this.onStart.bind(this),this.boundOnMove=this.onMove.bind(this),this.boundOnEnd=this.onEnd.bind(this)}getDistance(e){if(e.length<2)return 0;const n=e[0].clientX-e[1].clientX,i=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+i*i)}getAngle(e){if(e.length<2)return 0;const n=e[1].clientX-e[0].clientX,i=e[1].clientY-e[0].clientY;return Math.atan2(i,n)*180/Math.PI}getCenter(e){if("touches"in e){if(e.touches.length===0)return{x:0,y:0};let n=0,i=0;for(let r=0;r<e.touches.length;r++)n+=e.touches[r].clientX,i+=e.touches[r].clientY;return{x:n/e.touches.length,y:i/e.touches.length}}else return{x:e.clientX,y:e.clientY}}canStart(e){const i="touches"in e?e.touches.length:1;return i>=this.minTouches&&i<=this.maxTouches&&this.controller.canStart(this.name)}checkThreshold(){if(!this.useThreshold)return!0;const{deltaX:e,deltaY:n}=this.details;return this.direction==="x"?Math.abs(e)>=this.threshold:this.direction==="y"?Math.abs(n)>=this.threshold:Math.sqrt(e*e+n*n)>=this.threshold}onStart(e){if(!this.canStart(e))return;const n="touches"in e,i=this.getCenter(e);this.details.startX=i.x,this.details.startY=i.y,this.details.currentX=i.x,this.details.currentY=i.y,this.details.touchCount=n?e.touches.length:1,this.details.event=e,n&&e.touches.length>=2?(this.initialDistance=this.getDistance(e.touches),this.initialAngle=this.getAngle(e.touches)):(this.initialDistance=0,this.initialAngle=0),!(this.options.canStart&&!this.options.canStart(this.details))&&(this.passive||e.preventDefault(),this.details.isTracking=!0,this.details.deltaX=0,this.details.deltaY=0,this.details.velocityX=0,this.details.velocityY=0,this.details.scale=1,this.details.rotation=0,this.hasPassedThreshold=!this.useThreshold,this.lastMoveTime=Date.now(),this.prevX=i.x,this.prevY=i.y,this.controller.start(this.id,this.name,this.priority),this.useThreshold||this.tryCapture())}onMove(e){if(!this.details.isTracking)return;this.passive||e.preventDefault();const n="touches"in e,i=this.getCenter(e),r=Date.now(),s=r-this.lastMoveTime;if(this.details.currentX=i.x,this.details.currentY=i.y,this.details.deltaX=this.details.currentX-this.details.startX,this.details.deltaY=this.details.currentY-this.details.startY,this.details.touchCount=n?e.touches.length:1,this.details.event=e,n&&e.touches.length>=2){const o=this.getDistance(e.touches),a=this.getAngle(e.touches);this.initialDistance>0&&(this.details.scale=o/this.initialDistance);let l=a-this.initialAngle;l>180&&(l-=360),l<-180&&(l+=360),this.details.rotation=l}else this.details.scale=1,this.details.rotation=0;if(s>0&&(this.details.velocityX=(this.details.currentX-this.prevX)/s,this.details.velocityY=(this.details.currentY-this.prevY)/s),this.prevX=this.details.currentX,this.prevY=this.details.currentY,this.lastMoveTime=r,!this.hasPassedThreshold&&this.checkThreshold()){this.hasPassedThreshold=!0,this.tryCapture();return}this.hasPassedThreshold&&this.options.onMove&&this.options.onMove(this.details)}tryCapture(){this.controller.capture(this.id,this.name,this.priority)&&this.options.onStart&&this.options.onStart(this.details)}onEnd(e){if(!this.details.isTracking)return;this.passive||e.preventDefault();const n="touches"in e;this.details.touchCount=n?e.touches.length:0,this.details.event=e,this.controller.release(this.id),this.details.isTracking=!1,this.hasPassedThreshold=!this.useThreshold,this.options.onEnd&&this.options.onEnd(this.details)}init(){if(!this.el)return;const e={passive:this.passive},n={passive:this.passive},i={passive:this.passive};this.el.addEventListener("touchstart",this.boundOnStart,e),document.addEventListener("touchmove",this.boundOnMove,n),document.addEventListener("touchend",this.boundOnEnd,i),document.addEventListener("touchcancel",this.boundOnEnd,i),this.el.addEventListener("mousedown",this.boundOnStart,e),document.addEventListener("mousemove",this.boundOnMove,n),document.addEventListener("mouseup",this.boundOnEnd,i),document.addEventListener("mouseleave",this.boundOnEnd,i)}destroy(){this.el&&(this.el.removeEventListener("touchstart",this.boundOnStart),document.removeEventListener("touchmove",this.boundOnMove),document.removeEventListener("touchend",this.boundOnEnd),document.removeEventListener("touchcancel",this.boundOnEnd),this.el.removeEventListener("mousedown",this.boundOnStart),document.removeEventListener("mousemove",this.boundOnMove),document.removeEventListener("mouseup",this.boundOnEnd),document.removeEventListener("mouseleave",this.boundOnEnd),this.controller.release(this.id))}}let N;function He(){return N||(N=new Fe),N}function Ie(t,e){return He().createGesture(t,e)}function Ke(t){typeof document>"u"||(document.startViewTransition?document.startViewTransition(t):t())}let Ve=0;function Ge(t,e=[],n={duration:500,namePrefix:"vt"}){if(!document.startViewTransition){t();return}const i=e.map((s,o)=>`${n.namePrefix}-${++Ve}-${o}`);e.forEach((s,o)=>{s.style.viewTransitionName=i[o]}),document.startViewTransition(()=>{t()}).finished.finally(()=>{e.forEach(s=>{s.style.viewTransitionName=""})}),document.documentElement.style.setProperty("--vt-duration",`${n.duration}ms`)}exports.Fragment=d.Fragment;exports.Computed=m;exports.Effect=b;exports.FrameScheduler=De;exports.Signal=u;exports.batch=R;exports.computed=Z;exports.createContext=Ne;exports.createGesture=Ie;exports.effect=g;exports.get=ee;exports.hydrate=Ee;exports.link=ne;exports.onBeforeExit=Oe;exports.onLoad=Pe;exports.onMount=xe;exports.onUnmount=Me;exports.peek=Q;exports.render=pe;exports.set=te;exports.signal=q;exports.startViewTransition=Ke;exports.suspend=Te;exports.useContext=Ae;exports.withViewTransition=Ge;
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { n as H, s as w, g as I, c as m } from "./jsx-dev-runtime-dAReTOgq.js";
|
|
12
12
|
import { F as Re } from "./jsx-dev-runtime-dAReTOgq.js";
|
|
13
|
-
import { p as q,
|
|
13
|
+
import { p as q, b as Z } from "./server-context-CJbtcTMO.js";
|
|
14
14
|
var J = Symbol.for("preact-signals");
|
|
15
15
|
function T() {
|
|
16
16
|
if (p > 1)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Flash
|
|
4
|
+
* Copyright (c) 2025 Mateo Suarez. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Free to use in your own personal or commercial applications and projects.
|
|
7
|
+
* Unauthorized copying, modification, or distribution is strictly prohibited.
|
|
8
|
+
* See LICENSE file for full terms.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
"use strict";const n=new Map;let d=0,r=null;function c(){const e=d++;return n.set(e,null),r=e,e}function l(e){n.delete(e),r===e&&(r=null)}function o(){return r===null?null:n.get(r)??null}function i(e){if(r===null)throw new Error("No active render context");n.set(r,e)}function a(){if(r===null)throw new Error("createServerVNode called outside of render context");return{_parent:o(),_renderId:r}}function s(e,u){const t=o();if(!t)throw new Error("provideServerContext called outside of component render");t._contextMap||(t._contextMap=new Map),t._contextMap.set(e,u)}function x(e,u){let t=o();for(;t;){if(t._contextMap?.has(e))return t._contextMap.get(e);t=t._parent}return u}exports.consumeServerContext=x;exports.createServerVNode=a;exports.endRenderContext=l;exports.getCurrentServerVNode=o;exports.provideServerContext=s;exports.setCurrentServerVNode=i;exports.startRenderContext=c;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Flash
|
|
4
|
+
* Copyright (c) 2025 Mateo Suarez. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Free to use in your own personal or commercial applications and projects.
|
|
7
|
+
* Unauthorized copying, modification, or distribution is strictly prohibited.
|
|
8
|
+
* See LICENSE file for full terms.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const r = /* @__PURE__ */ new Map();
|
|
12
|
+
let u = 0, n = null;
|
|
13
|
+
function a() {
|
|
14
|
+
const e = u++;
|
|
15
|
+
return r.set(e, null), n = e, e;
|
|
16
|
+
}
|
|
17
|
+
function l(e) {
|
|
18
|
+
r.delete(e), n === e && (n = null);
|
|
19
|
+
}
|
|
20
|
+
function c() {
|
|
21
|
+
return n === null ? null : r.get(n) ?? null;
|
|
22
|
+
}
|
|
23
|
+
function d(e) {
|
|
24
|
+
if (n === null)
|
|
25
|
+
throw new Error("No active render context");
|
|
26
|
+
r.set(n, e);
|
|
27
|
+
}
|
|
28
|
+
function s() {
|
|
29
|
+
if (n === null)
|
|
30
|
+
throw new Error("createServerVNode called outside of render context");
|
|
31
|
+
return {
|
|
32
|
+
_parent: c(),
|
|
33
|
+
_renderId: n
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function i(e, o) {
|
|
37
|
+
const t = c();
|
|
38
|
+
if (!t)
|
|
39
|
+
throw new Error("provideServerContext called outside of component render");
|
|
40
|
+
t._contextMap || (t._contextMap = /* @__PURE__ */ new Map()), t._contextMap.set(e, o);
|
|
41
|
+
}
|
|
42
|
+
function f(e, o) {
|
|
43
|
+
let t = c();
|
|
44
|
+
for (; t; ) {
|
|
45
|
+
if (t._contextMap?.has(e))
|
|
46
|
+
return t._contextMap.get(e);
|
|
47
|
+
t = t._parent;
|
|
48
|
+
}
|
|
49
|
+
return o;
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
d as a,
|
|
53
|
+
f as b,
|
|
54
|
+
s as c,
|
|
55
|
+
l as e,
|
|
56
|
+
c as g,
|
|
57
|
+
i as p,
|
|
58
|
+
a as s
|
|
59
|
+
};
|
package/dist/server.cjs
CHANGED
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
* See LICENSE file for full terms.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
11
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./server-context-C7Uxb3AS.cjs"),S=require("node:fs/promises"),g=require("node:path");function N(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function b(r){return r.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}const H=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function j(r){return/^on[A-Z]/.test(r)}function E(r){return Object.entries(r).map(([t,n])=>`${t.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`)}:${n}`).join(";")}function T(r,t=!0){const n=Object.entries(r).filter(([e,o])=>!(o==null||t&&e==="children"||e==="innerHTML"||j(e))).map(([e,o])=>(e==="className"&&(e="class"),e==="style"&&typeof o=="object"&&(o=E(o)),typeof o=="boolean"?o?e:"":`${e}="${b(String(o))}"`)).filter(Boolean).join(" ");return n?` ${n}`:""}function A(r){return r?Array.isArray(r)?r:[r]:[]}function w(r){return r&&typeof r.then=="function"}function v(r,t){return`<div id="${r}" data-server-component="suspended" data-component-name="${t}">Loading...</div>`}const p=new Map;let y=0;function D(r){p.clear(),y=0;const t=l.startRenderContext();try{return a(r)}finally{l.endRenderContext(t)}}async function x(r){p.clear(),y=0;const t=l.startRenderContext();try{let n=a(r);for(;p.size>0;){console.log(`🔄 Resolving ${p.size} async components in parallel...`);const e=Array.from(p.entries());p.clear();const o=await Promise.allSettled(e.map(([s,{promise:i}])=>i));for(let s=0;s<e.length;s++){const i=e[s];if(!i)continue;const[u,{componentName:c,errorFallback:d,parentNode:h}]=i,m=o[s];if(!m)continue;const $=v(u,c);if(m.status==="fulfilled")try{console.log(`✅ Resolved: ${c} (${u})`),l.setCurrentServerVNode(h);const f=a(m.value);n=n.replace($,f)}catch(f){console.error(`❌ Error rendering ${c}:`,f),l.setCurrentServerVNode(h);const C=d?a(typeof d=="function"?d(f):d):`<div class="error">Error rendering ${c}</div>`;n=n.replace($,C)}else{console.error(`❌ Error resolving ${c}:`,m.reason),l.setCurrentServerVNode(h);const f=d?a(typeof d=="function"?d(m.reason):d):`<div class="error">Error loading ${c}</div>`;n=n.replace($,f)}}}return console.log("✅ All async components resolved!"),n}finally{l.endRenderContext(t)}}async function*P(r){p.clear(),y=0;const t=l.startRenderContext();try{for(yield a(r);p.size>0;){const e=Array.from(p.entries());p.clear();const o=e.map(async([s,{promise:i,parentNode:u}])=>{try{const c=await i;l.setCurrentServerVNode(u);const d=a(c);return`<script>
|
|
12
12
|
(function() {
|
|
13
|
-
const el = document.getElementById('${
|
|
13
|
+
const el = document.getElementById('${s}');
|
|
14
14
|
if (el) {
|
|
15
|
-
el.outerHTML = \`${
|
|
15
|
+
el.outerHTML = \`${d.replace(/`/g,"\\`").replace(/\$/g,"\\$")}\`;
|
|
16
16
|
}
|
|
17
17
|
})();
|
|
18
18
|
<\/script>`}catch{return`<script>
|
|
19
19
|
(function() {
|
|
20
|
-
const el = document.getElementById('${
|
|
20
|
+
const el = document.getElementById('${s}');
|
|
21
21
|
if (el) {
|
|
22
22
|
el.innerHTML = '<div class="error">Error loading component</div>';
|
|
23
23
|
}
|
|
24
24
|
})();
|
|
25
|
-
<\/script>`}});for(const
|
|
26
|
-
Example: const ${
|
|
27
|
-
<html${e}>${
|
|
25
|
+
<\/script>`}});for(const s of o)yield await s}}finally{l.endRenderContext(t)}}function a(r){if(typeof r=="function"){const e=r();return Array.isArray(e)?`<!--reactive-list-->${e.map(s=>a(s)).join("")}`:a(e)}if(typeof r=="string")return N(r);if(typeof r=="number")return String(r);if(Array.isArray(r))return r.map(e=>a(e)).join("");if(!r||typeof r!="object")return"";const{type:t,props:n}=r;if(t===Symbol.for("jsx.fragment"))return A(n.children).map(o=>a(o)).join("");if(typeof t=="string"&&t==="suspended"){const e=r,o=`async-${y++}`;return console.log(`⏳ Suspending: ${e._componentName} (${o})`),p.set(o,{id:o,promise:e.promise,componentName:e._componentName,errorFallback:e.errorFallback,parentNode:l.getCurrentServerVNode()}),v(o,e._componentName)}if(typeof t=="function"){const e=l.createServerVNode(),o=l.getCurrentServerVNode();l.setCurrentServerVNode(e);const s=t(n);if(w(s)){const u=`async-${y++}`,c=t.name||"AsyncComponent";return console.warn(`⚠️ DEPRECATED: Direct async component "${c}" detected. Please use suspend() HOF instead for better type safety and custom fallbacks.
|
|
26
|
+
Example: const ${c} = suspend(async (props) => { ... }, <Loading />, <Error />);`),console.log(`⏳ Suspending: ${c} (${u})`),p.set(u,{id:u,promise:s,componentName:c,parentNode:e}),l.setCurrentServerVNode(o),v(u,c)}const i=a(s);return l.setCurrentServerVNode(o),i}if(typeof t=="string"){const e=T(n);if(H.has(t))return`<${t}${e} />`;if(n.innerHTML!==void 0){const i=typeof n.innerHTML=="object"?JSON.stringify(n.innerHTML):n.innerHTML;return`<${t}${e}>${i}</${t}>`}const s=A(n.children).map(i=>{if(Array.isArray(i))return i.map(u=>a(u)).join("");if(typeof i=="function"){const u=i();return Array.isArray(u)?`<!--reactive-list-->${u.map(d=>a(d)).join("")}`:`<!--reactive-->${a(u)}`}return a(i)}).join("");return t==="html"?`<!DOCTYPE html>
|
|
27
|
+
<html${e}>${s}</html>`:`<${t}${e}>${s}</${t}>`}return""}class V{cacheDir;useDirectoryStructure;constructor(t={}){this.cacheDir=t.cacheDir||"./cache/html",this.useDirectoryStructure=t.useDirectoryStructure??!1}async save(t,n){const e=this.getFilepath(t);return await S.mkdir(g.dirname(e),{recursive:!0}),await Bun.write(e,n),console.log(`✅ Pre-rendered: ${t} → ${e}`),e}async load(t){const n=this.getFilepath(t),e=Bun.file(n);return await e.exists()?e:null}async clear(){await S.rm(this.cacheDir,{recursive:!0,force:!0}),await S.mkdir(this.cacheDir,{recursive:!0}),console.log("🗑️ Cache cleared")}async exists(t){const n=this.getFilepath(t);return await Bun.file(n).exists()}getFilepath(t){const n=t.replace(/^\/+|\/+$/g,"");if(this.useDirectoryStructure)return n===""?g.join(this.cacheDir,"index.html"):g.join(this.cacheDir,n,"index.html");{const e=n===""?"index.html":`${n.replace(/\//g,"-")}.html`;return g.join(this.cacheDir,e)}}}exports.PreRenderer=V;exports.renderToStream=P;exports.renderToString=D;exports.renderToStringAsync=x;
|
package/dist/server.js
CHANGED
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
* See LICENSE file for full terms.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import { mkdir as
|
|
13
|
-
import { dirname as
|
|
14
|
-
function
|
|
15
|
-
return
|
|
11
|
+
import { s as v, e as A, a as f, g as b, c as w } from "./server-context-CJbtcTMO.js";
|
|
12
|
+
import { mkdir as H, rm as D } from "node:fs/promises";
|
|
13
|
+
import { dirname as j, join as $ } from "node:path";
|
|
14
|
+
function T(r) {
|
|
15
|
+
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function C(r) {
|
|
18
|
+
return r.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const x = /* @__PURE__ */ new Set([
|
|
21
21
|
"area",
|
|
22
22
|
"base",
|
|
23
23
|
"br",
|
|
@@ -32,208 +32,225 @@ const T = /* @__PURE__ */ new Set([
|
|
|
32
32
|
"track",
|
|
33
33
|
"wbr"
|
|
34
34
|
]);
|
|
35
|
-
function
|
|
36
|
-
return /^on[A-Z]/.test(
|
|
35
|
+
function L(r) {
|
|
36
|
+
return /^on[A-Z]/.test(r);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return Object.entries(
|
|
38
|
+
function P(r) {
|
|
39
|
+
return Object.entries(r).map(([t, n]) => `${t.replace(/[A-Z]/g, (o) => `-${o.toLowerCase()}`)}:${n}`).join(";");
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
return
|
|
41
|
+
function I(r, t = !0) {
|
|
42
|
+
const n = Object.entries(r).filter(([e, o]) => !(o == null || t && e === "children" || e === "innerHTML" || L(e))).map(([e, o]) => (e === "className" && (e = "class"), e === "style" && typeof o == "object" && (o = P(o)), typeof o == "boolean" ? o ? e : "" : `${e}="${C(String(o))}"`)).filter(Boolean).join(" ");
|
|
43
|
+
return n ? ` ${n}` : "";
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
45
|
+
function E(r) {
|
|
46
|
+
return r ? Array.isArray(r) ? r : [r] : [];
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
48
|
+
function M(r) {
|
|
49
|
+
return r && typeof r.then == "function";
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return `<div id="${
|
|
51
|
+
function S(r, t) {
|
|
52
|
+
return `<div id="${r}" data-server-component="suspended" data-component-name="${t}">Loading...</div>`;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
54
|
+
const p = /* @__PURE__ */ new Map();
|
|
55
55
|
let y = 0;
|
|
56
|
-
function
|
|
57
|
-
|
|
56
|
+
function O(r) {
|
|
57
|
+
p.clear(), y = 0;
|
|
58
|
+
const t = v();
|
|
59
|
+
try {
|
|
60
|
+
return a(r);
|
|
61
|
+
} finally {
|
|
62
|
+
A(t);
|
|
63
|
+
}
|
|
58
64
|
}
|
|
59
|
-
async function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
65
|
+
async function R(r) {
|
|
66
|
+
p.clear(), y = 0;
|
|
67
|
+
const t = v();
|
|
68
|
+
try {
|
|
69
|
+
let n = a(r);
|
|
70
|
+
for (; p.size > 0; ) {
|
|
71
|
+
console.log(
|
|
72
|
+
`🔄 Resolving ${p.size} async components in parallel...`
|
|
73
|
+
);
|
|
74
|
+
const e = Array.from(p.entries());
|
|
75
|
+
p.clear();
|
|
76
|
+
const o = await Promise.allSettled(
|
|
77
|
+
e.map(([i, { promise: s }]) => s)
|
|
78
|
+
);
|
|
79
|
+
for (let i = 0; i < e.length; i++) {
|
|
80
|
+
const s = e[i];
|
|
81
|
+
if (!s) continue;
|
|
82
|
+
const [l, { componentName: c, errorFallback: u, parentNode: g }] = s, m = o[i];
|
|
83
|
+
if (!m) continue;
|
|
84
|
+
const h = S(l, c);
|
|
85
|
+
if (m.status === "fulfilled")
|
|
86
|
+
try {
|
|
87
|
+
console.log(`✅ Resolved: ${c} (${l})`), f(g);
|
|
88
|
+
const d = a(m.value);
|
|
89
|
+
n = n.replace(h, d);
|
|
90
|
+
} catch (d) {
|
|
91
|
+
console.error(`❌ Error rendering ${c}:`, d), f(g);
|
|
92
|
+
const N = u ? a(
|
|
93
|
+
typeof u == "function" ? u(d) : u
|
|
94
|
+
) : `<div class="error">Error rendering ${c}</div>`;
|
|
95
|
+
n = n.replace(h, N);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
console.error(`❌ Error resolving ${c}:`, m.reason), f(g);
|
|
99
|
+
const d = u ? a(
|
|
100
|
+
typeof u == "function" ? u(m.reason) : u
|
|
101
|
+
) : `<div class="error">Error loading ${c}</div>`;
|
|
102
|
+
n = n.replace(h, d);
|
|
88
103
|
}
|
|
89
|
-
else {
|
|
90
|
-
console.error(`❌ Error resolving ${i}:`, m.reason), p(d);
|
|
91
|
-
const f = s ? c(
|
|
92
|
-
typeof s == "function" ? s(m.reason) : s
|
|
93
|
-
) : `<div class="error">Error loading ${i}</div>`;
|
|
94
|
-
r = r.replace(g, f);
|
|
95
104
|
}
|
|
96
105
|
}
|
|
106
|
+
return console.log("✅ All async components resolved!"), n;
|
|
107
|
+
} finally {
|
|
108
|
+
A(t);
|
|
97
109
|
}
|
|
98
|
-
return console.log("✅ All async components resolved!"), r;
|
|
99
110
|
}
|
|
100
|
-
async function*
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
async function* V(r) {
|
|
112
|
+
p.clear(), y = 0;
|
|
113
|
+
const t = v();
|
|
114
|
+
try {
|
|
115
|
+
for (yield a(r); p.size > 0; ) {
|
|
116
|
+
const e = Array.from(p.entries());
|
|
117
|
+
p.clear();
|
|
118
|
+
const o = e.map(
|
|
119
|
+
async ([i, { promise: s, parentNode: l }]) => {
|
|
120
|
+
try {
|
|
121
|
+
const c = await s;
|
|
122
|
+
f(l);
|
|
123
|
+
const u = a(c);
|
|
124
|
+
return `<script>
|
|
111
125
|
(function() {
|
|
112
|
-
const el = document.getElementById('${
|
|
126
|
+
const el = document.getElementById('${i}');
|
|
113
127
|
if (el) {
|
|
114
|
-
el.outerHTML = \`${
|
|
128
|
+
el.outerHTML = \`${u.replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;
|
|
115
129
|
}
|
|
116
130
|
})();
|
|
117
131
|
<\/script>`;
|
|
118
|
-
|
|
119
|
-
|
|
132
|
+
} catch {
|
|
133
|
+
return `<script>
|
|
120
134
|
(function() {
|
|
121
|
-
const el = document.getElementById('${
|
|
135
|
+
const el = document.getElementById('${i}');
|
|
122
136
|
if (el) {
|
|
123
137
|
el.innerHTML = '<div class="error">Error loading component</div>';
|
|
124
138
|
}
|
|
125
139
|
})();
|
|
126
140
|
<\/script>`;
|
|
141
|
+
}
|
|
127
142
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
143
|
+
);
|
|
144
|
+
for (const i of o)
|
|
145
|
+
yield await i;
|
|
146
|
+
}
|
|
147
|
+
} finally {
|
|
148
|
+
A(t);
|
|
132
149
|
}
|
|
133
150
|
}
|
|
134
|
-
function
|
|
135
|
-
if (typeof
|
|
136
|
-
const e =
|
|
137
|
-
return Array.isArray(e) ? `<!--reactive-list-->${e.map((
|
|
151
|
+
function a(r) {
|
|
152
|
+
if (typeof r == "function") {
|
|
153
|
+
const e = r();
|
|
154
|
+
return Array.isArray(e) ? `<!--reactive-list-->${e.map((i) => a(i)).join("")}` : a(e);
|
|
138
155
|
}
|
|
139
|
-
if (typeof
|
|
140
|
-
return
|
|
141
|
-
if (typeof
|
|
142
|
-
return String(
|
|
143
|
-
if (Array.isArray(
|
|
144
|
-
return
|
|
145
|
-
if (!
|
|
156
|
+
if (typeof r == "string")
|
|
157
|
+
return T(r);
|
|
158
|
+
if (typeof r == "number")
|
|
159
|
+
return String(r);
|
|
160
|
+
if (Array.isArray(r))
|
|
161
|
+
return r.map((e) => a(e)).join("");
|
|
162
|
+
if (!r || typeof r != "object")
|
|
146
163
|
return "";
|
|
147
|
-
const { type:
|
|
148
|
-
if (
|
|
149
|
-
return
|
|
150
|
-
if (typeof
|
|
151
|
-
const e =
|
|
164
|
+
const { type: t, props: n } = r;
|
|
165
|
+
if (t === Symbol.for("jsx.fragment"))
|
|
166
|
+
return E(n.children).map((o) => a(o)).join("");
|
|
167
|
+
if (typeof t == "string" && t === "suspended") {
|
|
168
|
+
const e = r, o = `async-${y++}`;
|
|
152
169
|
return console.log(
|
|
153
|
-
`⏳ Suspending: ${e._componentName} (${
|
|
154
|
-
),
|
|
155
|
-
id:
|
|
170
|
+
`⏳ Suspending: ${e._componentName} (${o})`
|
|
171
|
+
), p.set(o, {
|
|
172
|
+
id: o,
|
|
156
173
|
promise: e.promise,
|
|
157
174
|
componentName: e._componentName,
|
|
158
175
|
errorFallback: e.errorFallback,
|
|
159
|
-
parentNode:
|
|
160
|
-
}),
|
|
176
|
+
parentNode: b()
|
|
177
|
+
}), S(o, e._componentName);
|
|
161
178
|
}
|
|
162
|
-
if (typeof
|
|
163
|
-
const e =
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
const
|
|
179
|
+
if (typeof t == "function") {
|
|
180
|
+
const e = w(), o = b();
|
|
181
|
+
f(e);
|
|
182
|
+
const i = t(n);
|
|
183
|
+
if (M(i)) {
|
|
184
|
+
const l = `async-${y++}`, c = t.name || "AsyncComponent";
|
|
168
185
|
return console.warn(
|
|
169
|
-
`⚠️ DEPRECATED: Direct async component "${
|
|
170
|
-
Example: const ${
|
|
171
|
-
), console.log(`⏳ Suspending: ${
|
|
172
|
-
id:
|
|
173
|
-
promise:
|
|
174
|
-
componentName:
|
|
186
|
+
`⚠️ DEPRECATED: Direct async component "${c}" detected. Please use suspend() HOF instead for better type safety and custom fallbacks.
|
|
187
|
+
Example: const ${c} = suspend(async (props) => { ... }, <Loading />, <Error />);`
|
|
188
|
+
), console.log(`⏳ Suspending: ${c} (${l})`), p.set(l, {
|
|
189
|
+
id: l,
|
|
190
|
+
promise: i,
|
|
191
|
+
componentName: c,
|
|
175
192
|
parentNode: e
|
|
176
|
-
}),
|
|
193
|
+
}), f(o), S(l, c);
|
|
177
194
|
}
|
|
178
|
-
const
|
|
179
|
-
return
|
|
195
|
+
const s = a(i);
|
|
196
|
+
return f(o), s;
|
|
180
197
|
}
|
|
181
|
-
if (typeof
|
|
182
|
-
const e =
|
|
183
|
-
if (
|
|
184
|
-
return `<${
|
|
185
|
-
if (
|
|
186
|
-
const
|
|
187
|
-
return `<${
|
|
198
|
+
if (typeof t == "string") {
|
|
199
|
+
const e = I(n);
|
|
200
|
+
if (x.has(t))
|
|
201
|
+
return `<${t}${e} />`;
|
|
202
|
+
if (n.innerHTML !== void 0) {
|
|
203
|
+
const s = typeof n.innerHTML == "object" ? JSON.stringify(n.innerHTML) : n.innerHTML;
|
|
204
|
+
return `<${t}${e}>${s}</${t}>`;
|
|
188
205
|
}
|
|
189
|
-
const
|
|
190
|
-
if (Array.isArray(
|
|
191
|
-
return
|
|
192
|
-
if (typeof
|
|
193
|
-
const
|
|
194
|
-
return Array.isArray(
|
|
206
|
+
const i = E(n.children).map((s) => {
|
|
207
|
+
if (Array.isArray(s))
|
|
208
|
+
return s.map((l) => a(l)).join("");
|
|
209
|
+
if (typeof s == "function") {
|
|
210
|
+
const l = s();
|
|
211
|
+
return Array.isArray(l) ? `<!--reactive-list-->${l.map((u) => a(u)).join("")}` : `<!--reactive-->${a(l)}`;
|
|
195
212
|
}
|
|
196
|
-
return
|
|
213
|
+
return a(s);
|
|
197
214
|
}).join("");
|
|
198
|
-
return
|
|
199
|
-
<html${e}>${
|
|
215
|
+
return t === "html" ? `<!DOCTYPE html>
|
|
216
|
+
<html${e}>${i}</html>` : `<${t}${e}>${i}</${t}>`;
|
|
200
217
|
}
|
|
201
218
|
return "";
|
|
202
219
|
}
|
|
203
|
-
class
|
|
220
|
+
class _ {
|
|
204
221
|
cacheDir;
|
|
205
222
|
useDirectoryStructure;
|
|
206
|
-
constructor(
|
|
207
|
-
this.cacheDir =
|
|
223
|
+
constructor(t = {}) {
|
|
224
|
+
this.cacheDir = t.cacheDir || "./cache/html", this.useDirectoryStructure = t.useDirectoryStructure ?? !1;
|
|
208
225
|
}
|
|
209
|
-
async save(
|
|
210
|
-
const e = this.getFilepath(
|
|
211
|
-
return await
|
|
226
|
+
async save(t, n) {
|
|
227
|
+
const e = this.getFilepath(t);
|
|
228
|
+
return await H(j(e), { recursive: !0 }), await Bun.write(e, n), console.log(`✅ Pre-rendered: ${t} → ${e}`), e;
|
|
212
229
|
}
|
|
213
|
-
async load(
|
|
214
|
-
const
|
|
230
|
+
async load(t) {
|
|
231
|
+
const n = this.getFilepath(t), e = Bun.file(n);
|
|
215
232
|
return await e.exists() ? e : null;
|
|
216
233
|
}
|
|
217
234
|
async clear() {
|
|
218
|
-
await
|
|
235
|
+
await D(this.cacheDir, { recursive: !0, force: !0 }), await H(this.cacheDir, { recursive: !0 }), console.log("🗑️ Cache cleared");
|
|
219
236
|
}
|
|
220
|
-
async exists(
|
|
221
|
-
const
|
|
222
|
-
return await Bun.file(
|
|
237
|
+
async exists(t) {
|
|
238
|
+
const n = this.getFilepath(t);
|
|
239
|
+
return await Bun.file(n).exists();
|
|
223
240
|
}
|
|
224
|
-
getFilepath(
|
|
225
|
-
const
|
|
241
|
+
getFilepath(t) {
|
|
242
|
+
const n = t.replace(/^\/+|\/+$/g, "");
|
|
226
243
|
if (this.useDirectoryStructure)
|
|
227
|
-
return
|
|
244
|
+
return n === "" ? $(this.cacheDir, "index.html") : $(this.cacheDir, n, "index.html");
|
|
228
245
|
{
|
|
229
|
-
const e =
|
|
230
|
-
return
|
|
246
|
+
const e = n === "" ? "index.html" : `${n.replace(/\//g, "-")}.html`;
|
|
247
|
+
return $(this.cacheDir, e);
|
|
231
248
|
}
|
|
232
249
|
}
|
|
233
250
|
}
|
|
234
251
|
export {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
252
|
+
_ as PreRenderer,
|
|
253
|
+
V as renderToStream,
|
|
254
|
+
O as renderToString,
|
|
255
|
+
R as renderToStringAsync
|
|
239
256
|
};
|
package/package.json
CHANGED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Flash
|
|
4
|
-
* Copyright (c) 2025 Mateo Suarez. All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* Free to use in your own personal or commercial applications and projects.
|
|
7
|
-
* Unauthorized copying, modification, or distribution is strictly prohibited.
|
|
8
|
-
* See LICENSE file for full terms.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const o = /* @__PURE__ */ new Map();
|
|
12
|
-
let r = null;
|
|
13
|
-
function c() {
|
|
14
|
-
return r === null ? null : o.get(r) ?? null;
|
|
15
|
-
}
|
|
16
|
-
function u(t) {
|
|
17
|
-
if (r === null)
|
|
18
|
-
throw new Error("No active render context");
|
|
19
|
-
o.set(r, t);
|
|
20
|
-
}
|
|
21
|
-
function a() {
|
|
22
|
-
if (r === null)
|
|
23
|
-
throw new Error("createServerVNode called outside of render context");
|
|
24
|
-
return {
|
|
25
|
-
_parent: c(),
|
|
26
|
-
_renderId: r
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function l() {
|
|
30
|
-
o.clear(), r = null;
|
|
31
|
-
}
|
|
32
|
-
function d(t, n) {
|
|
33
|
-
const e = c();
|
|
34
|
-
if (!e)
|
|
35
|
-
throw new Error("provideServerContext called outside of component render");
|
|
36
|
-
e._contextMap || (e._contextMap = /* @__PURE__ */ new Map()), e._contextMap.set(t, n);
|
|
37
|
-
}
|
|
38
|
-
function i(t, n) {
|
|
39
|
-
let e = c();
|
|
40
|
-
for (; e; ) {
|
|
41
|
-
if (e._contextMap?.has(t))
|
|
42
|
-
return e._contextMap.get(t);
|
|
43
|
-
e = e._parent;
|
|
44
|
-
}
|
|
45
|
-
return n;
|
|
46
|
-
}
|
|
47
|
-
export {
|
|
48
|
-
i as a,
|
|
49
|
-
a as c,
|
|
50
|
-
c as g,
|
|
51
|
-
d as p,
|
|
52
|
-
l as r,
|
|
53
|
-
u as s
|
|
54
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Flash
|
|
4
|
-
* Copyright (c) 2025 Mateo Suarez. All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* Free to use in your own personal or commercial applications and projects.
|
|
7
|
-
* Unauthorized copying, modification, or distribution is strictly prohibited.
|
|
8
|
-
* See LICENSE file for full terms.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
"use strict";const c=new Map;let r=null;function n(){return r===null?null:c.get(r)??null}function u(t){if(r===null)throw new Error("No active render context");c.set(r,t)}function d(){if(r===null)throw new Error("createServerVNode called outside of render context");return{_parent:n(),_renderId:r}}function l(){c.clear(),r=null}function i(t,o){const e=n();if(!e)throw new Error("provideServerContext called outside of component render");e._contextMap||(e._contextMap=new Map),e._contextMap.set(t,o)}function v(t,o){let e=n();for(;e;){if(e._contextMap?.has(t))return e._contextMap.get(t);e=e._parent}return o}exports.consumeServerContext=v;exports.createServerVNode=d;exports.getCurrentServerVNode=n;exports.provideServerContext=i;exports.resetServerContext=l;exports.setCurrentServerVNode=u;
|