@unsetsoft/ryunixjs 1.2.5-canary.6 → 1.2.5-canary.9

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Ryunix={})}(this,function(e){"use strict";const t="undefined"!=typeof requestIdleCallback?requestIdleCallback:e=>setTimeout(()=>e({timeRemaining:()=>1}),1);let r={containerRoot:null,nextUnitOfWork:null,currentRoot:null,wipRoot:null,deletions:[],wipFiber:null,hookIndex:0,effects:[]};const n=()=>r,o=/[A-Z]/g,s=Object.freeze({TEXT_ELEMENT:Symbol.for("ryunix.text.element"),RYUNIX_ELEMENT:Symbol.for("ryunix.element"),RYUNIX_EFFECT:Symbol.for("ryunix.effect"),RYUNIX_MEMO:Symbol.for("ryunix.memo"),RYUNIX_URL_QUERY:Symbol.for("ryunix.urlQuery"),RYUNIX_REF:Symbol.for("ryunix.ref"),RYUNIX_STORE:Symbol.for("ryunix.store"),RYUNIX_REDUCE:Symbol.for("ryunix.reduce"),RYUNIX_FRAGMENT:Symbol.for("ryunix.fragment"),RYUNIX_CONTEXT:Symbol.for("ryunix.context"),RYUNIX_SUSPENSE:Symbol.for("ryunix.suspense")}),i=Object.freeze({OBJECT:"object",FUNCTION:"function",STYLE:"ryunix-style",CLASS_NAME:"ryunix-class",CHILDREN:"children",BOOLEAN:"boolean",STRING:"string",UNDEFINED:"undefined"}),a=Object.freeze({STYLE:"style",CLASS_NAME:"className"}),l=Object.freeze({PLACEMENT:Symbol.for("ryunix.reconciler.status.placement"),UPDATE:Symbol.for("ryunix.reconciler.status.update"),DELETION:Symbol.for("ryunix.reconciler.status.deletion"),NO_EFFECT:Symbol.for("ryunix.reconciler.status.no_effect"),HYDRATE:Symbol.for("ryunix.reconciler.status.hydrate")}),c=(e,t=1)=>Array.isArray(e)?t<1?e.slice():e.reduce((e,r)=>(Array.isArray(r)&&t>0?e.push(...c(r,t-1)):e.push(r),e),[]):[e],u=e=>null!==e&&typeof e===i.OBJECT,d=e=>typeof e===i.FUNCTION,p=e=>typeof e===i.STRING,f=e=>null===e,y=e=>{let t=e;for(;t&&(3===t.nodeType&&!t.nodeValue.trim()||8===t.nodeType||1===t.nodeType&&t.hasAttribute("data-ryunix-ssr"));)t=t.nextSibling;return t},h=e=>({type:s.TEXT_ELEMENT,props:{nodeValue:e,children:[]}}),m=(e,t,...r)=>{const n=t||{};let o=r;0===r.length&&void 0!==n.children&&(o=Array.isArray(n.children)?n.children:[n.children]),o=o.flat().filter(e=>null!=e&&!1!==e&&!0!==e);const s=[];let a="";for(const e of o)typeof e!==i.OBJECT?a+=String(e):(""!==a&&(s.push(h(a)),a=""),s.push(e));return""!==a&&s.push(h(a)),{type:e,props:{...n,children:s}}},E=e=>{const t=Array.isArray(e.children)?e.children:[e.children];return m(s.RYUNIX_FRAGMENT,{},...t)},g=(e,t={},...r)=>{if(!e||!u(e))throw new Error("cloneElement requires a valid element");const n=r.length>0?r:e.props.children;return m(e.type,{...e.props,...t},...Array.isArray(n)?n:[n])},x=e=>u(e)&&void 0!==e.type&&void 0!==e.props,N=e=>e.startsWith("on"),b=e=>e!==i.CHILDREN&&!N(e),v=(e,t)=>r=>!Object.is(e[r],t[r]),_=e=>t=>!(t in e),R=e=>{e?.hooks?.length&&e.hooks.filter(e=>e.type===s.RYUNIX_EFFECT&&d(e.cancel)).forEach(e=>{try{e.cancel(),e.cancel=null}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in effect cleanup:",e)}})},w=e=>{e&&(e.hooks?.length>0&&e.hooks.filter(e=>e.type===s.RYUNIX_EFFECT&&d(e.cancel)).forEach(e=>{try{e.cancel(),e.cancel=null}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in deep effect cleanup:",e)}}),e.child&&w(e.child),e.sibling&&w(e.sibling))},S={strokeWidth:"stroke-width",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",fillRule:"fill-rule",fillOpacity:"fill-opacity",clipRule:"clip-rule",clipPath:"clip-path",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",textAnchor:"text-anchor",textDecoration:"text-decoration",dominantBaseline:"dominant-baseline",alignmentBaseline:"alignment-baseline",baselineShift:"baseline-shift",stopColor:"stop-color",stopOpacity:"stop-opacity",floodColor:"flood-color",floodOpacity:"flood-opacity",lightingColor:"lighting-color",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",pointerEvents:"pointer-events",shapeRendering:"shape-rendering",imageRendering:"image-rendering",markerStart:"marker-start",markerMid:"marker-mid",markerEnd:"marker-end"},k=e=>S[e]||e,T={IMMEDIATE:1,USER_BLOCKING:2,NORMAL:3,LOW:4,IDLE:5};let C=T.NORMAL,I=[],O=!1;const A=e=>{for(I.sort((e,t)=>e.priority-t.priority);I.length>0&&e.timeRemaining()>1;){const e=I.shift();C=e.priority,e.callback()}I.length>0?t(A):(O=!1,C=T.NORMAL)},D=(e,t)=>{const r=C;C=e;try{return t()}finally{C=r}},L=()=>C,M=e=>e.replace(o,e=>`-${e.toLowerCase()}`),U=(e,t,r)=>{if(!r||""===r.trim()){if(t){const r=t.split(/\s+/).filter(Boolean);e.classList.remove(...r)}return}if(t){const r=t.split(/\s+/).filter(Boolean);e.classList.remove(...r)}const n=r.split(/\s+/).filter(Boolean);n.length>0&&e.classList.add(...n)},$=e=>{if(e.type===s.RYUNIX_FRAGMENT||e.type===s.RYUNIX_CONTEXT||e.type===Symbol.for("ryunix.portal"))return null;let t;try{if(e.type===s.TEXT_ELEMENT)t=document.createTextNode("");else{if(!p(e.type))return"production"!==process.env.NODE_ENV&&console.warn("Attempted to create DOM for non-host component:",e.type),null;t=["svg","path","g","circle","polygon","rect","line","polyline","ellipse","text","tspan","defs","use","symbol","mask","clipPath","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComposite","foreignObject","image","marker","pattern","textPath"].includes(e.type)?document.createElementNS("http://www.w3.org/2000/svg",e.type):document.createElement(e.type)}return Y(t,{},e.props),t}catch(t){return"production"!==process.env.NODE_ENV&&console.error("Error creating DOM element:",t,e),null}},F=(e,t)=>{if("string"!=typeof t)return t;const r=e.toLowerCase();if("href"!==r&&"src"!==r&&"action"!==r&&"formaction"!==r)return t;const n=t.replace(/\s+/g,"").toLowerCase();return n.startsWith("javascript:")||n.startsWith("vbscript:")||n.startsWith("data:")?("production"!==process.env.NODE_ENV&&console.warn(`[Ryunix Security] Blocked dangerous ${e} URI: ${t}`),"javascript:void(0)"):t},Y=(e,t={},r={})=>{3!==e.nodeType?(Object.keys(t).filter(N).filter(e=>_(r)(e)||v(t,r)(e)).forEach(r=>{const n=r.toLowerCase().substring(2);try{const o=t[r],s=e._ryunixHandlers?.get(o)||o;e.removeEventListener(n,s),e._ryunixHandlers&&e._ryunixHandlers.delete(o)}catch(e){"production"!==process.env.NODE_ENV&&console.warn("Error removing event listener:",e)}}),Object.keys(t).filter(b).filter(_(r)).forEach(t=>{if(![i.STYLE,a.STYLE,i.CLASS_NAME,a.CLASS_NAME].includes(t))if(e instanceof SVGElement){const r=k(t);e.removeAttribute(r)}else e[t]="",e.removeAttribute(t)}),Object.keys(r).filter(b).filter(v(t,r)).forEach(n=>{try{if(n===i.STYLE||n===a.STYLE){const t=r[n];((e,t)=>{if(u(t)&&!f(t))try{const r=Object.entries(t).filter(([e,t])=>null!=t).map(([e,t])=>`${M(e)}: ${t}`).join("; ");e.style.cssText=r}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error applying styles:",e)}else e.style.cssText=""})(e,t)}else if(n===i.CLASS_NAME)U(e,t[i.CLASS_NAME],r[i.CLASS_NAME]);else if(n===a.CLASS_NAME)U(e,t[a.CLASS_NAME],r[a.CLASS_NAME]);else if("value"===n||"checked"===n)e[n]!==r[n]&&(e[n]=r[n]);else{if(e instanceof SVGElement){const t=k(n),o=F(t,r[n]);e.setAttribute(t,o)}else{const t=F(n,r[n]);e[n]=t,"object"!=typeof r[n]&&"function"!=typeof r[n]&&e.setAttribute(n,t)}}}catch(e){"production"!==process.env.NODE_ENV&&console.warn(`Error setting property ${n}:`,e)}}),Object.keys(r).filter(N).filter(v(t,r)).forEach(t=>{const n=t.toLowerCase().substring(2);try{const o=e=>{D(T.IMMEDIATE,()=>r[t](e))};e._ryunixHandlers||(e._ryunixHandlers=new Map),e._ryunixHandlers.set(r[t],o),e.addEventListener(n,o)}catch(e){"production"!==process.env.NODE_ENV&&console.warn("Error adding event listener:",e)}})):t.nodeValue!==r.nodeValue&&(e.nodeValue=r.nodeValue)},X=Symbol.for("ryunix.portal"),j=(e,t)=>t?{type:X,props:{children:Array.isArray(e)?e:[e]},containerInfo:t,_isPortal:!0}:("production"!==process.env.NODE_ENV&&console.error("createPortal: target container is not a DOM element."),null),P=e=>{if(e?.hooks?.length)for(let t=0;t<e.hooks.length;t++){const r=e.hooks[t];if(r.type===s.RYUNIX_EFFECT&&r.isLayout&&d(r.effect)){if(d(r.cancel))try{r.cancel()}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in layout effect cleanup:",e)}try{const e=r.effect();r.cancel=d(e)?e:null}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in layout effect:",e),r.cancel=null}r.effect=null}}},V=e=>{if(e?.hooks?.length)for(let t=0;t<e.hooks.length;t++){const r=e.hooks[t];if(r.type===s.RYUNIX_EFFECT&&!r.isLayout&&d(r.effect)){if(d(r.cancel))try{r.cancel()}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in effect cleanup:",e)}try{const e=r.effect();r.cancel=d(e)?e:null}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in effect:",e),r.cancel=null}r.effect=null}}};function B(e){if(!e)return;if(e.type===X||e._isPortal){const t=e.containerInfo;if(t){const r=e.child;r&&H(r,t)}return void B(e.sibling)}let t=e.parent;for(;t&&!t.dom;)t=t.parent;if(!t)return;const r=t.dom;if(e.effectTag===l.PLACEMENT)null!=e.dom&&("production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Appending PLACEMENT:",e.type),r.appendChild(e.dom)),P(e),V(e);else if(e.effectTag===l.UPDATE)R(e),null!=e.dom&&Y(e.dom,e.alternate.props,e.props),P(e),V(e);else if(e.effectTag===l.HYDRATE){n().hydrationFailed?("production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Hydration fallback PLACEMENT:",e.type),null!=e.dom&&r.appendChild(e.dom),P(e),V(e)):("production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Hydrating node:",e.type),null!=e.dom&&Y(e.dom,{},e.props),P(e),V(e))}else if(e.effectTag===l.DELETION)return w(e),void W(e);B(e.child),B(e.sibling)}const H=(e,t)=>{if(e){if(e.effectTag===l.PLACEMENT)null!=e.dom&&t.appendChild(e.dom),P(e),V(e);else if(e.effectTag===l.UPDATE)R(e),null!=e.dom&&Y(e.dom,e.alternate.props,e.props),P(e),V(e);else if(e.effectTag===l.DELETION)return w(e),void W(e);H(e.child,t),H(e.sibling,t)}},W=(e,t)=>{if(e.dom)e.dom.parentNode&&e.dom.parentNode.removeChild(e.dom);else{let t=e.child;for(;t;)W(t),t=t.sibling}},q=(e,t)=>{const r=n();let o,s=0,i=!0;const a=new Map;let c=e.alternate?.child,u=0;for(;c;){const e=c.key??`__index_${c.index??u}__`;a.set(e,c),c=c.sibling,u++}for(;s<t.length;){const n=t[s];if(!n){s++;continue}const c=n.key??`__index_${s}__`,u=a.get(c);let d;u&&n.type===u.type?(d={type:u.type,props:n.props,dom:u.dom,parent:e,alternate:u,effectTag:l.UPDATE,hooks:u.hooks,stateError:u.stateError,key:n.key,index:s},a.delete(c)):(d={type:n.type,props:n.props,dom:null,parent:e,alternate:null,effectTag:r.isHydrating?l.HYDRATE:l.PLACEMENT,key:n.key,index:s},u&&(u.effectTag=l.DELETION,r.deletions.push(u),a.delete(c))),i?(e.child=d,i=!1):d&&(o.sibling=d),o=d,s++}a.forEach(e=>{e.effectTag=l.DELETION,r.deletions.push(e)})};let G=null;let z=!1,K=[];const J=e=>{const t=z;z=!0;try{e()}finally{z=t,!z&&K.length>0&&Q()}},Q=()=>{if(0===K.length)return;const e=K;K=[],e.forEach(e=>e())};process.env.NODE_ENV;const Z=(e="A hook")=>{const t=n();if(!t.wipFiber)throw new Error(`${e} can only be called inside function components. Make sure you are calling hooks at the top level of your component.`);Array.isArray(t.wipFiber.hooks)||(t.wipFiber.hooks=[])},ee=(e,t)=>!e||!t||(e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))),te=(e,t=L())=>{if("undefined"==typeof window)return[d(e)?e():e,()=>{}];if(n().isServerRendering)return[d(e)?e():e,()=>{}];return re((e,t)=>d(t)?t(e):t,e,void 0,t)},re=(e,t,r,o=L())=>{if("undefined"==typeof window)return[r?r(t):t,()=>{}];const i=n();if(i.isServerRendering)return[r?r(t):t,()=>{}];Z();const{wipFiber:a,hookIndex:l}=i,c=a.alternate?.hooks?.[l],u={hookID:l,type:s.RYUNIX_STORE,state:c?c.state:r?r(t):t,queue:[]};c?.queue&&c.queue.forEach(t=>{try{u.state=e(u.state,t)}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in reducer:",e)}});return a.hooks[l]=u,i.hookIndex++,[u.state,(e,t=o)=>{if(void 0===e)return void("production"!==process.env.NODE_ENV&&console.warn("dispatch called with undefined action"));u.queue.push(e);const r=n(),s=r.currentRoot||r.wipRoot;if(!s)return;const i={dom:s.dom,props:s.props,alternate:r.currentRoot||null};var a;a=()=>((e,t)=>{if(G)return G(e,t);"production"!==process.env.NODE_ENV&&console.warn("[Ryunix] scheduleWork called before being initialized.")})(i,t),K.push(a),z||Q()}]},ne=(e,t)=>{if("undefined"==typeof window)return;const r=n();if(r.isServerRendering)return;if(Z(),!d(e))throw new Error("useEffect callback must be a function");if(void 0!==t&&!Array.isArray(t))throw new Error("useEffect dependencies must be an array or undefined");const{wipFiber:o,hookIndex:i}=r,a=o.alternate?.hooks?.[i],l=ee(a?.deps,t),c={hookID:i,type:s.RYUNIX_EFFECT,deps:t,effect:l?e:null,cancel:a?.cancel};o.hooks[i]=c,r.hookIndex++},oe=e=>{if("undefined"==typeof window)return{current:e};const t=n();if(t.isServerRendering)return{current:e};Z();const{wipFiber:r,hookIndex:o}=t,i=r.alternate?.hooks?.[o],a={hookID:o,type:s.RYUNIX_REF,value:i?i.value:{current:e}};return r.hooks[o]=a,t.hookIndex++,a.value},se=(e,t)=>{if("undefined"==typeof window)return e();const r=n();if(r.isServerRendering)return e();if(Z(),!d(e))throw new Error("useMemo callback must be a function");if(!Array.isArray(t))throw new Error("useMemo requires a dependencies array");const{wipFiber:o,hookIndex:i}=r,a=o.alternate?.hooks?.[i];let l;if(a&&!ee(a.deps,t))l=a.value;else try{l=e()}catch(e){throw"production"!==process.env.NODE_ENV&&console.error("Error in useMemo computation:",e),e}const c={hookID:i,type:s.RYUNIX_MEMO,value:l,deps:t};return o.hooks[i]=c,r.hookIndex++,l},ie=(e,t)=>{if(!d(e))throw new Error("useCallback requires a function as first argument");return se(()=>e,t)},ae=(e=s.RYUNIX_CONTEXT,t={})=>{const r=({value:t,children:r})=>m(s.RYUNIX_CONTEXT,{value:t,children:r,_contextId:e},...c([r]));r._contextId=e;return{Provider:r,useContext:(r=e)=>{const o=n();if(o.isServerRendering)return o.ssrContexts&&void 0!==o.ssrContexts[r]?o.ssrContexts[r]:t;Z();let s=o.wipFiber;for(;s;){if(s._contextId===r&&void 0!==s._contextValue)return s._contextValue;if(s.type?._contextId===r&&void 0!==s.props?.value)return s.props.value;s=s.parent}return t}}},le=()=>{if("undefined"==typeof window)return{};const e=new URLSearchParams(window.location.search),t={};for(const[r,n]of e.entries())t[r]=n;return t},ce=()=>{if("undefined"==typeof window)return"";const[e,t]=te(window.location.hash);return ne(()=>{const e=()=>t(window.location.hash);return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]),e},ue=(e={},t={})=>{const r=n();r.isServerRendering?r.ssrMetadata={...r.ssrMetadata,...e}:ne(()=>{if("undefined"==typeof document)return;let r="Ryunix App";const n=t.title?.template,o=t.title?.prefix||"Ryunix App",s=e.pageTitle||e.title;if(r=p(s)&&s.trim()?n?.includes("%s")?n.replace("%s",s):s:o,document.title=r,e.canonical){let t=document.querySelector('link[rel="canonical"]');t||(t=document.createElement("link"),t.setAttribute("rel","canonical"),document.head.appendChild(t)),t.setAttribute("href",e.canonical)}Object.entries(e).forEach(([e,t])=>{if(["title","pageTitle","canonical"].includes(e))return;const r=e.startsWith("og:")||e.startsWith("twitter:"),n=`meta[${r?"property":"name"}='${e}']`;let o=document.head.querySelector(n);o||(o=document.createElement("meta"),o.setAttribute(r?"property":"name",e),document.head.appendChild(o)),o.setAttribute("content",t)})},[JSON.stringify(e),JSON.stringify(t)])},de=ae("ryunix.navigation",{location:"/",params:{},query:{},navigate:e=>{},route:null}),pe=(e,t)=>{const r=t.split("?")[0].split("#")[0],n=e.find(e=>e.NotFound),o=n?{route:{component:n.NotFound},params:{}}:{route:{component:null},params:{}};for(const n of e){if(n.subRoutes){const e=pe(n.subRoutes,t);if(e)return e}if("*"===n.path)return o;if(!n.path||"string"!=typeof n.path)continue;const e=[],s=new RegExp(`^${n.path.replace(/:(\.\.\.)?(\w+)/g,(t,r,n)=>(e.push({key:n,isCatchAll:!!r}),r?"(.+)":"([^/]+)"))}$`),i=r.match(s);if(i){return{route:n,params:e.reduce((e,t,r)=>{const n=i[r+1];return e[t.key]=t.isCatchAll&&n?n.split("/"):n,e},{})}}}return o},fe=({routes:e,children:t})=>{if("undefined"==typeof window){const r="/",n=pe(e,r)||{},o={location:r,params:n.params||{},query:{},navigate:()=>{},route:n.route};return m(de.Provider,{value:o},E({children:t}))}const[r,n]=te(window.location.pathname);ne(()=>{const e=()=>n(window.location.pathname);return window.addEventListener("popstate",e),window.addEventListener("hashchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)}},[]);const o=pe(e,r)||{},s=le(),i={location:r,params:o.params||{},query:s,navigate:e=>{"undefined"!=typeof window&&window.__RYUNIX_MPA__?window.location.assign(e):(window.history.pushState({},"",e),n(e))},route:o.route};return m(de.Provider,{value:i},E({children:t}))},ye=()=>de.useContext("ryunix.navigation"),he=()=>{const{route:e,params:t,query:r,location:n}=ye();if(!e||!e.component)return null;const o=ce();return ne(()=>{if(o){const e=o.slice(1),t=document.getElementById(e);t&&t.scrollIntoView({block:"start",behavior:"smooth"})}},[o]),m(e.component,{key:n,params:t,query:r,hash:o,location:n})},me=()=>{const{location:e}=ye();return e.split("?")[0].split("#")[0]},Ee=()=>{const{query:e}=ye();return new URLSearchParams(e)},ge=({to:e,prefetch:t=!0,...r})=>{const{navigate:n}=ye(),{className:o,...s}=r;return m("a",{href:e,onClick:t=>{0!==t.button||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||(t.preventDefault(),n(e))},onMouseEnter:()=>{},className:r.className||r["ryunix-class"],...s},r.children)},xe=({to:e,exact:t=!1,...r})=>{const{location:n,navigate:o}=ye(),s=t?n===e:n.startsWith(e),i=r["ryunix-class"]?"ryunix-class":"className",a="function"==typeof(l=r["ryunix-class"]||r.className)?l({isActive:s}):l||"";var l;const{"ryunix-class":c,className:u,...d}=r;return m("a",{href:e,onClick:t=>{0!==t.button||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||(t.preventDefault(),o(e))},[i]:a,...d},r.children)},Ne=e=>{const[r,n]=re((e,t)=>"function"==typeof t?t.value(e):t.value,e);return[r,(e,r=T.NORMAL)=>{const o={value:e,priority:r};((e,r=T.NORMAL)=>{I.push({callback:e,priority:r,timestamp:Date.now()}),O||(O=!0,t(A))})(()=>n(o,r),r)}]},be=()=>{const[e,t]=Ne(!1);return[e,e=>{t(!0,T.IMMEDIATE),setTimeout(()=>{D(T.LOW,()=>{e(),t(!1,T.LOW)})},0)}]},ve=e=>{const[t,r]=Ne(e);return ne(()=>{const t=setTimeout(()=>{r(e,T.LOW)},100);return()=>clearTimeout(t)},[e]),t},_e=(e,t="")=>{const[r,n]=te(()=>{try{const r=window.localStorage.getItem(e);return r?JSON.parse(r):t}catch(e){return t}});return[r,t=>{try{n(t),window.localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}}]},Re=(e=!1)=>{const[t,r]=te(e);return[t,()=>{r(e=>!e)}]},we=(e,t)=>{if("undefined"==typeof window)return;const r=n();if(r.isServerRendering)return;if(Z(),!d(e))throw new Error("useLayoutEffect callback must be a function");if(void 0!==t&&!Array.isArray(t))throw new Error("useLayoutEffect dependencies must be an array or undefined");const{wipFiber:o,hookIndex:i}=r,a=o.alternate?.hooks?.[i],l=ee(a?.deps,t),c={hookID:i,type:s.RYUNIX_EFFECT,deps:t,effect:l?e:null,cancel:a?.cancel,isLayout:!0};o.hooks[i]=c,r.hookIndex++};let Se=0;const ke=()=>{Se=0},Te=()=>{const e=n();if(e.isServerRendering)return`:r${Se++}:`;Z();const{wipFiber:t,hookIndex:r}=e,o=t.alternate?.hooks?.[r],i={hookID:r,type:s.RYUNIX_REF,value:o?o.value:`:r${Se++}:`};return t.hooks[r]=i,e.hookIndex++,i.value},Ce=(e,t=300)=>{const[r,n]=te(e);return ne(()=>{const r=setTimeout(()=>{n(e)},t);return()=>clearTimeout(r)},[e,t]),r},Ie=(e,t=300)=>{const[r,n]=te(e),o=oe(Date.now());return ne(()=>{const r=Date.now(),s=r-o.current;if(!(s>=t)){const r=setTimeout(()=>{o.current=Date.now(),n(e)},t-s);return()=>clearTimeout(r)}o.current=r,n(e)},[e,t]),r};var Oe=Object.freeze({__proto__:null,Children:he,Link:ge,NavLink:xe,RouterProvider:fe,createContext:ae,resetIdCounter:ke,useCallback:ie,useDebounce:Ce,useDeferredValue:ve,useEffect:ne,useHash:ce,useId:Te,useLayoutEffect:we,useMemo:se,useMetadata:ue,usePathname:me,usePersistentStore:_e,usePersitentStore:_e,useQuery:le,useReducer:re,useRef:oe,useRouter:ye,useSearchParams:Ee,useStore:te,useStorePriority:Ne,useSwitch:Re,useThrottle:Ie,useTransition:be});const Ae=e=>"symbol"==typeof e?e.description||e.toString():"function"==typeof e?e.name||"anonymous":String(e),{Provider:De,useContext:Le}=ae("ryunix.mdx",{}),Me=e=>({...Le(),...e}),Ue={h1:e=>m("h1",{...e}),h2:e=>m("h2",{...e}),h3:e=>m("h3",{...e}),h4:e=>m("h4",{...e}),h5:e=>m("h5",{...e}),h6:e=>m("h6",{...e}),p:e=>m("p",{...e}),a:e=>m("a",{...e}),strong:e=>m("strong",{...e}),em:e=>m("em",{...e}),code:e=>m("code",{...e}),ul:e=>m("ul",{...e}),ol:e=>m("ol",{...e}),li:e=>m("li",{...e}),blockquote:e=>m("blockquote",{...e}),pre:e=>m("pre",{...e}),hr:e=>m("hr",{...e}),table:e=>m("table",{...e}),thead:e=>m("thead",{...e}),tbody:e=>m("tbody",{...e}),tr:e=>m("tr",{...e}),th:e=>m("th",{...e}),td:e=>m("td",{...e}),img:e=>m("img",{...e})},$e=()=>"undefined"!=typeof performance?performance.now():Date.now();const Fe=new class{constructor(){this.enabled="production"!==process.env.NODE_ENV,this.measures=new Map,this.renderTimes=[],this.maxSamples=100}startMeasure(e){this.enabled&&this.measures.set(e,$e())}endMeasure(e){if(!this.enabled)return;const t=this.measures.get(e);if(!t)return;const r=$e()-t;return this.measures.delete(e),r}recordRender(e,t){this.enabled&&(this.renderTimes.push({component:e,duration:t,timestamp:Date.now()}),this.renderTimes.length>this.maxSamples&&this.renderTimes.shift())}getStats(){if(!this.enabled)return null;const e=this.renderTimes.reduce((e,t)=>e+t.duration,0);return{total:e,avg:e/this.renderTimes.length,max:Math.max(...this.renderTimes.map(e=>e.duration)),min:Math.min(...this.renderTimes.map(e=>e.duration)),count:this.renderTimes.length}}getSlowestComponents(e=10){if(!this.enabled)return[];const t=new Map;return this.renderTimes.forEach(({component:e,duration:r})=>{t.has(e)||t.set(e,{total:0,count:0,max:0});const n=t.get(e);n.total+=r,n.count++,n.max=Math.max(n.max,r)}),Array.from(t.entries()).map(([e,t])=>({name:e,avg:t.total/t.count,max:t.max,count:t.count})).sort((e,t)=>t.avg-e.avg).slice(0,e)}logStats(){if(!this.enabled)return;const e=this.getStats();if(!e)return;console.group("šŸ” Ryunix Performance Stats"),console.log(`Total renders: ${e.count}`),console.log(`Avg render time: ${e.avg.toFixed(2)}ms`),console.log(`Min: ${e.min.toFixed(2)}ms | Max: ${e.max.toFixed(2)}ms`);const t=this.getSlowestComponents(5);t.length>0&&(console.log("\nāš ļø Slowest components:"),t.forEach((e,t)=>{console.log(`${t+1}. ${e.name}: ${e.avg.toFixed(2)}ms avg (${e.count} renders)`)})),console.groupEnd()}clear(){this.renderTimes=[],this.measures.clear()}enable(){this.enabled=!0}disable(){this.enabled=!1}},Ye=e=>{const t=$e();return()=>{const r=$e()-t;Fe.recordRender(e,r)}},Xe=(e,t)=>r=>{Fe.startMeasure(t);const n=e(r),o=Fe.endMeasure(t);return o&&Fe.recordRender(t,o),n};let je=[],Pe=!1;function Ve(e){const t=n(),r=e.type instanceof Function||"function"==typeof e.type;try{r?(e=>{const t=n();if(t.wipFiber=e,t.hookIndex=0,t.wipFiber.hooks=[],t.isHydrating&&(e.effectTag=l.HYDRATE),e.type._isMemo&&e.alternate){const{children:t,...r}=e.alternate.props||{},{children:n,...o}=e.props||{};if(e.type._arePropsEqual(r,o)){e.hooks=e.alternate.hooks;const t=e.alternate.child;return void(t&&(t.parent=e,e.child=t))}}let r=[e.type(e.props)];e.type._contextId&&void 0!==e.props.value&&(e._contextId=e.type._contextId,e._contextValue=e.props.value),q(e,r)})(e):(e=>{const t=n();e.type===s.RYUNIX_CONTEXT&&(e._contextId=e.props?._contextId,e._contextValue=e.props?.value);const r=e.type===s.RYUNIX_FRAGMENT||e.type===s.RYUNIX_CONTEXT||e.type===Symbol.for("ryunix.portal");if(t.isHydrating&&r)e.effectTag=l.HYDRATE;else if(!e.dom)if(t.isHydrating&&t.hydrateCursor){const r=t.hydrateCursor,n=e.type===s.TEXT_ELEMENT&&3===r.nodeType,o="string"==typeof e.type&&1===r.nodeType&&r.tagName.toLowerCase()===e.type.toLowerCase();n||o?(e.dom=r,e.effectTag=l.HYDRATE,t.hydrateCursor=y(r.firstChild)):("production"!==process.env.NODE_ENV&&console.warn(`[Hydration] Mismatch at ${Ae(e.type)}. Expected ${1===r.nodeType?r.tagName:"text"} but got ${e.type}. Falling back to CSR.`),t.isHydrating=!1,t.hydrationFailed=!0,t.hydrateCursor=null,e.dom=$(e),e.effectTag=l.PLACEMENT)}else e.dom=$(e);const o=e.props?.children||[];q(e,o)})(e)}catch(r){if("production"!==process.env.NODE_ENV){console.error("[Ryunix ErrorBoundary] Caught error during render:",r);try{const t=e.props&&e.props.__source;t&&r&&"object"==typeof r&&(r.__ryunix_source=t);let n=e;for(;!r.__ryunix_source&&n;)n.props&&n.props.__source&&(r.__ryunix_source=n.props.__source),n=n.parent}catch(e){}}let n=e.parent,o=!1;for(;n;){if(n.type&&"RYUNIX_ERROR_BOUNDARY"===n.type.ryunix_type){o=!0;break}n=n.parent}return o?("production"!==process.env.NODE_ENV&&console.warn("[Ryunix ErrorBoundary] Recovering tree at nearest boundary."),n.stateError=r,e.child=null,n):(console.error("[Ryunix] Fatal Uncaught Error. No ErrorBoundary was found in the tree to handle this exception:\n",r),t.nextUnitOfWork=null,null)}if(e.child)return e.child;let o=e;for(;o;){if(t.isHydrating&&o.dom&&(t.hydrateCursor=y(o.dom.nextSibling)),o.sibling)return o.sibling;o=o.parent}}const Be=e=>{const r=n();let o=!1;for(;(r.nextUnitOfWork||je.length>0)&&!o;){if(!r.nextUnitOfWork&&je.length>0){const e=je.shift();r.wipRoot=e,r.nextUnitOfWork=e,r.deletions=[],void 0!==e.isHydrating&&(r.isHydrating=e.isHydrating,r.hydrateCursor=e.hydrateCursor)}r.nextUnitOfWork&&(r.nextUnitOfWork=Ve(r.nextUnitOfWork)),o=e.timeRemaining()<1}!r.nextUnitOfWork&&r.wipRoot&&function(){const e=n();e.deletions.forEach(B);const t=e.wipRoot;if(e.currentRoot=t,e.isHydrating||e.hydrationFailed){if("production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log(`[Ryunix Debug] commitRoot - isHydrating: ${e.isHydrating}, hydrationFailed: ${e.hydrationFailed}`),e.hydrationFailed){"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Hydration failed. Clearing container.");const r=e.containerRoot||t.dom;r&&(r.textContent="")}else{let t=e.hydrateCursor;for(t&&"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Removing unmatched root siblings.");t;){const e=t.nextSibling;t.parentNode&&t.parentNode.removeChild(t),t=e}}e.isHydrating=!1,e.hydrationFailed=!1,e.hydrateCursor=null}B(t.child),e.wipRoot===t&&(e.wipRoot=null)}(),r.nextUnitOfWork||je.length>0?t(Be):Pe=!1},He=(e,r=L())=>{const o=n();o.wipRoot?je.push(e):(o.nextUnitOfWork=e,o.wipRoot=e,o.deletions=[],void 0!==e.isHydrating&&(o.isHydrating=e.isHydrating,o.hydrateCursor=e.hydrateCursor)),o.hookIndex=0,o.effects=[],Pe||(Pe=!0,r<=T.USER_BLOCKING?Promise.resolve().then(()=>{Be({timeRemaining:()=>10,didTimeout:!0})}):t(Be))};G=He;const We=(e,t)=>{const r=n();(e=>{if(e)for(;e.firstChild;)e.removeChild(e.firstChild)})(t);const o={dom:t,props:{children:[e]},alternate:r.currentRoot,isHydrating:!1,hydrateCursor:null};return He(o),o},qe=e=>{let t=e;for(;t&&(3===t.nodeType&&!t.nodeValue.trim()||8===t.nodeType||1===t.nodeType&&t.hasAttribute("data-ryunix-ssr"));)t=t.nextSibling;return t},Ge=(e,t)=>{const r=n();r.containerRoot=t;const o={dom:t,props:{children:[e]},alternate:r.currentRoot,isHydrating:!0,hydrateCursor:qe(t.firstChild)};return He(o),o},ze=(e,t="__ryunix",r={})=>{const o=n();o.containerRoot=document.getElementById(t),o.isHydrating=!1,o.hydrationFailed=!1;const s=o.containerRoot&&o.containerRoot.hasChildNodes();"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log(`[Ryunix Debug] init: hasChildNodes=${s}, has SSR content detected.`);const i="false"!==process.env.RYUNIX_SSR;if(s&&i){"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log(`[Ryunix Debug] init: SSR content detected. Starting hydration on #${t}`);return Ge(e,o.containerRoot)}"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log(`[Ryunix Debug] init: No SSR content or SSR disabled. Starting normal render on #${t}`);return We(e,o.containerRoot)},Ke=(e,t,r)=>{try{return e(t)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("Component error:",e),r&&r(e),null}},Je=e=>"string"!=typeof e?String(e):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),Qe=e=>!u(e)||f(e)?"":Object.entries(e).filter(([e,t])=>null!=t).map(([e,t])=>`${M(e)}:${t}`).join(";"),Ze=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),et=e=>{if(null==e||"boolean"==typeof e)return"";if("string"==typeof e||"number"==typeof e)return Je(e);if(Array.isArray(e))return e.map(e=>et(e)).join("");if(e.type===s.TEXT_ELEMENT)return Je(e.props.nodeValue);if(e.type===s.RYUNIX_FRAGMENT){return(e.props?.children||[]).map(e=>et(e)).join("")}if(e.type===s.RYUNIX_CONTEXT){const t=n();t.ssrContexts=t.ssrContexts||{};const r=e.props?._contextId,o=t.ssrContexts[r];r&&(t.ssrContexts[r]=e.props?.value);const s=e.props?.children||[];let i="";return i=Array.isArray(s)?s.map(e=>et(e)).join(""):et(s),r&&(t.ssrContexts[r]=o),i}if("function"==typeof e.type){const t=(0,e.type)(e.props||{});return et(t)}const t=e.type,r=e.props||{};let o="",l="",c=null;if(Object.entries(r).forEach(([e,t])=>{if("children"===e)l=Array.isArray(t)?t.map(e=>et(e)).join(""):et(t);else if("dangerouslySetInnerHTML"===e&&t?.__html)c=t.__html;else if(e===i.STYLE||e===a.STYLE){const e=Qe(t);e&&(o+=` style="${Je(e)}"`)}else if(e===i.CLASS_NAME||e===a.CLASS_NAME)t&&(o+=` class="${Je(t)}"`);else if(!e.startsWith("on")&&"__source"!==e&&"__self"!==e)if("boolean"==typeof t)t&&(o+=` ${e}=""`);else if(null!=t){let r=k(e),n=F(r,t);o+=` ${r}="${Je(n)}"`}}),Ze.has(t))return`<${t}${o} />`;return`<${t}${o}>${null!==c?c:l}</${t}>`},tt="\nfunction $RC(id, templateId) {\n var b = document.getElementById(id);\n var t = document.getElementById(templateId);\n if (b && t) {\n b.innerHTML = t.innerHTML;\n t.remove();\n }\n}\n".replace(/\s+/g," ").trim(),rt=async(e,t,r=[])=>{if(null==e||"boolean"==typeof e)return;if(e instanceof Promise&&(null==(e=await e)||"boolean"==typeof e))return;if("string"==typeof e||"number"==typeof e)return void t(Je(e));if(Array.isArray(e)){for(const n of e)await rt(n,t,r);return}if(e.type===s.TEXT_ELEMENT)return void t(Je(e.props.nodeValue));if(e.type===s.RYUNIX_FRAGMENT){const n=e.props?.children||[];for(const e of n)await rt(e,t,r);return}if(e.type===s.RYUNIX_CONTEXT){const o=n();o.ssrContexts=o.ssrContexts||{};const s=e.props?._contextId,i=o.ssrContexts[s];s&&(o.ssrContexts[s]=e.props?.value);const a=e.props?.children||[];if(Array.isArray(a))for(const e of a)await rt(e,t,r);else await rt(a,t,r);return void(s&&(o.ssrContexts[s]=i))}if(e.type===s.RYUNIX_SUSPENSE||e.type?.type===s.RYUNIX_SUSPENSE){const{fallback:o,children:s}=e.props,i=`s-${Math.random().toString(36).slice(2,9)}`;t(`\x3c!--$?--\x3e<template id="B:${i}"></template><div id="S:${i}">`);const a=(async()=>{const e=n(),t=e.isSuspenseBackground;e.isSuspenseBackground=!0;let o="";const a=e=>o+=e;try{return await rt(s,a,r),{id:i,content:o,success:!0}}catch(e){return{id:i,content:"",success:!1,error:e}}finally{e.isSuspenseBackground=t}})();return r.push(a),await rt(o,t,r),void t("</div>\x3c!--$/--\x3e")}let o=e.type,l=e.props||{};if("function"==typeof o){process.env.RYUNIX_DEBUG&&console.log("[SSR Debug] Rendering function:",o.name||"anonymous");const e=await o(l);return void await rt(e,t,r)}let c="",u=null,d=l.children||[];if(Object.entries(l).forEach(([e,t])=>{if("children"===e);else if("dangerouslySetInnerHTML"===e&&t?.__html)u=t.__html;else if(e===i.STYLE||e===a.STYLE){const e=Qe(t);e&&(c+=` style="${Je(e)}"`)}else if(e===i.CLASS_NAME||e===a.CLASS_NAME)t&&(c+=` class="${Je(t)}"`);else if(!e.startsWith("on")&&"__source"!==e&&"__self"!==e)if("boolean"==typeof t)t&&(c+=` ${e}=""`);else if(null!=t){const r=k(e),n=F(r,t);c+=` ${r}="${Je(n)}"`}}),t(`<${o}${c}>`),null!==u)t(u);else if(Array.isArray(d))for(const e of d)await rt(e,t,r);else await rt(d,t,r);Ze.has(o)||t(`</${o}>`)},nt=(e,t={})=>{const r=n(),o=new TextEncoder;return ke(),new ReadableStream({async start(n){const s=r.isServerRendering;r.isServerRendering=!0,r.ssrMetadata={};const i=e=>n.enqueue(o.encode(e)),a=[];try{const r=t.nonce?` nonce="${t.nonce}"`:"";for(i(`<script${r} data-ryunix-ssr>${tt}<\/script>`),await rt(e,i,a);a.length>0;){const e=a.shift(),t=await e;t.success&&(i(`<template id="P:${t.id}" data-ryunix-ssr>${t.content}</template>`),i(`<script${r} data-ryunix-ssr>$RC("S:${t.id}", "P:${t.id}")<\/script>`))}n.close()}catch(e){n.error(e)}finally{r.isServerRendering=s}}})},ot=(e,t={})=>{const r=n(),o=r.isServerRendering;r.isServerRendering=!0,r.ssrMetadata={},ke();try{return et(e)}finally{r.isServerRendering=o}},st=async(e,t={})=>{const r=nt(e,t).getReader(),n=new TextDecoder;let o="";for(;;){const{done:e,value:t}=await r.read();if(e)break;o+=n.decode(t,{stream:!0})}return o+=n.decode(),o},it=(e,t=at)=>{const r=t=>e(t);return r._isMemo=!0,r._wrappedComponent=e,r._arePropsEqual=t,r.displayName=`Memo(${e.displayName||e.name||"Component"})`,r},at=(e,t)=>{const r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(r=>Object.is(e[r],t[r]))},lt=(e,t)=>{if(e===t)return!0;if(null==e||null==t)return!1;if("object"!=typeof e||"object"!=typeof t)return!1;const r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(r=>lt(e[r],t[r]))},ct="pending",ut="resolved",dt="rejected",pt=e=>{let t=ct,r=null,n=null,o=null;const s=s=>{if(t===ut&&r)return m(r,s);if(t===dt&&n)throw n;o||(o=e().then(e=>{r=e.default||e,t=ut}).catch(e=>{n=e,t=dt}));const[,i]=te(0);return ne(()=>{if(t===ct&&o){let e=!0;return o.then(()=>{e&&i(e=>e+1)}).catch(()=>{e&&i(e=>e+1)}),()=>{e=!1}}},[]),null};return s._isLazy=!0,s._getStatus=()=>t,s},ft=({fallback:e,children:t})=>{const[r,o]=te(!1),s=Array.isArray(t)?t:[t];let i=!1;for(const e of s)if(e&&e.type&&e.type._isLazy){e.type._getStatus()===ct&&(i=!0)}return ne(()=>{i||r||o(!0)},[i]),i&&!n().isSuspenseBackground?e||null:m(E,{children:t})};ft.type=s.RYUNIX_SUSPENSE;const yt=e=>e(),ht=e=>{if("function"!=typeof e)throw new Error("forwardRef requires a render function");const t=t=>{const{ref:r,...n}=t||{};return e(n,r||null)};return t.displayName=`ForwardRef(${e.displayName||e.name||"Component"})`,t._isForwardRef=!0,t._render=e,t};function mt({children:e,id:t}){return m("div",{"data-ryunix-server":t,style:{display:"contents"}},e)}function Et({children:e,fallback:t}){const r=n();return r.wipFiber&&r.wipFiber.stateError?"function"==typeof t?t(r.wipFiber.stateError):t:m("ryunix-error-boundary-wrapper",{style:{display:"contents"}},e)}function gt(e){return async function(...t){const r=await fetch("/_ryunix/action",{method:"POST",headers:{"Content-Type":"application/json","X-Ryunix-Action":"true"},body:JSON.stringify({actionId:e,args:t})});if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.error||"Server Action failed")}return r.json()}}function xt(e){const t=e&&e.nativeEvent?e.error:e;let r=t instanceof Error||t&&t.message?t:t?.error||t;const n=JSON.stringify(e,Object.getOwnPropertyNames(e||{})),[o,s]=te(null),[i,a]=te(1),[l,c]=te(""),[u,d]=te(0);let p=[];r&&r.stack&&(p="string"==typeof r.stack?r.stack.split("\n").filter(e=>{const t=e.trim();if(!t)return!1;if(t.includes("node_modules"))return!1;return!["components.js","workers.js","reconciler.js","commits.js","hooks.js","errorBoundary.js","serverBoundary.js","app-router.js","app-router-server.js","render.js","createElement.js","index.js"].some(e=>t.includes(e))}):r.stack);const f=r&&r.name?r.name:"Unknown Error Type",y=r&&r.message?r.message:`Raw unhandled error. Debug: ${n}`;ne(()=>{let e=null,t=null;if(r&&r.__ryunix_source&&r.__ryunix_source.fileName&&(e=r.__ryunix_source.fileName,t=r.__ryunix_source.lineNumber),!e||!t)for(let r=0;r<p.length;r++){const n=p[r];if(!n.includes(":"))continue;let o=null,s=null;const i=n.indexOf("("),a=n.lastIndexOf(")");if(-1!==i&&a>i){const e=n.slice(i+1,a),t=e.lastIndexOf(":"),r=t>0?e.lastIndexOf(":",t-1):-1;if(r>0){const n=e.slice(t+1),i=e.slice(r+1,t);/^\d+$/.test(i)&&/^\d+$/.test(n)&&(o=e.slice(0,r),s=parseInt(i,10))}}if(!o){const e=n.trim();if(e.startsWith("at ")){const t=e.slice(3).trim(),r=t.lastIndexOf(":"),n=r>0?t.lastIndexOf(":",r-1):-1;if(n>0){const e=t.slice(r+1),i=t.slice(n+1,r);/^\d+$/.test(i)&&/^\d+$/.test(e)&&(o=t.slice(0,n),s=parseInt(i,10))}}}if(!o){const e=[".ryx",".jsx",".js",".ts",".tsx"],t=n.lastIndexOf(":");if(t>0){const r=n.slice(t+1).trim(),i=n.slice(0,t).trim();/^\d+$/.test(r)&&e.some(e=>i.endsWith(e))&&(o=i,s=parseInt(r,10))}}if(o&&s){e=o,t=s;break}}e&&t&&(c(e),d(t),fetch(`/_ryunix/source?file=${encodeURIComponent(e)}&line=${t}`).then(e=>e.json()).then(e=>{e.snippet&&(s(e.snippet),a(e.startLine))}).catch(e=>console.error("Failed to fetch source snippet",e)))},[r]);const h={backgroundColor:"#000",borderRadius:"8px",border:"1px solid #333",padding:"16px",fontFamily:"ui-monospace, monospace",fontSize:"14px",overflowX:"auto",color:"#d1d5db",marginBottom:"32px",whiteSpace:"pre-wrap",maxHeight:"150px",height:"auto"},E=e=>({display:"flex",backgroundColor:e?"rgba(239, 68, 68, 0.15)":"transparent",padding:"2px 8px",borderRadius:"4px",borderLeft:e?"3px solid #ef4444":"3px solid transparent"}),g=o?o.split("\n"):[];let x="UNHANDLED RUNTIME ERROR";return f&&"Error"!==f&&"Unknown Error Type"!==f&&(x=f.replace(/([a-z])([A-Z])/g,"$1 $2").toUpperCase()),m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:2147483647,backgroundColor:"rgba(0, 0, 0, 0.85)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",fontFamily:"system-ui, -apple-system, sans-serif"}},m("div",{style:{backgroundColor:"#0c0c0c",width:"100%",maxWidth:"1000px",maxHeight:"90vh",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.8)",display:"flex",flexDirection:"column",overflow:"hidden",border:"1px solid #333"}},m("div",{style:{backgroundColor:"#161616",padding:"16px 24px",borderBottom:"1px solid #333",display:"flex",justifyContent:"space-between",alignItems:"center"}},m("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},m("span",{style:{backgroundColor:"rgba(239, 68, 68, 0.2)",color:"#ef4444",padding:"4px 8px",borderRadius:"4px",fontSize:"13px",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"0.05em"}},x),m("span",{style:{color:"#9ca3af",fontSize:"14px"}},"Ryunix Development")),m("button",{onClick:()=>window.location.reload(),style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",outline:"none"},title:"Reload page"},m("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),m("path",{d:"M3 3v5h5"})))),m("div",{style:{padding:"32px",overflowY:"auto",flex:1,color:"#fff"}},m("h1",{style:{fontSize:"24px",fontWeight:"bold",marginBottom:"24px",fontFamily:"ui-monospace, monospace",wordBreak:"break-word",lineHeight:1.4}},m("span",{style:{color:"#f87171"}},f),": ",y),l&&m("div",{style:{marginBottom:"16px",color:"#9ca3af",fontSize:"14px",display:"flex",alignItems:"center",gap:"8px"}},m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),m("polyline",{points:"13 2 13 9 20 9"})),l,":",u),o&&m("div",{style:h},m("div",{style:{display:"flex",flexDirection:"column"}},...g.map((e,t)=>{const r=i+t,n=r===u;return m("div",{key:t,style:E(n)},m("span",{style:{color:"#6b7280",width:"40px",userSelect:"none",textAlign:"right",marginRight:"16px",display:"inline-block"}},r),m("span",{style:{color:n?"#f87171":"#e5e7eb",whiteSpace:"pre"}},e||" "))}))),m("div",{style:{marginBottom:"16px"}},m("p",{style:{color:"#9ca3af",fontSize:"14px",marginBottom:"8px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"}},"Call Stack"),m("div",{style:h},p.length>0?m("ul",{style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"12px"}},...p.map((e,t)=>{if(0===t&&(e.startsWith("Error:")||e.startsWith("TypeError:")))return null;const r=e.trim();let n="<anonymous>",o=e;if(r.startsWith("at ")){const e=r.slice(3),t=e.indexOf("("),s=e.lastIndexOf(")");-1!==t&&s>t?(n=e.slice(0,t).trim()||"<anonymous>",o=e.slice(t+1,s)):(n=e.includes(":")?"<anonymous>":e,o=e)}else if(r.includes("@")){const e=r.indexOf("@");n=r.slice(0,e)||"<anonymous>",o=r.slice(e+1)}else{const e=[".ryx",".jsx",".js",".ts",".tsx"],t=r.split(/\s+/);if(t.length>=2){const r=t[t.length-1],s=r.indexOf(":"),i=s>0?r.slice(0,s):r;e.some(e=>i.endsWith(e))?(n=t.slice(0,-1).join(" "),o=r):(n=t[0],o=t.slice(1).join(" "))}}return m("li",{key:t},m("span",{style:{color:"#60a5fa",fontWeight:600}},n),m("div",{style:{color:"#6b7280",marginTop:"4px",paddingLeft:"16px",display:"flex",alignItems:"center",gap:"8px"}},m("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),m("polyline",{points:"13 2 13 9 20 9"})),o))})):m("div",{style:{color:"#6b7280",fontStyle:"italic"}},"No stack trace available."))))))}mt.ryunix_type="RYUNIX_SERVER_BOUNDARY",Et.ryunix_type="RYUNIX_ERROR_BOUNDARY";var Nt=Object.freeze({__proto__:null,Children:he,ErrorBoundary:Et,Fragment:E,Hooks:Oe,Link:ge,NavLink:xe,Priority:T,RouterProvider:fe,RyunixDevOverlay:xt,ServerBoundary:mt,Suspense:ft,batchUpdates:J,cloneElement:g,createActionProxy:gt,createContext:ae,createElement:m,createPortal:j,deepEqual:lt,escapeHtml:Je,forwardRef:ht,getState:n,hydrate:Ge,init:ze,isValidElement:x,lazy:pt,memo:it,preload:yt,profiler:Fe,render:We,renderToReadableStream:nt,renderToString:ot,renderToStringAsync:st,resetIdCounter:ke,safeRender:Ke,shallowEqual:at,useCallback:ie,useDebounce:Ce,useDeferredValue:ve,useEffect:ne,useHash:ce,useId:Te,useLayoutEffect:we,useMemo:se,useMetadata:ue,usePathname:me,usePersistentStore:_e,usePersitentStore:_e,useProfiler:Ye,useQuery:le,useReducer:re,useRef:oe,useRouter:ye,useSearchParams:Ee,useStore:te,useStorePriority:Ne,useSwitch:Re,useThrottle:Ie,useTransition:be,withProfiler:Xe});"undefined"!=typeof window&&(window.Ryunix=Nt),e.Children=he,e.ErrorBoundary=Et,e.Fragment=E,e.Hooks=Oe,e.Image=({src:e,...t})=>m("img",{...t,src:e}),e.Link=ge,e.MDXContent=({children:e,components:t={}})=>{const r=Me(t);return m(De,{value:r},m("div",null,e))},e.MDXProvider=De,e.NavLink=xe,e.Priority=T,e.RouterProvider=fe,e.RyunixDevOverlay=xt,e.ServerBoundary=mt,e.Suspense=ft,e.batchUpdates=J,e.cloneElement=g,e.createActionProxy=gt,e.createContext=ae,e.createElement=m,e.createPortal=j,e.deepEqual=lt,e.default=Nt,e.defaultComponents=Ue,e.escapeHtml=Je,e.forwardRef=ht,e.getMDXComponents=Me,e.getState=n,e.hydrate=Ge,e.init=ze,e.isValidElement=x,e.lazy=pt,e.memo=it,e.preload=yt,e.profiler=Fe,e.render=We,e.renderToReadableStream=nt,e.renderToString=ot,e.renderToStringAsync=st,e.resetIdCounter=ke,e.safeRender=Ke,e.shallowEqual=at,e.useCallback=ie,e.useDebounce=Ce,e.useDeferredValue=ve,e.useEffect=ne,e.useHash=ce,e.useId=Te,e.useLayoutEffect=we,e.useMDXComponents=Le,e.useMemo=se,e.useMetadata=ue,e.usePathname=me,e.usePersistentStore=_e,e.usePersitentStore=_e,e.useProfiler=Ye,e.useQuery=le,e.useReducer=re,e.useRef=oe,e.useRouter=ye,e.useSearchParams=Ee,e.useStore=te,e.useStorePriority=Ne,e.useSwitch=Re,e.useThrottle=Ie,e.useTransition=be,e.withProfiler=Xe,Object.defineProperty(e,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Ryunix={})}(this,function(e){"use strict";const t="undefined"!=typeof requestIdleCallback?requestIdleCallback:e=>setTimeout(()=>e({timeRemaining:()=>1}),1);let n={containerRoot:null,nextUnitOfWork:null,currentRoot:null,wipRoot:null,deletions:[],wipFiber:null,hookIndex:0,effects:[]};const r=()=>n,o=/[A-Z]/g,s=Object.freeze({TEXT_ELEMENT:Symbol.for("ryunix.text.element"),RYUNIX_ELEMENT:Symbol.for("ryunix.element"),RYUNIX_EFFECT:Symbol.for("ryunix.effect"),RYUNIX_MEMO:Symbol.for("ryunix.memo"),RYUNIX_URL_QUERY:Symbol.for("ryunix.urlQuery"),RYUNIX_REF:Symbol.for("ryunix.ref"),RYUNIX_STORE:Symbol.for("ryunix.store"),RYUNIX_REDUCE:Symbol.for("ryunix.reduce"),RYUNIX_FRAGMENT:Symbol.for("ryunix.fragment"),RYUNIX_CONTEXT:Symbol.for("ryunix.context"),RYUNIX_SUSPENSE:Symbol.for("ryunix.suspense")}),i=Object.freeze({OBJECT:"object",FUNCTION:"function",STYLE:"ryunix-style",CLASS_NAME:"ryunix-class",CHILDREN:"children",BOOLEAN:"boolean",STRING:"string",UNDEFINED:"undefined"}),a=Object.freeze({STYLE:"style",CLASS_NAME:"className"}),l=Object.freeze({PLACEMENT:Symbol.for("ryunix.reconciler.status.placement"),UPDATE:Symbol.for("ryunix.reconciler.status.update"),DELETION:Symbol.for("ryunix.reconciler.status.deletion"),NO_EFFECT:Symbol.for("ryunix.reconciler.status.no_effect"),HYDRATE:Symbol.for("ryunix.reconciler.status.hydrate")});function c(e,t=1){return Array.isArray(e)?t<1?e.slice():e.reduce((e,n)=>(Array.isArray(n)&&t>0?e.push(...c(n,t-1)):e.push(n),e),[]):[e]}const u=e=>null!==e&&typeof e===i.OBJECT,d=e=>typeof e===i.FUNCTION,p=e=>typeof e===i.STRING,f=e=>null===e;function y(e){let t=e;for(;t&&(3===t.nodeType&&!t.nodeValue?.trim()||8===t.nodeType||1===t.nodeType&&t.hasAttribute("data-ryunix-ssr"));)t=t.nextSibling;return t}const h=e=>({type:s.TEXT_ELEMENT,props:{nodeValue:String(e),children:[]}}),m=(e,t,...n)=>{const r=t||{};let o=n;0===n.length&&void 0!==r.children&&(o=Array.isArray(r.children)?r.children:[r.children]),o=o.flat().filter(e=>null!=e&&!1!==e&&!0!==e);const s=[];let a="";for(const e of o)typeof e!==i.OBJECT?a+=String(e):(""!==a&&(s.push(h(a)),a=""),s.push(e));return""!==a&&s.push(h(a)),{type:e,props:{...r,children:s}}},g=e=>{const t=Array.isArray(e.children)?e.children:[e.children];return m(s.RYUNIX_FRAGMENT,{},...t)},E=(e,t={},...n)=>{if(!e||!u(e))throw new Error("cloneElement requires a valid element");const r=n.length>0?n:e.props.children??[];return m(e.type,{...e.props,...t},...Array.isArray(r)?r:[r])},x=e=>u(e)&&void 0!==e.type&&void 0!==e.props,b=e=>e.startsWith("on"),N=e=>e!==i.CHILDREN&&!b(e),v=(e,t)=>n=>!Object.is(e[n],t[n]),R=e=>t=>!(t in e),w=e=>{e?.hooks?.length&&e.hooks.filter(e=>e.type===s.RYUNIX_EFFECT&&d(e.cancel)).forEach(e=>{try{e.cancel&&e.cancel(),e.cancel=null}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in effect cleanup:",e)}})},S=e=>{e&&(e.hooks?.length&&e.hooks.filter(e=>e.type===s.RYUNIX_EFFECT&&d(e.cancel)).forEach(e=>{try{e.cancel&&e.cancel(),e.cancel=null}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in deep effect cleanup:",e)}}),e.child&&S(e.child),e.sibling&&S(e.sibling))},_={strokeWidth:"stroke-width",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",fillRule:"fill-rule",fillOpacity:"fill-opacity",clipRule:"clip-rule",clipPath:"clip-path",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",textAnchor:"text-anchor",textDecoration:"text-decoration",dominantBaseline:"dominant-baseline",alignmentBaseline:"alignment-baseline",baselineShift:"baseline-shift",stopColor:"stop-color",stopOpacity:"stop-opacity",floodColor:"flood-color",floodOpacity:"flood-opacity",lightingColor:"lighting-color",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",pointerEvents:"pointer-events",shapeRendering:"shape-rendering",imageRendering:"image-rendering",markerStart:"marker-start",markerMid:"marker-mid",markerEnd:"marker-end"};function k(e){return _[e]??e}const T={IMMEDIATE:1,USER_BLOCKING:2,NORMAL:3,LOW:4,IDLE:5};let C=T.NORMAL,I=[],O=!1;function A(e){for(I.sort((e,t)=>e.priority-t.priority);I.length>0&&e.timeRemaining()>1;){const e=I.shift();if(!e)break;C=e.priority,e.callback()}I.length>0?t(A):(O=!1,C=T.NORMAL)}function D(e,t){const n=C;C=e;try{return t()}finally{C=n}}function L(){return C}const M=e=>e.replace(o,e=>`-${e.toLowerCase()}`),U=(e,t,n)=>{if(!n||""===n.trim()){if(t){const n=t.split(/\s+/).filter(Boolean);e.classList.remove(...n)}return}if(t){const n=t.split(/\s+/).filter(Boolean);e.classList.remove(...n)}const r=n.split(/\s+/).filter(Boolean);r.length>0&&e.classList.add(...r)},$=e=>{if(e.type===s.RYUNIX_FRAGMENT||e.type===s.RYUNIX_CONTEXT||e.type===Symbol.for("ryunix.portal"))return null;let t;try{if(e.type===s.TEXT_ELEMENT)t=document.createTextNode("");else{if(!p(e.type))return"production"!==process.env.NODE_ENV&&console.warn("Attempted to create DOM for non-host component:",e.type),null;{const n=e.type;t=["svg","path","g","circle","polygon","rect","line","polyline","ellipse","text","tspan","defs","use","symbol","mask","clipPath","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComposite","foreignObject","image","marker","pattern","textPath"].includes(n)?document.createElementNS("http://www.w3.org/2000/svg",n):document.createElement(n)}}return X(t,{},e.props),t}catch(t){return"production"!==process.env.NODE_ENV&&console.error("Error creating DOM element:",t,e),null}},j=(e,t)=>{if("string"!=typeof t)return t;const n=e.toLowerCase();if("href"!==n&&"src"!==n&&"action"!==n&&"formaction"!==n)return t;const r=t.replace(/\s+/g,"").toLowerCase();return r.startsWith("javascript:")||r.startsWith("vbscript:")||r.startsWith("data:")?("production"!==process.env.NODE_ENV&&console.warn(`[Ryunix Security] Blocked dangerous ${e} URI: ${t}`),"javascript:void(0)"):t},Y=j,X=(e,t={},n={})=>{if(3===e.nodeType)return void(t.nodeValue!==n.nodeValue&&(e.nodeValue=String(n.nodeValue??"")));const r=e,o=r,s=o._ryunixHandlers;Object.keys(t).filter(b).filter(e=>R(n)(e)||v(t,n)(e)).forEach(e=>{const n=e.toLowerCase().substring(2);try{const o=t[e],i=s?.get(o)||o;r.removeEventListener(n,i),s&&s.delete(o)}catch(e){"production"!==process.env.NODE_ENV&&console.warn("Error removing event listener:",e)}}),Object.keys(t).filter(N).filter(R(n)).forEach(e=>{if(e!==i.STYLE&&e!==a.STYLE&&e!==i.CLASS_NAME&&e!==a.CLASS_NAME)if(r instanceof SVGElement){const t=k(e);r.removeAttribute(t)}else r[e]="",r.removeAttribute(e)}),Object.keys(n).filter(N).filter(v(t,n)).forEach(e=>{try{if(e===i.STYLE||e===a.STYLE){const t=n[e];((e,t)=>{if(u(t)&&!f(t))try{const n=Object.entries(t).filter(([e,t])=>null!=t).map(([e,t])=>`${M(e)}: ${t}`).join("; ");e.style.cssText=n}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error applying styles:",e)}else e.style.cssText=""})(r,t)}else if(e===i.CLASS_NAME)U(r,t[i.CLASS_NAME],n[i.CLASS_NAME]);else if(e===a.CLASS_NAME)U(r,t[a.CLASS_NAME],n[a.CLASS_NAME]);else if("value"===e||"checked"===e)r[e]!==n[e]&&(r[e]=n[e]);else{if(r instanceof SVGElement){const t=k(e),o=j(t,n[e]);r.setAttribute(t,o)}else{const t=n[e],o=j(e,t);r[e]=o,"object"!=typeof t&&"function"!=typeof t&&r.setAttribute(e,o)}}}catch(t){"production"!==process.env.NODE_ENV&&console.warn(`Error setting property ${e}:`,t)}}),Object.keys(n).filter(b).filter(v(t,n)).forEach(e=>{const t=e.toLowerCase().substring(2);try{const s=t=>{D(T.IMMEDIATE,()=>n[e](t))};o._ryunixHandlers||(o._ryunixHandlers=new Map),o._ryunixHandlers.set(n[e],s),r.addEventListener(t,s)}catch(e){"production"!==process.env.NODE_ENV&&console.warn("Error adding event listener:",e)}})},F=Symbol.for("ryunix.portal");function P(e,t){return t?{type:F,props:{children:Array.isArray(e)?e:[e]},containerInfo:t,_isPortal:!0}:("production"!==process.env.NODE_ENV&&console.error("createPortal: target container is not a DOM element."),null)}const V=e=>{if(e?.hooks?.length)for(let t=0;t<e.hooks.length;t++){const n=e.hooks[t];if(n.type===s.RYUNIX_EFFECT&&n.isLayout&&d(n.effect)){if(d(n.cancel))try{n.cancel()}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in layout effect cleanup:",e)}try{const e=n.effect();n.cancel=d(e)?e:null}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in layout effect:",e),n.cancel=null}n.effect=null}}},B=e=>{if(e?.hooks?.length)for(let t=0;t<e.hooks.length;t++){const n=e.hooks[t];if(n.type===s.RYUNIX_EFFECT&&!n.isLayout&&d(n.effect)){if(d(n.cancel))try{n.cancel()}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in effect cleanup:",e)}try{const e=n.effect();n.cancel=d(e)?e:null}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in effect:",e),n.cancel=null}n.effect=null}}};function H(e){if(!e)return;if(e.type===F||e._isPortal){const t=e.containerInfo;if(t){const n=e.child;n&&W(n,t)}return void H(e.sibling)}let t=e.parent;for(;t&&!t.dom;)t=t.parent;if(!t)return;const n=t.dom;if(e.effectTag===l.PLACEMENT)null!=e.dom&&("production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Appending PLACEMENT:",e.type),n.appendChild(e.dom)),V(e),B(e);else if(e.effectTag===l.UPDATE)w(e),null!=e.dom&&X(e.dom,e.alternate.props,e.props),V(e),B(e);else if(e.effectTag===l.HYDRATE){r().hydrationFailed?("production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Hydration fallback PLACEMENT:",e.type),null!=e.dom&&n.appendChild(e.dom),V(e),B(e)):("production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Hydrating node:",e.type),null!=e.dom&&X(e.dom,{},e.props),V(e),B(e))}else if(e.effectTag===l.DELETION)return S(e),void q(e);H(e.child),H(e.sibling)}const W=(e,t)=>{if(e){if(e.effectTag===l.PLACEMENT)null!=e.dom&&t.appendChild(e.dom),V(e),B(e);else if(e.effectTag===l.UPDATE)w(e),null!=e.dom&&X(e.dom,e.alternate.props,e.props),V(e),B(e);else if(e.effectTag===l.DELETION)return S(e),void q(e);W(e.child,t),W(e.sibling,t)}},q=(e,t)=>{if(e.dom)e.dom.parentNode&&e.dom.parentNode.removeChild(e.dom);else{let t=e.child;for(;t;)q(t),t=t.sibling}},G=(e,t)=>{const n=r();let o,s=0,i=!0;const a=new Map;let c=e.alternate?.child,u=0;for(;c;){const e=c.key??`__index_${c.index??u}__`;a.set(e,c),c=c.sibling,u++}for(;s<t.length;){const r=t[s];if(!r){s++;continue}const c=r.key??`__index_${s}__`,u=a.get(c);let d;u&&r.type===u.type&&u?(d={type:u.type,props:r.props,dom:u.dom,parent:e,alternate:u,effectTag:l.UPDATE,hooks:u.hooks,stateError:u.stateError,key:r.key,index:s},a.delete(c)):(d={type:r.type,props:r.props,dom:null,parent:e,alternate:null,effectTag:n.isHydrating?l.HYDRATE:l.PLACEMENT,key:r.key,index:s},u&&(u.effectTag=l.DELETION,n.deletions.push(u),a.delete(c))),i?(e.child=d,i=!1):o&&(o.sibling=d),o=d,s++}a.forEach(e=>{e.effectTag=l.DELETION,n.deletions.push(e)})};let z=null;let K=!1,J=[];function Q(e){const t=K;K=!0;try{e()}finally{K=t,!K&&J.length>0&&Z()}}function Z(){if(0===J.length)return;const e=J;J=[],e.forEach(e=>e())}process.env.NODE_ENV;const ee=(e="A hook")=>{const t=r();if(!t.wipFiber)throw new Error(`${e} can only be called inside function components. Make sure you are calling hooks at the top level of your component.`);const n=t.wipFiber;Array.isArray(n.hooks)||(n.hooks=[])},te=(e,t)=>!e||!t||(e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))),ne=(e,t=L())=>{if("undefined"==typeof window)return[d(e)?e():e,()=>{}];if(r().isServerRendering)return[d(e)?e():e,()=>{}];return re((e,t)=>d(t)?t(e):t,e,void 0,t)},re=(e,t,n,o=L())=>{if("undefined"==typeof window)return[n?n(t):t,()=>{}];const i=r();if(i.isServerRendering)return[n?n(t):t,()=>{}];ee();const{hookIndex:a}=i,l=i.wipFiber,c=l.alternate?.hooks?.[a],u={hookID:a,type:s.RYUNIX_STORE,state:c?c.state:n?n(t):t,queue:[]};c?.queue&&c.queue.forEach(t=>{try{u.state=e(u.state,t)}catch(e){"production"!==process.env.NODE_ENV&&console.error("Error in reducer:",e)}});return l.hooks[a]=u,i.hookIndex++,[u.state,(e,t=o)=>{if(void 0===e)return void("production"!==process.env.NODE_ENV&&console.warn("dispatch called with undefined action"));u.queue.push(e);const n=r(),s=n.currentRoot||n.wipRoot;if(!s)return;const i={dom:s.dom,props:s.props,alternate:n.currentRoot||null};var a;a=()=>((e,t)=>{if(z)return z(e,t);"production"!==process.env.NODE_ENV&&console.warn("[Ryunix] scheduleWork called before being initialized.")})(i,t),J.push(a),K||Z()}]},oe=(e,t)=>{if("undefined"==typeof window)return;const n=r();if(n.isServerRendering)return;if(ee(),!d(e))throw new Error("useEffect callback must be a function");if(void 0!==t&&!Array.isArray(t))throw new Error("useEffect dependencies must be an array or undefined");const{hookIndex:o}=n,i=n.wipFiber,a=i.alternate?.hooks?.[o],l=te(a?.deps,t),c={hookID:o,type:s.RYUNIX_EFFECT,deps:t,effect:l?e:null,cancel:a?.cancel};i.hooks[o]=c,n.hookIndex++},se=e=>{if("undefined"==typeof window)return{current:e};const t=r();if(t.isServerRendering)return{current:e};ee();const{hookIndex:n}=t,o=t.wipFiber,i=o.alternate?.hooks?.[n],a={hookID:n,type:s.RYUNIX_REF,value:i?i.value:{current:e}};return o.hooks[n]=a,t.hookIndex++,a.value},ie=(e,t)=>{if("undefined"==typeof window)return e();const n=r();if(n.isServerRendering)return e();if(ee(),!d(e))throw new Error("useMemo callback must be a function");if(!Array.isArray(t))throw new Error("useMemo requires a dependencies array");const{hookIndex:o}=n,i=n.wipFiber,a=i.alternate?.hooks?.[o];let l;if(a&&!te(a.deps,t))l=a.value;else try{l=e()}catch(e){throw"production"!==process.env.NODE_ENV&&console.error("Error in useMemo computation:",e),e}const c={hookID:o,type:s.RYUNIX_MEMO,value:l,deps:t};return i.hooks[o]=c,n.hookIndex++,l},ae=(e,t)=>{if(!d(e))throw new Error("useCallback requires a function as first argument");return ie(()=>e,t)},le=(e=s.RYUNIX_CONTEXT,t={})=>{const n=({value:t,children:n})=>m(s.RYUNIX_CONTEXT,{value:t,children:n,_contextId:e},...c([n]));n._contextId=e;return{Provider:n,useContext:(n=e)=>{const o=r();if(o.isServerRendering){const e=o.ssrContexts;return e&&void 0!==e[n]?e[n]:t}ee();let s=o.wipFiber;for(;s;){if(s._contextId===n&&void 0!==s._contextValue)return s._contextValue;const e=s.type;if(e?._contextId===n&&void 0!==s.props?.value)return s.props.value;s=s.parent}return t}}},ce=()=>{if("undefined"==typeof window)return{};const e=new URLSearchParams(window.location.search),t={};for(const[n,r]of e.entries())t[n]=r;return t},ue=()=>{if("undefined"==typeof window)return"";const[e,t]=ne(window.location.hash);return oe(()=>{const e=()=>t(window.location.hash);return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]),e},de=(e={},t={})=>{const n=r();n.isServerRendering?n.ssrMetadata={...n.ssrMetadata,...e}:oe(()=>{if("undefined"==typeof document)return;let n="Ryunix App";const r=t.title?.template,o=t.title?.prefix||"Ryunix App",s=e.pageTitle||e.title;if(n=p(s)&&s.trim()?r?.includes("%s")?r.replace("%s",s):s:o,document.title=n,e.canonical){let t=document.querySelector('link[rel="canonical"]');t||(t=document.createElement("link"),t.setAttribute("rel","canonical"),document.head.appendChild(t)),t.setAttribute("href",e.canonical)}Object.entries(e).forEach(([e,t])=>{if(["title","pageTitle","canonical"].includes(e))return;const n=e.startsWith("og:")||e.startsWith("twitter:"),r=`meta[${n?"property":"name"}='${e}']`;let o=document.head.querySelector(r);o||(o=document.createElement("meta"),o.setAttribute(n?"property":"name",e),document.head.appendChild(o)),o.setAttribute("content",t)})},[JSON.stringify(e),JSON.stringify(t)])},pe=le("ryunix.navigation",{location:"/",params:{},query:{},navigate:e=>{},route:null}),fe=(e,t)=>{const n=t.split("?")[0].split("#")[0],r=e.find(e=>e.NotFound),o=r?{route:{component:r.NotFound},params:{}}:{route:{component:null},params:{}};for(const r of e){if(r.subRoutes){const e=fe(r.subRoutes,t);if(e)return e}if("*"===r.path)return o;if(!r.path||"string"!=typeof r.path)continue;const e=[],s=new RegExp(`^${r.path.replace(/:(\.\.\.)?(\w+)/g,(t,n,r)=>(e.push({key:r,isCatchAll:!!n}),n?"(.+)":"([^/]+)"))}$`),i=n.match(s);if(i){return{route:r,params:e.reduce((e,t,n)=>{const r=i[n+1];return e[t.key]=t.isCatchAll&&r?r.split("/"):r,e},{})}}}return o},ye=({routes:e,children:t})=>{if("undefined"==typeof window){const n=(()=>{const e=globalThis?.window?.location?.pathname;return"string"==typeof e&&e?e.split("?")[0].split("#")[0]:"/"})(),r=fe(e,n),o={location:n,params:r.params||{},query:{},navigate:()=>{},route:r.route};return m(pe.Provider,{value:o},g({children:t}))}const[n,r]=ne(window.location.pathname);oe(()=>{const e=()=>r(window.location.pathname);return window.addEventListener("popstate",e),window.addEventListener("hashchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)}},[]);const o=fe(e,n),s=ce(),i={location:n,params:o.params||{},query:s,navigate:e=>{"undefined"!=typeof window&&window.__RYUNIX_MPA__?window.location.assign(e):(window.history.pushState({},"",e),r(e))},route:o.route};return m(pe.Provider,{value:i},g({children:t}))},he=()=>pe.useContext("ryunix.navigation"),me=()=>{const{route:e,params:t,query:n,location:r}=he();if(!e||!e.component)return null;const o=ue();return oe(()=>{if(o){const e=o.slice(1),t=document.getElementById(e);t&&t.scrollIntoView({block:"start",behavior:"smooth"})}},[o]),m(e.component,{key:r,params:t,query:n,hash:o,location:r})},ge=()=>{const{location:e}=he();return e.split("?")[0].split("#")[0]},Ee=()=>{const{query:e}=he();return new URLSearchParams(e)},xe=({to:e,prefetch:t=!0,...n})=>{const{navigate:r}=he(),{className:o,...s}=n;return m("a",{href:e,onClick:t=>{0!==t.button||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||(t.preventDefault(),r(e))},onMouseEnter:()=>{},className:n.className||n["ryunix-class"],...s},n.children)},be=({to:e,exact:t=!1,...n})=>{const{location:r,navigate:o}=he(),s=t?r===e:r.startsWith(e),i=n["ryunix-class"]?"ryunix-class":"className",a="function"==typeof(l=n["ryunix-class"]||n.className)?l({isActive:s}):l||"";var l;const{"ryunix-class":c,className:u,...d}=n;return m("a",{href:e,onClick:t=>{0!==t.button||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||(t.preventDefault(),o(e))},[i]:a,...d},n.children)},Ne=e=>{const[n,r]=re((e,t)=>"function"==typeof t?t.value(e):t.value,e,void 0);return[n,(e,n=T.NORMAL)=>{const o={value:e,priority:n};!function(e,n=T.NORMAL){I.push({callback:e,priority:n,timestamp:Date.now()}),O||(O=!0,t(A))}(()=>r(o,n),n)}]},ve=()=>{const[e,t]=Ne(!1);return[e,e=>{t(!0,T.IMMEDIATE),setTimeout(()=>{D(T.LOW,()=>{e(),t(!1,T.LOW)})},0)}]},Re=e=>{const[t,n]=Ne(e);return oe(()=>{const t=setTimeout(()=>{n(e,T.LOW)},100);return()=>clearTimeout(t)},[e]),t},we=(e,t="")=>{const[n,r]=ne(()=>{try{const n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch(e){return t}});return[n,t=>{try{r(t),window.localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}}]},Se=(e=!1)=>{const[t,n]=ne(e);return[t,()=>{n(e=>!e)}]},_e=(e,t)=>{if("undefined"==typeof window)return;const n=r();if(n.isServerRendering)return;if(ee(),!d(e))throw new Error("useLayoutEffect callback must be a function");if(void 0!==t&&!Array.isArray(t))throw new Error("useLayoutEffect dependencies must be an array or undefined");const{hookIndex:o}=n,i=n.wipFiber,a=i.alternate?.hooks?.[o],l=te(a?.deps,t),c={hookID:o,type:s.RYUNIX_EFFECT,deps:t,effect:l?e:null,cancel:a?.cancel,isLayout:!0};i.hooks[o]=c,n.hookIndex++};let ke=0;const Te=()=>{ke=0},Ce=()=>{const e=r();if(e.isServerRendering)return`:r${ke++}:`;ee();const{hookIndex:t}=e,n=e.wipFiber,o=n.alternate?.hooks?.[t],i={hookID:t,type:s.RYUNIX_REF,value:o?o.value:`:r${ke++}:`};return n.hooks[t]=i,e.hookIndex++,i.value},Ie=(e,t=300)=>{const[n,r]=ne(e);return oe(()=>{const n=setTimeout(()=>{r(e)},t);return()=>clearTimeout(n)},[e,t]),n},Oe=(e,t=300)=>{const[n,r]=ne(e),o=se(Date.now());return oe(()=>{const n=Date.now(),s=n-o.current;if(!(s>=t)){const n=setTimeout(()=>{o.current=Date.now(),r(e)},t-s);return()=>clearTimeout(n)}o.current=n,r(e)},[e,t]),n};var Ae=Object.freeze({__proto__:null,Children:me,Link:xe,NavLink:be,RouterProvider:ye,createContext:le,resetIdCounter:Te,useCallback:ae,useDebounce:Ie,useDeferredValue:Re,useEffect:oe,useHash:ue,useId:Ce,useLayoutEffect:_e,useMemo:ie,useMetadata:de,usePathname:ge,usePersistentStore:we,usePersitentStore:we,useQuery:ce,useReducer:re,useRef:se,useRouter:he,useSearchParams:Ee,useStore:ne,useStorePriority:Ne,useSwitch:Se,useThrottle:Oe,useTransition:ve});const De=e=>"symbol"==typeof e?e.description||e.toString():"function"==typeof e?e.name||"anonymous":String(e),{Provider:Le,useContext:Me}=le("ryunix.mdx",{}),Ue=e=>({...Me(),...e}),$e=(e,t)=>m(e,t),je={h1:e=>$e("h1",e),h2:e=>$e("h2",e),h3:e=>$e("h3",e),h4:e=>$e("h4",e),h5:e=>$e("h5",e),h6:e=>$e("h6",e),p:e=>$e("p",e),a:e=>$e("a",e),strong:e=>$e("strong",e),em:e=>$e("em",e),code:e=>$e("code",e),ul:e=>$e("ul",e),ol:e=>$e("ol",e),li:e=>$e("li",e),blockquote:e=>$e("blockquote",e),pre:e=>$e("pre",e),hr:e=>$e("hr",e),table:e=>$e("table",e),thead:e=>$e("thead",e),tbody:e=>$e("tbody",e),tr:e=>$e("tr",e),th:e=>$e("th",e),td:e=>$e("td",e),img:e=>$e("img",e)};let Ye=[],Xe=!1;function Fe(e){const t=r(),n=e.type instanceof Function||"function"==typeof e.type;try{n?(e=>{const t=r();t.wipFiber=e,t.hookIndex=0,t.wipFiber.hooks=[],t.isHydrating&&(e.effectTag=l.HYDRATE);const n=e.type;if(n._isMemo&&e.alternate){const{children:t,...r}=e.alternate.props||{},{children:o,...s}=e.props||{};if(n._arePropsEqual?.(r,s)){e.hooks=e.alternate.hooks;const t=e.alternate.child;return void(t&&(t.parent=e,e.child=t))}}let o=[n(e.props)];n._contextId&&void 0!==e.props?.value&&(e._contextId=n._contextId,e._contextValue=e.props.value),G(e,o)})(e):(e=>{const t=r();e.type===s.RYUNIX_CONTEXT&&(e._contextId=e.props?._contextId,e._contextValue=e.props?.value);const n=e.type===s.RYUNIX_FRAGMENT||e.type===s.RYUNIX_CONTEXT||e.type===Symbol.for("ryunix.portal");if(t.isHydrating&&n)e.effectTag=l.HYDRATE;else if(!e.dom)if(t.isHydrating&&t.hydrateCursor){const n=t.hydrateCursor,r=e.type===s.TEXT_ELEMENT&&3===n.nodeType,o="string"==typeof e.type&&1===n.nodeType&&n.tagName.toLowerCase()===e.type.toLowerCase();r||o?(e.dom=n,e.effectTag=l.HYDRATE,t.hydrateCursor=y(n.firstChild)):("production"!==process.env.NODE_ENV&&console.warn(`[Hydration] Mismatch at ${De(e.type)}. Expected ${1===n.nodeType?n.tagName:"text"} but got ${String(e.type)}. Falling back to CSR.`),t.isHydrating=!1,t.hydrationFailed=!0,t.hydrateCursor=null,e.dom=$(e),e.effectTag=l.PLACEMENT)}else e.dom=$(e);const o=e.props?.children||[];G(e,o)})(e)}catch(n){if("production"!==process.env.NODE_ENV){console.error("[Ryunix ErrorBoundary] Caught error during render:",n);try{const t=e.props&&e.props.__source;t&&n&&"object"==typeof n&&(n.__ryunix_source=t);let r=e;for(;!n.__ryunix_source&&r;)r.props&&r.props.__source&&(n.__ryunix_source=r.props.__source),r=r.parent}catch(e){}}let r=e.parent,o=!1;for(;r;){if(r.type&&"RYUNIX_ERROR_BOUNDARY"===r.type.ryunix_type){o=!0;break}r=r.parent}return o?("production"!==process.env.NODE_ENV&&console.warn("[Ryunix ErrorBoundary] Recovering tree at nearest boundary."),r.stateError=n,e.child=null,r):(console.error("[Ryunix] Fatal Uncaught Error. No ErrorBoundary was found in the tree to handle this exception:\n",n),t.nextUnitOfWork=null,null)}if(e.child)return e.child;let o=e;for(;o;){if(t.isHydrating&&o.dom&&(t.hydrateCursor=y(o.dom.nextSibling)),o.sibling)return o.sibling;o=o.parent}}const Pe=e=>{const n=r();let o=!1;for(;(n.nextUnitOfWork||Ye.length>0)&&!o;){if(!n.nextUnitOfWork&&Ye.length>0){const e=Ye.shift();n.wipRoot=e,n.nextUnitOfWork=e,n.deletions=[],void 0!==e.isHydrating&&(n.isHydrating=e.isHydrating,n.hydrateCursor=e.hydrateCursor)}n.nextUnitOfWork&&(n.nextUnitOfWork=Fe(n.nextUnitOfWork)),o=e.timeRemaining()<1}!n.nextUnitOfWork&&n.wipRoot&&function(){const e=r();e.deletions.forEach(H);const t=e.wipRoot;if(e.currentRoot=t,e.isHydrating||e.hydrationFailed){if("production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log(`[Ryunix Debug] commitRoot - isHydrating: ${e.isHydrating}, hydrationFailed: ${e.hydrationFailed}`),e.hydrationFailed){"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Hydration failed. Clearing container.");const n=e.containerRoot||t.dom;n&&(n.textContent="")}else{let t=e.hydrateCursor;for(t&&"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log("[Ryunix Debug] Removing unmatched root siblings.");t;){const e=t.nextSibling;t.parentNode&&t.parentNode.removeChild(t),t=e}}e.isHydrating=!1,e.hydrationFailed=!1,e.hydrateCursor=null}H(t.child),e.wipRoot===t&&(e.wipRoot=null)}(),n.nextUnitOfWork||Ye.length>0?t(Pe):Xe=!1},Ve=(e,n=L())=>{const o=r();o.wipRoot?Ye.push(e):(o.nextUnitOfWork=e,o.wipRoot=e,o.deletions=[],void 0!==e.isHydrating&&(o.isHydrating=e.isHydrating,o.hydrateCursor=e.hydrateCursor)),o.hookIndex=0,o.effects=[],Xe||(Xe=!0,n<=T.USER_BLOCKING?Promise.resolve().then(()=>{Pe({timeRemaining:()=>10,didTimeout:!0})}):t(Pe))};z=Ve;const Be=(e,t)=>{const n=r();(e=>{if(e)for(;e.firstChild;)e.removeChild(e.firstChild)})(t);const o={dom:t,props:{children:[e]},alternate:n.currentRoot,isHydrating:!1,hydrateCursor:null};return Ve(o),o},He=e=>{let t=e;for(;t&&(3===t.nodeType&&!t.nodeValue.trim()||8===t.nodeType||1===t.nodeType&&t.hasAttribute("data-ryunix-ssr"));)t=t.nextSibling;return t},We=(e,t)=>{const n=r();n.containerRoot=t;const o={dom:t,props:{children:[e]},alternate:n.currentRoot,isHydrating:!0,hydrateCursor:He(t.firstChild)};return Ve(o),o},qe=(e,t="__ryunix",n={})=>{const o=r();o.containerRoot=document.getElementById(t),o.isHydrating=!1,o.hydrationFailed=!1;const s=o.containerRoot&&o.containerRoot.hasChildNodes();"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log(`[Ryunix Debug] init: hasChildNodes=${s}, has SSR content detected.`);const i="false"!==process.env.RYUNIX_SSR;if(s&&i){"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log(`[Ryunix Debug] init: SSR content detected. Starting hydration on #${t}`);return We(e,o.containerRoot)}"production"!==process.env.NODE_ENV&&process.env.RYUNIX_DEBUG&&console.log(`[Ryunix Debug] init: No SSR content or SSR disabled. Starting normal render on #${t}`);return Be(e,o.containerRoot)},Ge=(e,t,n)=>{try{return e(t)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("Component error:",e),n&&n(e),null}},ze=e=>"string"!=typeof e?String(e):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),Ke=e=>!u(e)||f(e)?"":Object.entries(e).filter(([e,t])=>null!=t).map(([e,t])=>`${M(e)}:${t}`).join(";"),Je=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Qe=e=>{if(null==e||"boolean"==typeof e)return"";if("string"==typeof e||"number"==typeof e)return ze(e);if(Array.isArray(e))return e.map(e=>Qe(e)).join("");const t=e;if(t.type===s.TEXT_ELEMENT)return ze(t.props.nodeValue);if(t.type===s.RYUNIX_FRAGMENT){return(t.props?.children||[]).map(e=>Qe(e)).join("")}if(t.type===s.RYUNIX_CONTEXT){const e=r();e.ssrContexts=e.ssrContexts||{};const n=t.props||{},o=n._contextId,s=e.ssrContexts[o];o&&(e.ssrContexts[o]=n.value);const i=n.children||[];let a="";return a=Array.isArray(i)?i.map(e=>Qe(e)).join(""):Qe(i),o&&(e.ssrContexts[o]=s),a}if("function"==typeof t.type){const e=(0,t.type)(t.props||{});return Qe(e)}const n=String(t.type),o=t.props||{};let l="",c="",u=null;if(Object.entries(o).forEach(([e,t])=>{if("children"===e)c=Array.isArray(t)?t.map(e=>Qe(e)).join(""):Qe(t);else if("dangerouslySetInnerHTML"===e){const e=t;e?.__html&&(u=e.__html)}else if(e===i.STYLE||e===a.STYLE){const e=Ke(t);e&&(l+=` style="${ze(e)}"`)}else if(e===i.CLASS_NAME||e===a.CLASS_NAME)t&&(l+=` class="${ze(t)}"`);else if(!e.startsWith("on")&&"__source"!==e&&"__self"!==e)if("boolean"==typeof t)t&&(l+=` ${e}=""`);else if(null!=t){let n=k(e),r=Y(n,t);l+=` ${n}="${ze(r)}"`}}),Je.has(n))return`<${n}${l} />`;return`<${n}${l}>${null!==u?u:c}</${n}>`},Ze="\nfunction $RC(id, templateId) {\n var b = document.getElementById(id);\n var t = document.getElementById(templateId);\n if (b && t) {\n b.innerHTML = t.innerHTML;\n t.remove();\n }\n}\n".replace(/\s+/g," ").trim(),et=async(e,t,n=[])=>{if(null==e||"boolean"==typeof e)return;if(e instanceof Promise&&(null==(e=await e)||"boolean"==typeof e))return;if("string"==typeof e||"number"==typeof e)return void t(ze(e));if(Array.isArray(e)){for(const r of e)await et(r,t,n);return}const o=e;if(o.type===s.TEXT_ELEMENT)return void t(ze(o.props.nodeValue));if(o.type===s.RYUNIX_FRAGMENT){const e=o.props?.children||[];for(const r of e)await et(r,t,n);return}if(o.type===s.RYUNIX_CONTEXT){const e=r();e.ssrContexts=e.ssrContexts||{};const s=o.props||{},i=s._contextId,a=e.ssrContexts[i];i&&(e.ssrContexts[i]=s.value);const l=s.children||[];if(Array.isArray(l))for(const e of l)await et(e,t,n);else await et(l,t,n);return void(i&&(e.ssrContexts[i]=a))}const l=o.type;if(o.type===s.RYUNIX_SUSPENSE||"object"==typeof l&&null!=l&&l.type===s.RYUNIX_SUSPENSE){const e=o.props||{},{fallback:s,children:i}=e,a=`s-${Math.random().toString(36).slice(2,9)}`;t(`\x3c!--$?--\x3e<template id="B:${a}"></template><div id="S:${a}">`);const l=(async()=>{const e=r(),t=e.isSuspenseBackground;e.isSuspenseBackground=!0;let o="";const s=e=>{o+=e};try{return await et(i,s,n),{id:a,content:o,success:!0}}catch(e){return{id:a,content:"",success:!1,error:e}}finally{e.isSuspenseBackground=t}})();return n.push(l),await et(s,t,n),void t("</div>\x3c!--$/--\x3e")}let c=o.type,u=o.props||{};if("function"==typeof c){process.env.RYUNIX_DEBUG&&console.log("[SSR Debug] Rendering function:",c.name||"anonymous");const e=await c(u);return void await et(e,t,n)}const d=String(c);let p="",f=null,y=u.children||[];if(Object.entries(u).forEach(([e,t])=>{if("children"===e);else if("dangerouslySetInnerHTML"===e){const e=t;e?.__html&&(f=e.__html)}else if(e===i.STYLE||e===a.STYLE){const e=Ke(t);e&&(p+=` style="${ze(e)}"`)}else if(e===i.CLASS_NAME||e===a.CLASS_NAME)t&&(p+=` class="${ze(t)}"`);else if(!e.startsWith("on")&&"__source"!==e&&"__self"!==e)if("boolean"==typeof t)t&&(p+=` ${e}=""`);else if(null!=t){const n=k(e),r=Y(n,t);p+=` ${n}="${ze(r)}"`}}),t(`<${d}${p}>`),null!==f)t(f);else if(Array.isArray(y))for(const e of y)await et(e,t,n);else await et(y,t,n);Je.has(d)||t(`</${d}>`)},tt=(e,t={})=>{const n=r(),o=new TextEncoder;return Te(),new ReadableStream({async start(r){const s=n.isServerRendering;n.isServerRendering=!0,n.ssrMetadata={};const i=e=>r.enqueue(o.encode(e)),a=[];try{const n=t.nonce?` nonce="${t.nonce}"`:"";for(i(`<script${n} data-ryunix-ssr>${Ze}<\/script>`),await et(e,i,a);a.length>0;){const e=a.shift(),t=await e;t.success&&(i(`<template id="P:${t.id}" data-ryunix-ssr>${t.content}</template>`),i(`<script${n} data-ryunix-ssr>$RC("S:${t.id}", "P:${t.id}")<\/script>`))}r.close()}catch(e){r.error(e)}finally{n.isServerRendering=s}}})},nt=(e,t={})=>{const n=r(),o=n.isServerRendering;n.isServerRendering=!0,n.ssrMetadata={},Te();try{return Qe(e)}finally{n.isServerRendering=o}},rt=async(e,t={})=>{const n=tt(e,t).getReader(),r=new TextDecoder;let o="";for(;;){const{done:e,value:t}=await n.read();if(e)break;o+=r.decode(t,{stream:!0})}return o+=r.decode(),o};function ot(e,t=st){const n=t=>e(t);return n._isMemo=!0,n._wrappedComponent=e,n._arePropsEqual=t,n.displayName=`Memo(${e.displayName||e.name||"Component"})`,n}function st(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.is(e[n],t[n]))}function it(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if("object"!=typeof e||"object"!=typeof t)return!1;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>it(e[n],t[n]))}const at="pending",lt="resolved",ct="rejected";function ut(e){return null!=e&&"object"==typeof e&&"type"in e&&"function"==typeof e.type&&Boolean(e.type._isLazy)}function dt(e){let t=at,n=null,r=null,o=null;const s=s=>{if(t===lt&&n)return m(n,s);if(t===ct&&r)throw r;o||(o=e().then(e=>{const r=e;n="default"in r&&r.default?r.default:r,t=lt}).catch(e=>{r=e,t=ct}));const[,i]=ne(0);return oe(()=>{if(t===at&&o){let e=!0;return o.then(()=>{e&&i(e=>e+1)}).catch(()=>{e&&i(e=>e+1)}),()=>{e=!1}}},[]),null};return s._isLazy=!0,s._getStatus=()=>t,s}const pt=({fallback:e,children:t})=>{const[n,o]=ne(!1),s=Array.isArray(t)?t:[t];let i=!1;for(const e of s)if(ut(e)){const t=e.type._getStatus?.();t===at&&(i=!0)}return oe(()=>{i||n||o(!0)},[i]),i&&!r().isSuspenseBackground?e||null:m(g,{children:t})};function ft(e){return e()}pt.type=s.RYUNIX_SUSPENSE;const yt=()=>"undefined"!=typeof performance?performance.now():Date.now();const ht=new class{enabled;measures;renderTimes;maxSamples;constructor(){this.enabled="production"!==process.env.NODE_ENV,this.measures=new Map,this.renderTimes=[],this.maxSamples=100}startMeasure(e){this.enabled&&this.measures.set(e,yt())}endMeasure(e){if(!this.enabled)return;const t=this.measures.get(e);if(!t)return;const n=yt()-t;return this.measures.delete(e),n}recordRender(e,t){this.enabled&&(this.renderTimes.push({component:e,duration:t,timestamp:Date.now()}),this.renderTimes.length>this.maxSamples&&this.renderTimes.shift())}getStats(){if(!this.enabled)return null;const e=this.renderTimes.reduce((e,t)=>e+t.duration,0);return{total:e,avg:e/this.renderTimes.length,max:Math.max(...this.renderTimes.map(e=>e.duration)),min:Math.min(...this.renderTimes.map(e=>e.duration)),count:this.renderTimes.length}}getSlowestComponents(e=10){if(!this.enabled)return[];const t=new Map;return this.renderTimes.forEach(({component:e,duration:n})=>{t.has(e)||t.set(e,{total:0,count:0,max:0});const r=t.get(e);r.total+=n,r.count++,r.max=Math.max(r.max,n)}),Array.from(t.entries()).map(([e,t])=>({name:e,avg:t.total/t.count,max:t.max,count:t.count})).sort((e,t)=>t.avg-e.avg).slice(0,e)}logStats(){if(!this.enabled)return;const e=this.getStats();if(!e)return;console.group("šŸ” Ryunix Performance Stats"),console.log(`Total renders: ${e.count}`),console.log(`Avg render time: ${e.avg.toFixed(2)}ms`),console.log(`Min: ${e.min.toFixed(2)}ms | Max: ${e.max.toFixed(2)}ms`);const t=this.getSlowestComponents(5);t.length>0&&(console.log("\nāš ļø Slowest components:"),t.forEach((e,t)=>{console.log(`${t+1}. ${e.name}: ${e.avg.toFixed(2)}ms avg (${e.count} renders)`)})),console.groupEnd()}clear(){this.renderTimes=[],this.measures.clear()}enable(){this.enabled=!0}disable(){this.enabled=!1}};function mt(e){const t=yt();return()=>{const n=yt()-t;ht.recordRender(e,n)}}function gt(e,t){return n=>{ht.startMeasure(t);const r=e(n),o=ht.endMeasure(t);return o&&ht.recordRender(t,o),r}}function Et(e){if("function"!=typeof e)throw new Error("forwardRef requires a render function");const t=t=>{const{ref:n,...r}=t||{};return e(r,n??null)},n=e;return t.displayName=`ForwardRef(${n.displayName||n.name||"Component"})`,t._isForwardRef=!0,t._render=e,t}function xt({children:e,id:t}){return m("div",{"data-ryunix-server":t,style:{display:"contents"}},e)}function bt({children:e,fallback:t}){const n=r().wipFiber;if(n?.stateError){const e=n.stateError;return"function"==typeof t?t(e):t??null}return m("ryunix-error-boundary-wrapper",{style:{display:"contents"}},e)}function Nt(e){return async function(...t){const n=await fetch("/_ryunix/action",{method:"POST",headers:{"Content-Type":"application/json","X-Ryunix-Action":"true"},body:JSON.stringify({actionId:e,args:t})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.error||"Server Action failed")}return n.json()}}function vt(e){const t=e,n=!t||"object"!=typeof t||t instanceof Error||!t.nativeEvent?t:t.error;let r=null;if(n instanceof Error)r=n;else if(n&&"object"==typeof n)if("message"in n)r=n;else if("error"in n){const e=n.error;r=e&&"object"==typeof e?e:null}else r=n;const o=JSON.stringify(t,Object.getOwnPropertyNames(t||{})),[s,i]=ne(null),[a,l]=ne(1),[c,u]=ne(""),[d,p]=ne(0),f=s,y=a,h=c,g=d;let E=[];r&&r.stack&&(E="string"==typeof r.stack?r.stack.split("\n").filter(e=>{const t=e.trim();if(!t)return!1;if(t.includes("node_modules"))return!1;return!["components.js","workers.js","reconciler.js","commits.js","hooks.js","errorBoundary.js","serverBoundary.js","app-router.js","app-router-server.js","render.js","createElement.js","index.js"].some(e=>t.includes(e))}):Array.isArray(r.stack)?r.stack:[]);const x=r&&"string"==typeof r.name?r.name:"Unknown Error Type",b=r&&"string"==typeof r.message?r.message:`Raw unhandled error. Debug: ${o}`;oe(()=>{let e=null,t=null;const n=r?.__ryunix_source;if(n?.fileName&&(e=n.fileName,t=n.lineNumber??null),!e||!t)for(let n=0;n<E.length;n++){const r=E[n];if(!r.includes(":"))continue;let o=null,s=null;const i=r.indexOf("("),a=r.lastIndexOf(")");if(-1!==i&&a>i){const e=r.slice(i+1,a),t=e.lastIndexOf(":"),n=t>0?e.lastIndexOf(":",t-1):-1;if(n>0){const r=e.slice(t+1),i=e.slice(n+1,t);/^\d+$/.test(i)&&/^\d+$/.test(r)&&(o=e.slice(0,n),s=parseInt(i,10))}}if(!o){const e=r.trim();if(e.startsWith("at ")){const t=e.slice(3).trim(),n=t.lastIndexOf(":"),r=n>0?t.lastIndexOf(":",n-1):-1;if(r>0){const e=t.slice(n+1),i=t.slice(r+1,n);/^\d+$/.test(i)&&/^\d+$/.test(e)&&(o=t.slice(0,r),s=parseInt(i,10))}}}if(!o){const e=[".ryx",".jsx",".js",".ts",".tsx"],t=r.lastIndexOf(":");if(t>0){const n=r.slice(t+1).trim(),i=r.slice(0,t).trim();/^\d+$/.test(n)&&e.some(e=>i.endsWith(e))&&(o=i,s=parseInt(n,10))}}if(o&&s){e=o,t=s;break}}e&&t&&(u(e),p(t),fetch(`/_ryunix/source?file=${encodeURIComponent(e)}&line=${t}`).then(e=>e.json()).then(e=>{e.snippet&&(i(e.snippet),l(e.startLine))}).catch(e=>console.error("Failed to fetch source snippet",e)))},[r]);const N={backgroundColor:"#000",borderRadius:"8px",border:"1px solid #333",padding:"16px",fontFamily:"ui-monospace, monospace",fontSize:"14px",overflowX:"auto",color:"#d1d5db",marginBottom:"32px",whiteSpace:"pre-wrap",maxHeight:"150px",height:"auto"},v=e=>({display:"flex",backgroundColor:e?"rgba(239, 68, 68, 0.15)":"transparent",padding:"2px 8px",borderRadius:"4px",borderLeft:e?"3px solid #ef4444":"3px solid transparent"}),R=f?f.split("\n"):[];let w="UNHANDLED RUNTIME ERROR";return x&&"Error"!==x&&"Unknown Error Type"!==x&&(w=x.replace(/([a-z])([A-Z])/g,"$1 $2").toUpperCase()),m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:2147483647,backgroundColor:"rgba(0, 0, 0, 0.85)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",fontFamily:"system-ui, -apple-system, sans-serif"}},m("div",{style:{backgroundColor:"#0c0c0c",width:"100%",maxWidth:"1000px",maxHeight:"90vh",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.8)",display:"flex",flexDirection:"column",overflow:"hidden",border:"1px solid #333"}},m("div",{style:{backgroundColor:"#161616",padding:"16px 24px",borderBottom:"1px solid #333",display:"flex",justifyContent:"space-between",alignItems:"center"}},m("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},m("span",{style:{backgroundColor:"rgba(239, 68, 68, 0.2)",color:"#ef4444",padding:"4px 8px",borderRadius:"4px",fontSize:"13px",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"0.05em"}},w),m("span",{style:{color:"#9ca3af",fontSize:"14px"}},"Ryunix Development")),m("button",{onClick:()=>window.location.reload(),style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",outline:"none"},title:"Reload page"},m("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),m("path",{d:"M3 3v5h5"})))),m("div",{style:{padding:"32px",overflowY:"auto",flex:1,color:"#fff"}},m("h1",{style:{fontSize:"24px",fontWeight:"bold",marginBottom:"24px",fontFamily:"ui-monospace, monospace",wordBreak:"break-word",lineHeight:1.4}},m("span",{style:{color:"#f87171"}},x),": ",b),h&&m("div",{style:{marginBottom:"16px",color:"#9ca3af",fontSize:"14px",display:"flex",alignItems:"center",gap:"8px"}},m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),m("polyline",{points:"13 2 13 9 20 9"})),h,":",g),f&&m("div",{style:N},m("div",{style:{display:"flex",flexDirection:"column"}},...R.map((e,t)=>{const n=y+t,r=n===g;return m("div",{key:t,style:v(r)},m("span",{style:{color:"#6b7280",width:"40px",userSelect:"none",textAlign:"right",marginRight:"16px",display:"inline-block"}},n),m("span",{style:{color:r?"#f87171":"#e5e7eb",whiteSpace:"pre"}},e||" "))}))),m("div",{style:{marginBottom:"16px"}},m("p",{style:{color:"#9ca3af",fontSize:"14px",marginBottom:"8px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"}},"Call Stack"),m("div",{style:N},E.length>0?m("ul",{style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"12px"}},...E.map((e,t)=>{if(0===t&&(e.startsWith("Error:")||e.startsWith("TypeError:")))return null;const n=e.trim();let r="<anonymous>",o=e;if(n.startsWith("at ")){const e=n.slice(3),t=e.indexOf("("),s=e.lastIndexOf(")");-1!==t&&s>t?(r=e.slice(0,t).trim()||"<anonymous>",o=e.slice(t+1,s)):(r=e.includes(":")?"<anonymous>":e,o=e)}else if(n.includes("@")){const e=n.indexOf("@");r=n.slice(0,e)||"<anonymous>",o=n.slice(e+1)}else{const e=[".ryx",".jsx",".js",".ts",".tsx"],t=n.split(/\s+/);if(t.length>=2){const n=t[t.length-1],s=n.indexOf(":"),i=s>0?n.slice(0,s):n;e.some(e=>i.endsWith(e))?(r=t.slice(0,-1).join(" "),o=n):(r=t[0],o=t.slice(1).join(" "))}}return m("li",{key:t},m("span",{style:{color:"#60a5fa",fontWeight:600}},r),m("div",{style:{color:"#6b7280",marginTop:"4px",paddingLeft:"16px",display:"flex",alignItems:"center",gap:"8px"}},m("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),m("polyline",{points:"13 2 13 9 20 9"})),o))})):m("div",{style:{color:"#6b7280",fontStyle:"italic"}},"No stack trace available."))))))}xt.ryunix_type="RYUNIX_SERVER_BOUNDARY",bt.ryunix_type="RYUNIX_ERROR_BOUNDARY";var Rt=Object.freeze({__proto__:null,Children:me,ErrorBoundary:bt,Fragment:g,Hooks:Ae,Link:xe,NavLink:be,Priority:T,RouterProvider:ye,RyunixDevOverlay:vt,ServerBoundary:xt,Suspense:pt,batchUpdates:Q,cloneElement:E,createActionProxy:Nt,createContext:le,createElement:m,createPortal:P,deepEqual:it,escapeHtml:ze,forwardRef:Et,getState:r,hydrate:We,init:qe,isValidElement:x,lazy:dt,memo:ot,preload:ft,profiler:ht,render:Be,renderToReadableStream:tt,renderToString:nt,renderToStringAsync:rt,resetIdCounter:Te,safeRender:Ge,shallowEqual:st,useCallback:ae,useDebounce:Ie,useDeferredValue:Re,useEffect:oe,useHash:ue,useId:Ce,useLayoutEffect:_e,useMemo:ie,useMetadata:de,usePathname:ge,usePersistentStore:we,usePersitentStore:we,useProfiler:mt,useQuery:ce,useReducer:re,useRef:se,useRouter:he,useSearchParams:Ee,useStore:ne,useStorePriority:Ne,useSwitch:Se,useThrottle:Oe,useTransition:ve,withProfiler:gt});"undefined"!=typeof window&&(window.Ryunix=Rt),e.Children=me,e.ErrorBoundary=bt,e.Fragment=g,e.Hooks=Ae,e.Image=({src:e,...t})=>m("img",{...t,src:e}),e.Link=xe,e.MDXContent=({children:e,components:t={}})=>{const n=Ue(t);return m(Le,{value:n},m("div",null,e))},e.MDXProvider=Le,e.NavLink=be,e.Priority=T,e.RouterProvider=ye,e.RyunixDevOverlay=vt,e.ServerBoundary=xt,e.Suspense=pt,e.batchUpdates=Q,e.cloneElement=E,e.createActionProxy=Nt,e.createContext=le,e.createElement=m,e.createPortal=P,e.deepEqual=it,e.default=Rt,e.defaultComponents=je,e.escapeHtml=ze,e.forwardRef=Et,e.getMDXComponents=Ue,e.getState=r,e.hydrate=We,e.init=qe,e.isValidElement=x,e.lazy=dt,e.memo=ot,e.preload=ft,e.profiler=ht,e.render=Be,e.renderToReadableStream=tt,e.renderToString=nt,e.renderToStringAsync=rt,e.resetIdCounter=Te,e.safeRender=Ge,e.shallowEqual=st,e.useCallback=ae,e.useDebounce=Ie,e.useDeferredValue=Re,e.useEffect=oe,e.useHash=ue,e.useId=Ce,e.useLayoutEffect=_e,e.useMDXComponents=Me,e.useMemo=ie,e.useMetadata=de,e.usePathname=ge,e.usePersistentStore=we,e.usePersitentStore=we,e.useProfiler=mt,e.useQuery=ce,e.useReducer=re,e.useRef=se,e.useRouter=he,e.useSearchParams=Ee,e.useStore=ne,e.useStorePriority=Ne,e.useSwitch=Se,e.useThrottle=Oe,e.useTransition=ve,e.withProfiler=gt,Object.defineProperty(e,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=Ryunix.umd.min.js.map