@ryupold/vode 1.6.0 → 1.6.1

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/vode.js CHANGED
@@ -586,10 +586,10 @@ var V = (() => {
586
586
  newvode[1] = remember(state, newvode[1], void 0);
587
587
  }
588
588
  const properties = props(newVode);
589
- xmlns = properties?.xmlns || xmlns;
589
+ if (properties?.xmlns !== void 0) xmlns = properties.xmlns;
590
590
  const newNode = xmlns ? document.createElementNS(xmlns, newVode[0]) : document.createElement(newVode[0]);
591
591
  newVode.node = newNode;
592
- patchProperties(state, newNode, void 0, properties);
592
+ patchProperties(state, newNode, void 0, properties, xmlns);
593
593
  if (!!properties && "catch" in properties) {
594
594
  newVode.node["catch"] = null;
595
595
  newVode.node.removeAttribute("catch");
@@ -604,12 +604,13 @@ var V = (() => {
604
604
  parent.appendChild(newNode);
605
605
  }
606
606
  }
607
- const newChildren = children(newVode);
608
- if (newChildren) {
609
- for (let i = 0; i < newChildren.length; i++) {
610
- const child2 = newChildren[i];
607
+ const newKids = children(newVode);
608
+ if (newKids) {
609
+ const childOffset = !!properties ? 2 : 1;
610
+ for (let i = 0; i < newKids.length; i++) {
611
+ const child2 = newKids[i];
611
612
  const attached = render(state, newNode, i, void 0, child2, xmlns);
612
- newVode[properties ? i + 2 : i + 1] = attached;
613
+ newVode[i + childOffset] = attached;
613
614
  }
614
615
  }
615
616
  newNode.onMount && state.patch(newNode.onMount(newNode));
@@ -620,16 +621,16 @@ var V = (() => {
620
621
  const newvode = newVode;
621
622
  const oldvode = oldVode;
622
623
  const properties = props(newVode);
623
- let hasProps = !!properties;
624
624
  const oldProps = props(oldVode);
625
+ if (properties?.xmlns !== void 0) xmlns = properties.xmlns;
625
626
  if (newvode[1]?.__memo) {
626
627
  const prev = newvode[1];
627
628
  newvode[1] = remember(state, newvode[1], oldvode[1]);
628
629
  if (prev !== newvode[1]) {
629
- patchProperties(state, oldNode, oldProps, properties);
630
+ patchProperties(state, oldNode, oldProps, properties, xmlns);
630
631
  }
631
632
  } else {
632
- patchProperties(state, oldNode, oldProps, properties);
633
+ patchProperties(state, oldNode, oldProps, properties, xmlns);
633
634
  }
634
635
  if (!!properties?.catch && oldProps?.catch !== properties.catch) {
635
636
  newVode.node["catch"] = null;
@@ -638,12 +639,13 @@ var V = (() => {
638
639
  const newKids = children(newVode);
639
640
  const oldKids = children(oldVode);
640
641
  if (newKids) {
642
+ const childOffset = !!properties ? 2 : 1;
641
643
  for (let i = 0; i < newKids.length; i++) {
642
644
  const child2 = newKids[i];
643
645
  const oldChild = oldKids && oldKids[i];
644
646
  const attached = render(state, oldNode, i, oldChild, child2, xmlns);
645
647
  if (attached) {
646
- newVode[hasProps ? i + 2 : i + 1] = attached;
648
+ newVode[i + childOffset] = attached;
647
649
  }
648
650
  }
649
651
  }
@@ -707,15 +709,18 @@ var V = (() => {
707
709
  return c;
708
710
  }
709
711
  }
710
- function patchProperties(s, node, oldProps, newProps) {
712
+ function patchProperties(s, node, oldProps, newProps, xmlns) {
711
713
  if (!newProps && !oldProps) return;
714
+ const xmlMode = xmlns !== void 0;
712
715
  if (oldProps) {
713
716
  for (const key in oldProps) {
714
717
  const oldValue = oldProps[key];
715
718
  const newValue = newProps?.[key];
716
719
  if (oldValue !== newValue) {
717
- if (newProps) newProps[key] = patchProperty(s, node, key, oldValue, newValue);
718
- else patchProperty(s, node, key, oldValue, void 0);
720
+ if (newProps)
721
+ newProps[key] = patchProperty(s, node, key, oldValue, newValue, xmlMode);
722
+ else
723
+ patchProperty(s, node, key, oldValue, void 0, xmlMode);
719
724
  }
720
725
  }
721
726
  }
@@ -723,17 +728,17 @@ var V = (() => {
723
728
  for (const key in newProps) {
724
729
  if (!(key in oldProps)) {
725
730
  const newValue = newProps[key];
726
- newProps[key] = patchProperty(s, node, key, void 0, newValue);
731
+ newProps[key] = patchProperty(s, node, key, void 0, newValue, xmlMode);
727
732
  }
728
733
  }
729
734
  } else if (newProps) {
730
735
  for (const key in newProps) {
731
736
  const newValue = newProps[key];
732
- newProps[key] = patchProperty(s, node, key, void 0, newValue);
737
+ newProps[key] = patchProperty(s, node, key, void 0, newValue, xmlMode);
733
738
  }
734
739
  }
735
740
  }
736
- function patchProperty(s, node, key, oldValue, newValue) {
741
+ function patchProperty(s, node, key, oldValue, newValue, xmlMode) {
737
742
  if (key === "style") {
738
743
  if (!newValue) {
739
744
  node.style.cssText = "";
@@ -778,7 +783,7 @@ var V = (() => {
778
783
  node[key] = null;
779
784
  }
780
785
  } else {
781
- node[key] = newValue;
786
+ if (!xmlMode) node[key] = newValue;
782
787
  if (newValue === void 0 || newValue === null || newValue === false)
783
788
  node.removeAttribute(key);
784
789
  else
package/dist/vode.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";var V=(()=>{var O=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var B=(e,o)=>{for(var a in o)O(e,a,{get:o[a],enumerable:!0})},_=(e,o,a,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of G(o))!K.call(e,t)&&t!==a&&O(e,t,{get:()=>o[t],enumerable:!(n=U(o,t))||n.enumerable});return e};var q=e=>_(O({},"__esModule",{value:!0}),e);var Xn={};B(Xn,{A:()=>ot,ABBR:()=>nt,ADDRESS:()=>st,ANIMATE:()=>ro,ANIMATEMOTION:()=>co,ANIMATETRANSFORM:()=>io,ANNOTATION:()=>dn,ANNOTATION_XML:()=>un,AREA:()=>at,ARTICLE:()=>rt,ASIDE:()=>ct,AUDIO:()=>it,B:()=>pt,BASE:()=>lt,BDI:()=>St,BDO:()=>ft,BLOCKQUOTE:()=>dt,BODY:()=>ut,BR:()=>Tt,BUTTON:()=>yt,CANVAS:()=>gt,CAPTION:()=>xt,CIRCLE:()=>po,CITE:()=>ht,CLIPPATH:()=>lo,CODE:()=>mt,COL:()=>Et,COLGROUP:()=>bt,DATA:()=>Pt,DATALIST:()=>At,DD:()=>Ct,DEFS:()=>So,DEL:()=>Mt,DESC:()=>fo,DETAILS:()=>Nt,DFN:()=>Rt,DIALOG:()=>Ot,DIV:()=>Dt,DL:()=>vt,DT:()=>Lt,DelegateStateContext:()=>I,ELLIPSE:()=>uo,EM:()=>It,EMBED:()=>Vt,FEBLEND:()=>To,FECOLORMATRIX:()=>yo,FECOMPONENTTRANSFER:()=>go,FECOMPOSITE:()=>xo,FECONVOLVEMATRIX:()=>ho,FEDIFFUSELIGHTING:()=>mo,FEDISPLACEMENTMAP:()=>Eo,FEDISTANTLIGHT:()=>bo,FEDROPSHADOW:()=>Po,FEFLOOD:()=>Ao,FEFUNCA:()=>Co,FEFUNCB:()=>Mo,FEFUNCG:()=>No,FEFUNCR:()=>Ro,FEGAUSSIANBLUR:()=>Oo,FEIMAGE:()=>Do,FEMERGE:()=>vo,FEMERGENODE:()=>Lo,FEMORPHOLOGY:()=>Io,FEOFFSET:()=>Vo,FEPOINTLIGHT:()=>Fo,FESPECULARLIGHTING:()=>ko,FESPOTLIGHT:()=>jo,FETILE:()=>Ho,FETURBULENCE:()=>Uo,FIELDSET:()=>Ft,FIGCAPTION:()=>kt,FIGURE:()=>jt,FILTER:()=>Go,FOOTER:()=>Ht,FOREIGNOBJECT:()=>Ko,FORM:()=>Ut,G:()=>Bo,H1:()=>Gt,H2:()=>Kt,H3:()=>Bt,H4:()=>_t,H5:()=>qt,H6:()=>Xt,HEAD:()=>$t,HEADER:()=>wt,HGROUP:()=>Yt,HR:()=>Wt,HTML:()=>Jt,I:()=>Qt,IFRAME:()=>zt,IMAGE:()=>_o,IMG:()=>Zt,INPUT:()=>te,INS:()=>ee,KBD:()=>oe,KeyStateContext:()=>L,LABEL:()=>ne,LEGEND:()=>se,LI:()=>ae,LINE:()=>qo,LINEARGRADIENT:()=>Xo,LINK:()=>re,MACTION:()=>Tn,MAIN:()=>ce,MAP:()=>ie,MARK:()=>pe,MARKER:()=>$o,MASK:()=>wo,MATH:()=>yn,MENU:()=>le,MERROR:()=>gn,META:()=>Se,METADATA:()=>Yo,METER:()=>fe,MFRAC:()=>xn,MI:()=>hn,MMULTISCRIPTS:()=>mn,MN:()=>En,MO:()=>bn,MOVER:()=>Pn,MPADDED:()=>An,MPATH:()=>Wo,MPHANTOM:()=>Cn,MPRESCRIPTS:()=>Mn,MROOT:()=>Nn,MROW:()=>Rn,MS:()=>On,MSPACE:()=>Dn,MSQRT:()=>vn,MSTYLE:()=>Ln,MSUB:()=>In,MSUBSUP:()=>Vn,MSUP:()=>Fn,MTABLE:()=>kn,MTD:()=>jn,MTEXT:()=>Hn,MTR:()=>Un,MUNDER:()=>Gn,MUNDEROVER:()=>Kn,NAV:()=>de,NOSCRIPT:()=>ue,OBJECT:()=>Te,OL:()=>ye,OPTGROUP:()=>ge,OPTION:()=>xe,OUTPUT:()=>he,P:()=>me,PATH:()=>Jo,PATTERN:()=>Qo,PICTURE:()=>Ee,POLYGON:()=>zo,POLYLINE:()=>Zo,PRE:()=>be,PROGRESS:()=>Pe,Q:()=>Ae,RADIALGRADIENT:()=>tn,RECT:()=>en,RP:()=>Ce,RT:()=>Me,RUBY:()=>Ne,S:()=>Re,SAMP:()=>Oe,SCRIPT:()=>De,SEARCH:()=>ve,SECTION:()=>Le,SELECT:()=>Ie,SEMANTICS:()=>Bn,SET:()=>on,SLOT:()=>Ve,SMALL:()=>Fe,SOURCE:()=>ke,SPAN:()=>je,STOP:()=>nn,STRONG:()=>He,STYLE:()=>Ue,SUB:()=>Ge,SUMMARY:()=>Ke,SUP:()=>Be,SVG:()=>sn,SWITCH:()=>an,SYMBOL:()=>rn,TABLE:()=>_e,TBODY:()=>qe,TD:()=>Xe,TEMPLATE:()=>$e,TEXT:()=>cn,TEXTAREA:()=>we,TEXTPATH:()=>pn,TFOOT:()=>Ye,TH:()=>We,THEAD:()=>Je,TIME:()=>Qe,TITLE:()=>ze,TR:()=>Ze,TRACK:()=>to,TSPAN:()=>ln,U:()=>eo,UL:()=>oo,USE:()=>Sn,VAR:()=>no,VIDEO:()=>so,VIEW:()=>fn,WBR:()=>ao,app:()=>$,child:()=>Z,childCount:()=>z,children:()=>C,childrenStart:()=>R,createPatch:()=>J,createState:()=>W,defuse:()=>w,globals:()=>h,hydrate:()=>N,memo:()=>Y,mergeClass:()=>_n,mergeStyle:()=>qn,props:()=>m,tag:()=>Q,vode:()=>X});var h={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function X(e,o,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:o?[e,o,...a]:[e,...a]}function $(e,o,a,...n){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!o||typeof o!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=h.requestAnimationFrame,t.asyncRenderer=h.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let s=o;Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,d)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let f=await l.next();for(;f.done===!1;){t.stats.liveEffectCount++;try{s.patch(f.value,d),f=await l.next()}finally{t.stats.liveEffectCount--}}s.patch(f.value,d)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;s.patch(l,d)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)s.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=y(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{h.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?s.patch(p(t.state),d):d?(t.stats.asyncRenderPatchCount++,t.qAsync=y(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=y(t.qSync||{},p,!1),t.renderSync())}});function r(p){let d=Date.now(),l=a(t.state);t.vode=P(t.state,e.parentElement,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-d,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),i=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=y(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await h.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=y(t.state,t.qAsync,!0),t.qAsync=null,h.currentViewTransition=t.asyncRenderer(i),await h.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=s;let E=e;E._vode=t,t.vode=P(o,e.parentElement,Array.from(e.parentElement.children).indexOf(e),N(e,!0),a(o));for(let p of n)s.patch(p);return p=>s.patch(p)}function w(e){if(e?._vode){let a=function(t){if(!t?.node)return;let s=m(t);if(s){for(let c in s)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=C(t);if(r)for(let c of r)a(c)};var o=a;let n=e._vode;delete e._vode,Object.defineProperty(n.state,"patch",{value:void 0}),Object.defineProperty(n,"renderSync",{value:()=>{}}),Object.defineProperty(n,"renderAsync",{value:()=>{}}),a(n.vode)}}function N(e,o){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?o?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let n=[e.tagName.toLowerCase()];if(o&&(n.node=e),e?.hasAttributes()){let t={},s=e.attributes;for(let r of s)t[r.name]=r.value;n.push(t)}if(e.hasChildNodes()){let t=[];for(let s of e.childNodes){let r=s&&N(s,o);r?n.push(r):s&&o&&t.push(s)}for(let s of t)s.remove()}return n}else return}function Y(e,o){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof o!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return o.__memo=e,o}function W(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function J(e){return e}function Q(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function m(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function C(e){let o=R(e);return o>0?e.slice(o):null}function z(e){let o=R(e);return o<0?0:e.length-o}function Z(e,o){let a=R(e);if(a>0)return e[o+a]}function R(e){return m(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function y(e,o,a){if(!o)return e;for(let n in o){let t=o[n];if(t&&typeof t=="object"){let s=e[n];s?Array.isArray(t)?e[n]=[...t]:t instanceof Date&&s!==t?e[n]=new Date(t):Array.isArray(s)?e[n]=y({},t,a):typeof s=="object"?y(e[n],t,a):e[n]=y({},t,a):Array.isArray(t)?e[n]=[...t]:t instanceof Date?e[n]=new Date(t):e[n]=y({},t,a)}else t===void 0&&a?delete e[n]:e[n]=t}return e}function P(e,o,a,n,t,s){try{t=D(e,t,n);let r=!t||typeof t=="number"||typeof t=="boolean";if(t===n||!n&&r)return n;let c=n?.nodeType===Node.TEXT_NODE,i=c?n:n?.node;if(r){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let E=!r&&et(t),p=!r&&tt(t),d=!!t&&typeof t!="string"&&!!(t?.node||t?.nodeType===Node.TEXT_NODE);if(!E&&!p&&!d&&!n)throw new Error("Invalid vode: "+typeof t+" "+JSON.stringify(t));if(d&&E?t=t.wholeText:d&&p&&(t=[...t]),c&&E)return i.nodeValue!==t&&(i.nodeValue=t),n;if(E&&(!i||!c)){let l=document.createTextNode(t);return i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l)):o.childNodes[a]?o.insertBefore(l,o.childNodes[a]):o.appendChild(l),l}if(p&&(!i||c||n[0]!==t[0])){let l=t;1 in l&&(l[1]=D(e,l[1],void 0));let f=m(t);s=f?.xmlns||s;let S=s?document.createElementNS(s,t[0]):document.createElement(t[0]);t.node=S,v(e,S,void 0,f),f&&"catch"in f&&(t.node.catch=null,t.node.removeAttribute("catch")),i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(S)):o.childNodes[a]?o.insertBefore(S,o.childNodes[a]):o.appendChild(S);let A=C(t);if(A)for(let T=0;T<A.length;T++){let g=A[T],x=P(e,S,T,void 0,g,s);t[f?T+2:T+1]=x}return S.onMount&&e.patch(S.onMount(S)),t}if(!c&&p&&n[0]===t[0]){t.node=i;let l=t,f=n,S=m(t),A=!!S,T=m(n);if(l[1]?.__memo){let u=l[1];l[1]=D(e,l[1],f[1]),u!==l[1]&&v(e,i,T,S)}else v(e,i,T,S);S?.catch&&T?.catch!==S.catch&&(t.node.catch=null,t.node.removeAttribute("catch"));let g=C(t),x=C(n);if(g)for(let u=0;u<g.length;u++){let b=g[u],H=x&&x[u],V=P(e,i,u,H,b,s);V&&(t[A?u+2:u+1]=V)}if(x){let u=g?g.length:0;for(let b=x.length-1;b>=u;b--)P(e,i,b,x[b],void 0,s)}return t}}catch(r){let c=m(t)?.catch;if(c){let i=typeof c=="function"?c(e,r):c;return P(e,o,a,N(t?.node||n?.node,!0),i,s)}else throw r}}function tt(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function et(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function D(e,o,a){if(typeof o!="function")return o;let n=o?.__memo,t=a?.__memo;if(Array.isArray(n)&&Array.isArray(t)&&n.length===t.length){let r=!0;for(let c=0;c<n.length;c++)if(n[c]!==t[c]){r=!1;break}if(r)return a}let s=F(o,e);return typeof s=="object"&&(s.__memo=o?.__memo),s}function F(e,o){return typeof e=="function"?F(e(o),o):e}function v(e,o,a,n){if(!(!n&&!a)){if(a)for(let t in a){let s=a[t],r=n?.[t];s!==r&&(n?n[t]=M(e,o,t,s,r):M(e,o,t,s,void 0))}if(n&&a){for(let t in n)if(!(t in a)){let s=n[t];n[t]=M(e,o,t,void 0,s)}}else if(n)for(let t in n){let s=n[t];n[t]=M(e,o,t,void 0,s)}}}function M(e,o,a,n,t){if(a==="style")if(!t)o.style.cssText="";else if(typeof t=="string")n!==t&&(o.style.cssText=t);else if(n&&typeof n=="object"){for(let s in n)t[s]||(o.style[s]=null);for(let s in t){let r=n[s],c=t[s];r!==c&&(o.style[s]=c)}}else for(let s in t)o.style[s]=t[s];else if(a==="class")t?o.setAttribute("class",k(t)):o.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let s=null;if(typeof t=="function"){let r=t;s=c=>e.patch(r(e,c))}else typeof t=="object"&&(s=()=>e.patch(t));o[a]=s}else o[a]=null;else o[a]=t,t==null||t===!1?o.removeAttribute(a):o.setAttribute(a,t);return t}function k(e){return typeof e=="string"?e:Array.isArray(e)?e.map(k).join(" "):typeof e=="object"?Object.keys(e).filter(o=>e[o]).join(" "):""}var ot="a",nt="abbr",st="address",at="area",rt="article",ct="aside",it="audio",pt="b",lt="base",St="bdi",ft="bdo",dt="blockquote",ut="body",Tt="br",yt="button",gt="canvas",xt="caption",ht="cite",mt="code",Et="col",bt="colgroup",Pt="data",At="datalist",Ct="dd",Mt="del",Nt="details",Rt="dfn",Ot="dialog",Dt="div",vt="dl",Lt="dt",It="em",Vt="embed",Ft="fieldset",kt="figcaption",jt="figure",Ht="footer",Ut="form",Gt="h1",Kt="h2",Bt="h3",_t="h4",qt="h5",Xt="h6",$t="head",wt="header",Yt="hgroup",Wt="hr",Jt="html",Qt="i",zt="iframe",Zt="img",te="input",ee="ins",oe="kbd",ne="label",se="legend",ae="li",re="link",ce="main",ie="map",pe="mark",le="menu",Se="meta",fe="meter",de="nav",ue="noscript",Te="object",ye="ol",ge="optgroup",xe="option",he="output",me="p",Ee="picture",be="pre",Pe="progress",Ae="q",Ce="rp",Me="rt",Ne="ruby",Re="s",Oe="samp",De="script",ve="search",Le="section",Ie="select",Ve="slot",Fe="small",ke="source",je="span",He="strong",Ue="style",Ge="sub",Ke="summary",Be="sup",_e="table",qe="tbody",Xe="td",$e="template",we="textarea",Ye="tfoot",We="th",Je="thead",Qe="time",ze="title",Ze="tr",to="track",eo="u",oo="ul",no="var",so="video",ao="wbr",ro="animate",co="animateMotion",io="animateTransform",po="circle",lo="clipPath",So="defs",fo="desc",uo="ellipse",To="feBlend",yo="feColorMatrix",go="feComponentTransfer",xo="feComposite",ho="feConvolveMatrix",mo="feDiffuseLighting",Eo="feDisplacementMap",bo="feDistantLight",Po="feDropShadow",Ao="feFlood",Co="feFuncA",Mo="feFuncB",No="feFuncG",Ro="feFuncR",Oo="feGaussianBlur",Do="feImage",vo="feMerge",Lo="feMergeNode",Io="feMorphology",Vo="feOffset",Fo="fePointLight",ko="feSpecularLighting",jo="feSpotLight",Ho="feTile",Uo="feTurbulence",Go="filter",Ko="foreignObject",Bo="g",_o="image",qo="line",Xo="linearGradient",$o="marker",wo="mask",Yo="metadata",Wo="mpath",Jo="path",Qo="pattern",zo="polygon",Zo="polyline",tn="radialGradient",en="rect",on="set",nn="stop",sn="svg",an="switch",rn="symbol",cn="text",pn="textPath",ln="tspan",Sn="use",fn="view",dn="annotation",un="annotation-xml",Tn="maction",yn="math",gn="merror",xn="mfrac",hn="mi",mn="mmultiscripts",En="mn",bn="mo",Pn="mover",An="mpadded",Cn="mphantom",Mn="mprescripts",Nn="mroot",Rn="mrow",On="ms",Dn="mspace",vn="msqrt",Ln="mstyle",In="msub",Vn="msubsup",Fn="msup",kn="mtable",jn="mtd",Hn="mtext",Un="mtr",Gn="munder",Kn="munderover",Bn="semantics";function _n(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let o=e[0];for(let a=1;a<e.length;a++){let n=o,t=e[a];if(!n)o=t;else if(t)if(typeof n=="string"&&typeof t=="string"){let s=n.split(" "),r=t.split(" "),c=new Set([...s,...r]);o=Array.from(c).join(" ").trim()}else if(typeof n=="string"&&Array.isArray(t)){let s=new Set([...t,...n.split(" ")]);o=Array.from(s).join(" ").trim()}else if(Array.isArray(n)&&typeof t=="string"){let s=new Set([...n,...t.split(" ")]);o=Array.from(s).join(" ").trim()}else if(Array.isArray(n)&&Array.isArray(t)){let s=new Set([...n,...t]);o=Array.from(s).join(" ").trim()}else if(typeof n=="string"&&typeof t=="object")o={[n]:!0,...t};else if(typeof n=="object"&&typeof t=="string")o={...n,[t]:!0};else if(typeof n=="object"&&typeof t=="object")o={...n,...t};else if(typeof n=="object"&&Array.isArray(t)){let s={...n};for(let r of t)s[r]=!0;o=s}else if(Array.isArray(n)&&typeof t=="object"){let s={};for(let r of n)s[r]=!0;for(let r of Object.keys(t))s[r]=t[r];o=s}else throw new Error(`cannot merge classes of ${n} (${typeof n}) and ${t} (${typeof t})`);else continue}return o}var j=document.createElement("div");function qn(...e){try{let o=j.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let n in a)o[n]=a[n];else typeof a=="string"&&(o.cssText+=";"+a);return o.cssText}finally{j.style.cssText=""}}var L=class{constructor(o,a){this.state=o;this.path=a;this.keys=a.split(".")}keys;get(){let o=this.keys,a=this.state?this.state[o[0]]:void 0;for(let n=1;n<o.length&&a;n++)a=a[o[n]];return a}put(o){this.putDeep(o,this.state)}patch(o){if(Array.isArray(o)){let a=[];for(let n of o)a.push(this.createPatch(n));this.state.patch(a)}else this.state.patch(this.createPatch(o))}createPatch(o){let a={};return this.putDeep(o,a),a}putDeep(o,a){let n=this.keys;if(n.length>1){let t=0,s=a[n[t]];for((typeof s!="object"||s===null)&&(a[n[t]]=s={}),t=1;t<n.length-1;t++){let r=s;s=s[n[t]],(typeof s!="object"||s===null)&&(r[n[t]]=s={})}s[n[t]]=o}else typeof a[n[0]]=="object"&&typeof o=="object"?Object.assign(a[n[0]],o):a[n[0]]=o}},I=class{constructor(o,a,n,t){this.state=o;this.get=a;this.put=n;this.patch=t}};return q(Xn);})();
1
+ "use strict";var V=(()=>{var R=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var B=(e,n)=>{for(var s in n)R(e,s,{get:n[s],enumerable:!0})},_=(e,n,s,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of G(n))!K.call(e,t)&&t!==s&&R(e,t,{get:()=>n[t],enumerable:!(o=U(n,t))||o.enumerable});return e};var q=e=>_(R({},"__esModule",{value:!0}),e);var Xo={};B(Xo,{A:()=>nt,ABBR:()=>ot,ADDRESS:()=>st,ANIMATE:()=>rn,ANIMATEMOTION:()=>cn,ANIMATETRANSFORM:()=>pn,ANNOTATION:()=>So,ANNOTATION_XML:()=>uo,AREA:()=>at,ARTICLE:()=>rt,ASIDE:()=>ct,AUDIO:()=>it,B:()=>pt,BASE:()=>lt,BDI:()=>ft,BDO:()=>St,BLOCKQUOTE:()=>dt,BODY:()=>ut,BR:()=>Tt,BUTTON:()=>yt,CANVAS:()=>gt,CAPTION:()=>xt,CIRCLE:()=>ln,CITE:()=>ht,CLIPPATH:()=>fn,CODE:()=>mt,COL:()=>Et,COLGROUP:()=>bt,DATA:()=>Pt,DATALIST:()=>At,DD:()=>Ct,DEFS:()=>Sn,DEL:()=>Mt,DESC:()=>dn,DETAILS:()=>Nt,DFN:()=>Rt,DIALOG:()=>Ot,DIV:()=>Dt,DL:()=>vt,DT:()=>Lt,DelegateStateContext:()=>L,ELLIPSE:()=>un,EM:()=>It,EMBED:()=>Vt,FEBLEND:()=>Tn,FECOLORMATRIX:()=>yn,FECOMPONENTTRANSFER:()=>gn,FECOMPOSITE:()=>xn,FECONVOLVEMATRIX:()=>hn,FEDIFFUSELIGHTING:()=>mn,FEDISPLACEMENTMAP:()=>En,FEDISTANTLIGHT:()=>bn,FEDROPSHADOW:()=>Pn,FEFLOOD:()=>An,FEFUNCA:()=>Cn,FEFUNCB:()=>Mn,FEFUNCG:()=>Nn,FEFUNCR:()=>Rn,FEGAUSSIANBLUR:()=>On,FEIMAGE:()=>Dn,FEMERGE:()=>vn,FEMERGENODE:()=>Ln,FEMORPHOLOGY:()=>In,FEOFFSET:()=>Vn,FEPOINTLIGHT:()=>Fn,FESPECULARLIGHTING:()=>kn,FESPOTLIGHT:()=>jn,FETILE:()=>Hn,FETURBULENCE:()=>Un,FIELDSET:()=>Ft,FIGCAPTION:()=>kt,FIGURE:()=>jt,FILTER:()=>Gn,FOOTER:()=>Ht,FOREIGNOBJECT:()=>Kn,FORM:()=>Ut,G:()=>Bn,H1:()=>Gt,H2:()=>Kt,H3:()=>Bt,H4:()=>_t,H5:()=>qt,H6:()=>Xt,HEAD:()=>$t,HEADER:()=>wt,HGROUP:()=>Yt,HR:()=>Wt,HTML:()=>Jt,I:()=>Qt,IFRAME:()=>zt,IMAGE:()=>_n,IMG:()=>Zt,INPUT:()=>te,INS:()=>ee,KBD:()=>ne,KeyStateContext:()=>v,LABEL:()=>oe,LEGEND:()=>se,LI:()=>ae,LINE:()=>qn,LINEARGRADIENT:()=>Xn,LINK:()=>re,MACTION:()=>To,MAIN:()=>ce,MAP:()=>ie,MARK:()=>pe,MARKER:()=>$n,MASK:()=>wn,MATH:()=>yo,MENU:()=>le,MERROR:()=>go,META:()=>fe,METADATA:()=>Yn,METER:()=>Se,MFRAC:()=>xo,MI:()=>ho,MMULTISCRIPTS:()=>mo,MN:()=>Eo,MO:()=>bo,MOVER:()=>Po,MPADDED:()=>Ao,MPATH:()=>Wn,MPHANTOM:()=>Co,MPRESCRIPTS:()=>Mo,MROOT:()=>No,MROW:()=>Ro,MS:()=>Oo,MSPACE:()=>Do,MSQRT:()=>vo,MSTYLE:()=>Lo,MSUB:()=>Io,MSUBSUP:()=>Vo,MSUP:()=>Fo,MTABLE:()=>ko,MTD:()=>jo,MTEXT:()=>Ho,MTR:()=>Uo,MUNDER:()=>Go,MUNDEROVER:()=>Ko,NAV:()=>de,NOSCRIPT:()=>ue,OBJECT:()=>Te,OL:()=>ye,OPTGROUP:()=>ge,OPTION:()=>xe,OUTPUT:()=>he,P:()=>me,PATH:()=>Jn,PATTERN:()=>Qn,PICTURE:()=>Ee,POLYGON:()=>zn,POLYLINE:()=>Zn,PRE:()=>be,PROGRESS:()=>Pe,Q:()=>Ae,RADIALGRADIENT:()=>to,RECT:()=>eo,RP:()=>Ce,RT:()=>Me,RUBY:()=>Ne,S:()=>Re,SAMP:()=>Oe,SCRIPT:()=>De,SEARCH:()=>ve,SECTION:()=>Le,SELECT:()=>Ie,SEMANTICS:()=>Bo,SET:()=>no,SLOT:()=>Ve,SMALL:()=>Fe,SOURCE:()=>ke,SPAN:()=>je,STOP:()=>oo,STRONG:()=>He,STYLE:()=>Ue,SUB:()=>Ge,SUMMARY:()=>Ke,SUP:()=>Be,SVG:()=>so,SWITCH:()=>ao,SYMBOL:()=>ro,TABLE:()=>_e,TBODY:()=>qe,TD:()=>Xe,TEMPLATE:()=>$e,TEXT:()=>co,TEXTAREA:()=>we,TEXTPATH:()=>io,TFOOT:()=>Ye,TH:()=>We,THEAD:()=>Je,TIME:()=>Qe,TITLE:()=>ze,TR:()=>Ze,TRACK:()=>tn,TSPAN:()=>po,U:()=>en,UL:()=>nn,USE:()=>lo,VAR:()=>on,VIDEO:()=>sn,VIEW:()=>fo,WBR:()=>an,app:()=>$,child:()=>Z,childCount:()=>z,children:()=>A,childrenStart:()=>N,createPatch:()=>J,createState:()=>W,defuse:()=>w,globals:()=>m,hydrate:()=>M,memo:()=>Y,mergeClass:()=>_o,mergeStyle:()=>qo,props:()=>E,tag:()=>Q,vode:()=>X});var m={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function X(e,n,...s){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...s]:[e,...s]}function $(e,n,s,...o){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof s!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=m.requestAnimationFrame,t.asyncRenderer=m.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let a=n;Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,u)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{a.patch(S.value,u),S=await l.next()}finally{t.stats.liveEffectCount--}}a.patch(S.value,u)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;a.patch(l,u)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)a.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=y(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{m.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?a.patch(p(t.state),u):u?(t.stats.asyncRenderPatchCount++,t.qAsync=y(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=y(t.qSync||{},p,!1),t.renderSync())}});function r(p){let u=Date.now(),l=s(t.state);t.vode=P(t.state,e.parentElement,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-u,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),i=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=y(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await m.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=y(t.state,t.qAsync,!0),t.qAsync=null,m.currentViewTransition=t.asyncRenderer(i),await m.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=a;let b=e;b._vode=t,t.vode=P(n,e.parentElement,Array.from(e.parentElement.children).indexOf(e),M(e,!0),s(n));for(let p of o)a.patch(p);return p=>a.patch(p)}function w(e){if(e?._vode){let s=function(t){if(!t?.node)return;let a=E(t);if(a){for(let c in a)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=A(t);if(r)for(let c of r)s(c)};var n=s;let o=e._vode;delete e._vode,Object.defineProperty(o.state,"patch",{value:void 0}),Object.defineProperty(o,"renderSync",{value:()=>{}}),Object.defineProperty(o,"renderAsync",{value:()=>{}}),s(o.vode)}}function M(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let o=[e.tagName.toLowerCase()];if(n&&(o.node=e),e?.hasAttributes()){let t={},a=e.attributes;for(let r of a)t[r.name]=r.value;o.push(t)}if(e.hasChildNodes()){let t=[];for(let a of e.childNodes){let r=a&&M(a,n);r?o.push(r):a&&n&&t.push(a)}for(let a of t)a.remove()}return o}else return}function Y(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function W(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function J(e){return e}function Q(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function E(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function A(e){let n=N(e);return n>0?e.slice(n):null}function z(e){let n=N(e);return n<0?0:e.length-n}function Z(e,n){let s=N(e);if(s>0)return e[n+s]}function N(e){return E(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function y(e,n,s){if(!n)return e;for(let o in n){let t=n[o];if(t&&typeof t=="object"){let a=e[o];a?Array.isArray(t)?e[o]=[...t]:t instanceof Date&&a!==t?e[o]=new Date(t):Array.isArray(a)?e[o]=y({},t,s):typeof a=="object"?y(e[o],t,s):e[o]=y({},t,s):Array.isArray(t)?e[o]=[...t]:t instanceof Date?e[o]=new Date(t):e[o]=y({},t,s)}else t===void 0&&s?delete e[o]:e[o]=t}return e}function P(e,n,s,o,t,a){try{t=O(e,t,o);let r=!t||typeof t=="number"||typeof t=="boolean";if(t===o||!o&&r)return o;let c=o?.nodeType===Node.TEXT_NODE,i=c?o:o?.node;if(r){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!r&&et(t),p=!r&&tt(t),u=!!t&&typeof t!="string"&&!!(t?.node||t?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!u&&!o)throw new Error("Invalid vode: "+typeof t+" "+JSON.stringify(t));if(u&&b?t=t.wholeText:u&&p&&(t=[...t]),c&&b)return i.nodeValue!==t&&(i.nodeValue=t),o;if(b&&(!i||!c)){let l=document.createTextNode(t);return i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l)):n.childNodes[s]?n.insertBefore(l,n.childNodes[s]):n.appendChild(l),l}if(p&&(!i||c||o[0]!==t[0])){let l=t;1 in l&&(l[1]=O(e,l[1],void 0));let S=E(t);S?.xmlns!==void 0&&(a=S.xmlns);let f=a?document.createElementNS(a,t[0]):document.createElement(t[0]);t.node=f,D(e,f,void 0,S,a),S&&"catch"in S&&(t.node.catch=null,t.node.removeAttribute("catch")),i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(f)):n.childNodes[s]?n.insertBefore(f,n.childNodes[s]):n.appendChild(f);let g=A(t);if(g){let x=S?2:1;for(let T=0;T<g.length;T++){let h=g[T],d=P(e,f,T,void 0,h,a);t[T+x]=d}}return f.onMount&&e.patch(f.onMount(f)),t}if(!c&&p&&o[0]===t[0]){t.node=i;let l=t,S=o,f=E(t),g=E(o);if(f?.xmlns!==void 0&&(a=f.xmlns),l[1]?.__memo){let h=l[1];l[1]=O(e,l[1],S[1]),h!==l[1]&&D(e,i,g,f,a)}else D(e,i,g,f,a);f?.catch&&g?.catch!==f.catch&&(t.node.catch=null,t.node.removeAttribute("catch"));let x=A(t),T=A(o);if(x){let h=f?2:1;for(let d=0;d<x.length;d++){let j=x[d],H=T&&T[d],I=P(e,i,d,H,j,a);I&&(t[d+h]=I)}}if(T){let h=x?x.length:0;for(let d=T.length-1;d>=h;d--)P(e,i,d,T[d],void 0,a)}return t}}catch(r){let c=E(t)?.catch;if(c){let i=typeof c=="function"?c(e,r):c;return P(e,n,s,M(t?.node||o?.node,!0),i,a)}else throw r}}function tt(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function et(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function O(e,n,s){if(typeof n!="function")return n;let o=n?.__memo,t=s?.__memo;if(Array.isArray(o)&&Array.isArray(t)&&o.length===t.length){let r=!0;for(let c=0;c<o.length;c++)if(o[c]!==t[c]){r=!1;break}if(r)return s}let a=V(n,e);return typeof a=="object"&&(a.__memo=n?.__memo),a}function V(e,n){return typeof e=="function"?V(e(n),n):e}function D(e,n,s,o,t){if(!o&&!s)return;let a=t!==void 0;if(s)for(let r in s){let c=s[r],i=o?.[r];c!==i&&(o?o[r]=C(e,n,r,c,i,a):C(e,n,r,c,void 0,a))}if(o&&s){for(let r in o)if(!(r in s)){let c=o[r];o[r]=C(e,n,r,void 0,c,a)}}else if(o)for(let r in o){let c=o[r];o[r]=C(e,n,r,void 0,c,a)}}function C(e,n,s,o,t,a){if(s==="style")if(!t)n.style.cssText="";else if(typeof t=="string")o!==t&&(n.style.cssText=t);else if(o&&typeof o=="object"){for(let r in o)t[r]||(n.style[r]=null);for(let r in t){let c=o[r],i=t[r];c!==i&&(n.style[r]=i)}}else for(let r in t)n.style[r]=t[r];else if(s==="class")t?n.setAttribute("class",F(t)):n.removeAttribute("class");else if(s[0]==="o"&&s[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=i=>e.patch(c(e,i))}else typeof t=="object"&&(r=()=>e.patch(t));n[s]=r}else n[s]=null;else a||(n[s]=t),t==null||t===!1?n.removeAttribute(s):n.setAttribute(s,t);return t}function F(e){return typeof e=="string"?e:Array.isArray(e)?e.map(F).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var nt="a",ot="abbr",st="address",at="area",rt="article",ct="aside",it="audio",pt="b",lt="base",ft="bdi",St="bdo",dt="blockquote",ut="body",Tt="br",yt="button",gt="canvas",xt="caption",ht="cite",mt="code",Et="col",bt="colgroup",Pt="data",At="datalist",Ct="dd",Mt="del",Nt="details",Rt="dfn",Ot="dialog",Dt="div",vt="dl",Lt="dt",It="em",Vt="embed",Ft="fieldset",kt="figcaption",jt="figure",Ht="footer",Ut="form",Gt="h1",Kt="h2",Bt="h3",_t="h4",qt="h5",Xt="h6",$t="head",wt="header",Yt="hgroup",Wt="hr",Jt="html",Qt="i",zt="iframe",Zt="img",te="input",ee="ins",ne="kbd",oe="label",se="legend",ae="li",re="link",ce="main",ie="map",pe="mark",le="menu",fe="meta",Se="meter",de="nav",ue="noscript",Te="object",ye="ol",ge="optgroup",xe="option",he="output",me="p",Ee="picture",be="pre",Pe="progress",Ae="q",Ce="rp",Me="rt",Ne="ruby",Re="s",Oe="samp",De="script",ve="search",Le="section",Ie="select",Ve="slot",Fe="small",ke="source",je="span",He="strong",Ue="style",Ge="sub",Ke="summary",Be="sup",_e="table",qe="tbody",Xe="td",$e="template",we="textarea",Ye="tfoot",We="th",Je="thead",Qe="time",ze="title",Ze="tr",tn="track",en="u",nn="ul",on="var",sn="video",an="wbr",rn="animate",cn="animateMotion",pn="animateTransform",ln="circle",fn="clipPath",Sn="defs",dn="desc",un="ellipse",Tn="feBlend",yn="feColorMatrix",gn="feComponentTransfer",xn="feComposite",hn="feConvolveMatrix",mn="feDiffuseLighting",En="feDisplacementMap",bn="feDistantLight",Pn="feDropShadow",An="feFlood",Cn="feFuncA",Mn="feFuncB",Nn="feFuncG",Rn="feFuncR",On="feGaussianBlur",Dn="feImage",vn="feMerge",Ln="feMergeNode",In="feMorphology",Vn="feOffset",Fn="fePointLight",kn="feSpecularLighting",jn="feSpotLight",Hn="feTile",Un="feTurbulence",Gn="filter",Kn="foreignObject",Bn="g",_n="image",qn="line",Xn="linearGradient",$n="marker",wn="mask",Yn="metadata",Wn="mpath",Jn="path",Qn="pattern",zn="polygon",Zn="polyline",to="radialGradient",eo="rect",no="set",oo="stop",so="svg",ao="switch",ro="symbol",co="text",io="textPath",po="tspan",lo="use",fo="view",So="annotation",uo="annotation-xml",To="maction",yo="math",go="merror",xo="mfrac",ho="mi",mo="mmultiscripts",Eo="mn",bo="mo",Po="mover",Ao="mpadded",Co="mphantom",Mo="mprescripts",No="mroot",Ro="mrow",Oo="ms",Do="mspace",vo="msqrt",Lo="mstyle",Io="msub",Vo="msubsup",Fo="msup",ko="mtable",jo="mtd",Ho="mtext",Uo="mtr",Go="munder",Ko="munderover",Bo="semantics";function _o(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let s=1;s<e.length;s++){let o=n,t=e[s];if(!o)n=t;else if(t)if(typeof o=="string"&&typeof t=="string"){let a=o.split(" "),r=t.split(" "),c=new Set([...a,...r]);n=Array.from(c).join(" ").trim()}else if(typeof o=="string"&&Array.isArray(t)){let a=new Set([...t,...o.split(" ")]);n=Array.from(a).join(" ").trim()}else if(Array.isArray(o)&&typeof t=="string"){let a=new Set([...o,...t.split(" ")]);n=Array.from(a).join(" ").trim()}else if(Array.isArray(o)&&Array.isArray(t)){let a=new Set([...o,...t]);n=Array.from(a).join(" ").trim()}else if(typeof o=="string"&&typeof t=="object")n={[o]:!0,...t};else if(typeof o=="object"&&typeof t=="string")n={...o,[t]:!0};else if(typeof o=="object"&&typeof t=="object")n={...o,...t};else if(typeof o=="object"&&Array.isArray(t)){let a={...o};for(let r of t)a[r]=!0;n=a}else if(Array.isArray(o)&&typeof t=="object"){let a={};for(let r of o)a[r]=!0;for(let r of Object.keys(t))a[r]=t[r];n=a}else throw new Error(`cannot merge classes of ${o} (${typeof o}) and ${t} (${typeof t})`);else continue}return n}var k=document.createElement("div");function qo(...e){try{let n=k.style;for(let s of e)if(typeof s=="object"&&s!==null)for(let o in s)n[o]=s[o];else typeof s=="string"&&(n.cssText+=";"+s);return n.cssText}finally{k.style.cssText=""}}var v=class{constructor(n,s){this.state=n;this.path=s;this.keys=s.split(".")}keys;get(){let n=this.keys,s=this.state?this.state[n[0]]:void 0;for(let o=1;o<n.length&&s;o++)s=s[n[o]];return s}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let s=[];for(let o of n)s.push(this.createPatch(o));this.state.patch(s)}else this.state.patch(this.createPatch(n))}createPatch(n){let s={};return this.putDeep(n,s),s}putDeep(n,s){let o=this.keys;if(o.length>1){let t=0,a=s[o[t]];for((typeof a!="object"||a===null)&&(s[o[t]]=a={}),t=1;t<o.length-1;t++){let r=a;a=a[o[t]],(typeof a!="object"||a===null)&&(r[o[t]]=a={})}a[o[t]]=n}else typeof s[o[0]]=="object"&&typeof n=="object"?Object.assign(s[o[0]],n):s[o[0]]=n}},L=class{constructor(n,s,o,t){this.state=n;this.get=s;this.put=o;this.patch=t}};return q(Xo);})();
package/dist/vode.min.mjs CHANGED
@@ -1 +1 @@
1
- var E={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function G(e,n,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...a]:[e,...a]}function K(e,n,a,...o){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=E.requestAnimationFrame,t.asyncRenderer=E.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let s=n;Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,d)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let f=await l.next();for(;f.done===!1;){t.stats.liveEffectCount++;try{s.patch(f.value,d),f=await l.next()}finally{t.stats.liveEffectCount--}}s.patch(f.value,d)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;s.patch(l,d)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)s.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=y(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{E.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?s.patch(p(t.state),d):d?(t.stats.asyncRenderPatchCount++,t.qAsync=y(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=y(t.qSync||{},p,!1),t.renderSync())}});function r(p){let d=Date.now(),l=a(t.state);t.vode=P(t.state,e.parentElement,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-d,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),i=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=y(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await E.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=y(t.state,t.qAsync,!0),t.qAsync=null,E.currentViewTransition=t.asyncRenderer(i),await E.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=s;let h=e;h._vode=t,t.vode=P(n,e.parentElement,Array.from(e.parentElement.children).indexOf(e),O(e,!0),a(n));for(let p of o)s.patch(p);return p=>s.patch(p)}function B(e){if(e?._vode){let a=function(t){if(!t?.node)return;let s=b(t);if(s){for(let c in s)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=M(t);if(r)for(let c of r)a(c)};var n=a;let o=e._vode;delete e._vode,Object.defineProperty(o.state,"patch",{value:void 0}),Object.defineProperty(o,"renderSync",{value:()=>{}}),Object.defineProperty(o,"renderAsync",{value:()=>{}}),a(o.vode)}}function O(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let o=[e.tagName.toLowerCase()];if(n&&(o.node=e),e?.hasAttributes()){let t={},s=e.attributes;for(let r of s)t[r.name]=r.value;o.push(t)}if(e.hasChildNodes()){let t=[];for(let s of e.childNodes){let r=s&&O(s,n);r?o.push(r):s&&n&&t.push(s)}for(let s of t)s.remove()}return o}else return}function _(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function q(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function X(e){return e}function $(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function b(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function M(e){let n=D(e);return n>0?e.slice(n):null}function w(e){let n=D(e);return n<0?0:e.length-n}function Y(e,n){let a=D(e);if(a>0)return e[n+a]}function D(e){return b(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function y(e,n,a){if(!n)return e;for(let o in n){let t=n[o];if(t&&typeof t=="object"){let s=e[o];s?Array.isArray(t)?e[o]=[...t]:t instanceof Date&&s!==t?e[o]=new Date(t):Array.isArray(s)?e[o]=y({},t,a):typeof s=="object"?y(e[o],t,a):e[o]=y({},t,a):Array.isArray(t)?e[o]=[...t]:t instanceof Date?e[o]=new Date(t):e[o]=y({},t,a)}else t===void 0&&a?delete e[o]:e[o]=t}return e}function P(e,n,a,o,t,s){try{t=N(e,t,o);let r=!t||typeof t=="number"||typeof t=="boolean";if(t===o||!o&&r)return o;let c=o?.nodeType===Node.TEXT_NODE,i=c?o:o?.node;if(r){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let h=!r&&U(t),p=!r&&H(t),d=!!t&&typeof t!="string"&&!!(t?.node||t?.nodeType===Node.TEXT_NODE);if(!h&&!p&&!d&&!o)throw new Error("Invalid vode: "+typeof t+" "+JSON.stringify(t));if(d&&h?t=t.wholeText:d&&p&&(t=[...t]),c&&h)return i.nodeValue!==t&&(i.nodeValue=t),o;if(h&&(!i||!c)){let l=document.createTextNode(t);return i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l)):n.childNodes[a]?n.insertBefore(l,n.childNodes[a]):n.appendChild(l),l}if(p&&(!i||c||o[0]!==t[0])){let l=t;1 in l&&(l[1]=N(e,l[1],void 0));let f=b(t);s=f?.xmlns||s;let S=s?document.createElementNS(s,t[0]):document.createElement(t[0]);t.node=S,R(e,S,void 0,f),f&&"catch"in f&&(t.node.catch=null,t.node.removeAttribute("catch")),i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(S)):n.childNodes[a]?n.insertBefore(S,n.childNodes[a]):n.appendChild(S);let A=M(t);if(A)for(let T=0;T<A.length;T++){let g=A[T],x=P(e,S,T,void 0,g,s);t[f?T+2:T+1]=x}return S.onMount&&e.patch(S.onMount(S)),t}if(!c&&p&&o[0]===t[0]){t.node=i;let l=t,f=o,S=b(t),A=!!S,T=b(o);if(l[1]?.__memo){let u=l[1];l[1]=N(e,l[1],f[1]),u!==l[1]&&R(e,i,T,S)}else R(e,i,T,S);S?.catch&&T?.catch!==S.catch&&(t.node.catch=null,t.node.removeAttribute("catch"));let g=M(t),x=M(o);if(g)for(let u=0;u<g.length;u++){let m=g[u],j=x&&x[u],v=P(e,i,u,j,m,s);v&&(t[A?u+2:u+1]=v)}if(x){let u=g?g.length:0;for(let m=x.length-1;m>=u;m--)P(e,i,m,x[m],void 0,s)}return t}}catch(r){let c=b(t)?.catch;if(c){let i=typeof c=="function"?c(e,r):c;return P(e,n,a,O(t?.node||o?.node,!0),i,s)}else throw r}}function H(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function U(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function N(e,n,a){if(typeof n!="function")return n;let o=n?.__memo,t=a?.__memo;if(Array.isArray(o)&&Array.isArray(t)&&o.length===t.length){let r=!0;for(let c=0;c<o.length;c++)if(o[c]!==t[c]){r=!1;break}if(r)return a}let s=L(n,e);return typeof s=="object"&&(s.__memo=n?.__memo),s}function L(e,n){return typeof e=="function"?L(e(n),n):e}function R(e,n,a,o){if(!(!o&&!a)){if(a)for(let t in a){let s=a[t],r=o?.[t];s!==r&&(o?o[t]=C(e,n,t,s,r):C(e,n,t,s,void 0))}if(o&&a){for(let t in o)if(!(t in a)){let s=o[t];o[t]=C(e,n,t,void 0,s)}}else if(o)for(let t in o){let s=o[t];o[t]=C(e,n,t,void 0,s)}}}function C(e,n,a,o,t){if(a==="style")if(!t)n.style.cssText="";else if(typeof t=="string")o!==t&&(n.style.cssText=t);else if(o&&typeof o=="object"){for(let s in o)t[s]||(n.style[s]=null);for(let s in t){let r=o[s],c=t[s];r!==c&&(n.style[s]=c)}}else for(let s in t)n.style[s]=t[s];else if(a==="class")t?n.setAttribute("class",I(t)):n.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let s=null;if(typeof t=="function"){let r=t;s=c=>e.patch(r(e,c))}else typeof t=="object"&&(s=()=>e.patch(t));n[a]=s}else n[a]=null;else n[a]=t,t==null||t===!1?n.removeAttribute(a):n.setAttribute(a,t);return t}function I(e){return typeof e=="string"?e:Array.isArray(e)?e.map(I).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var J="a",Q="abbr",z="address",Z="area",tt="article",et="aside",ot="audio",nt="b",st="base",at="bdi",rt="bdo",ct="blockquote",it="body",pt="br",lt="button",St="canvas",ft="caption",dt="cite",ut="code",Tt="col",yt="colgroup",gt="data",xt="datalist",ht="dd",mt="del",Et="details",bt="dfn",Pt="dialog",At="div",Ct="dl",Mt="dt",Nt="em",Rt="embed",Ot="fieldset",Dt="figcaption",vt="figure",Lt="footer",It="form",Vt="h1",Ft="h2",kt="h3",jt="h4",Ht="h5",Ut="h6",Gt="head",Kt="header",Bt="hgroup",_t="hr",qt="html",Xt="i",$t="iframe",wt="img",Yt="input",Wt="ins",Jt="kbd",Qt="label",zt="legend",Zt="li",te="link",ee="main",oe="map",ne="mark",se="menu",ae="meta",re="meter",ce="nav",ie="noscript",pe="object",le="ol",Se="optgroup",fe="option",de="output",ue="p",Te="picture",ye="pre",ge="progress",xe="q",he="rp",me="rt",Ee="ruby",be="s",Pe="samp",Ae="script",Ce="search",Me="section",Ne="select",Re="slot",Oe="small",De="source",ve="span",Le="strong",Ie="style",Ve="sub",Fe="summary",ke="sup",je="table",He="tbody",Ue="td",Ge="template",Ke="textarea",Be="tfoot",_e="th",qe="thead",Xe="time",$e="title",we="tr",Ye="track",We="u",Je="ul",Qe="var",ze="video",Ze="wbr",to="animate",eo="animateMotion",oo="animateTransform",no="circle",so="clipPath",ao="defs",ro="desc",co="ellipse",io="feBlend",po="feColorMatrix",lo="feComponentTransfer",So="feComposite",fo="feConvolveMatrix",uo="feDiffuseLighting",To="feDisplacementMap",yo="feDistantLight",go="feDropShadow",xo="feFlood",ho="feFuncA",mo="feFuncB",Eo="feFuncG",bo="feFuncR",Po="feGaussianBlur",Ao="feImage",Co="feMerge",Mo="feMergeNode",No="feMorphology",Ro="feOffset",Oo="fePointLight",Do="feSpecularLighting",vo="feSpotLight",Lo="feTile",Io="feTurbulence",Vo="filter",Fo="foreignObject",ko="g",jo="image",Ho="line",Uo="linearGradient",Go="marker",Ko="mask",Bo="metadata",_o="mpath",qo="path",Xo="pattern",$o="polygon",wo="polyline",Yo="radialGradient",Wo="rect",Jo="set",Qo="stop",zo="svg",Zo="switch",tn="symbol",en="text",on="textPath",nn="tspan",sn="use",an="view",rn="annotation",cn="annotation-xml",pn="maction",ln="math",Sn="merror",fn="mfrac",dn="mi",un="mmultiscripts",Tn="mn",yn="mo",gn="mover",xn="mpadded",hn="mphantom",mn="mprescripts",En="mroot",bn="mrow",Pn="ms",An="mspace",Cn="msqrt",Mn="mstyle",Nn="msub",Rn="msubsup",On="msup",Dn="mtable",vn="mtd",Ln="mtext",In="mtr",Vn="munder",Fn="munderover",kn="semantics";function Hn(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let a=1;a<e.length;a++){let o=n,t=e[a];if(!o)n=t;else if(t)if(typeof o=="string"&&typeof t=="string"){let s=o.split(" "),r=t.split(" "),c=new Set([...s,...r]);n=Array.from(c).join(" ").trim()}else if(typeof o=="string"&&Array.isArray(t)){let s=new Set([...t,...o.split(" ")]);n=Array.from(s).join(" ").trim()}else if(Array.isArray(o)&&typeof t=="string"){let s=new Set([...o,...t.split(" ")]);n=Array.from(s).join(" ").trim()}else if(Array.isArray(o)&&Array.isArray(t)){let s=new Set([...o,...t]);n=Array.from(s).join(" ").trim()}else if(typeof o=="string"&&typeof t=="object")n={[o]:!0,...t};else if(typeof o=="object"&&typeof t=="string")n={...o,[t]:!0};else if(typeof o=="object"&&typeof t=="object")n={...o,...t};else if(typeof o=="object"&&Array.isArray(t)){let s={...o};for(let r of t)s[r]=!0;n=s}else if(Array.isArray(o)&&typeof t=="object"){let s={};for(let r of o)s[r]=!0;for(let r of Object.keys(t))s[r]=t[r];n=s}else throw new Error(`cannot merge classes of ${o} (${typeof o}) and ${t} (${typeof t})`);else continue}return n}var V=document.createElement("div");function Gn(...e){try{let n=V.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let o in a)n[o]=a[o];else typeof a=="string"&&(n.cssText+=";"+a);return n.cssText}finally{V.style.cssText=""}}var F=class{constructor(n,a){this.state=n;this.path=a;this.keys=a.split(".")}keys;get(){let n=this.keys,a=this.state?this.state[n[0]]:void 0;for(let o=1;o<n.length&&a;o++)a=a[n[o]];return a}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let a=[];for(let o of n)a.push(this.createPatch(o));this.state.patch(a)}else this.state.patch(this.createPatch(n))}createPatch(n){let a={};return this.putDeep(n,a),a}putDeep(n,a){let o=this.keys;if(o.length>1){let t=0,s=a[o[t]];for((typeof s!="object"||s===null)&&(a[o[t]]=s={}),t=1;t<o.length-1;t++){let r=s;s=s[o[t]],(typeof s!="object"||s===null)&&(r[o[t]]=s={})}s[o[t]]=n}else typeof a[o[0]]=="object"&&typeof n=="object"?Object.assign(a[o[0]],n):a[o[0]]=n}},k=class{constructor(n,a,o,t){this.state=n;this.get=a;this.put=o;this.patch=t}};export{J as A,Q as ABBR,z as ADDRESS,to as ANIMATE,eo as ANIMATEMOTION,oo as ANIMATETRANSFORM,rn as ANNOTATION,cn as ANNOTATION_XML,Z as AREA,tt as ARTICLE,et as ASIDE,ot as AUDIO,nt as B,st as BASE,at as BDI,rt as BDO,ct as BLOCKQUOTE,it as BODY,pt as BR,lt as BUTTON,St as CANVAS,ft as CAPTION,no as CIRCLE,dt as CITE,so as CLIPPATH,ut as CODE,Tt as COL,yt as COLGROUP,gt as DATA,xt as DATALIST,ht as DD,ao as DEFS,mt as DEL,ro as DESC,Et as DETAILS,bt as DFN,Pt as DIALOG,At as DIV,Ct as DL,Mt as DT,k as DelegateStateContext,co as ELLIPSE,Nt as EM,Rt as EMBED,io as FEBLEND,po as FECOLORMATRIX,lo as FECOMPONENTTRANSFER,So as FECOMPOSITE,fo as FECONVOLVEMATRIX,uo as FEDIFFUSELIGHTING,To as FEDISPLACEMENTMAP,yo as FEDISTANTLIGHT,go as FEDROPSHADOW,xo as FEFLOOD,ho as FEFUNCA,mo as FEFUNCB,Eo as FEFUNCG,bo as FEFUNCR,Po as FEGAUSSIANBLUR,Ao as FEIMAGE,Co as FEMERGE,Mo as FEMERGENODE,No as FEMORPHOLOGY,Ro as FEOFFSET,Oo as FEPOINTLIGHT,Do as FESPECULARLIGHTING,vo as FESPOTLIGHT,Lo as FETILE,Io as FETURBULENCE,Ot as FIELDSET,Dt as FIGCAPTION,vt as FIGURE,Vo as FILTER,Lt as FOOTER,Fo as FOREIGNOBJECT,It as FORM,ko as G,Vt as H1,Ft as H2,kt as H3,jt as H4,Ht as H5,Ut as H6,Gt as HEAD,Kt as HEADER,Bt as HGROUP,_t as HR,qt as HTML,Xt as I,$t as IFRAME,jo as IMAGE,wt as IMG,Yt as INPUT,Wt as INS,Jt as KBD,F as KeyStateContext,Qt as LABEL,zt as LEGEND,Zt as LI,Ho as LINE,Uo as LINEARGRADIENT,te as LINK,pn as MACTION,ee as MAIN,oe as MAP,ne as MARK,Go as MARKER,Ko as MASK,ln as MATH,se as MENU,Sn as MERROR,ae as META,Bo as METADATA,re as METER,fn as MFRAC,dn as MI,un as MMULTISCRIPTS,Tn as MN,yn as MO,gn as MOVER,xn as MPADDED,_o as MPATH,hn as MPHANTOM,mn as MPRESCRIPTS,En as MROOT,bn as MROW,Pn as MS,An as MSPACE,Cn as MSQRT,Mn as MSTYLE,Nn as MSUB,Rn as MSUBSUP,On as MSUP,Dn as MTABLE,vn as MTD,Ln as MTEXT,In as MTR,Vn as MUNDER,Fn as MUNDEROVER,ce as NAV,ie as NOSCRIPT,pe as OBJECT,le as OL,Se as OPTGROUP,fe as OPTION,de as OUTPUT,ue as P,qo as PATH,Xo as PATTERN,Te as PICTURE,$o as POLYGON,wo as POLYLINE,ye as PRE,ge as PROGRESS,xe as Q,Yo as RADIALGRADIENT,Wo as RECT,he as RP,me as RT,Ee as RUBY,be as S,Pe as SAMP,Ae as SCRIPT,Ce as SEARCH,Me as SECTION,Ne as SELECT,kn as SEMANTICS,Jo as SET,Re as SLOT,Oe as SMALL,De as SOURCE,ve as SPAN,Qo as STOP,Le as STRONG,Ie as STYLE,Ve as SUB,Fe as SUMMARY,ke as SUP,zo as SVG,Zo as SWITCH,tn as SYMBOL,je as TABLE,He as TBODY,Ue as TD,Ge as TEMPLATE,en as TEXT,Ke as TEXTAREA,on as TEXTPATH,Be as TFOOT,_e as TH,qe as THEAD,Xe as TIME,$e as TITLE,we as TR,Ye as TRACK,nn as TSPAN,We as U,Je as UL,sn as USE,Qe as VAR,ze as VIDEO,an as VIEW,Ze as WBR,K as app,Y as child,w as childCount,M as children,D as childrenStart,X as createPatch,q as createState,B as defuse,E as globals,O as hydrate,_ as memo,Hn as mergeClass,Gn as mergeStyle,b as props,$ as tag,G as vode};
1
+ var E={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function G(e,o,...s){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:o?[e,o,...s]:[e,...s]}function K(e,o,s,...n){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!o||typeof o!="object")throw new Error("second argument to app() must be a state object");if(typeof s!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=E.requestAnimationFrame,t.asyncRenderer=E.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let a=o;Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,u)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{a.patch(S.value,u),S=await l.next()}finally{t.stats.liveEffectCount--}}a.patch(S.value,u)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;a.patch(l,u)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)a.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=y(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{E.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?a.patch(p(t.state),u):u?(t.stats.asyncRenderPatchCount++,t.qAsync=y(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=y(t.qSync||{},p,!1),t.renderSync())}});function r(p){let u=Date.now(),l=s(t.state);t.vode=P(t.state,e.parentElement,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-u,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),i=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=y(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await E.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=y(t.state,t.qAsync,!0),t.qAsync=null,E.currentViewTransition=t.asyncRenderer(i),await E.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=a;let m=e;m._vode=t,t.vode=P(o,e.parentElement,Array.from(e.parentElement.children).indexOf(e),R(e,!0),s(o));for(let p of n)a.patch(p);return p=>a.patch(p)}function B(e){if(e?._vode){let s=function(t){if(!t?.node)return;let a=b(t);if(a){for(let c in a)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=C(t);if(r)for(let c of r)s(c)};var o=s;let n=e._vode;delete e._vode,Object.defineProperty(n.state,"patch",{value:void 0}),Object.defineProperty(n,"renderSync",{value:()=>{}}),Object.defineProperty(n,"renderAsync",{value:()=>{}}),s(n.vode)}}function R(e,o){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?o?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let n=[e.tagName.toLowerCase()];if(o&&(n.node=e),e?.hasAttributes()){let t={},a=e.attributes;for(let r of a)t[r.name]=r.value;n.push(t)}if(e.hasChildNodes()){let t=[];for(let a of e.childNodes){let r=a&&R(a,o);r?n.push(r):a&&o&&t.push(a)}for(let a of t)a.remove()}return n}else return}function _(e,o){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof o!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return o.__memo=e,o}function q(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function X(e){return e}function $(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function b(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function C(e){let o=O(e);return o>0?e.slice(o):null}function w(e){let o=O(e);return o<0?0:e.length-o}function Y(e,o){let s=O(e);if(s>0)return e[o+s]}function O(e){return b(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function y(e,o,s){if(!o)return e;for(let n in o){let t=o[n];if(t&&typeof t=="object"){let a=e[n];a?Array.isArray(t)?e[n]=[...t]:t instanceof Date&&a!==t?e[n]=new Date(t):Array.isArray(a)?e[n]=y({},t,s):typeof a=="object"?y(e[n],t,s):e[n]=y({},t,s):Array.isArray(t)?e[n]=[...t]:t instanceof Date?e[n]=new Date(t):e[n]=y({},t,s)}else t===void 0&&s?delete e[n]:e[n]=t}return e}function P(e,o,s,n,t,a){try{t=M(e,t,n);let r=!t||typeof t=="number"||typeof t=="boolean";if(t===n||!n&&r)return n;let c=n?.nodeType===Node.TEXT_NODE,i=c?n:n?.node;if(r){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let m=!r&&U(t),p=!r&&H(t),u=!!t&&typeof t!="string"&&!!(t?.node||t?.nodeType===Node.TEXT_NODE);if(!m&&!p&&!u&&!n)throw new Error("Invalid vode: "+typeof t+" "+JSON.stringify(t));if(u&&m?t=t.wholeText:u&&p&&(t=[...t]),c&&m)return i.nodeValue!==t&&(i.nodeValue=t),n;if(m&&(!i||!c)){let l=document.createTextNode(t);return i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l)):o.childNodes[s]?o.insertBefore(l,o.childNodes[s]):o.appendChild(l),l}if(p&&(!i||c||n[0]!==t[0])){let l=t;1 in l&&(l[1]=M(e,l[1],void 0));let S=b(t);S?.xmlns!==void 0&&(a=S.xmlns);let f=a?document.createElementNS(a,t[0]):document.createElement(t[0]);t.node=f,N(e,f,void 0,S,a),S&&"catch"in S&&(t.node.catch=null,t.node.removeAttribute("catch")),i?(i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(f)):o.childNodes[s]?o.insertBefore(f,o.childNodes[s]):o.appendChild(f);let g=C(t);if(g){let x=S?2:1;for(let T=0;T<g.length;T++){let h=g[T],d=P(e,f,T,void 0,h,a);t[T+x]=d}}return f.onMount&&e.patch(f.onMount(f)),t}if(!c&&p&&n[0]===t[0]){t.node=i;let l=t,S=n,f=b(t),g=b(n);if(f?.xmlns!==void 0&&(a=f.xmlns),l[1]?.__memo){let h=l[1];l[1]=M(e,l[1],S[1]),h!==l[1]&&N(e,i,g,f,a)}else N(e,i,g,f,a);f?.catch&&g?.catch!==f.catch&&(t.node.catch=null,t.node.removeAttribute("catch"));let x=C(t),T=C(n);if(x){let h=f?2:1;for(let d=0;d<x.length;d++){let k=x[d],j=T&&T[d],D=P(e,i,d,j,k,a);D&&(t[d+h]=D)}}if(T){let h=x?x.length:0;for(let d=T.length-1;d>=h;d--)P(e,i,d,T[d],void 0,a)}return t}}catch(r){let c=b(t)?.catch;if(c){let i=typeof c=="function"?c(e,r):c;return P(e,o,s,R(t?.node||n?.node,!0),i,a)}else throw r}}function H(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function U(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function M(e,o,s){if(typeof o!="function")return o;let n=o?.__memo,t=s?.__memo;if(Array.isArray(n)&&Array.isArray(t)&&n.length===t.length){let r=!0;for(let c=0;c<n.length;c++)if(n[c]!==t[c]){r=!1;break}if(r)return s}let a=v(o,e);return typeof a=="object"&&(a.__memo=o?.__memo),a}function v(e,o){return typeof e=="function"?v(e(o),o):e}function N(e,o,s,n,t){if(!n&&!s)return;let a=t!==void 0;if(s)for(let r in s){let c=s[r],i=n?.[r];c!==i&&(n?n[r]=A(e,o,r,c,i,a):A(e,o,r,c,void 0,a))}if(n&&s){for(let r in n)if(!(r in s)){let c=n[r];n[r]=A(e,o,r,void 0,c,a)}}else if(n)for(let r in n){let c=n[r];n[r]=A(e,o,r,void 0,c,a)}}function A(e,o,s,n,t,a){if(s==="style")if(!t)o.style.cssText="";else if(typeof t=="string")n!==t&&(o.style.cssText=t);else if(n&&typeof n=="object"){for(let r in n)t[r]||(o.style[r]=null);for(let r in t){let c=n[r],i=t[r];c!==i&&(o.style[r]=i)}}else for(let r in t)o.style[r]=t[r];else if(s==="class")t?o.setAttribute("class",L(t)):o.removeAttribute("class");else if(s[0]==="o"&&s[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=i=>e.patch(c(e,i))}else typeof t=="object"&&(r=()=>e.patch(t));o[s]=r}else o[s]=null;else a||(o[s]=t),t==null||t===!1?o.removeAttribute(s):o.setAttribute(s,t);return t}function L(e){return typeof e=="string"?e:Array.isArray(e)?e.map(L).join(" "):typeof e=="object"?Object.keys(e).filter(o=>e[o]).join(" "):""}var J="a",Q="abbr",z="address",Z="area",tt="article",et="aside",nt="audio",ot="b",st="base",at="bdi",rt="bdo",ct="blockquote",it="body",pt="br",lt="button",ft="canvas",St="caption",dt="cite",ut="code",Tt="col",yt="colgroup",gt="data",xt="datalist",ht="dd",mt="del",Et="details",bt="dfn",Pt="dialog",At="div",Ct="dl",Mt="dt",Nt="em",Rt="embed",Ot="fieldset",Dt="figcaption",vt="figure",Lt="footer",It="form",Vt="h1",Ft="h2",kt="h3",jt="h4",Ht="h5",Ut="h6",Gt="head",Kt="header",Bt="hgroup",_t="hr",qt="html",Xt="i",$t="iframe",wt="img",Yt="input",Wt="ins",Jt="kbd",Qt="label",zt="legend",Zt="li",te="link",ee="main",ne="map",oe="mark",se="menu",ae="meta",re="meter",ce="nav",ie="noscript",pe="object",le="ol",fe="optgroup",Se="option",de="output",ue="p",Te="picture",ye="pre",ge="progress",xe="q",he="rp",me="rt",Ee="ruby",be="s",Pe="samp",Ae="script",Ce="search",Me="section",Ne="select",Re="slot",Oe="small",De="source",ve="span",Le="strong",Ie="style",Ve="sub",Fe="summary",ke="sup",je="table",He="tbody",Ue="td",Ge="template",Ke="textarea",Be="tfoot",_e="th",qe="thead",Xe="time",$e="title",we="tr",Ye="track",We="u",Je="ul",Qe="var",ze="video",Ze="wbr",tn="animate",en="animateMotion",nn="animateTransform",on="circle",sn="clipPath",an="defs",rn="desc",cn="ellipse",pn="feBlend",ln="feColorMatrix",fn="feComponentTransfer",Sn="feComposite",dn="feConvolveMatrix",un="feDiffuseLighting",Tn="feDisplacementMap",yn="feDistantLight",gn="feDropShadow",xn="feFlood",hn="feFuncA",mn="feFuncB",En="feFuncG",bn="feFuncR",Pn="feGaussianBlur",An="feImage",Cn="feMerge",Mn="feMergeNode",Nn="feMorphology",Rn="feOffset",On="fePointLight",Dn="feSpecularLighting",vn="feSpotLight",Ln="feTile",In="feTurbulence",Vn="filter",Fn="foreignObject",kn="g",jn="image",Hn="line",Un="linearGradient",Gn="marker",Kn="mask",Bn="metadata",_n="mpath",qn="path",Xn="pattern",$n="polygon",wn="polyline",Yn="radialGradient",Wn="rect",Jn="set",Qn="stop",zn="svg",Zn="switch",to="symbol",eo="text",no="textPath",oo="tspan",so="use",ao="view",ro="annotation",co="annotation-xml",io="maction",po="math",lo="merror",fo="mfrac",So="mi",uo="mmultiscripts",To="mn",yo="mo",go="mover",xo="mpadded",ho="mphantom",mo="mprescripts",Eo="mroot",bo="mrow",Po="ms",Ao="mspace",Co="msqrt",Mo="mstyle",No="msub",Ro="msubsup",Oo="msup",Do="mtable",vo="mtd",Lo="mtext",Io="mtr",Vo="munder",Fo="munderover",ko="semantics";function Ho(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let o=e[0];for(let s=1;s<e.length;s++){let n=o,t=e[s];if(!n)o=t;else if(t)if(typeof n=="string"&&typeof t=="string"){let a=n.split(" "),r=t.split(" "),c=new Set([...a,...r]);o=Array.from(c).join(" ").trim()}else if(typeof n=="string"&&Array.isArray(t)){let a=new Set([...t,...n.split(" ")]);o=Array.from(a).join(" ").trim()}else if(Array.isArray(n)&&typeof t=="string"){let a=new Set([...n,...t.split(" ")]);o=Array.from(a).join(" ").trim()}else if(Array.isArray(n)&&Array.isArray(t)){let a=new Set([...n,...t]);o=Array.from(a).join(" ").trim()}else if(typeof n=="string"&&typeof t=="object")o={[n]:!0,...t};else if(typeof n=="object"&&typeof t=="string")o={...n,[t]:!0};else if(typeof n=="object"&&typeof t=="object")o={...n,...t};else if(typeof n=="object"&&Array.isArray(t)){let a={...n};for(let r of t)a[r]=!0;o=a}else if(Array.isArray(n)&&typeof t=="object"){let a={};for(let r of n)a[r]=!0;for(let r of Object.keys(t))a[r]=t[r];o=a}else throw new Error(`cannot merge classes of ${n} (${typeof n}) and ${t} (${typeof t})`);else continue}return o}var I=document.createElement("div");function Go(...e){try{let o=I.style;for(let s of e)if(typeof s=="object"&&s!==null)for(let n in s)o[n]=s[n];else typeof s=="string"&&(o.cssText+=";"+s);return o.cssText}finally{I.style.cssText=""}}var V=class{constructor(o,s){this.state=o;this.path=s;this.keys=s.split(".")}keys;get(){let o=this.keys,s=this.state?this.state[o[0]]:void 0;for(let n=1;n<o.length&&s;n++)s=s[o[n]];return s}put(o){this.putDeep(o,this.state)}patch(o){if(Array.isArray(o)){let s=[];for(let n of o)s.push(this.createPatch(n));this.state.patch(s)}else this.state.patch(this.createPatch(o))}createPatch(o){let s={};return this.putDeep(o,s),s}putDeep(o,s){let n=this.keys;if(n.length>1){let t=0,a=s[n[t]];for((typeof a!="object"||a===null)&&(s[n[t]]=a={}),t=1;t<n.length-1;t++){let r=a;a=a[n[t]],(typeof a!="object"||a===null)&&(r[n[t]]=a={})}a[n[t]]=o}else typeof s[n[0]]=="object"&&typeof o=="object"?Object.assign(s[n[0]],o):s[n[0]]=o}},F=class{constructor(o,s,n,t){this.state=o;this.get=s;this.put=n;this.patch=t}};export{J as A,Q as ABBR,z as ADDRESS,tn as ANIMATE,en as ANIMATEMOTION,nn as ANIMATETRANSFORM,ro as ANNOTATION,co as ANNOTATION_XML,Z as AREA,tt as ARTICLE,et as ASIDE,nt as AUDIO,ot as B,st as BASE,at as BDI,rt as BDO,ct as BLOCKQUOTE,it as BODY,pt as BR,lt as BUTTON,ft as CANVAS,St as CAPTION,on as CIRCLE,dt as CITE,sn as CLIPPATH,ut as CODE,Tt as COL,yt as COLGROUP,gt as DATA,xt as DATALIST,ht as DD,an as DEFS,mt as DEL,rn as DESC,Et as DETAILS,bt as DFN,Pt as DIALOG,At as DIV,Ct as DL,Mt as DT,F as DelegateStateContext,cn as ELLIPSE,Nt as EM,Rt as EMBED,pn as FEBLEND,ln as FECOLORMATRIX,fn as FECOMPONENTTRANSFER,Sn as FECOMPOSITE,dn as FECONVOLVEMATRIX,un as FEDIFFUSELIGHTING,Tn as FEDISPLACEMENTMAP,yn as FEDISTANTLIGHT,gn as FEDROPSHADOW,xn as FEFLOOD,hn as FEFUNCA,mn as FEFUNCB,En as FEFUNCG,bn as FEFUNCR,Pn as FEGAUSSIANBLUR,An as FEIMAGE,Cn as FEMERGE,Mn as FEMERGENODE,Nn as FEMORPHOLOGY,Rn as FEOFFSET,On as FEPOINTLIGHT,Dn as FESPECULARLIGHTING,vn as FESPOTLIGHT,Ln as FETILE,In as FETURBULENCE,Ot as FIELDSET,Dt as FIGCAPTION,vt as FIGURE,Vn as FILTER,Lt as FOOTER,Fn as FOREIGNOBJECT,It as FORM,kn as G,Vt as H1,Ft as H2,kt as H3,jt as H4,Ht as H5,Ut as H6,Gt as HEAD,Kt as HEADER,Bt as HGROUP,_t as HR,qt as HTML,Xt as I,$t as IFRAME,jn as IMAGE,wt as IMG,Yt as INPUT,Wt as INS,Jt as KBD,V as KeyStateContext,Qt as LABEL,zt as LEGEND,Zt as LI,Hn as LINE,Un as LINEARGRADIENT,te as LINK,io as MACTION,ee as MAIN,ne as MAP,oe as MARK,Gn as MARKER,Kn as MASK,po as MATH,se as MENU,lo as MERROR,ae as META,Bn as METADATA,re as METER,fo as MFRAC,So as MI,uo as MMULTISCRIPTS,To as MN,yo as MO,go as MOVER,xo as MPADDED,_n as MPATH,ho as MPHANTOM,mo as MPRESCRIPTS,Eo as MROOT,bo as MROW,Po as MS,Ao as MSPACE,Co as MSQRT,Mo as MSTYLE,No as MSUB,Ro as MSUBSUP,Oo as MSUP,Do as MTABLE,vo as MTD,Lo as MTEXT,Io as MTR,Vo as MUNDER,Fo as MUNDEROVER,ce as NAV,ie as NOSCRIPT,pe as OBJECT,le as OL,fe as OPTGROUP,Se as OPTION,de as OUTPUT,ue as P,qn as PATH,Xn as PATTERN,Te as PICTURE,$n as POLYGON,wn as POLYLINE,ye as PRE,ge as PROGRESS,xe as Q,Yn as RADIALGRADIENT,Wn as RECT,he as RP,me as RT,Ee as RUBY,be as S,Pe as SAMP,Ae as SCRIPT,Ce as SEARCH,Me as SECTION,Ne as SELECT,ko as SEMANTICS,Jn as SET,Re as SLOT,Oe as SMALL,De as SOURCE,ve as SPAN,Qn as STOP,Le as STRONG,Ie as STYLE,Ve as SUB,Fe as SUMMARY,ke as SUP,zn as SVG,Zn as SWITCH,to as SYMBOL,je as TABLE,He as TBODY,Ue as TD,Ge as TEMPLATE,eo as TEXT,Ke as TEXTAREA,no as TEXTPATH,Be as TFOOT,_e as TH,qe as THEAD,Xe as TIME,$e as TITLE,we as TR,Ye as TRACK,oo as TSPAN,We as U,Je as UL,so as USE,Qe as VAR,ze as VIDEO,ao as VIEW,Ze as WBR,K as app,Y as child,w as childCount,C as children,O as childrenStart,X as createPatch,q as createState,B as defuse,E as globals,R as hydrate,_ as memo,Ho as mergeClass,Go as mergeStyle,b as props,$ as tag,G as vode};
package/dist/vode.mjs CHANGED
@@ -342,10 +342,10 @@ function render(state, parent, childIndex, oldVode, newVode, xmlns) {
342
342
  newvode[1] = remember(state, newvode[1], void 0);
343
343
  }
344
344
  const properties = props(newVode);
345
- xmlns = properties?.xmlns || xmlns;
345
+ if (properties?.xmlns !== void 0) xmlns = properties.xmlns;
346
346
  const newNode = xmlns ? document.createElementNS(xmlns, newVode[0]) : document.createElement(newVode[0]);
347
347
  newVode.node = newNode;
348
- patchProperties(state, newNode, void 0, properties);
348
+ patchProperties(state, newNode, void 0, properties, xmlns);
349
349
  if (!!properties && "catch" in properties) {
350
350
  newVode.node["catch"] = null;
351
351
  newVode.node.removeAttribute("catch");
@@ -360,12 +360,13 @@ function render(state, parent, childIndex, oldVode, newVode, xmlns) {
360
360
  parent.appendChild(newNode);
361
361
  }
362
362
  }
363
- const newChildren = children(newVode);
364
- if (newChildren) {
365
- for (let i = 0; i < newChildren.length; i++) {
366
- const child2 = newChildren[i];
363
+ const newKids = children(newVode);
364
+ if (newKids) {
365
+ const childOffset = !!properties ? 2 : 1;
366
+ for (let i = 0; i < newKids.length; i++) {
367
+ const child2 = newKids[i];
367
368
  const attached = render(state, newNode, i, void 0, child2, xmlns);
368
- newVode[properties ? i + 2 : i + 1] = attached;
369
+ newVode[i + childOffset] = attached;
369
370
  }
370
371
  }
371
372
  newNode.onMount && state.patch(newNode.onMount(newNode));
@@ -376,16 +377,16 @@ function render(state, parent, childIndex, oldVode, newVode, xmlns) {
376
377
  const newvode = newVode;
377
378
  const oldvode = oldVode;
378
379
  const properties = props(newVode);
379
- let hasProps = !!properties;
380
380
  const oldProps = props(oldVode);
381
+ if (properties?.xmlns !== void 0) xmlns = properties.xmlns;
381
382
  if (newvode[1]?.__memo) {
382
383
  const prev = newvode[1];
383
384
  newvode[1] = remember(state, newvode[1], oldvode[1]);
384
385
  if (prev !== newvode[1]) {
385
- patchProperties(state, oldNode, oldProps, properties);
386
+ patchProperties(state, oldNode, oldProps, properties, xmlns);
386
387
  }
387
388
  } else {
388
- patchProperties(state, oldNode, oldProps, properties);
389
+ patchProperties(state, oldNode, oldProps, properties, xmlns);
389
390
  }
390
391
  if (!!properties?.catch && oldProps?.catch !== properties.catch) {
391
392
  newVode.node["catch"] = null;
@@ -394,12 +395,13 @@ function render(state, parent, childIndex, oldVode, newVode, xmlns) {
394
395
  const newKids = children(newVode);
395
396
  const oldKids = children(oldVode);
396
397
  if (newKids) {
398
+ const childOffset = !!properties ? 2 : 1;
397
399
  for (let i = 0; i < newKids.length; i++) {
398
400
  const child2 = newKids[i];
399
401
  const oldChild = oldKids && oldKids[i];
400
402
  const attached = render(state, oldNode, i, oldChild, child2, xmlns);
401
403
  if (attached) {
402
- newVode[hasProps ? i + 2 : i + 1] = attached;
404
+ newVode[i + childOffset] = attached;
403
405
  }
404
406
  }
405
407
  }
@@ -463,15 +465,18 @@ function unwrap(c, s) {
463
465
  return c;
464
466
  }
465
467
  }
466
- function patchProperties(s, node, oldProps, newProps) {
468
+ function patchProperties(s, node, oldProps, newProps, xmlns) {
467
469
  if (!newProps && !oldProps) return;
470
+ const xmlMode = xmlns !== void 0;
468
471
  if (oldProps) {
469
472
  for (const key in oldProps) {
470
473
  const oldValue = oldProps[key];
471
474
  const newValue = newProps?.[key];
472
475
  if (oldValue !== newValue) {
473
- if (newProps) newProps[key] = patchProperty(s, node, key, oldValue, newValue);
474
- else patchProperty(s, node, key, oldValue, void 0);
476
+ if (newProps)
477
+ newProps[key] = patchProperty(s, node, key, oldValue, newValue, xmlMode);
478
+ else
479
+ patchProperty(s, node, key, oldValue, void 0, xmlMode);
475
480
  }
476
481
  }
477
482
  }
@@ -479,17 +484,17 @@ function patchProperties(s, node, oldProps, newProps) {
479
484
  for (const key in newProps) {
480
485
  if (!(key in oldProps)) {
481
486
  const newValue = newProps[key];
482
- newProps[key] = patchProperty(s, node, key, void 0, newValue);
487
+ newProps[key] = patchProperty(s, node, key, void 0, newValue, xmlMode);
483
488
  }
484
489
  }
485
490
  } else if (newProps) {
486
491
  for (const key in newProps) {
487
492
  const newValue = newProps[key];
488
- newProps[key] = patchProperty(s, node, key, void 0, newValue);
493
+ newProps[key] = patchProperty(s, node, key, void 0, newValue, xmlMode);
489
494
  }
490
495
  }
491
496
  }
492
- function patchProperty(s, node, key, oldValue, newValue) {
497
+ function patchProperty(s, node, key, oldValue, newValue, xmlMode) {
493
498
  if (key === "style") {
494
499
  if (!newValue) {
495
500
  node.style.cssText = "";
@@ -534,7 +539,7 @@ function patchProperty(s, node, key, oldValue, newValue) {
534
539
  node[key] = null;
535
540
  }
536
541
  } else {
537
- node[key] = newValue;
542
+ if (!xmlMode) node[key] = newValue;
538
543
  if (newValue === void 0 || newValue === null || newValue === false)
539
544
  node.removeAttribute(key);
540
545
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryupold/vode",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "a minimalist web framework",
5
5
  "author": "Michael Scherbakow (ryupold)",
6
6
  "license": "MIT",
package/src/vode.ts CHANGED
@@ -33,6 +33,7 @@ export type Props<S> = Partial<
33
33
  { [K in keyof EventsMap]: EventFunction<S> | Patch<S> } // all on* events
34
34
  > & {
35
35
  [_: string]: unknown,
36
+ xmlns?: string | null,
36
37
  class?: ClassProp,
37
38
  style?: StyleProp,
38
39
  /** called after the element was attached */
@@ -471,7 +472,7 @@ function mergeState(target: any, source: any, allowDeletion: boolean) {
471
472
  return target;
472
473
  };
473
474
 
474
- function render<S extends PatchableState>(state: S, parent: Element, childIndex: number, oldVode: AttachedVode<S> | undefined, newVode: ChildVode<S>, xmlns?: string): AttachedVode<S> | undefined {
475
+ function render<S extends PatchableState>(state: S, parent: Element, childIndex: number, oldVode: AttachedVode<S> | undefined, newVode: ChildVode<S>, xmlns?: string | null): AttachedVode<S> | undefined {
475
476
  try {
476
477
  // unwrap component if it is memoized
477
478
  newVode = remember(state, newVode, oldVode) as ChildVode<S>;
@@ -539,13 +540,14 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
539
540
 
540
541
  const properties = props(newVode);
541
542
 
542
- xmlns = properties?.xmlns as string || xmlns;
543
+ if (properties?.xmlns !== undefined) xmlns = properties.xmlns;
544
+
543
545
  const newNode: ChildNode = xmlns
544
546
  ? document.createElementNS(xmlns, (<Vode<S>>newVode)[0])
545
547
  : document.createElement((<Vode<S>>newVode)[0]);
546
548
  (<AttachedVode<S>>newVode).node = newNode;
547
549
 
548
- patchProperties(state, newNode, undefined, properties);
550
+ patchProperties(state, newNode, undefined, properties, xmlns);
549
551
 
550
552
  if (!!properties && 'catch' in properties) {
551
553
  (<any>newVode).node['catch'] = null;
@@ -563,12 +565,13 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
563
565
  }
564
566
  }
565
567
 
566
- const newChildren = children(newVode);
567
- if (newChildren) {
568
- for (let i = 0; i < newChildren.length; i++) {
569
- const child = newChildren[i];
568
+ const newKids = children(newVode);
569
+ if (newKids) {
570
+ const childOffset = !!properties ? 2 : 1;
571
+ for (let i = 0; i < newKids.length; i++) {
572
+ const child = newKids[i];
570
573
  const attached = render(state, newNode as Element, i, undefined, child, xmlns);
571
- (<Vode<S>>newVode!)[properties ? i + 2 : i + 1] = <Vode<S>>attached;
574
+ (<Vode<S>>newVode!)[i + childOffset] = <Vode<S>>attached;
572
575
  }
573
576
  }
574
577
 
@@ -584,18 +587,19 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
584
587
  const oldvode = <Vode<S>>oldVode;
585
588
 
586
589
  const properties = props(newVode);
587
- let hasProps = !!properties;
588
590
  const oldProps = props(oldVode);
589
591
 
592
+ if (properties?.xmlns !== undefined) xmlns = properties.xmlns;
593
+
590
594
  if ((<any>newvode[1])?.__memo) {
591
595
  const prev = newvode[1] as any;
592
596
  newvode[1] = remember(state, newvode[1], oldvode[1]) as Vode<S>;
593
597
  if (prev !== newvode[1]) {
594
- patchProperties(state, oldNode!, oldProps, properties);
598
+ patchProperties(state, oldNode!, oldProps, properties, xmlns);
595
599
  }
596
600
  }
597
601
  else {
598
- patchProperties(state, oldNode!, oldProps, properties);
602
+ patchProperties(state, oldNode!, oldProps, properties, xmlns);
599
603
  }
600
604
 
601
605
  if (!!properties?.catch && oldProps?.catch !== properties.catch) {
@@ -606,13 +610,14 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
606
610
  const newKids = children(newVode);
607
611
  const oldKids = children(oldVode) as AttachedVode<S>[];
608
612
  if (newKids) {
613
+ const childOffset = !!properties ? 2 : 1;
609
614
  for (let i = 0; i < newKids.length; i++) {
610
615
  const child = newKids[i];
611
616
  const oldChild = oldKids && oldKids[i];
612
617
 
613
618
  const attached = render(state, oldNode as Element, i, oldChild, child, xmlns);
614
619
  if (attached) {
615
- (<Vode<S>>newVode)[hasProps ? i + 2 : i + 1] = <Vode<S>>attached;
620
+ (<Vode<S>>newVode)[i + childOffset] = <Vode<S>>attached;
616
621
  }
617
622
  }
618
623
  }
@@ -688,9 +693,15 @@ function unwrap<S>(c: Component<S> | ChildVode<S>, s: S): ChildVode<S> {
688
693
  }
689
694
  }
690
695
 
691
- function patchProperties<S extends PatchableState>(s: S, node: ChildNode, oldProps?: Props<S>, newProps?: Props<S>) {
696
+ function patchProperties<S extends PatchableState>(
697
+ s: S, node: ChildNode,
698
+ oldProps: Props<S> | null | undefined, newProps: Props<S> | null | undefined,
699
+ xmlns: string | null | undefined
700
+ ) {
692
701
  if (!newProps && !oldProps) return;
693
702
 
703
+ const xmlMode = xmlns !== undefined;
704
+
694
705
  // match existing properties
695
706
  if (oldProps) {
696
707
  for (const key in oldProps) {
@@ -698,8 +709,10 @@ function patchProperties<S extends PatchableState>(s: S, node: ChildNode, oldPro
698
709
  const newValue = newProps?.[key as keyof Props<S>] as PropertyValue<S>;
699
710
 
700
711
  if (oldValue !== newValue) {
701
- if (newProps) newProps[key as keyof Props<S>] = patchProperty(s, node, key, oldValue, newValue);
702
- else patchProperty(s, node, key, oldValue, undefined);
712
+ if (newProps)
713
+ newProps[key as keyof Props<S>] = patchProperty(s, node, key, oldValue, newValue, xmlMode);
714
+ else
715
+ patchProperty(s, node, key, oldValue, undefined, xmlMode);
703
716
  }
704
717
  }
705
718
  }
@@ -709,7 +722,7 @@ function patchProperties<S extends PatchableState>(s: S, node: ChildNode, oldPro
709
722
  for (const key in newProps) {
710
723
  if (!(key in oldProps)) {
711
724
  const newValue = newProps[key as keyof Props<S>] as PropertyValue<S>;
712
- newProps[key as keyof Props<S>] = patchProperty(s, <Element>node, key, undefined, newValue);
725
+ newProps[key as keyof Props<S>] = patchProperty(s, <Element>node, key, undefined, newValue, xmlMode);
713
726
  }
714
727
  }
715
728
  }
@@ -717,12 +730,12 @@ function patchProperties<S extends PatchableState>(s: S, node: ChildNode, oldPro
717
730
  else if (newProps) {
718
731
  for (const key in newProps) {
719
732
  const newValue = newProps[key as keyof Props<S>] as PropertyValue<S>;
720
- newProps[key as keyof Props<S>] = patchProperty(s, <Element>node, key, undefined, newValue);
733
+ newProps[key as keyof Props<S>] = patchProperty(s, <Element>node, key, undefined, newValue, xmlMode);
721
734
  }
722
735
  }
723
736
  }
724
737
 
725
- function patchProperty<S extends PatchableState>(s: S, node: ChildNode, key: string | keyof ElementEventMap, oldValue?: PropertyValue<S>, newValue?: PropertyValue<S>) {
738
+ function patchProperty<S extends PatchableState>(s: S, node: ChildNode, key: string | keyof ElementEventMap, oldValue: PropertyValue<S>, newValue: PropertyValue<S>, xmlMode: boolean) {
726
739
  if (key === "style") {
727
740
  if (!newValue) {
728
741
  (node as HTMLElement).style.cssText = "";
@@ -768,7 +781,7 @@ function patchProperty<S extends PatchableState>(s: S, node: ChildNode, key: str
768
781
  (<any>node)[key] = null;
769
782
  }
770
783
  } else {
771
- (<any>node)[key] = newValue;
784
+ if (!xmlMode) (<any>node)[key] = newValue;
772
785
  if (newValue === undefined || newValue === null || newValue === false)
773
786
  (<HTMLElement>node).removeAttribute(key);
774
787
  else