dothtml 6.0.4 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.global.js +5 -5
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var ke=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var bt=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var a=(n,e)=>ke(n,"name",{value:e,configurable:!0});var _t=(n,e)=>{for(var t in e)ke(n,t,{get:e[t],enumerable:!0})},wt=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bt(e))!yt.call(n,i)&&i!==t&&ke(n,i,{get:()=>e[i],enumerable:!(s=gt(e,i))||s.enumerable});return n};var vt=n=>wt(ke({},"__esModule",{value:!0}),n);var Tt={};_t(Tt,{DotComponent:()=>Qe,Link:()=>je,Priority:()=>w,Router:()=>ge,currentHash:()=>G,currentPath:()=>V,currentSearch:()=>me,dot:()=>g,generatePath:()=>Re,getGlobalRoutes:()=>qe,initScrollManager:()=>Ye,matchRoute:()=>ut,navigate:()=>X,previousPath:()=>z,setGlobalRoutes:()=>ct,useHash:()=>We,useQueryParams:()=>Fe});module.exports=vt(Tt);var W="_dotVDom",Z=typeof process<"u"?process.env.NODE_ENV!=="production":(()=>{try{return new Function("return import.meta.env?.DEV")()}catch{return!1}})()??!1;var c=class{static{a(this,"Binding")}_source;_transform;get isWritable(){return this._source.isWritable&&(!this._transform||!!this._transform.read)}get value(){return this._get()}_get(){return this._transform?.display?this._transform.display(this._source.value):this._source.value}_set(e){let t=this._transform?.read?this._transform.read(e):e;this._source.value=t}_subscribe(e,t=!1){return this._source._subscribe(this,e,t)}subscribe(e,t=!1){return this._subscribe(e,t)}_unsubscribe(e){this._source.unsubscribe(e)}unsubscribe(e){this._source.unsubscribe(e)}constructor(e){this._source=e}};var Y=class{static{a(this,"VMetaNode")}};function he(n,e){if(n.parentNode!==e.parentNode)throw new Error("Start and end nodes must have the same parent.");let t=n.nextSibling;for(;t&&t!==e;){let s=t.nextSibling;t[W]?t[W]._unrender():t.parentNode?.removeChild(t),t=s}}a(he,"removeNodesBetween");function Le(n,e,t=new Map){if(n===e)return!0;if(n==null||e==null||typeof n!="object"||typeof e!="object")return!1;if(t.has(n))return t.get(n)===e;if(t.set(n,e),Array.isArray(n)&&Array.isArray(e)&&n.length!==e.length)return!1;for(let s in n)if(!e.hasOwnProperty(s)||!Le(n[s],e[s],t))return!1;for(let s in e)if(!n.hasOwnProperty(s))return!1;return!0}a(Le,"deepEqual");var be=new RegExp("[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?","g");var u=class{static{a(this,"Vdom")}_dot;_onEnterHook;_onLeaveHook;constructor(e){this._dot=e}_unrenderAsync(){let t=this._getNodes().find(s=>s instanceof HTMLElement);if(this._onLeaveHook&&t){let s=this._onLeaveHook(t);if(s instanceof Promise)return s.then(()=>this._unrender())}this._unrender()}_moveBefore(e,t){let s=this._getNodes();if(s.length===0)return;let i=e?.parentElement||t;if(!i)throw new Error("Internal Error: Cannot move nodes without a parent.");for(let o=0;o<s.length;o++)if(s[o]===e)return;let r=(e?.ownerDocument||i.ownerDocument||document).createDocumentFragment();for(let o=0;o<s.length;o++)r.appendChild(s[o]);i.insertBefore(r,e)}__isRendered=!1;get _isRendered(){return this.__isRendered}set _isRendered(e){this.__isRendered=e}toString(){let e=document.createElement("div");return this._render(e),e.innerHTML}_renderBefore(e){let t=e.ownerDocument.createElement("div");for(this._render(t);t.childNodes.length>0;){let s=t.childNodes[0];s.parentElement.removeChild(s),e.parentElement.insertBefore(s,e)}}_renderAfter(e){if(e.nextSibling)this._renderBefore(e.nextSibling);else{let t=e.ownerDocument.createTextNode("");e.parentElement.appendChild(t),this._renderBefore(t),t.parentElement.removeChild(t)}}_moveTo(e){let t=this._getNodes();for(let s=0;s<t.length;s++)e.appendChild(t[s])}text(e){return null}html(e){return null}md(e){return null}mount(e,t){return null}when(e,t){return null}each(e,t){return null}otherwiseWhen(e,t,s){return null}otherwise(e){return null}attr(e,t){return null}style(e){return null}on(e,t){return null}onEnter(e){return null}onLeave(e){return null}empty(){return null}remove(){}};var A=class extends u{static{a(this,"TextVdom")}_text;textNode=null;observerId=0;constructor(e){super(),this._text=e}_render(e){this._text instanceof c?(this.textNode=e.ownerDocument.createTextNode(this._text._get()??""),this.observerId=this._text._subscribe(this)):this.textNode=e.ownerDocument.createTextNode(`${this._text??""}`),e.appendChild(this.textNode)}_unrender(){this.textNode&&(this.textNode.parentElement&&this.textNode.parentElement.removeChild(this.textNode),this.textNode=null),this.observerId&&this._text instanceof c&&(this._text._unsubscribe(this.observerId),this.observerId=0)}_getNodes(){return this.textNode?[this.textNode]:[]}_getLastChild(){return this}toString(){let e=document.createTextNode((this._text instanceof c?this._text._get():this._text)??""),t=document.createElement("div");return t.appendChild(e),t.innerHTML}};var T=class extends u{static{a(this,"FragmentVdom")}_children=[];constructor(e){super(e)}_render(e){this._isRendered=!0;for(let t=0;t<this._children.length;t++)this._children[t]._render(e)}_unrender(){if(this._isRendered){this._isRendered=!1;for(let e=0;e<this._children.length;e++)this._children[e]._unrender()}}_getNodes(){let e=[];for(let t=0;t<this._children.length;t++)e.push(...this._children[t]._getNodes());return e}_getLastChild(){return this._children[this._children.length-1]||null}};var w=(function(n){return n[n.Immediate=0]="Immediate",n[n.UserBlocking=1]="UserBlocking",n[n.Normal=2]="Normal",n[n.Background=3]="Background",n})({});var St=class{static{a(this,"Scheduler")}queues=[new Set,new Set,new Set,new Set];isPending=!1;startTime=0;frameYieldMs=5;isSync=!1;isSyncing=!1;onError;channel=typeof MessageChannel<"u"?new MessageChannel:null;constructor(){this.channel&&(this.channel.port1.onmessage=()=>this.workLoop())}enqueue(e,t=w.Normal){e.isQueued||(e.isQueued=!0,this.queues[t].add(e)),t===w.Immediate||this.isSync?this.flushSync():this.scheduleFlush()}scheduleFlush(){this.isPending||(this.isPending=!0,this.channel?this.channel.port2.postMessage(null):setTimeout(()=>this.workLoop(),0))}shouldYield(){return performance.now()-this.startTime>=this.frameYieldMs}workLoop(){for(this.startTime=performance.now(),this.isPending=!1;this.flushQueues();)if(this.shouldYield()){this.scheduleFlush();break}}flushQueues(){for(let e=w.Immediate;e<=w.Background;e++){let t=this.queues[e];if(t.size===0)continue;let s=Array.from(t);t.clear();for(let i=0;i<s.length;i++){let r=s[i];if(r.isQueued=!1,r.active)try{r.update()&&(r.isQueued=!0,t.add(r))}catch(o){this.onError?this.onError(o):console.error("Scheduler error:",o)}if(this.shouldYield()){for(let o=i+1;o<s.length;o++)t.add(s[o]);return!0}}}for(let e=w.Immediate;e<=w.Background;e++)if(this.queues[e].size>0)return!0;return!1}flushSync(){if(this.isSyncing)return;this.isSyncing=!0,this.isPending=!0;let e=this.shouldYield;this.shouldYield=()=>!1;try{let t=!0;for(;t;){t=!1;for(let s=w.Immediate;s<=w.Background;s++){let i=this.queues[s];if(i.size===0)continue;let r=Array.from(i);i.clear();for(let o of r)if(o.isQueued=!1,o.active)try{o.update()&&(o.isQueued=!0,i.add(o),t=!0)}catch(l){throw this.onError&&this.onError(l),l}i.size>0&&(t=!0)}}}finally{this.shouldYield=e,this.isPending=!1,this.isSyncing=!1}}setSync(e){this.isSync=e}clear(){for(let e of this.queues)e.clear();this.isPending=!1}},x=new St;var ne=class n extends u{static{a(this,"CollectionVdom")}static MAX_BATCH_SIZE=128;value;renderCallback;startNode;endNode;observerId=0;mappedItems=[];updateState=null;constructor(e,t,s){super(e),this.value=t,this.renderCallback=s}_render(e){this.value instanceof c&&(this.observerId=this.value._subscribe(this)),this.startNode=e.ownerDocument.createTextNode(""),this.endNode=e.ownerDocument.createTextNode(""),e.appendChild(this.startNode),e.appendChild(this.endNode);let t=x.shouldYield;x.shouldYield=()=>!1;try{this.updateList()}finally{x.shouldYield=t}}_unrender(){this.observerId&&this.value instanceof c&&(this.value._unsubscribe(this.observerId),this.observerId=null);for(let e=0;e<this.mappedItems.length;e++){let t=this.mappedItems[e];t.vdom._unrender(),t.afterNode.parentElement.removeChild(t.afterNode)}this.mappedItems.length=0,this.startNode.parentElement.removeChild(this.startNode),this.endNode.parentElement.removeChild(this.endNode),this.startNode=null,this.endNode=null}_getNodes(){if(!this.startNode)return[];let e=[this.startNode];for(let t=0;t<this.mappedItems.length;t++)e.push(...this.mappedItems[t].vdom._getNodes()),e.push(this.mappedItems[t].afterNode);return e.push(this.endNode),e}_getLastChild(){return this}getTailAppendPrefixLength(e){let t=this.mappedItems;if(t.length===0||e.length<=t.length)return 0;for(let s=0;s<t.length;s++)if(e[s]!==t[s].keyValue)return 0;return t.length}isItemPositionedAfter(e,t){let s=e.vdom._getNodes();if(!s.length||!t.parentElement||s[0]!==t.nextSibling)return!1;let i=s[s.length-1];return e.afterNode===i.nextSibling}reuseExistingItem(e,t,s){if(e.value!==t&&!Le(e.value,t)){e.vdom._unrender(),e.value=t;let i=this.renderCallback(t,this.value instanceof c?e.observableIndex:s,e.keyValue),r;i instanceof u?r=i:typeof i=="object"&&i?.build?(r=new T(this._dot),r.mount(i)):r=new A(i),r._root&&(r=r._root),e.vdom=r}else e.observableIndex._set(s)}getInsertBeforeAnchor(e,t){for(let s=e;s<t.length;s++)if(t[s].vdom._isRendered){let i=t[s].vdom._getNodes();if(i.length)return i[0]}return this.endNode}countConsecutiveUnrendered(e,t){let s=0;for(;e+s<t.length&&!t[e+s].vdom._isRendered&&s<n.MAX_BATCH_SIZE;)s++;return s}batchRenderNewItems(e,t,s){let i=t.ownerDocument.createDocumentFragment();for(let r of e)r.vdom._render(i),i.appendChild(r.afterNode);t.insertBefore(i,s)}removeItem(e){let t=e.vdom._unrenderAsync();if(t instanceof Promise)return t.then(()=>{e.afterNode.parentElement&&e.afterNode.parentElement.removeChild(e.afterNode)});e.afterNode.parentElement&&e.afterNode.parentElement.removeChild(e.afterNode)}updateList(){let e=null;this.value instanceof c?e=this.value._get():e=this.value;let t=Array.isArray(e)?e:Object.values(e);if(this.updateState&&(Le(this.updateState.newItems,t)||(this.updateState=null)),!this.updateState){let i=null;this.value instanceof c&&(i=this.value._source.key??null);let r=t,o=Array.isArray(e)?r.map((h,p)=>i?h[i]:p):Object.keys(e).map((h,p)=>i?e[h][i]:h),l=this.getTailAppendPrefixLength(o),d=new Map;for(let h=0;h<this.mappedItems.length;h++){let p=this.mappedItems[h];h>=l&&d.set(p.keyValue,p)}this.updateState={newItems:r,newKeys:o,oldMap:d,nextMappedItems:[],currentIndex:0,lastNode:this.startNode,tailAppendPrefix:l,step:"diff"}}let s=this.updateState;if(s.step==="diff"){for(;s.currentIndex<s.newItems.length;){let i=s.newItems[s.currentIndex],r=s.newKeys[s.currentIndex];if(s.currentIndex<s.tailAppendPrefix){let o=this.mappedItems[s.currentIndex];this.reuseExistingItem(o,i,s.currentIndex),s.nextMappedItems.push(o)}else{let o=s.oldMap.get(r);if(o)s.oldMap.delete(r),this.reuseExistingItem(o,i,s.currentIndex),s.nextMappedItems.push(o);else{let d=new f().bind();d._set(s.currentIndex);let h=this.renderCallback(i,this.value instanceof c?d:s.currentIndex,r),p;h instanceof u?p=h:typeof h=="object"&&h?.build?(p=new T(this._dot),p.mount(h)):p=new A(h),p._root&&(p=p._root);let b=this.startNode.ownerDocument.createTextNode("");s.nextMappedItems.push({vdom:p,value:i,keyValue:r,afterNode:b,observableIndex:d})}}if(s.currentIndex++,x.shouldYield())return!0}s.step="cleanup"}if(s.step==="cleanup"){let i=Array.from(s.oldMap.values());for(let r of i)this.removeItem(r);s.step="reorder",s.currentIndex=0,this.mappedItems=[]}if(s.step==="reorder")for(;s.currentIndex<s.nextMappedItems.length;){let i=s.nextMappedItems[s.currentIndex];if(i.vdom._isRendered)this.isItemPositionedAfter(i,s.lastNode)?(s.lastNode=i.afterNode,this.mappedItems.push(i),s.currentIndex++):(i.vdom._moveBefore(s.lastNode.nextSibling,s.lastNode.parentElement),s.lastNode.parentElement.insertBefore(i.afterNode,i.vdom._getNodes().slice(-1)[0].nextSibling),s.lastNode=i.afterNode,this.mappedItems.push(i),s.currentIndex++);else{let r=this.countConsecutiveUnrendered(s.currentIndex,s.nextMappedItems);if(r>=2){let o=s.nextMappedItems.slice(s.currentIndex,s.currentIndex+r),l=s.lastNode.parentElement,d=this.getInsertBeforeAnchor(s.currentIndex+r,s.nextMappedItems);this.batchRenderNewItems(o,l,d);for(let h of o)s.lastNode=h.afterNode,this.mappedItems.push(h);s.currentIndex+=r}else i.vdom._renderAfter(s.lastNode),s.lastNode.parentElement.insertBefore(i.afterNode,i.vdom._getNodes().slice(-1)[0].nextSibling),s.lastNode=i.afterNode,this.mappedItems.push(i),s.currentIndex++}if(x.shouldYield())return!0}return this.updateState=null,!1}};var ie=class extends u{static{a(this,"ConditionalVdom")}conditions=[];sealed=!1;renderedIndex=-1;currentUpdatePromise=null;nextIndex=null;constructor(e){super(e)}addCondition(e,t,s=!1){if(this.sealed)throw new Error("Cannot add additional conditions to a sealed block.");this.sealed=s;let i={condition:e,vNode:t,startAnchor:null,endAnchor:null,observerId:0};this.conditions.push(i),this._isRendered&&(this.renderClause(i,this.conditions[0].startAnchor.parentElement),this.renderedIndex==-1&&this.updateConditions())}renderClause(e,t){if(e.startAnchor)throw new Error("Item is already rendered.");e.startAnchor=t.ownerDocument.createTextNode(""),e.endAnchor=t.ownerDocument.createTextNode(""),t.appendChild(e.startAnchor),t.appendChild(e.endAnchor),e.condition instanceof c&&(e.observerId=e.condition._subscribe(this))}_render(e){this._isRendered=!0;for(let t=0;t<this.conditions.length;t++)this.renderClause(this.conditions[t],e);this.updateConditions()}removeCNode(e){e.condition instanceof c&&(e.condition._unsubscribe(e.observerId),e.observerId=0);let t=e.startAnchor,s=e.endAnchor;t.parentElement.removeChild(t),s.parentElement.removeChild(s),e.startAnchor=null,e.endAnchor=null,e.vNode._unrender()}_unrender(){if(this._isRendered){this._isRendered=!1,this.renderedIndex=-1,this.nextIndex=null,this.currentUpdatePromise=null;for(let e=0;e<this.conditions.length;e++){let t=this.conditions[e];this.removeCNode(t)}}}_getNodes(){if(!this._isRendered)return[];let e=[];for(let t=0;t<this.conditions.length;t++){let s=this.conditions[t];e.push(s.startAnchor),t==this.renderedIndex&&e.push(...s.vNode._getNodes()),e.push(s.endAnchor)}return e}_getLastChild(){return this}updateConditions(){let e=-1;for(let t=0;t<this.conditions.length;t++){let s=this.conditions[t];if(s.condition instanceof c?s.condition._get():s.condition){e=t;break}}if(this.currentUpdatePromise){this.nextIndex=e;return}e!=this.renderedIndex&&this.performUpdate(e)}performUpdate(e){let t=this.renderedIndex;if(t!=-1){let i=this.conditions[t].vNode._unrenderAsync();if(i instanceof Promise){this.currentUpdatePromise=i,i.then(()=>{this.currentUpdatePromise=null,this.renderedIndex=-1,this.finishUpdate(e)});return}}this.renderedIndex=-1,this.finishUpdate(e)}finishUpdate(e){if(this.nextIndex!==null){let t=this.nextIndex;if(this.nextIndex=null,t!==e){this.performUpdate(t);return}}if(this.renderedIndex=e,this.renderedIndex!=-1){let t=this.conditions[this.renderedIndex];t.vNode._renderBefore(t.endAnchor)}if(this.nextIndex!==null){let t=this.nextIndex;this.nextIndex=null,t!==this.renderedIndex&&this.performUpdate(t)}}};var ce=class extends u{static{a(this,"HtmlVdom")}beforeNode;afterNode;_html;observerId=0;constructor(e){super(),this._html=e}updateHtml(e){if(this.beforeNode){he(this.beforeNode,this.afterNode);let t=this.beforeNode.ownerDocument.createElement("div");for(t.innerHTML=e;t.firstChild;)this.afterNode.parentElement.insertBefore(t.firstChild,this.afterNode)}}_render(e){let t="";this._html instanceof c?(t=this._html._get()??"",this.observerId=this._html._subscribe(this)):t=this._html,this.beforeNode=e.ownerDocument.createTextNode(""),this.afterNode=e.ownerDocument.createTextNode(""),e.appendChild(this.beforeNode),e.appendChild(this.afterNode),this.updateHtml(t??"")}_unrender(){if(this.beforeNode){let e=this.beforeNode.parentElement;he(this.beforeNode,this.afterNode),e.removeChild(this.beforeNode),e.removeChild(this.afterNode),this.beforeNode=null,this.afterNode=null}this.observerId&&this._html instanceof c&&(this._html._unsubscribe(this.observerId),this.observerId=0)}_getNodes(){if(!this.beforeNode)return[];let e=[this.beforeNode],t=this.beforeNode.nextSibling;for(;t&&t!==this.afterNode;)e.push(t),t=t.nextSibling;return e.push(this.afterNode),e}_getLastChild(){return this}toString(){return this._html instanceof c?this._html._get():this._html}};var re=class{static{a(this,"ReactiveAttr")}elementVdom;attribute;constructor(e,t){this.elementVdom=e,this.attribute=t}};var ye=class{static{a(this,"Subscription")}boundReactive;item;active=!0;isQueued=!1;constructor(e,t){this.boundReactive=e,this.item=t}update(){if(!this.active)return;let e=this.boundReactive._get();if(this.item instanceof A)this.item.textNode.textContent=e??"";else if(this.item._isReactiveVdom)this.item.update(e);else if(this.item instanceof ce)this.item.updateHtml(e);else if(this.item instanceof re)this.item.elementVdom.updateReactiveAttr(this.item.attribute,e);else if(this.item instanceof Y)this.item.update();else{if(this.item instanceof ne)return this.item.updateList();this.item instanceof ie?this.item.updateConditions():this.item instanceof Function&&this.item(e)}}};var J=[];var Ct=7,Ms=Ct+1,f=class{static{a(this,"Signal")}bindAs(e){let t=new c(this);return e.call&&e.apply?t._transform={display:e}:t._transform=e,t}bind(){return new c(this)}_value;key;subscribers=new Map;get isWritable(){return!0}constructor(){}get value(){let e=J[J.length-1];return e&&e.addDependency&&e.addDependency(this),this._value}set value(e){this.setValue(e)}getValue(){return this.value}setValue(e,t=w.Normal){this._value!==e&&(this._value=e,this.updater(this._value,t))}updater(e,t=w.Normal){for(let s of this.subscribers.values())s.sync?s.update():(!s.isQueued||t===w.Immediate)&&x.enqueue(s,t)}nextId=1;subscribe(e,t=!1){return new c(this)._subscribe(e,t)}_subscribe(e,t,s=!1){let i=this.nextId++,r=new ye(e,t);return r.sync=s,this.subscribers.set(i,r),i}unsubscribe(e){this.subscribers.has(e)&&(this.subscribers.get(e).active=!1,this.subscribers.delete(e))}_detachBinding(e){this.unsubscribe(e)}refresh(e=w.Normal){let t=this.value;this.updater(t,e)}updateObservers(e=w.Normal){this.refresh(e)}};var oe=class extends Y{static{a(this,"AttributeVNode")}attr;value;target;observables={};constructor(e,t){super(),this.attr=e,this.value=t}render(e){this.target=e;for(let t in this.value){let s=this.value[t];if(s instanceof f&&(s=s.bind()),s&&s instanceof c){let i=s._subscribe(this);this.observables[i]=s}}this.update()}update(){if(!this.target)return;let e=[];for(let t in this.value){let s=this.value[t];s&&(s instanceof f&&(s=s.bind()),(!(s instanceof c)||s._get())&&e.push(t))}e.length>0?this.target.setAttribute(this.attr,e.join(" ")):this.target.removeAttribute(this.attr)}unrender(){this.target=null;for(let e in this.observables)this.observables[e]._unsubscribe(Number(e));this.observables={}}};var Ge={color:"color|background-Color|border-Bottom-Color|border-Color|border-Left-Color|border-Right-Color|border-Top-Color|text-Decoration-Color|outline-Color|column-Rule-Color",length:"background-Size|block-Size|border-Bottom-Left-Radius|border-Bottom-Right-Radius|border-Bottom-Width|border-Left-Width|border-Radius|border-Right-Width|border-Top-Left-Radius|border-Top-Right-Radius|border-Top-Width|border-Width|bottom|gap|height|left|margin|margin-Bottom|margin-Left|margin-Right|margin-Top|max-Height|max-Width|min-Height|min-Width|padding|padding-Bottom|padding-Left|padding-Right|padding-Top|right|top|width|flex-Basis|font-Size|text-Indent|letter-Spacing|word-Spacing|border-Spacing|outline-Offset|outline-Width|column-Gap|column-Rule-Width|grid-Column-Gap|grid-Gap|grid-Row-Gap|column-Width|perspective|row-Gap",hybrid:"line-Height|border-Image-Width|border-Image-Outset|tab-Size|flex",url:"background-Image|border-Image|list-Style-Image|content|image-Orientation",transformation:"transform",filter:"filter|backdrop-Filter",time:"animation-Delay|animation-Direction|animation-Duration|transition-Duration|transition-Delay",misc:"appearance|aspect-Ratio|opacity|background|background-Attachment|background-Blend-Mode|background-Position|background-Repeat|background-Clip|background-Origin|border|border-Bottom|border-Bottom-Style|border-Image-Repeat|border-Image-Slice|border-Image-Source|border-Left|border-Left-Style|border-Right|border-Right-Style|border-Style|border-Top|border-Top-Style|box-Decoration-Break|box-Shadow|clear|clip|display|float|overflow|box|overflow-X|overflow-Y|position|visibility|vertical-Align|z-Index|align-Content|align-Items|align-Self|flex-Direction|flex-Flow|flex-Grow|flex-Shrink|flex-Wrap|grid|grid-Area|grid-Auto-Columns|grid-auto-Rows|grid-Column|grid-Column-End|grid-Column-Start|grid-Row|grid-Row-End|grid-Row-Start|grid-Template|grid-Template-Areas|grid-Template-Columns|grid-Template-Rows|justify-Content|order|hanging-Punctuation|hyphens|line-Break|overflow-Wrap|text-Align|text-Align-Last|text-Combine-Upright|text-Justify|text-Transform|white-Space|word-Break|word-Wrap|text-Decoration|text-Decoration-Line|text-Decoration-Style|text-Shadow|text-Underline-Position|font|font-Family|font-Feature-Settings|font-Kerning|font-Language-Override|font-Size-Adjust|font-Stretch|font-Style|font-Synthesis|font-Variant|font-Variant-Alternates|font-Variant-Caps|font-Variant-East-Asian|font-Variant-Ligatures|font-Variant-Numeric|font-Variant-Position|font-Weight|direction|text-Orientation|text-Combine-Upright|unicode-Bidi|user-Select|writing-Mode|border-Collapse|caption-Side|empty-Cells|table-Layout|counter-Increment|counter-Reset|list-Style|list-Style-Position|list-Style-Type|animation|animation-Fill-Mode|animation-Iteration-Count|animation-Name|animation-Play-State|animation-Timing-Function|animation-Timeline|container-Type|container-Name|backface-Visibility|perspective2d|perspective-Origin|transform-Origin|transform-Style|transition|transition-Property|transition-Timing-Function|box-Sizing|cursor|ime-Mode|nav-Down|nav-Index|nav-Left|nav-Right|nav-Up|outline|outline-Style|resize|text-Overflow|break-After|break-Before|break-Inside|column-Count|column-Fill|column-Rule|column-Rule-Style|column-Span|columns|widows|orphans|page-Break-After|page-Break-Before|page-Break-Inside|marks|quotes|image-Rendering|image-Resolution|object-Fit|object-Position|mask|mask-Type|mark|mark-After|mark-Before|phonemes|rest|rest-After|rest-Before|voice-Balance|voice-Duration|voice-Pitch|voice-Pitch-Range|voice-Rate|voice-Stress|voice-Volume|marquee-Direction|marquee-Play-Count|marquee-Speed|marquee-Style|pointer-Events"},xt="Cm|Mm|In|Px|Pt|Pc|Ch|Em|Ex|Lh|Rem|Vh|Vw|Vmin|Vmax|Cqw|Cqh|Cqi|Cqb|Cqmin|Cqmax|P".split("|"),Et="Ms|S".split("|"),Nt="Deg|Grad|Rad|Turn".split("|"),It="Hz|Khz".split("|"),ue={};for(let n in Ge){let e=Ge[n].split("|");for(let t of e){let s=t.split("-").join("");switch(n){case"hybrid":case"length":{for(let i of xt)ue[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i=="P"?"%":i.toLowerCase()};break}case"time":{for(let i of Et)ue[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i.toLowerCase()};break}case"angle":{for(let i of Nt)ue[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i.toLowerCase()};break}case"frequency":{for(let i of It)ue[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i.toLowerCase()};break}default:break}ue[s]={dotName:s,cssName:t.toLowerCase(),type:n,unit:void 0}}}var ae=ue;var L=class{static{a(this,"CssFunctionBuilderVStyle")}funcs=[];propName;constructor(e){this.propName=e}toString(){let e="";for(let t of this.funcs){let s=Array.from(t.args).map(i=>{let r=i.v!==void 0?i.v:i,o=i.f||(l=>`${l}`);return r instanceof c?o(r._get()):r instanceof f?o(r.value):o(r).toString().split(" ").join(", ")}).join(", ");e+=`${t.func}(${s}) `}return e.trim()}appendFunction(e,t){return this.funcs.push({func:e,args:t}),this}};function _(n,e="px"){if(n=n||"0px",n instanceof c&&(n=n._get()),n instanceof f&&(n=n.value),n instanceof Array)return n.map(s=>_(s,e)).join(" ");isNaN(n)||(n=n+e);let t=n.trim().split(" ");if(t.length>1)return t.map(s=>_(s,e)).join(" ");{let s=Number(n.match(be)[0]),i=n.split(be)[1]||e;return`${s}${i}`}}a(_,"formatCssLength");function Ve(n){if(n=n||"0%",n instanceof c&&(n=n._get()),n instanceof f&&(n=n.value),n instanceof Array)return n.map(t=>Ve(t)).join(" ");let e=n.trim().split(" ");return e.length>1?e.map(t=>Ve(t)).join(" "):isNaN(n)?n:`${n}%`}a(Ve,"formatCssPercentage");function Xe(n){if(typeof n=="number"){let e=0,t=0,s=0,i=1;return s=n&255,n>>=8,t=n&255,n>>=8,e=n&255,`rgb(${e} ${t} ${s})`}else if(typeof n=="string")return n}a(Xe,"formatCssColor");function D(n){if(n=n||"0deg",n instanceof c&&(n=n._get()),n instanceof f&&(n=n.value),n instanceof Array)return n.map(t=>D(t)).join(" ");isNaN(n)||(n=`${n}deg`);let e=n.trim().split(" ");if(e.length>1)return e.map(t=>D(t)).join(" ");{let t=Number(n.match(be)[0]),s=n.split(be)[1]||"deg";return`${t}${s}`}}a(D,"formatCssAngle");var H=class extends L{static{a(this,"FilterVStyle")}blur(e){return this.appendFunction("blur",[{v:e,f:_}])}brightness(e){return this.appendFunction("brightness",[{v:e,f:Ve}])}contrast(e){return this.appendFunction("contrast",[{v:e,f:_}])}dropShadow(e,t,s,i){return this.appendFunction("drop-shadow",[{v:e,f:_},{v:t,f:_},{v:s,f:_},{v:i,f:Xe}])}grayscale(e){return this.appendFunction("grayscale",[{v:e,f:_}])}hueRotate(e){return this.appendFunction("hue-rotate",[{v:e,f:_}])}invert(e){return this.appendFunction("invert",[{v:e,f:_}])}opacity(e){return this.appendFunction("opacity",[{v:e,f:_}])}sepia(e){return this.appendFunction("sepia",[{v:e,f:_}])}saturate(e){return this.appendFunction("saturate",[{v:e,f:_}])}};var q=class extends L{static{a(this,"TransformVStyle")}matrix3d(e,t,s,i,r,o,l,d,h,p,b,S,m,y,k,K){return this.appendFunction("matrix3d",arguments)}matrix(e,t,s,i,r,o){return this.appendFunction("matrix",arguments)}translate(e,t){return arguments.length==1?this.appendFunction("translate",[{f:_,v:e}]):this.appendFunction("translate",[{f:_,v:e},{f:_,v:t}])}translate3d(e,t,s){return this.appendFunction("translate3d",[{f:_,v:e},{f:_,v:t},{f:_,v:s}])}translateX(e){return this.appendFunction("translateX",[{f:_,v:e}])}translateY(e){return this.appendFunction("translateY",[{f:_,v:e}])}translateZ(e){return this.appendFunction("translateZ",[{f:_,v:e}])}scale(e,t){return this.appendFunction("scale",[e,t??1])}scale3d(e,t,s){return this.appendFunction("scale3d",[e,t,s])}scaleX(e){return this.appendFunction("scaleX",[e])}scaleY(e){return this.appendFunction("scaleY",[e])}scaleZ(e){return this.appendFunction("scaleZ",[e])}rotate(e){return this.appendFunction("rotate",[{f:D,v:e}])}rotate3d(e,t,s,i){return this.appendFunction("rotate3d",[e,t,s,{f:D,v:i}])}rotate3dDeg(e,t,s,i){return this.rotate3d(e,t,s,i)}rotate3dRad(e,t,s,i){return this.rotate3d(e,t,s,`${i}rad`)}rotate3dGrad(e,t,s,i){return this.rotate3d(e,t,s,`${i}grad`)}rotate3dTurn(e,t,s,i){return this.rotate3d(e,t,s,`${i}turn`)}rotateX(e){return this.appendFunction("rotateX",[{f:D,v:e}])}rotateY(e){return this.appendFunction("rotateY",[{f:D,v:e}])}rotateZ(e){return this.appendFunction("rotateZ",[{f:D,v:e}])}skew(e,t){return arguments.length==1?this.appendFunction("skew",[{f:D,v:e}]):this.appendFunction("skew",[{f:D,v:e},{f:D,v:t}])}skewX(e){return this.appendFunction("skewX",[{f:D,v:e}])}skewY(e){return this.appendFunction("skewY",[{f:D,v:e}])}perspective(e){return this.appendFunction("perspective",[{f:_,v:e}])}};var E=class n{static{a(this,"BaseVStyle")}_isBase=!1;props=[];onUpdate;setProp(e,t){return this._isBase?new n().setProp(e,t):(this.props.push({prop:e,value:t}),this.onUpdate&&this.onUpdate(),this)}_setOnUpdate(e){this.onUpdate=e}variable(e,t){return e.startsWith("--")||(e="--"+e),this.setProp(e,t)}v(e){return e.startsWith("--")||(e="--"+e),`var(${e})`}getProps(){return this.props}};for(let n in ae)E.prototype[n]=function(e){return this.setProp(n,e)};var O=class extends Y{static{a(this,"StyleVNode")}target;document;shadowRoot;styleSource;styleElement;observables=[];observableIds=[];isQueued=!1;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.applyStyles()},"update")};constructor(e){super(),this.styleSource=e,this.styleSource instanceof E&&this.styleSource._setOnUpdate(()=>this.update()),this.extractObservables()}extractObservables(){let e=this.styleSource instanceof E?this.styleSource.getProps():this.styleSource;if(Array.isArray(e))for(let t=0;t<e.length;t++){let s=e[t];this.processValue(s.prop,s.value,i=>s.value=i)}else for(let t in e)this.processValue(t,e[t],s=>e[t]=s)}processValue(e,t,s){if(!this.tryExtractObservable(t)&&typeof t=="object"&&t!==null&&!(t instanceof L)){let i;switch(e){case"filter":{i=new H(e);break}case"transform":{i=new q(e);break}}if(i){let r=Array.isArray(t)?t:[t];for(let o of r)for(let l in o){let d=o[l];if(this.tryExtractObservable(d),Array.isArray(d))for(let p of d)this.tryExtractObservable(p);let h=l.replace(/_\d+$/,"");typeof i[h]=="function"&&(Array.isArray(d)?i[h](...d):i[h](d))}s(i)}}}tryExtractObservable(e){if(e instanceof c||e instanceof f){if(this.observables.indexOf(e)===-1&&(this.observables.push(e),this.target)){let t=e.subscribe(()=>this.update());this.observableIds.push(t)}return!0}return!1}render(e,t=window.document,s){this.target=e,this.document=t,this.shadowRoot=s;for(let i of this.observables){let r=i.subscribe(()=>this.update());this.observableIds.push(r)}typeof e=="string"&&(this.styleElement=this.document.createElement("style"),this.shadowRoot?this.shadowRoot.appendChild(this.styleElement):this.document.head.appendChild(this.styleElement)),this.applyStyles()}update(){this.isQueued||(this.isQueued=!0,x.enqueue(this.updateSubscription,w.Normal))}applyStyles(){if(this.target)if(typeof this.target=="string")this.styleElement&&(this.styleElement.textContent=`${this.target} { ${this.getStyleString()} }`);else{this.extractObservables();let e=this.styleSource instanceof E?this.styleSource.getProps():this.styleSource;if(Array.isArray(e))for(let t of e){let s=t.value instanceof c?t.value._get():t.value instanceof f?t.value.value:t.value;this.applySingleStyle(t.prop,s)}else for(let t in e){let s=e[t]instanceof c?e[t]._get():e[t]instanceof f?e[t].value:e[t];this.applySingleStyle(t,s)}}}applySingleStyle(e,t){let s;if(t instanceof L)s=t.toString();else if(typeof t=="object"&&t!==null&&(e==="transform"||e==="filter")){let l=e==="transform"?new q(e):new H(e);this.applyObjectToBuilder(l,t),s=l.toString()}else s=t;let i=e,r,o=ae[e];o&&(i=o.cssName,r=o.unit,(o.type==="length"||o.type==="hybrid")&&typeof s=="number"?o.type==="hybrid"&&r===void 0||(s=_(s,r)):o.unit&&typeof s=="number"&&(s=`${s}${o.unit}`)),this.target instanceof HTMLElement&&this.target.style.setProperty(i,`${s}`)}getStyleString(){let e="",t=this.styleSource instanceof E?this.styleSource.getProps():this.styleSource;if(Array.isArray(t))for(let s of t)e+=this.formatSingleStyle(s.prop,s.value);else for(let s in t)e+=this.formatSingleStyle(s,t[s]);return e}applyObjectToBuilder(e,t){let s=Array.isArray(t)?t:[t];for(let i of s)for(let r in i){let o=i[r],l=r.replace(/_\d+$/,"");typeof e[l]=="function"&&(Array.isArray(o)?e[l](...o):e[l](o))}}formatSingleStyle(e,t){let s=t instanceof c?t._get():t instanceof f?t.value:t;if(s instanceof L)s=s.toString();else if(typeof s=="object"&&s!==null&&(e==="transform"||e==="filter")){let l=e==="transform"?new q(e):new H(e);this.applyObjectToBuilder(l,s),s=l.toString()}let i=e,r,o=ae[e];return o&&(i=o.cssName,r=o.unit,(o.type==="length"||o.type==="hybrid")&&typeof s=="number"?o.type==="hybrid"&&r===void 0||(s=_(s,r)):o.unit&&typeof s=="number"&&(s=`${s}${o.unit}`)),`${i}: ${s}; `}unrender(){for(let e=0;e<this.observableIds.length;e++){let t=this.observableIds[e],s=this.observables[e];s instanceof c?s._unsubscribe(t):s.unsubscribe(t)}this.observableIds=[],this.observables=[],this.styleElement&&(this.styleElement.remove(),this.styleElement=null),this.target=null,this.updateSubscription.active=!1}toString(){return typeof this.target=="string"?`${this.target} { ${this.getStyleString()} }`:this.getStyleString()}};var _e=class{static{a(this,"SyntheticEvent")}nativeEvent;target;currentTarget;type;timeStamp;defaultPrevented;detail;_propagationStopped=!1;_immediatePropagationStopped=!1;constructor(e){this.nativeEvent=e,this.target=e.target,this.currentTarget=e.currentTarget,this.type=e.type,this.timeStamp=e.timeStamp,this.defaultPrevented=e.defaultPrevented,this.detail=e.detail}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this._propagationStopped=!0,this.nativeEvent.stopPropagation()}stopImmediatePropagation(){this._immediatePropagationStopped=!0,this._propagationStopped=!0,this.nativeEvent.stopImmediatePropagation()}isPropagationStopped(){return this._propagationStopped}isImmediatePropagationStopped(){return this._immediatePropagationStopped}};var ee=class n{static{a(this,"EventManager")}static managers=new Map;static getForDocument(e){let t=this.managers.get(e);return t||(t=new n(e),this.managers.set(e,t)),t}document;listeners=new WeakMap;activeEventTypes=new Set;constructor(e){this.document=e}addListener(e,t,s,i=[]){let r=this.listeners.get(e);r||(r=new Map,this.listeners.set(e,r));let o=r.get(t);o||(o=[],r.set(t,o)),o.push({handler:s,modifiers:i}),this.ensureGlobalListener(t)}removeListener(e,t,s){let i=this.listeners.get(e);if(!i)return;let r=i.get(t);if(!r)return;let o=r.findIndex(l=>l.handler===s);o!==-1&&r.splice(o,1),r.length===0&&i.delete(t)}ensureGlobalListener(e){if(this.activeEventTypes.has(e))return;let t=e==="focus"||e==="blur";this.document.addEventListener(e,s=>{this.dispatchEvent(e,s)},t),this.activeEventTypes.add(e)}dispatchEvent(e,t){let s=t.composedPath();if(!s||s.length===0){s=[];let r=t.target;for(;r;)s.push(r),r=r.parentNode||r.host}let i=new _e(t);for(let r of s){if(r===this.document||r===window)continue;let o=this.listeners.get(r);if(!o)continue;let l=o.get(e);if(l){i.currentTarget=r;for(let{handler:d,modifiers:h}of[...l])if(!(h.includes("self")&&t.target!==r)&&(h.includes("stop")&&i.stopPropagation(),h.includes("prevent")&&i.preventDefault(),d(i),h.includes("once")&&this.removeListener(r,e,d),i.isImmediatePropagationStopped()))break;if(i.isPropagationStopped())break}}}};var R=class extends u{static{a(this,"ElementVdom")}_children=null;get children(){return this._children||(this._children=new v(this._dot),this._children._parent=this),this._children}set children(e){this._children=e}element;tag=null;attributes={};events=[];attributeObserverIds=[];childBuilders=[];attrVNodes=[];styleVNodes=[];ref;inputListener;compositionStartListener;compositionEndListener;manualInputAllowed=!0;isComposing=!1;activeBindings={};lastSyncedValues={};constructor(e,t){super(e),this.tag=t}_render(e){this._isRendered=!0,this.element=e.ownerDocument.createElement(this.tag),this.element[W]=this,this.ref&&(typeof this.ref=="function"?this.ref(this.element):this.ref.value=this.element),e.appendChild(this.element),this._children&&this._children._render(this.element);for(let t=0;t<this.events.length;t++){let s=this.events[t];this.renderEvent(s.name,s.callback,s.modifiers)}this.attributes.type!==void 0&&this.renderAttr("type",this.attributes.type,this.element);for(let t in this.attributes)t!=="type"&&this.renderAttr(t,this.attributes[t],this.element);this._onEnterHook&&this._onEnterHook(this.element)}_unrender(){if(!this._isRendered||(this._isRendered=!1,this._children&&this._children._unrender(),!this.element))return;let e=ee.getForDocument(this.element.ownerDocument);this.inputListener&&(e.removeListener(this.element,"input",this.inputListener),this.inputListener=null),this.compositionStartListener&&(e.removeListener(this.element,"compositionstart",this.compositionStartListener),this.compositionStartListener=null),this.compositionEndListener&&(e.removeListener(this.element,"compositionend",this.compositionEndListener),this.compositionEndListener=null);for(let t=0;t<this.events.length;t++){let s=this.events[t];e.removeListener(this.element,s.name.toLowerCase(),s.callback)}this.element.parentNode?.removeChild(this.element);for(let t=0;t<this.childBuilders.length;t++)this.childBuilders[t]._unrender();this.childBuilders.length=0;for(let t=0;t<this.attrVNodes.length;t++)this.attrVNodes[t].unrender();this.attrVNodes.length=0;for(let t=0;t<this.styleVNodes.length;t++)this.styleVNodes[t].unrender();this.styleVNodes.length=0;for(let t=0;t<this.attributeObserverIds.length;t++){let s=this.attributeObserverIds[t];s.observable._unsubscribe(s.id)}this.attributeObserverIds.length=0,this.ref&&(typeof this.ref=="function"?this.ref(null):this.ref.value=null),this.element=null}_getNodes(){return this.element?[this.element]:[]}_getLastChild(){return this}toString(){return this.element?this.element.outerHTML:super.toString()}setAttr(e,t){e=(e??"").toLowerCase();let s=e;if(e=="bind"){let r=this.attributes.type;r instanceof c?r=r._get():r instanceof f&&(r=r.value);let o=typeof r=="string"?r.toLowerCase():null;s=this.tag.toLowerCase()=="input"&&(o=="checkbox"||o=="radio")?"checked":"value"}let i=this.attributes[e];if(i instanceof O){i.unrender();let r=this.styleVNodes.indexOf(i);r!==-1&&this.styleVNodes.splice(r,1)}if(i instanceof oe){i.unrender();let r=this.attrVNodes.indexOf(i);r!==-1&&this.attrVNodes.splice(r,1)}for(let r=0;r<this.attributeObserverIds.length;r++){let o=this.attributeObserverIds[r];if(o.attr===e||o.attr===s){o.observable._unsubscribe(o.id),this.attributeObserverIds.splice(r,1);break}}if(t&&typeof t=="object"&&!(t instanceof Array||t instanceof c||t instanceof f||t instanceof E))switch(e){case"style":{t=new O(t);break}case"ref":break;default:{t=new oe(e,t);break}}if(typeof t=="function"&&e==="style"){let r=new E;t(r),t=new O(r)}t instanceof E&&e==="style"&&(t=new O(t)),this.attributes[e]=t,this.element&&this.renderAttr(e,t,this.element)}updateReactiveAttr(e,t){this.element&&this.renderAttr((e??"").toLowerCase(),t,this.element)}renderAttr(e,t,s,i=!1){if(e=="bind"){let r=this.attributes.type;r instanceof c?r=r._get():r instanceof f&&(r=r.value);let o=typeof r=="string"?r.toLowerCase():null;e=this.tag.toLowerCase()=="input"&&(o=="checkbox"||o=="radio")?"checked":"value",i=!0}if(e=="ref")this.ref=t,this.element&&(typeof this.ref=="function"?this.ref(this.element):this.ref.value=this.element);else if(typeof t=="string"||typeof t=="number")e=="value"&&(this.tag.toLowerCase()=="input"||this.tag.toLowerCase()=="textarea"||this.tag.toLowerCase()=="select")?(s.value=t??"",this.lastSyncedValues[e]=t??""):s.setAttribute(e,`${t}`);else if(typeof t=="boolean"||t==null||t==null)e=="checked"&&this.tag.toLowerCase()=="input"?(s.checked=!!t,this.lastSyncedValues[e]=!!t):e=="selected"&&this.tag.toLowerCase()=="option"?s.selected=!!t:e=="value"&&(this.tag.toLowerCase()=="input"||this.tag.toLowerCase()=="textarea"||this.tag.toLowerCase()=="select")&&(s.value=t??"",this.lastSyncedValues[e]=t??""),t?s.setAttribute(e,`${t}`):s.removeAttribute(e);else if(t instanceof Array)s.setAttribute(e,t.join(" "));else if(t instanceof c){if(this.renderAttr(e,t._get(),s,i),!this.attributeObserverIds.some(r=>r.attr===e&&r.observable===t)){let r=t._subscribe(new re(this,e));this.attributeObserverIds.push({id:r,observable:t,attr:e})}if((e=="value"||e=="checked")&&t.isWritable&&i&&(this.activeBindings[e]=t,!this.inputListener)){this.inputListener=o=>{if(!this.isComposing)try{let l=o.target.type==="checkbox"||o.target.type==="radio"?"checked":"value",d=this.activeBindings[l];if(!d)return;let h=this.element[l],p=d._get(),b=this.lastSyncedValues[l];p==b&&h!=b&&d._set(h),this.lastSyncedValues[l]=d._get()}catch(l){console.error("CAUGHT ERROR: "+l.message)}},this.compositionStartListener=()=>{this.isComposing=!0},this.compositionEndListener=o=>{this.isComposing=!1,this.inputListener(o)};let r=ee.getForDocument(this.element.ownerDocument);r.addListener(this.element,"input",this.inputListener),r.addListener(this.element,"compositionstart",this.compositionStartListener),r.addListener(this.element,"compositionend",this.compositionEndListener)}}else t instanceof oe?(t.render(s),this.attrVNodes.push(t)):t instanceof O&&(t.render(s),this.styleVNodes.push(t))}addEventListener(e,t,s=[]){this.events.some(i=>i.name===e&&i.callback===t)||(this.events.push({name:e,callback:t,modifiers:s}),this.element&&this.renderEvent(e,t,s))}renderEvent(e,t,s=[]){ee.getForDocument(this.element.ownerDocument).addListener(this.element,e.toLowerCase(),t,s)}};var v=class extends u{static{a(this,"ContainerVdom")}_children=[];_parent=null;element=null;constructor(e){super(e)}_addChild(e){return this._children.push(e),this.element?e._render(this.element):this._parent&&this._parent instanceof R&&this._parent.element&&e._render(this._parent.element),this}_render(e){this._isRendered=!0,this.element=e;for(let t=0;t<this._children.length;t++)this._children[t]._render(e)}_unrender(){if(this._isRendered){this._isRendered=!1,this.element=null;for(let e=0;e<this._children.length;e++)this._children[e]._unrender()}}_getNodes(){let e=[];for(let t=0;t<this._children.length;t++)e.push(...this._children[t]._getNodes());return e}_getLastChild(){return this._children[this._children.length-1]||null}};var Q=class extends f{static{a(this,"Ref")}constructor(){return super(),this._value=null,new Proxy(this,{get(e,t,s){if(t in e)return Reflect.get(e,t,s);let i=e.value;if(i&&typeof i[t]=="function")return(...r)=>i[t].apply(i,r)}})}get element(){return this.value}async ready(){return this.value?this.value:new Promise(e=>{let t=this.subscribe(s=>{s&&(this.unsubscribe(t),e(s))})})}};var Ke={onAbort:1,onBlur:1,onChange:1,onInput:1,onCanPlay:1,onCantPlayThrough:1,onClick:1,onCopy:1,onContextMenu:1,onCueChange:1,onCut:1,onDblClick:1,onDrag:1,onDragEnd:1,onDragEnter:1,onDragLeave:1,onDragOver:1,onDragStart:1,onDrop:1,onDurationChange:1,onEmptied:1,onEnded:1,onError:1,onFocus:1,onHashChange:1,onInvalid:1,onKeyDown:1,onKeyPress:1,onKeyUp:1,onLoad:1,onLoadedData:1,onLoadedMetadata:1,onLoadStart:1,onMouseDown:1,onMouseEnter:1,onMouseLeave:1,onMouseMove:1,onMouseOut:1,onMouseOver:1,onMouseUp:1,onPointerCancel:1,onPointerDown:1,onPointerEnter:1,onPointerLeave:1,onPointerMove:1,onPointerOut:1,onPointerOver:1,onPointerUp:1,onTouchStart:1,onTouchEnd:1,onTouchCancel:1,onTouchMove:1,onMouseWheel:1,onOffline:1,onOnline:1,onPageHide:1,onPagePaste:1,onPageShow:1,onPause:1,onPlay:1,onPlaying:1,onPopState:1,onProgress:1,onRateChange:1,onReset:1,onResize:1,onScroll:1,onSearch:1,onSeeked:1,onSeeking:1,onSelect:1,onStalled:1,onStorage:1,onSubmit:1,onSuspend:1,onTimeUpdate:1,onToggle:1,onUnload:1,onVolumeChange:1,onWaiting:1,onWheel:1};var De=a(n=>n instanceof v||n instanceof u||n?._root||n?._children||typeof n=="object"&&n?.build||n instanceof f||n instanceof c||typeof n=="string"||typeof n=="number"||typeof n=="boolean"||Array.isArray(n),"isContent"),$=a((n,e,t)=>{let s=e instanceof R?e.children:e;if(Array.isArray(t))for(let i=0;i<t.length;i++)$(n,e,t[i]);else if(t?._root)$(n,e,t._root);else if(Array.isArray(t?._children)){let i=t._children;if(i&&i.length>0)for(let r=0;r<i.length;r++)s._addChild(i[r])}else if(t instanceof u)s._addChild(t);else if(typeof t=="object"&&t?.build)s.mount(t);else if(t!=null){let i=t;i instanceof f&&(i=i.bind()),i instanceof c?s._addChild(new fe(n,i)):s._addChild(new A(i))}},"applyContent"),kt=a((n,e)=>{for(let t in e){let s=e[t];s instanceof f&&!(s instanceof Q)&&(s=s.bind());let i=t,r=[];if(t.includes(".")){let l=t.split(".");i=l[0],r=l.slice(1)}if(Ke[i]||i.startsWith("on")&&i[2]&&i[2]===i[2].toUpperCase()){if(typeof e[t]!="function")throw new Error(`Value of event attribute ${t} must be a function.`);n.addEventListener(i.substring(2).toLowerCase(),s,r)}else n.setAttr(t,s)}},"applyAttributes"),Me=a((n,e,t)=>{let s=new R(n,e);for(let i=0;i<t.length;i++){let r=t[i];De(r)?$(n,s,r):r&&typeof r=="object"&&kt(s,r)}return s},"createElement");var C=class extends f{static{a(this,"Computed")}getter;dependencies=new Map;isQueued=!1;isEvaluating=!1;active=!0;dirty=!0;error=null;get isWritable(){return!1}updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.dirty&&this._update()},"update")};constructor(e){super(),this.getter=e,this._update()}get value(){if(this.isEvaluating)throw new Error("Circular dependency detected in computed signal.");if(this.dirty&&this._update(),this.error)throw this.error;return super.value}addDependency(e){this.active&&(this.newDependencies.has(e)||this.newDependencies.add(e))}requestUpdate(){this.active&&(this.dirty=!0,this.isQueued||(this.isQueued=!0,x.enqueue(this.updateSubscription,w.Normal)))}newDependencies=new Set;_update(){if(!this.active)return;if(this.isEvaluating)throw new Error("Circular dependency detected in computed signal.");this.isEvaluating=!0,this.dirty=!1,this.error=null,this.newDependencies.clear(),J.push(this);let e,t=!1;try{e=this.getter()}catch(i){this.error=i,t=!0}finally{J.pop(),this.isEvaluating=!1}t||this.setValue(e);let s=[];for(let[i,r]of this.dependencies)this.newDependencies.has(i)||(i.unsubscribe(r),s.push(i));for(let i of s)this.dependencies.delete(i);for(let i of this.newDependencies)if(!this.dependencies.has(i)){let r=i.subscribe(()=>this.requestUpdate(),!0);this.dependencies.set(i,r)}}dispose(){this.active=!1;for(let[e,t]of this.dependencies)e.unsubscribe(t);this.dependencies.clear()}};var Pe=[],B=a(()=>Pe[Pe.length-1]||null,"getCurrentComponent"),N=a(n=>Pe.push(n),"pushComponent"),I=a(()=>Pe.pop(),"popComponent");var we=class{static{a(this,"KeyframesBuilder")}sheet;steps=[];constructor(e){this.sheet=e}step(e,t){let s=new E;return t(s),this.steps.push({selector:e,style:s}),this}from(e){return this.step("from",e)}to(e){return this.step("to",e)}at(e,t){let s=typeof e=="number"?`${e}%`:e;return this.step(s,t)}toString(e=""){return this.steps.map(t=>`${e}${t.selector} { ${this.sheet.formatPropsForBlock(t.style)} }`).join(`
|
|
2
|
-
`)}};var
|
|
1
|
+
var ke=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var a=(n,e)=>ke(n,"name",{value:e,configurable:!0});var wt=(n,e)=>{for(var t in e)ke(n,t,{get:e[t],enumerable:!0})},vt=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _t(e))!yt.call(n,i)&&i!==t&&ke(n,i,{get:()=>e[i],enumerable:!(s=bt(e,i))||s.enumerable});return n};var St=n=>vt(ke({},"__esModule",{value:!0}),n);var Dt={};wt(Dt,{DotComponent:()=>Qe,Link:()=>je,Priority:()=>w,Router:()=>be,currentHash:()=>z,currentPath:()=>P,currentSearch:()=>ge,dot:()=>b,generatePath:()=>Re,getGlobalRoutes:()=>qe,initScrollManager:()=>Ye,matchRoute:()=>ft,navigate:()=>G,previousPath:()=>Q,setGlobalRoutes:()=>ct,useHash:()=>We,useQueryParams:()=>Fe});module.exports=St(Dt);var F="_dotVDom",K=typeof process<"u"?process.env.NODE_ENV!=="production":(()=>{try{return new Function("return import.meta.env?.DEV")()}catch{return!1}})()??!1;var u=class{static{a(this,"Binding")}_isBinding=!0;_source;_transform;get isWritable(){return this._source.isWritable&&(!this._transform||!!this._transform.read)}get value(){return this._get()}_get(){return this._transform?.display?this._transform.display(this._source.value):this._source.value}_set(e){let t=this._transform?.read?this._transform.read(e):e;this._source.value=t}_subscribe(e,t=!1){return this._source._subscribe(this,e,t)}subscribe(e,t=!1){return this._subscribe(e,t)}_unsubscribe(e){this._source.unsubscribe(e)}unsubscribe(e){this._source.unsubscribe(e)}constructor(e){this._source=e}};var Y=class{static{a(this,"VMetaNode")}};function ue(n,e){if(n.parentNode!==e.parentNode)throw new Error("Start and end nodes must have the same parent.");let t=n.nextSibling;for(;t&&t!==e;){let s=t.nextSibling;t[F]?t[F]._unrender():t.parentNode?.removeChild(t),t=s}}a(ue,"removeNodesBetween");function Ve(n,e,t=new Map){if(n===e)return!0;if(n==null||e==null||typeof n!="object"||typeof e!="object")return!1;if(t.has(n))return t.get(n)===e;if(t.set(n,e),Array.isArray(n)&&Array.isArray(e)&&n.length!==e.length)return!1;for(let s in n)if(!e.hasOwnProperty(s)||!Ve(n[s],e[s],t))return!1;for(let s in e)if(!n.hasOwnProperty(s))return!1;return!0}a(Ve,"deepEqual");var _e=new RegExp("[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?","g");var c=class{static{a(this,"Vdom")}_dot;_onEnterHook;_onLeaveHook;constructor(e){this._dot=e}_unrenderAsync(){let t=this._getNodes().find(s=>s instanceof HTMLElement);if(this._onLeaveHook&&t){let s=this._onLeaveHook(t);if(s instanceof Promise)return s.then(()=>this._unrender())}this._unrender()}_moveBefore(e,t){let s=this._getNodes();if(s.length===0)return;let i=e?.parentElement||t;if(!i)throw new Error("Internal Error: Cannot move nodes without a parent.");for(let o=0;o<s.length;o++)if(s[o]===e)return;let r=(e?.ownerDocument||i.ownerDocument||document).createDocumentFragment();for(let o=0;o<s.length;o++)r.appendChild(s[o]);i.insertBefore(r,e)}__isRendered=!1;get _isRendered(){return this.__isRendered}set _isRendered(e){this.__isRendered=e}toString(){let e=document.createElement("div");return this._render(e),e.innerHTML}_renderBefore(e){let t=e.ownerDocument.createElement("div");for(this._render(t);t.childNodes.length>0;){let s=t.childNodes[0];s.parentElement.removeChild(s),e.parentElement.insertBefore(s,e)}}_renderAfter(e){if(e.nextSibling)this._renderBefore(e.nextSibling);else{let t=e.ownerDocument.createTextNode("");e.parentElement.appendChild(t),this._renderBefore(t),t.parentElement.removeChild(t)}}_moveTo(e){let t=this._getNodes();for(let s=0;s<t.length;s++)e.appendChild(t[s])}text(e){return null}html(e){return null}md(e){return null}mount(e,t){return null}append(e){return null}prepend(e){return null}when(e,t){return null}each(e,t){return null}otherwiseWhen(e,t,s){return null}otherwise(e){return null}attr(e,t){return null}style(e){return null}on(e,t){return null}onEnter(e){return null}onLeave(e){return null}empty(){return null}remove(){}};var R=class extends c{static{a(this,"TextVdom")}_text;textNode=null;observerId=0;constructor(e){super(),this._text=e}_render(e){this._text instanceof u?(this.textNode=e.ownerDocument.createTextNode(this._text._get()??""),this.observerId=this._text._subscribe(this)):this.textNode=e.ownerDocument.createTextNode(`${this._text??""}`),e.appendChild(this.textNode)}_unrender(){this.textNode&&(this.textNode.parentElement&&this.textNode.parentElement.removeChild(this.textNode),this.textNode=null),this.observerId&&this._text instanceof u&&(this._text._unsubscribe(this.observerId),this.observerId=0)}_getNodes(){return this.textNode?[this.textNode]:[]}_getLastChild(){return this}toString(){let e=document.createTextNode((this._text instanceof u?this._text._get():this._text)??""),t=document.createElement("div");return t.appendChild(e),t.innerHTML}};var T=class extends c{static{a(this,"FragmentVdom")}_children=[];constructor(e){super(e)}_render(e){this._isRendered=!0;for(let t=0;t<this._children.length;t++)this._children[t]._render(e)}_unrender(){if(this._isRendered){this._isRendered=!1;for(let e=0;e<this._children.length;e++)this._children[e]._unrender()}}_getNodes(){let e=[];for(let t=0;t<this._children.length;t++)e.push(...this._children[t]._getNodes());return e}_getLastChild(){return this._children[this._children.length-1]||null}};var w=(function(n){return n[n.Immediate=0]="Immediate",n[n.UserBlocking=1]="UserBlocking",n[n.Normal=2]="Normal",n[n.Background=3]="Background",n})({});var Ct=class{static{a(this,"Scheduler")}queues=[new Set,new Set,new Set,new Set];isPending=!1;startTime=0;frameYieldMs=5;isSync=!1;isSyncing=!1;onError;channel=typeof MessageChannel<"u"?new MessageChannel:null;constructor(){this.channel&&(this.channel.port1.onmessage=()=>this.workLoop())}enqueue(e,t=w.Normal){e.isQueued||(e.isQueued=!0,this.queues[t].add(e)),t===w.Immediate||this.isSync?this.flushSync():this.scheduleFlush()}scheduleFlush(){this.isPending||(this.isPending=!0,this.channel?this.channel.port2.postMessage(null):setTimeout(()=>this.workLoop(),0))}shouldYield(){return performance.now()-this.startTime>=this.frameYieldMs}workLoop(){for(this.startTime=performance.now(),this.isPending=!1;this.flushQueues();)if(this.shouldYield()){this.scheduleFlush();break}}flushQueues(){for(let e=w.Immediate;e<=w.Background;e++){let t=this.queues[e];if(t.size===0)continue;let s=Array.from(t);t.clear();for(let i=0;i<s.length;i++){let r=s[i];if(r.isQueued=!1,r.active)try{r.update()&&(r.isQueued=!0,t.add(r))}catch(o){this.onError?this.onError(o):console.error("Scheduler error:",o)}if(this.shouldYield()){for(let o=i+1;o<s.length;o++)t.add(s[o]);return!0}}}for(let e=w.Immediate;e<=w.Background;e++)if(this.queues[e].size>0)return!0;return!1}flushSync(){if(this.isSyncing)return;this.isSyncing=!0,this.isPending=!0;let e=this.shouldYield;this.shouldYield=()=>!1;try{let t=!0;for(;t;){t=!1;for(let s=w.Immediate;s<=w.Background;s++){let i=this.queues[s];if(i.size===0)continue;let r=Array.from(i);i.clear();for(let o of r)if(o.isQueued=!1,o.active)try{o.update()&&(o.isQueued=!0,i.add(o),t=!0)}catch(l){throw this.onError&&this.onError(l),l}i.size>0&&(t=!0)}}}finally{this.shouldYield=e,this.isPending=!1,this.isSyncing=!1}}setSync(e){this.isSync=e}clear(){for(let e of this.queues)e.clear();this.isPending=!1}},x=new Ct;var se=class n extends c{static{a(this,"CollectionVdom")}static MAX_BATCH_SIZE=128;value;renderCallback;startNode;endNode;observerId=0;mappedItems=[];updateState=null;constructor(e,t,s){super(e),this.value=t,this.renderCallback=s}_render(e){this.value instanceof u&&(this.observerId=this.value._subscribe(this)),this.startNode=e.ownerDocument.createTextNode(""),this.endNode=e.ownerDocument.createTextNode(""),e.appendChild(this.startNode),e.appendChild(this.endNode);let t=x.shouldYield;x.shouldYield=()=>!1;try{this.updateList()}finally{x.shouldYield=t}}_unrender(){this.observerId&&this.value instanceof u&&(this.value._unsubscribe(this.observerId),this.observerId=null);for(let e=0;e<this.mappedItems.length;e++){let t=this.mappedItems[e];t.vdom._unrender(),t.afterNode.parentElement.removeChild(t.afterNode)}this.mappedItems.length=0,this.startNode.parentElement.removeChild(this.startNode),this.endNode.parentElement.removeChild(this.endNode),this.startNode=null,this.endNode=null}_getNodes(){if(!this.startNode)return[];let e=[this.startNode];for(let t=0;t<this.mappedItems.length;t++)e.push(...this.mappedItems[t].vdom._getNodes()),e.push(this.mappedItems[t].afterNode);return e.push(this.endNode),e}_getLastChild(){return this}getTailAppendPrefixLength(e){let t=this.mappedItems;if(t.length===0||e.length<=t.length)return 0;for(let s=0;s<t.length;s++)if(e[s]!==t[s].keyValue)return 0;return t.length}isItemPositionedAfter(e,t){let s=e.vdom._getNodes();if(!s.length||!t.parentElement||s[0]!==t.nextSibling)return!1;let i=s[s.length-1];return e.afterNode===i.nextSibling}reuseExistingItem(e,t,s){if(e.value!==t&&!Ve(e.value,t)){e.vdom._unrender(),e.value=t;let i=this.renderCallback(t,this.value instanceof u?e.observableIndex:s,e.keyValue),r;i instanceof c?r=i:typeof i=="object"&&i?.build?(r=new T(this._dot),r.mount(i)):r=new R(i),r._root&&(r=r._root),e.vdom=r}else e.observableIndex._set(s)}getInsertBeforeAnchor(e,t){for(let s=e;s<t.length;s++)if(t[s].vdom._isRendered){let i=t[s].vdom._getNodes();if(i.length)return i[0]}return this.endNode}countConsecutiveUnrendered(e,t){let s=0;for(;e+s<t.length&&!t[e+s].vdom._isRendered&&s<n.MAX_BATCH_SIZE;)s++;return s}batchRenderNewItems(e,t,s){let i=t.ownerDocument.createDocumentFragment();for(let r of e)r.vdom._render(i),i.appendChild(r.afterNode);t.insertBefore(i,s)}removeItem(e){let t=e.vdom._unrenderAsync();if(t instanceof Promise)return t.then(()=>{e.afterNode.parentElement&&e.afterNode.parentElement.removeChild(e.afterNode)});e.afterNode.parentElement&&e.afterNode.parentElement.removeChild(e.afterNode)}updateList(){let e=null;this.value instanceof u?e=this.value._get():e=this.value;let t=Array.isArray(e)?e:Object.values(e);if(this.updateState&&(Ve(this.updateState.newItems,t)||(this.updateState=null)),!this.updateState){let i=null;this.value instanceof u&&(i=this.value._source.key??null);let r=t,o=Array.isArray(e)?r.map((h,f)=>i?h[i]:f):Object.keys(e).map((h,f)=>i?e[h][i]:h),l=this.getTailAppendPrefixLength(o),d=new Map;for(let h=0;h<this.mappedItems.length;h++){let f=this.mappedItems[h];h>=l&&d.set(f.keyValue,f)}this.updateState={newItems:r,newKeys:o,oldMap:d,nextMappedItems:[],currentIndex:0,lastNode:this.startNode,tailAppendPrefix:l,step:"diff"}}let s=this.updateState;if(s.step==="diff"){for(;s.currentIndex<s.newItems.length;){let i=s.newItems[s.currentIndex],r=s.newKeys[s.currentIndex];if(s.currentIndex<s.tailAppendPrefix){let o=this.mappedItems[s.currentIndex];this.reuseExistingItem(o,i,s.currentIndex),s.nextMappedItems.push(o)}else{let o=s.oldMap.get(r);if(o)s.oldMap.delete(r),this.reuseExistingItem(o,i,s.currentIndex),s.nextMappedItems.push(o);else{let d=new p().bind();d._set(s.currentIndex);let h=this.renderCallback(i,this.value instanceof u?d:s.currentIndex,r),f;h instanceof c?f=h:typeof h=="object"&&h?.build?(f=new T(this._dot),f.mount(h)):f=new R(h),f._root&&(f=f._root);let m=this.startNode.ownerDocument.createTextNode("");s.nextMappedItems.push({vdom:f,value:i,keyValue:r,afterNode:m,observableIndex:d})}}if(s.currentIndex++,x.shouldYield())return!0}s.step="cleanup"}if(s.step==="cleanup"){let i=Array.from(s.oldMap.values());for(let r of i)this.removeItem(r);s.step="reorder",s.currentIndex=0,this.mappedItems=[]}if(s.step==="reorder")for(;s.currentIndex<s.nextMappedItems.length;){let i=s.nextMappedItems[s.currentIndex];if(i.vdom._isRendered)this.isItemPositionedAfter(i,s.lastNode)?(s.lastNode=i.afterNode,this.mappedItems.push(i),s.currentIndex++):(i.vdom._moveBefore(s.lastNode.nextSibling,s.lastNode.parentElement),s.lastNode.parentElement.insertBefore(i.afterNode,i.vdom._getNodes().slice(-1)[0].nextSibling),s.lastNode=i.afterNode,this.mappedItems.push(i),s.currentIndex++);else{let r=this.countConsecutiveUnrendered(s.currentIndex,s.nextMappedItems);if(r>=2){let o=s.nextMappedItems.slice(s.currentIndex,s.currentIndex+r),l=s.lastNode.parentElement,d=this.getInsertBeforeAnchor(s.currentIndex+r,s.nextMappedItems);this.batchRenderNewItems(o,l,d);for(let h of o)s.lastNode=h.afterNode,this.mappedItems.push(h);s.currentIndex+=r}else i.vdom._renderAfter(s.lastNode),s.lastNode.parentElement.insertBefore(i.afterNode,i.vdom._getNodes().slice(-1)[0].nextSibling),s.lastNode=i.afterNode,this.mappedItems.push(i),s.currentIndex++}if(x.shouldYield())return!0}return this.updateState=null,!1}};var ne=class extends c{static{a(this,"ConditionalVdom")}conditions=[];sealed=!1;renderedIndex=-1;currentUpdatePromise=null;nextIndex=null;constructor(e){super(e)}addCondition(e,t,s=!1){if(this.sealed)throw new Error("Cannot add additional conditions to a sealed block.");this.sealed=s;let i={condition:e,vNode:t,startAnchor:null,endAnchor:null,observerId:0};this.conditions.push(i),this._isRendered&&(this.renderClause(i,this.conditions[0].startAnchor.parentElement),this.renderedIndex==-1&&this.updateConditions())}renderClause(e,t){if(e.startAnchor)throw new Error("Item is already rendered.");e.startAnchor=t.ownerDocument.createTextNode(""),e.endAnchor=t.ownerDocument.createTextNode(""),t.appendChild(e.startAnchor),t.appendChild(e.endAnchor),e.condition instanceof u&&(e.observerId=e.condition._subscribe(this))}_render(e){this._isRendered=!0;for(let t=0;t<this.conditions.length;t++)this.renderClause(this.conditions[t],e);this.updateConditions()}removeCNode(e){e.condition instanceof u&&(e.condition._unsubscribe(e.observerId),e.observerId=0);let t=e.startAnchor,s=e.endAnchor;t.parentElement.removeChild(t),s.parentElement.removeChild(s),e.startAnchor=null,e.endAnchor=null,e.vNode._unrender()}_unrender(){if(this._isRendered){this._isRendered=!1,this.renderedIndex=-1,this.nextIndex=null,this.currentUpdatePromise=null;for(let e=0;e<this.conditions.length;e++){let t=this.conditions[e];this.removeCNode(t)}}}_getNodes(){if(!this._isRendered)return[];let e=[];for(let t=0;t<this.conditions.length;t++){let s=this.conditions[t];e.push(s.startAnchor),t==this.renderedIndex&&e.push(...s.vNode._getNodes()),e.push(s.endAnchor)}return e}_getLastChild(){return this}updateConditions(){let e=-1;for(let t=0;t<this.conditions.length;t++){let s=this.conditions[t];if(s.condition instanceof u?s.condition._get():s.condition){e=t;break}}if(this.currentUpdatePromise){this.nextIndex=e;return}e!=this.renderedIndex&&this.performUpdate(e)}performUpdate(e){let t=this.renderedIndex;if(t!=-1){let i=this.conditions[t].vNode._unrenderAsync();if(i instanceof Promise){this.currentUpdatePromise=i,i.then(()=>{this.currentUpdatePromise=null,this.renderedIndex=-1,this.finishUpdate(e)});return}}this.renderedIndex=-1,this.finishUpdate(e)}finishUpdate(e){if(this.nextIndex!==null){let t=this.nextIndex;if(this.nextIndex=null,t!==e){this.performUpdate(t);return}}if(this.renderedIndex=e,this.renderedIndex!=-1){let t=this.conditions[this.renderedIndex];t.vNode._renderBefore(t.endAnchor)}if(this.nextIndex!==null){let t=this.nextIndex;this.nextIndex=null,t!==this.renderedIndex&&this.performUpdate(t)}}};var ce=class extends c{static{a(this,"HtmlVdom")}beforeNode;afterNode;_content;currentVdom=null;observerId=0;constructor(e,t){super(t),this._content=e}_toVdom(e){return e==null?null:e instanceof c||e?._root?e?._root||e:this._dot&&(typeof e=="object"&&e.build||Array.isArray(e))?this._dot.mount(e)._root:null}updateHtml(e){if(this.beforeNode){this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null),ue(this.beforeNode,this.afterNode);let t=this._toVdom(e);if(t)this.currentVdom=t,this.currentVdom._renderBefore(this.afterNode);else if(e!=null){let s=this.beforeNode.ownerDocument.createElement("div");for(s.innerHTML=e;s.firstChild;)this.afterNode.parentElement.insertBefore(s.firstChild,this.afterNode)}}}_render(e){let t="";this._content instanceof u?(t=this._content._get(),this.observerId=this._content._subscribe(this)):t=this._content,this.beforeNode=e.ownerDocument.createTextNode(""),this.afterNode=e.ownerDocument.createTextNode(""),e.appendChild(this.beforeNode),e.appendChild(this.afterNode),this.updateHtml(t)}_unrender(){if(this.beforeNode){this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null);let e=this.beforeNode.parentElement;ue(this.beforeNode,this.afterNode),e.removeChild(this.beforeNode),e.removeChild(this.afterNode),this.beforeNode=null,this.afterNode=null}this.observerId&&this._content instanceof u&&(this._content._unsubscribe(this.observerId),this.observerId=0)}update(e){this.updateHtml(e)}_getNodes(){if(!this.beforeNode)return[];let e=[this.beforeNode],t=this.beforeNode.nextSibling;for(;t&&t!==this.afterNode;)e.push(t),t=t.nextSibling;return e.push(this.afterNode),e}_getLastChild(){return this}toString(){return this.currentVdom?this.currentVdom.toString():this._content instanceof u?this._content._get():this._content}};var ie=class{static{a(this,"ReactiveAttr")}elementVdom;attribute;constructor(e,t){this.elementVdom=e,this.attribute=t}};var ye=class{static{a(this,"Subscription")}boundReactive;item;active=!0;isQueued=!1;constructor(e,t){this.boundReactive=e,this.item=t}update(){if(!this.active)return;let e=this.boundReactive._get();if(this.item instanceof R)this.item.textNode.textContent=e??"";else if(this.item._isReactiveVdom)this.item.update(e);else if(this.item instanceof ce)this.item.updateHtml(e);else if(this.item instanceof ie)this.item.elementVdom.updateReactiveAttr(this.item.attribute,e);else if(this.item instanceof Y)this.item.update();else{if(this.item instanceof se)return this.item.updateList();this.item instanceof ne?this.item.updateConditions():this.item instanceof Function&&this.item(e)}}};var Z=[];var xt=7,Ms=xt+1,p=class{static{a(this,"Signal")}_isSignal=!0;_isRef=!1;bindAs(e){let t=new u(this);return e.call&&e.apply?t._transform={display:e}:t._transform=e,t}bind(){return new u(this)}_value;key;subscribers=new Map;get isWritable(){return!0}constructor(){}get value(){let e=Z[Z.length-1];return e&&e.addDependency&&e.addDependency(this),this._value}set value(e){this.setValue(e)}getValue(){return this.value}setValue(e,t=w.Normal){this._value!==e&&(this._value=e,this.updater(this._value,t))}updater(e,t=w.Normal){for(let s of this.subscribers.values())s.sync?s.update():(!s.isQueued||t===w.Immediate)&&x.enqueue(s,t)}nextId=1;subscribe(e,t=!1){return new u(this)._subscribe(e,t)}_subscribe(e,t,s=!1){let i=this.nextId++,r=new ye(e,t);return r.sync=s,this.subscribers.set(i,r),i}unsubscribe(e){this.subscribers.has(e)&&(this.subscribers.get(e).active=!1,this.subscribers.delete(e))}_detachBinding(e){this.unsubscribe(e)}refresh(e=w.Normal){let t=this.value;this.updater(t,e)}updateObservers(e=w.Normal){this.refresh(e)}};var re=class extends Y{static{a(this,"AttributeVNode")}attr;value;target;observables={};constructor(e,t){super(),this.attr=e,this.value=t}render(e){this.target=e;for(let t in this.value){let s=this.value[t];if(s instanceof p&&(s=s.bind()),s&&s instanceof u){let i=s._subscribe(this);this.observables[i]=s}}this.update()}update(){if(!this.target)return;let e=[];for(let t in this.value){let s=this.value[t];s&&(s instanceof p&&(s=s.bind()),(!(s instanceof u)||s._get())&&e.push(t))}e.length>0?this.target.setAttribute(this.attr,e.join(" ")):this.target.removeAttribute(this.attr)}unrender(){this.target=null;for(let e in this.observables)this.observables[e]._unsubscribe(Number(e));this.observables={}}};var Ge={color:"color|background-Color|border-Bottom-Color|border-Color|border-Left-Color|border-Right-Color|border-Top-Color|text-Decoration-Color|outline-Color|column-Rule-Color",length:"background-Size|block-Size|border-Bottom-Left-Radius|border-Bottom-Right-Radius|border-Bottom-Width|border-Left-Width|border-Radius|border-Right-Width|border-Top-Left-Radius|border-Top-Right-Radius|border-Top-Width|border-Width|bottom|gap|height|left|margin|margin-Bottom|margin-Left|margin-Right|margin-Top|max-Height|max-Width|min-Height|min-Width|padding|padding-Bottom|padding-Left|padding-Right|padding-Top|right|top|width|flex-Basis|font-Size|text-Indent|letter-Spacing|word-Spacing|border-Spacing|outline-Offset|outline-Width|column-Gap|column-Rule-Width|grid-Column-Gap|grid-Gap|grid-Row-Gap|column-Width|perspective|row-Gap",hybrid:"line-Height|border-Image-Width|border-Image-Outset|tab-Size|flex",url:"background-Image|border-Image|list-Style-Image|content|image-Orientation",transformation:"transform",filter:"filter|backdrop-Filter",time:"animation-Delay|animation-Direction|animation-Duration|transition-Duration|transition-Delay",misc:"appearance|aspect-Ratio|opacity|background|background-Attachment|background-Blend-Mode|background-Position|background-Repeat|background-Clip|background-Origin|border|border-Bottom|border-Bottom-Style|border-Image-Repeat|border-Image-Slice|border-Image-Source|border-Left|border-Left-Style|border-Right|border-Right-Style|border-Style|border-Top|border-Top-Style|box-Decoration-Break|box-Shadow|clear|clip|display|float|overflow|box|overflow-X|overflow-Y|position|visibility|vertical-Align|z-Index|align-Content|align-Items|align-Self|flex-Direction|flex-Flow|flex-Grow|flex-Shrink|flex-Wrap|grid|grid-Area|grid-Auto-Columns|grid-auto-Rows|grid-Column|grid-Column-End|grid-Column-Start|grid-Row|grid-Row-End|grid-Row-Start|grid-Template|grid-Template-Areas|grid-Template-Columns|grid-Template-Rows|justify-Content|order|hanging-Punctuation|hyphens|line-Break|overflow-Wrap|text-Align|text-Align-Last|text-Combine-Upright|text-Justify|text-Transform|white-Space|word-Break|word-Wrap|text-Decoration|text-Decoration-Line|text-Decoration-Style|text-Shadow|text-Underline-Position|font|font-Family|font-Feature-Settings|font-Kerning|font-Language-Override|font-Size-Adjust|font-Stretch|font-Style|font-Synthesis|font-Variant|font-Variant-Alternates|font-Variant-Caps|font-Variant-East-Asian|font-Variant-Ligatures|font-Variant-Numeric|font-Variant-Position|font-Weight|direction|text-Orientation|text-Combine-Upright|unicode-Bidi|user-Select|writing-Mode|border-Collapse|caption-Side|empty-Cells|table-Layout|counter-Increment|counter-Reset|list-Style|list-Style-Position|list-Style-Type|animation|animation-Fill-Mode|animation-Iteration-Count|animation-Name|animation-Play-State|animation-Timing-Function|animation-Timeline|container-Type|container-Name|backface-Visibility|perspective2d|perspective-Origin|transform-Origin|transform-Style|transition|transition-Property|transition-Timing-Function|box-Sizing|cursor|ime-Mode|nav-Down|nav-Index|nav-Left|nav-Right|nav-Up|outline|outline-Style|resize|text-Overflow|break-After|break-Before|break-Inside|column-Count|column-Fill|column-Rule|column-Rule-Style|column-Span|columns|widows|orphans|page-Break-After|page-Break-Before|page-Break-Inside|marks|quotes|image-Rendering|image-Resolution|object-Fit|object-Position|mask|mask-Type|mark|mark-After|mark-Before|phonemes|rest|rest-After|rest-Before|voice-Balance|voice-Duration|voice-Pitch|voice-Pitch-Range|voice-Rate|voice-Stress|voice-Volume|marquee-Direction|marquee-Play-Count|marquee-Speed|marquee-Style|pointer-Events"},Et="Cm|Mm|In|Px|Pt|Pc|Ch|Em|Ex|Lh|Rem|Vh|Vw|Vmin|Vmax|Cqw|Cqh|Cqi|Cqb|Cqmin|Cqmax|P".split("|"),Nt="Ms|S".split("|"),It="Deg|Grad|Rad|Turn".split("|"),kt="Hz|Khz".split("|"),fe={};for(let n in Ge){let e=Ge[n].split("|");for(let t of e){let s=t.split("-").join("");switch(n){case"hybrid":case"length":{for(let i of Et)fe[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i=="P"?"%":i.toLowerCase()};break}case"time":{for(let i of Nt)fe[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i.toLowerCase()};break}case"angle":{for(let i of It)fe[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i.toLowerCase()};break}case"frequency":{for(let i of kt)fe[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i.toLowerCase()};break}default:break}fe[s]={dotName:s,cssName:t.toLowerCase(),type:n,unit:void 0}}}var oe=fe;var V=class{static{a(this,"CssFunctionBuilderVStyle")}funcs=[];propName;constructor(e){this.propName=e}toString(){let e="";for(let t of this.funcs){let s=Array.from(t.args).map(i=>{let r=i.v!==void 0?i.v:i,o=i.f||(l=>`${l}`);return r instanceof u?o(r._get()):r instanceof p?o(r.value):o(r).toString().split(" ").join(", ")}).join(", ");e+=`${t.func}(${s}) `}return e.trim()}appendFunction(e,t){return this.funcs.push({func:e,args:t}),this}};function y(n,e="px"){if(n=n||"0px",n instanceof u&&(n=n._get()),n instanceof p&&(n=n.value),n instanceof Array)return n.map(s=>y(s,e)).join(" ");isNaN(n)||(n=n+e);let t=n.trim().split(" ");if(t.length>1)return t.map(s=>y(s,e)).join(" ");{let s=Number(n.match(_e)[0]),i=n.split(_e)[1]||e;return`${s}${i}`}}a(y,"formatCssLength");function Le(n){if(n=n||"0%",n instanceof u&&(n=n._get()),n instanceof p&&(n=n.value),n instanceof Array)return n.map(t=>Le(t)).join(" ");let e=n.trim().split(" ");return e.length>1?e.map(t=>Le(t)).join(" "):isNaN(n)?n:`${n}%`}a(Le,"formatCssPercentage");function Xe(n){if(typeof n=="number"){let e=0,t=0,s=0,i=1;return s=n&255,n>>=8,t=n&255,n>>=8,e=n&255,`rgb(${e} ${t} ${s})`}else if(typeof n=="string")return n}a(Xe,"formatCssColor");function D(n){if(n=n||"0deg",n instanceof u&&(n=n._get()),n instanceof p&&(n=n.value),n instanceof Array)return n.map(t=>D(t)).join(" ");isNaN(n)||(n=`${n}deg`);let e=n.trim().split(" ");if(e.length>1)return e.map(t=>D(t)).join(" ");{let t=Number(n.match(_e)[0]),s=n.split(_e)[1]||"deg";return`${t}${s}`}}a(D,"formatCssAngle");var W=class extends V{static{a(this,"FilterVStyle")}blur(e){return this.appendFunction("blur",[{v:e,f:y}])}brightness(e){return this.appendFunction("brightness",[{v:e,f:Le}])}contrast(e){return this.appendFunction("contrast",[{v:e,f:y}])}dropShadow(e,t,s,i){return this.appendFunction("drop-shadow",[{v:e,f:y},{v:t,f:y},{v:s,f:y},{v:i,f:Xe}])}grayscale(e){return this.appendFunction("grayscale",[{v:e,f:y}])}hueRotate(e){return this.appendFunction("hue-rotate",[{v:e,f:y}])}invert(e){return this.appendFunction("invert",[{v:e,f:y}])}opacity(e){return this.appendFunction("opacity",[{v:e,f:y}])}sepia(e){return this.appendFunction("sepia",[{v:e,f:y}])}saturate(e){return this.appendFunction("saturate",[{v:e,f:y}])}};var H=class extends V{static{a(this,"TransformVStyle")}matrix3d(e,t,s,i,r,o,l,d,h,f,m,S,g,_,k,X){return this.appendFunction("matrix3d",arguments)}matrix(e,t,s,i,r,o){return this.appendFunction("matrix",arguments)}translate(e,t){return arguments.length==1?this.appendFunction("translate",[{f:y,v:e}]):this.appendFunction("translate",[{f:y,v:e},{f:y,v:t}])}translate3d(e,t,s){return this.appendFunction("translate3d",[{f:y,v:e},{f:y,v:t},{f:y,v:s}])}translateX(e){return this.appendFunction("translateX",[{f:y,v:e}])}translateY(e){return this.appendFunction("translateY",[{f:y,v:e}])}translateZ(e){return this.appendFunction("translateZ",[{f:y,v:e}])}scale(e,t){return this.appendFunction("scale",[e,t??1])}scale3d(e,t,s){return this.appendFunction("scale3d",[e,t,s])}scaleX(e){return this.appendFunction("scaleX",[e])}scaleY(e){return this.appendFunction("scaleY",[e])}scaleZ(e){return this.appendFunction("scaleZ",[e])}rotate(e){return this.appendFunction("rotate",[{f:D,v:e}])}rotate3d(e,t,s,i){return this.appendFunction("rotate3d",[e,t,s,{f:D,v:i}])}rotate3dDeg(e,t,s,i){return this.rotate3d(e,t,s,i)}rotate3dRad(e,t,s,i){return this.rotate3d(e,t,s,`${i}rad`)}rotate3dGrad(e,t,s,i){return this.rotate3d(e,t,s,`${i}grad`)}rotate3dTurn(e,t,s,i){return this.rotate3d(e,t,s,`${i}turn`)}rotateX(e){return this.appendFunction("rotateX",[{f:D,v:e}])}rotateY(e){return this.appendFunction("rotateY",[{f:D,v:e}])}rotateZ(e){return this.appendFunction("rotateZ",[{f:D,v:e}])}skew(e,t){return arguments.length==1?this.appendFunction("skew",[{f:D,v:e}]):this.appendFunction("skew",[{f:D,v:e},{f:D,v:t}])}skewX(e){return this.appendFunction("skewX",[{f:D,v:e}])}skewY(e){return this.appendFunction("skewY",[{f:D,v:e}])}perspective(e){return this.appendFunction("perspective",[{f:y,v:e}])}};var E=class n{static{a(this,"BaseVStyle")}_isBase=!1;props=[];onUpdate;setProp(e,t){return this._isBase?new n().setProp(e,t):(this.props.push({prop:e,value:t}),this.onUpdate&&this.onUpdate(),this)}_setOnUpdate(e){this.onUpdate=e}variable(e,t){return e.startsWith("--")||(e="--"+e),this.setProp(e,t)}v(e){return e.startsWith("--")||(e="--"+e),`var(${e})`}getProps(){return this.props}};for(let n in oe)E.prototype[n]=function(e){return this.setProp(n,e)};var M=class extends Y{static{a(this,"StyleVNode")}target;document;shadowRoot;styleSource;styleElement;observables=[];observableIds=[];isQueued=!1;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.applyStyles()},"update")};constructor(e){super(),this.styleSource=e,this.styleSource instanceof E&&this.styleSource._setOnUpdate(()=>this.update()),this.extractObservables()}extractObservables(){let e=this.styleSource instanceof E?this.styleSource.getProps():this.styleSource;if(Array.isArray(e))for(let t=0;t<e.length;t++){let s=e[t];this.processValue(s.prop,s.value,i=>s.value=i)}else for(let t in e)this.processValue(t,e[t],s=>e[t]=s)}processValue(e,t,s){if(!this.tryExtractObservable(t)&&typeof t=="object"&&t!==null&&!(t instanceof V)){let i;switch(e){case"filter":{i=new W(e);break}case"transform":{i=new H(e);break}}if(i){let r=Array.isArray(t)?t:[t];for(let o of r)for(let l in o){let d=o[l];if(this.tryExtractObservable(d),Array.isArray(d))for(let f of d)this.tryExtractObservable(f);let h=l.replace(/_\d+$/,"");typeof i[h]=="function"&&(Array.isArray(d)?i[h](...d):i[h](d))}s(i)}}}tryExtractObservable(e){if(e instanceof u||e instanceof p){if(this.observables.indexOf(e)===-1&&(this.observables.push(e),this.target)){let t=e.subscribe(()=>this.update());this.observableIds.push(t)}return!0}return!1}render(e,t=window.document,s){this.target=e,this.document=t,this.shadowRoot=s;for(let i of this.observables){let r=i.subscribe(()=>this.update());this.observableIds.push(r)}typeof e=="string"&&(this.styleElement=this.document.createElement("style"),this.shadowRoot?this.shadowRoot.appendChild(this.styleElement):this.document.head.appendChild(this.styleElement)),this.applyStyles()}update(){this.isQueued||(this.isQueued=!0,x.enqueue(this.updateSubscription,w.Normal))}applyStyles(){if(this.target)if(typeof this.target=="string")this.styleElement&&(this.styleElement.textContent=`${this.target} { ${this.getStyleString()} }`);else{this.extractObservables();let e=this.styleSource instanceof E?this.styleSource.getProps():this.styleSource;if(Array.isArray(e))for(let t of e){let s=t.value instanceof u?t.value._get():t.value instanceof p?t.value.value:t.value;this.applySingleStyle(t.prop,s)}else for(let t in e){let s=e[t]instanceof u?e[t]._get():e[t]instanceof p?e[t].value:e[t];this.applySingleStyle(t,s)}}}applySingleStyle(e,t){let s;if(t instanceof V)s=t.toString();else if(typeof t=="object"&&t!==null&&(e==="transform"||e==="filter")){let l=e==="transform"?new H(e):new W(e);this.applyObjectToBuilder(l,t),s=l.toString()}else s=t;let i=e,r,o=oe[e];o&&(i=o.cssName,r=o.unit,(o.type==="length"||o.type==="hybrid")&&typeof s=="number"?o.type==="hybrid"&&r===void 0||(s=y(s,r)):o.unit&&typeof s=="number"&&(s=`${s}${o.unit}`)),this.target instanceof HTMLElement&&this.target.style.setProperty(i,`${s}`)}getStyleString(){let e="",t=this.styleSource instanceof E?this.styleSource.getProps():this.styleSource;if(Array.isArray(t))for(let s of t)e+=this.formatSingleStyle(s.prop,s.value);else for(let s in t)e+=this.formatSingleStyle(s,t[s]);return e}applyObjectToBuilder(e,t){let s=Array.isArray(t)?t:[t];for(let i of s)for(let r in i){let o=i[r],l=r.replace(/_\d+$/,"");typeof e[l]=="function"&&(Array.isArray(o)?e[l](...o):e[l](o))}}formatSingleStyle(e,t){let s=t instanceof u?t._get():t instanceof p?t.value:t;if(s instanceof V)s=s.toString();else if(typeof s=="object"&&s!==null&&(e==="transform"||e==="filter")){let l=e==="transform"?new H(e):new W(e);this.applyObjectToBuilder(l,s),s=l.toString()}let i=e,r,o=oe[e];return o&&(i=o.cssName,r=o.unit,(o.type==="length"||o.type==="hybrid")&&typeof s=="number"?o.type==="hybrid"&&r===void 0||(s=y(s,r)):o.unit&&typeof s=="number"&&(s=`${s}${o.unit}`)),`${i}: ${s}; `}unrender(){for(let e=0;e<this.observableIds.length;e++){let t=this.observableIds[e],s=this.observables[e];s instanceof u?s._unsubscribe(t):s.unsubscribe(t)}this.observableIds=[],this.observables=[],this.styleElement&&(this.styleElement.remove(),this.styleElement=null),this.target=null,this.updateSubscription.active=!1}toString(){return typeof this.target=="string"?`${this.target} { ${this.getStyleString()} }`:this.getStyleString()}};var we=class{static{a(this,"SyntheticEvent")}nativeEvent;target;currentTarget;type;timeStamp;defaultPrevented;detail;_propagationStopped=!1;_immediatePropagationStopped=!1;constructor(e){this.nativeEvent=e,this.target=e.target,this.currentTarget=e.currentTarget,this.type=e.type,this.timeStamp=e.timeStamp,this.defaultPrevented=e.defaultPrevented,this.detail=e.detail}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this._propagationStopped=!0,this.nativeEvent.stopPropagation()}stopImmediatePropagation(){this._immediatePropagationStopped=!0,this._propagationStopped=!0,this.nativeEvent.stopImmediatePropagation()}isPropagationStopped(){return this._propagationStopped}isImmediatePropagationStopped(){return this._immediatePropagationStopped}};var J=class n{static{a(this,"EventManager")}static managers=new Map;static getForDocument(e){let t=this.managers.get(e);return t||(t=new n(e),this.managers.set(e,t)),t}document;listeners=new WeakMap;activeEventTypes=new Set;constructor(e){this.document=e}addListener(e,t,s,i=[]){let r=this.listeners.get(e);r||(r=new Map,this.listeners.set(e,r));let o=r.get(t);o||(o=[],r.set(t,o)),o.push({handler:s,modifiers:i}),this.ensureGlobalListener(t)}removeListener(e,t,s){let i=this.listeners.get(e);if(!i)return;let r=i.get(t);if(!r)return;let o=r.findIndex(l=>l.handler===s);o!==-1&&r.splice(o,1),r.length===0&&i.delete(t)}ensureGlobalListener(e){if(this.activeEventTypes.has(e))return;let t=e==="focus"||e==="blur";this.document.addEventListener(e,s=>{this.dispatchEvent(e,s)},t),this.activeEventTypes.add(e)}dispatchEvent(e,t){let s=t.composedPath();if(!s||s.length===0){s=[];let r=t.target;for(;r;)s.push(r),r=r.parentNode||r.host}let i=new we(t);for(let r of s){if(r===this.document||r===window)continue;let o=this.listeners.get(r);if(!o)continue;let l=o.get(e);if(l){i.currentTarget=r;for(let{handler:d,modifiers:h}of[...l])if(!(h.includes("self")&&t.target!==r)&&(h.includes("stop")&&i.stopPropagation(),h.includes("prevent")&&i.preventDefault(),d(i),h.includes("once")&&this.removeListener(r,e,d),i.isImmediatePropagationStopped()))break;if(i.isPropagationStopped())break}}}};var L=class extends c{static{a(this,"ElementVdom")}_children=null;get children(){return this._children||(this._children=new v(this._dot),this._children._parent=this),this._children}set children(e){this._children=e}element;tag=null;attributes={};events=[];attributeObserverIds=[];childBuilders=[];attrVNodes=[];styleVNodes=[];ref;inputListener;compositionStartListener;compositionEndListener;manualInputAllowed=!0;isComposing=!1;activeBindings={};lastSyncedValues={};constructor(e,t){super(e),this.tag=t}_render(e){this._isRendered=!0,this.element=e.ownerDocument.createElement(this.tag),this.element[F]=this,this.ref&&(typeof this.ref=="function"?this.ref(this.element):this.ref.value=this.element),e.appendChild(this.element),this._children&&this._children._render(this.element);for(let t=0;t<this.events.length;t++){let s=this.events[t];this.renderEvent(s.name,s.callback,s.modifiers)}this.attributes.type!==void 0&&this.renderAttr("type",this.attributes.type,this.element);for(let t in this.attributes)t!=="type"&&this.renderAttr(t,this.attributes[t],this.element);this._onEnterHook&&this._onEnterHook(this.element)}_unrender(){if(!this._isRendered||(this._isRendered=!1,this._children&&this._children._unrender(),!this.element))return;let e=J.getForDocument(this.element.ownerDocument);this.inputListener&&(e.removeListener(this.element,"input",this.inputListener),this.inputListener=null),this.compositionStartListener&&(e.removeListener(this.element,"compositionstart",this.compositionStartListener),this.compositionStartListener=null),this.compositionEndListener&&(e.removeListener(this.element,"compositionend",this.compositionEndListener),this.compositionEndListener=null);for(let t=0;t<this.events.length;t++){let s=this.events[t];e.removeListener(this.element,s.name.toLowerCase(),s.callback)}this.element.parentNode?.removeChild(this.element);for(let t=0;t<this.childBuilders.length;t++)this.childBuilders[t]._unrender();this.childBuilders.length=0;for(let t=0;t<this.attrVNodes.length;t++)this.attrVNodes[t].unrender();this.attrVNodes.length=0;for(let t=0;t<this.styleVNodes.length;t++)this.styleVNodes[t].unrender();this.styleVNodes.length=0;for(let t=0;t<this.attributeObserverIds.length;t++){let s=this.attributeObserverIds[t];s.observable._unsubscribe(s.id)}this.attributeObserverIds.length=0,this.ref&&(typeof this.ref=="function"?this.ref(null):this.ref.value=null),this.element=null}_getNodes(){return this.element?[this.element]:[]}_getLastChild(){return this}toString(){return this.element?this.element.outerHTML:super.toString()}setAttr(e,t){e=(e??"").toLowerCase();let s=e;if(e=="bind"){let r=this.attributes.type;r instanceof u?r=r._get():r instanceof p&&(r=r.value);let o=typeof r=="string"?r.toLowerCase():null;s=this.tag.toLowerCase()=="input"&&(o=="checkbox"||o=="radio")?"checked":"value"}let i=this.attributes[e];if(i instanceof M){i.unrender();let r=this.styleVNodes.indexOf(i);r!==-1&&this.styleVNodes.splice(r,1)}if(i instanceof re){i.unrender();let r=this.attrVNodes.indexOf(i);r!==-1&&this.attrVNodes.splice(r,1)}for(let r=0;r<this.attributeObserverIds.length;r++){let o=this.attributeObserverIds[r];if(o.attr===e||o.attr===s){o.observable._unsubscribe(o.id),this.attributeObserverIds.splice(r,1);break}}if(t&&typeof t=="object"&&!(t instanceof Array||t instanceof u||t?._isBinding||t instanceof p||t?._isSignal||t instanceof E))switch(e){case"style":{t=new M(t);break}case"ref":break;default:{t=new re(e,t);break}}if(typeof t=="function"&&e==="style"){let r=new E;t(r),t=new M(r)}t instanceof E&&e==="style"&&(t=new M(t)),this.attributes[e]=t,this.element&&this.renderAttr(e,t,this.element)}updateReactiveAttr(e,t){this.element&&this.renderAttr((e??"").toLowerCase(),t,this.element)}renderAttr(e,t,s,i=!1){if(e=="bind"){let r=this.attributes.type;r instanceof u?r=r._get():r instanceof p&&(r=r.value);let o=typeof r=="string"?r.toLowerCase():null;e=this.tag.toLowerCase()=="input"&&(o=="checkbox"||o=="radio")?"checked":"value",i=!0}if(e=="ref")this.ref=t,this.element&&(typeof this.ref=="function"?this.ref(this.element):this.ref.value=this.element);else if(typeof t=="string"||typeof t=="number")e=="value"&&(this.tag.toLowerCase()=="input"||this.tag.toLowerCase()=="textarea"||this.tag.toLowerCase()=="select")?(s.value=t??"",this.lastSyncedValues[e]=t??""):s.setAttribute(e,`${t}`);else if(typeof t=="boolean"||t==null||t==null)e=="checked"&&this.tag.toLowerCase()=="input"?(s.checked=!!t,this.lastSyncedValues[e]=!!t):e=="selected"&&this.tag.toLowerCase()=="option"?s.selected=!!t:e=="value"&&(this.tag.toLowerCase()=="input"||this.tag.toLowerCase()=="textarea"||this.tag.toLowerCase()=="select")&&(s.value=t??"",this.lastSyncedValues[e]=t??""),t?s.setAttribute(e,`${t}`):s.removeAttribute(e);else if(t instanceof Array)s.setAttribute(e,t.join(" "));else if(t instanceof u||t?._isBinding){if(this.renderAttr(e,t._get(),s,i),!this.attributeObserverIds.some(r=>r.attr===e&&r.observable===t)){let r=t._subscribe(new ie(this,e));this.attributeObserverIds.push({id:r,observable:t,attr:e})}if((e=="value"||e=="checked")&&t.isWritable&&i&&(this.activeBindings[e]=t,!this.inputListener)){this.inputListener=o=>{if(!this.isComposing)try{let l=o.target.type==="checkbox"||o.target.type==="radio"?"checked":"value",d=this.activeBindings[l];if(!d)return;let h=this.element[l],f=d._get(),m=this.lastSyncedValues[l];f==m&&h!=m&&d._set(h),this.lastSyncedValues[l]=d._get()}catch(l){console.error("CAUGHT ERROR: "+l.message)}},this.compositionStartListener=()=>{this.isComposing=!0},this.compositionEndListener=o=>{this.isComposing=!1,this.inputListener(o)};let r=J.getForDocument(this.element.ownerDocument);r.addListener(this.element,"input",this.inputListener),r.addListener(this.element,"compositionstart",this.compositionStartListener),r.addListener(this.element,"compositionend",this.compositionEndListener)}}else t instanceof re?(t.render(s),this.attrVNodes.push(t)):t instanceof M&&(t.render(s),this.styleVNodes.push(t))}addEventListener(e,t,s=[]){this.events.some(i=>i.name===e&&i.callback===t)||(this.events.push({name:e,callback:t,modifiers:s}),this.element&&this.renderEvent(e,t,s))}renderEvent(e,t,s=[]){J.getForDocument(this.element.ownerDocument).addListener(this.element,e.toLowerCase(),t,s)}};var v=class extends c{static{a(this,"ContainerVdom")}_children=[];_parent=null;element=null;constructor(e){super(e)}_addChild(e){return this._children.push(e),this.element?e._render(this.element):this._parent&&this._parent instanceof L&&this._parent.element&&e._render(this._parent.element),this}_prependChild(e){return this._children.unshift(e),this.element?this.element.firstChild?e._renderBefore(this.element.firstChild):e._render(this.element):this._parent&&this._parent instanceof L&&this._parent.element&&(this._parent.element.firstChild?e._renderBefore(this._parent.element.firstChild):e._render(this._parent.element)),this}_render(e){this._isRendered=!0,this.element=e;for(let t=0;t<this._children.length;t++)this._children[t]._render(e)}_unrender(){if(this._isRendered){this._isRendered=!1,this.element=null;for(let e=0;e<this._children.length;e++)this._children[e]._unrender()}}_getNodes(){let e=[];for(let t=0;t<this._children.length;t++)e.push(...this._children[t]._getNodes());return e}_getLastChild(){return this._children[this._children.length-1]||null}};var Ke={onAbort:1,onBlur:1,onChange:1,onInput:1,onCanPlay:1,onCantPlayThrough:1,onClick:1,onCopy:1,onContextMenu:1,onCueChange:1,onCut:1,onDblClick:1,onDrag:1,onDragEnd:1,onDragEnter:1,onDragLeave:1,onDragOver:1,onDragStart:1,onDrop:1,onDurationChange:1,onEmptied:1,onEnded:1,onError:1,onFocus:1,onHashChange:1,onInvalid:1,onKeyDown:1,onKeyPress:1,onKeyUp:1,onLoad:1,onLoadedData:1,onLoadedMetadata:1,onLoadStart:1,onMouseDown:1,onMouseEnter:1,onMouseLeave:1,onMouseMove:1,onMouseOut:1,onMouseOver:1,onMouseUp:1,onPointerCancel:1,onPointerDown:1,onPointerEnter:1,onPointerLeave:1,onPointerMove:1,onPointerOut:1,onPointerOver:1,onPointerUp:1,onTouchStart:1,onTouchEnd:1,onTouchCancel:1,onTouchMove:1,onMouseWheel:1,onOffline:1,onOnline:1,onPageHide:1,onPagePaste:1,onPageShow:1,onPause:1,onPlay:1,onPlaying:1,onPopState:1,onProgress:1,onRateChange:1,onReset:1,onResize:1,onScroll:1,onSearch:1,onSeeked:1,onSeeking:1,onSelect:1,onStalled:1,onStorage:1,onSubmit:1,onSuspend:1,onTimeUpdate:1,onToggle:1,onUnload:1,onVolumeChange:1,onWaiting:1,onWheel:1};var De=a(n=>n instanceof v||n instanceof c||n?._root||n?._children||typeof n=="object"&&n?.build||n instanceof p||n?._isSignal||n instanceof u||n?._isBinding||typeof n=="string"||typeof n=="number"||typeof n=="boolean"||Array.isArray(n),"isContent"),O=a((n,e,t)=>{let s=e instanceof L?e.children:e;if(Array.isArray(t))for(let i=0;i<t.length;i++)O(n,e,t[i]);else if(t?._root)O(n,e,t._root);else if(Array.isArray(t?._children)){let i=t._children;if(i&&i.length>0)for(let r=0;r<i.length;r++)s._addChild(i[r])}else if(t instanceof c)s._addChild(t);else if(typeof t=="object"&&t?.build)s.mount(t);else if(t!=null){let i=t;(i instanceof p||i?._isSignal)&&(i=i.bind()),i instanceof u||i?._isBinding?s._addChild(new pe(n,i)):s._addChild(new R(i))}},"applyContent"),Vt=a((n,e)=>{for(let t in e){let s=e[t];(s instanceof p||s?._isSignal)&&!s?._isRef&&(s=s.bind());let i=t,r=[];if(t.includes(".")){let l=t.split(".");i=l[0],r=l.slice(1)}if(Ke[i]||i.startsWith("on")&&i[2]&&i[2]===i[2].toUpperCase()){if(typeof e[t]!="function")throw new Error(`Value of event attribute ${t} must be a function.`);n.addEventListener(i.substring(2).toLowerCase(),s,r)}else n.setAttr(t,s)}},"applyAttributes"),Be=a((n,e,t)=>{let s=new L(n,e);for(let i=0;i<t.length;i++){let r=t[i];De(r)?O(n,s,r):r&&typeof r=="object"&&Vt(s,r)}return s},"createElement");var C=class extends p{static{a(this,"Computed")}getter;dependencies=new Map;isQueued=!1;isEvaluating=!1;active=!0;dirty=!0;error=null;get isWritable(){return!1}updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.dirty&&this._update()},"update")};constructor(e){super(),this.getter=e,this._update()}get value(){if(this.isEvaluating)throw new Error("Circular dependency detected in computed signal.");if(this.dirty&&this._update(),this.error)throw this.error;return super.value}addDependency(e){this.active&&(this.newDependencies.has(e)||this.newDependencies.add(e))}requestUpdate(){this.active&&(this.dirty=!0,this.isQueued||(this.isQueued=!0,x.enqueue(this.updateSubscription,w.Normal)))}newDependencies=new Set;_update(){if(!this.active)return;if(this.isEvaluating)throw new Error("Circular dependency detected in computed signal.");this.isEvaluating=!0,this.dirty=!1,this.error=null,this.newDependencies.clear(),Z.push(this);let e,t=!1;try{e=this.getter()}catch(i){this.error=i,t=!0}finally{Z.pop(),this.isEvaluating=!1}t||this.setValue(e);let s=[];for(let[i,r]of this.dependencies)this.newDependencies.has(i)||(i.unsubscribe(r),s.push(i));for(let i of s)this.dependencies.delete(i);for(let i of this.newDependencies)if(!this.dependencies.has(i)){let r=i.subscribe(()=>this.requestUpdate(),!0);this.dependencies.set(i,r)}}dispose(){this.active=!1;for(let[e,t]of this.dependencies)e.unsubscribe(t);this.dependencies.clear()}};var Pe=[],$=a(()=>Pe[Pe.length-1]||null,"getCurrentComponent"),N=a(n=>Pe.push(n),"pushComponent"),I=a(()=>Pe.pop(),"popComponent");var ve=class{static{a(this,"KeyframesBuilder")}sheet;steps=[];constructor(e){this.sheet=e}step(e,t){let s=new E;return t(s),this.steps.push({selector:e,style:s}),this}from(e){return this.step("from",e)}to(e){return this.step("to",e)}at(e,t){let s=typeof e=="number"?`${e}%`:e;return this.step(s,t)}toString(e=""){return this.steps.map(t=>`${e}${t.selector} { ${this.sheet.formatPropsForBlock(t.style)} }`).join(`
|
|
2
|
+
`)}};var Se=class n{static{a(this,"StyleSheetBuilder")}rules=[];theme=null;ghostVars=[];varCounter=0;getGhostVars(){return this.ghostVars}setTheme(e){return this.theme=e,this}clearRules(){this.rules=[],this.ghostVars=[],this.varCounter=0}template(e,...t){return new C(()=>{let s="";for(let i=0;i<e.length;i++)if(s+=e[i],i<t.length){let r=t[i];r instanceof p||r instanceof u?s+=r instanceof u?r._get():r.value:s+=r}return s})}class(e,t){return this.rule(`.${e}`,t)}rule(e,t){let s=new E;return t(s),this.rules.push({type:"rule",selector:e,style:s}),this}selector(e,t){return this.rule(e,t)}media(e,t){let s=new n;return t(s),this.rules.push({type:"media",condition:e,builder:s}),this}container(e,t){let s=new n;return t(s),this.rules.push({type:"container",condition:e,builder:s}),this}supports(e,t){let s=new n;return t(s),this.rules.push({type:"supports",condition:e,builder:s}),this}keyframes(e,t){let s=new ve(this);return t(s),this.rules.push({type:"keyframes",name:e,builder:s}),this}v(e){return e.startsWith("--")||(e="--"+e),`var(${e})`}applyObjectToBuilder(e,t){let s=Array.isArray(t)?t:[t];for(let i of s)for(let r in i){let o=i[r],l=r.replace(/_\d+$/,"");typeof e[l]=="function"&&(Array.isArray(o)?e[l](...o):e[l](o))}}formatPropsForBlock(e){return e.getProps().map(t=>{let s=oe[t.prop],i=t.prop,r=t.value;if(typeof r=="object"&&r!==null&&!(r instanceof V)&&!(r instanceof p)&&!(r instanceof u)){let o;switch(t.prop){case"filter":{o=new W(t.prop);break}case"transform":{o=new H(t.prop);break}}o&&(this.applyObjectToBuilder(o,r),r=o)}if(r instanceof p||r instanceof u||r instanceof V){let o=r instanceof p||r instanceof u;if(r instanceof V)for(let l of r.funcs){for(let d of l.args)if(d.v instanceof p||d.v instanceof u||d instanceof p||d instanceof u){o=!0;break}if(o)break}if(o){let l;t.prop.startsWith("--")?l=t.prop:l=`--dh-v${++this.varCounter}`;let d=r,h=r;(t.prop==="transform"||t.prop==="filter")&&!(d instanceof V)?h=new C(()=>{let f=d instanceof u?d._get():d.value;if(typeof f=="object"&&f!==null){let m=t.prop==="transform"?new H(t.prop):new W(t.prop);return this.applyObjectToBuilder(m,f),m.toString()}return f}):s&&s.unit&&!(d instanceof V)?h=new C(()=>{let f=d instanceof u?d._get():d.value;return typeof f=="number"?`${f}${s.unit}`:f}):s&&(s.type==="length"||s.type==="hybrid")&&!(d instanceof V)?h=new C(()=>{let f=d instanceof u?d._get():d.value;return typeof f=="number"?y(f,s.unit):f}):d instanceof V&&(h=new C(()=>d.toString())),this.ghostVars.push({name:l,value:h}),r=`var(${l})`}}return s&&(i=s.cssName,(s.type==="length"||s.type==="hybrid")&&typeof t.value=="number"?s.type==="hybrid"&&s.unit===void 0||(r=y(t.value,s.unit)):s.unit&&typeof t.value=="number"&&(r=`${t.value}${s.unit}`)),`${i}: ${r};`}).join(" ")}toString(e=""){return this.rules.map(t=>{if(t.type==="media")return`${e}@media ${t.condition} {
|
|
3
3
|
${t.builder.toString(e+" ")}
|
|
4
4
|
${e}}`;if(t.type==="container")return`${e}@container ${t.condition} {
|
|
5
5
|
${t.builder.toString(e+" ")}
|
|
@@ -8,7 +8,7 @@ ${t.builder.toString(e+" ")}
|
|
|
8
8
|
${e}}`;if(t.type==="keyframes")return`${e}@keyframes ${t.name} {
|
|
9
9
|
${t.builder.toString(e+" ")}
|
|
10
10
|
${e}}`;let s=this.formatPropsForBlock(t.style);return`${e}${t.selector} { ${s} }`}).join(`
|
|
11
|
-
`)}hasRules(){return this.rules.length>0}dispose(){for(let e of this.ghostVars)e.value instanceof C?e.value.dispose():e.value instanceof
|
|
11
|
+
`)}hasRules(){return this.rules.length>0}dispose(){for(let e of this.ghostVars)e.value instanceof C?e.value.dispose():e.value instanceof u&&e.value._source instanceof C&&e.value._source.dispose();for(let e of this.rules)(e.type==="media"||e.type==="container"||e.type==="supports")&&e.builder.dispose()}};var Ce=new Map;function Ze(n,e){Ce.has(n)||Ce.set(n,new Set),Ce.get(n).add(e)}a(Ze,"registerInstance");function Je(n,e){Ce.get(n)?.delete(e)}a(Je,"unregisterInstance");function et(n){return Ce.get(n)||new Set}a(et,"getInstances");var B=class n extends Error{static{a(this,"HandledError")}constructor(){super("Error handled by error boundary."),Object.setPrototypeOf(this,n.prototype)}},Lt=65536;function Pt(n){return`dothtml-${n.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}`}a(Pt,"getStableTagName");var q=class extends c{static{a(this,"ComponentVdom")}component;shadowEl;childShadowVdom;events=[];styleVNodes=[];isQueued=!1;isBuilding=!1;computedSignals=[];buildComputedSignals=[];effects=[];buildEffects=[];disposables=[];buildDisposables=[];ref;slots={};parentComponent=null;lastError=null;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.rebuild()},"update")};constructor(e,t){if(super(e),this.component=t,this.parentComponent=$(),this.childShadowVdom=new v(e),t._?._meta?.isRendered)throw new Error("Component has already been added to the VDOM.");if(!t.constructor._dotHtmlComponent){t.constructor._dotHtmlComponent={};let s=t.constructor.__hmrId;if(K&&s)t.constructor._dotHtmlComponent.tagName=Pt(s);else{let i=Math.floor(performance.now()*1e13).toString(16),r=(Lt++).toString(16);t.constructor._dotHtmlComponent.tagName=`dothtml-${r}${e._addTimestamp?`-${i}`:""}`}}if(t._||(t._={}),t._.cvdom=this,t._.refs={},t._._meta=t._._meta||{},t._._meta.isRendered=!1,t._._meta.tagName=t.constructor._dotHtmlComponent.tagName,t.emit=(s,i)=>{this.shadowEl&&this.shadowEl.dispatchEvent(new CustomEvent(s.toLowerCase(),{detail:i,bubbles:!0,composed:!0}))},t._trackedComputeds){for(let s of t._trackedComputeds)this.registerComputed(s);delete t._trackedComputeds}if(t._trackedEffects){for(let s of t._trackedEffects)this.registerEffect(s);delete t._trackedEffects}if(t._trackedDisposables){for(let s of t._trackedDisposables)this.registerDisposable(s);delete t._trackedDisposables}if(K){let s=t.constructor.__hmrId;s&&Ze(s,this)}}registerComputed(e){this.isBuilding?this.buildComputedSignals.push(e):this.computedSignals.push(e)}registerEffect(e){this.isBuilding?this.buildEffects.push(e):this.effects.push(e)}registerDisposable(e){this.isBuilding?this.buildDisposables.push(e):this.disposables.push(e)}setRef(e){this.ref=e}addSlot(e,t){let s;if(typeof t=="function"?this.slots[e]=t:((!this.slots[e]||typeof this.slots[e]=="function")&&(this.slots[e]=new v(this._dot)),s=this.slots[e],O(this._dot,s,t)),this.shadowEl){if(typeof t!="function"&&(s._render(this.shadowEl),e!=="default")){let i=s._getNodes();for(let r of i)r&&r.setAttribute&&r.setAttribute("slot",e)}this.rebuild()}}_hmrSwap(e){let t=this.component;N(this);try{t.unmounting&&t.unmounting()}finally{I()}let s=new e;for(let i in t){if(i==="_"||i==="constructor")continue;let r=t[i],o=s[i];r instanceof p&&!(r instanceof C)?o instanceof p&&!(o instanceof C)?o.value=r.value:s[i]=r:r instanceof C||(s[i]=r)}this.component=s,this.component._=t._,this.component._.cvdom=this,this.shadowEl&&(this.shadowEl.component=this.component);try{this.init(),this.subscribeToProps(),N(this);try{this.component.mounted&&this.component.mounted()}finally{I()}N(this);try{t.unmounted&&t.unmounted()}finally{I()}}catch(i){if(i instanceof B)return;this.handleError(i)}}init(){if(this.validateProps(),this.subscribeToProps(),this.shadowEl){this.rebuild();return}N(this),this.isBuilding=!0;try{let e=this.component.build(this._dot);e?._root?this.childShadowVdom=e._root:e instanceof c?this.childShadowVdom=e:(this.childShadowVdom=new v(this._dot),O(this._dot,this.childShadowVdom,e))}finally{this.isBuilding=!1,I()}this.component.built&&this.component.built()}handleError(e){if(e instanceof B)throw e;if(this.lastError=e,this.component.errorCaught)try{let t=this.component.errorCaught(e);if(t){if(this.lastError=null,this.childShadowVdom=new v(this._dot),O(this._dot,this.childShadowVdom,t),this.shadowEl){let s=this.shadowEl.shadowRoot;if(s){s.innerHTML="",N(this);try{this.childShadowVdom._render(s)}finally{I()}}}throw new B}}catch(t){if(t instanceof B)throw t;e=t}throw this._dot.onError?(this._dot.onError(e),this.lastError=null,new B):this.parentComponent&&this.parentComponent.handleError?(this.parentComponent.handleError(e),this.lastError=null,new B):K?(this.shadowEl&&!e.isPropValidationError&&this.renderErrorBox(e),typeof globalThis.describe=="function"&&(!this.shadowEl||e.isPropValidationError)?e:new B):e}subscribeToProps(){let e=this.component.props;if(e)for(let t in e){let s=e[t];(s instanceof p||s instanceof u)&&s.subscribe(()=>{this.validateProps(),this.requestUpdate()})}}requestUpdate(){this.isQueued||(this.isQueued=!0,x.enqueue(this.updateSubscription,w.Normal))}rebuild(){if(this.shadowEl)try{this.childShadowVdom._unrender();for(let t of this.buildEffects)t.dispose&&t.dispose();this.buildEffects=[];for(let t of this.buildComputedSignals)t.dispose();this.buildComputedSignals=[];for(let t of this.buildDisposables)t();this.buildDisposables=[],this.validateProps(),N(this),this.isBuilding=!0;try{let t=this.component.build(this._dot);t?._root?this.childShadowVdom=t._root:t instanceof c?this.childShadowVdom=t:(this.childShadowVdom=new v(this._dot),O(this._dot,this.childShadowVdom,t))}finally{this.isBuilding=!1,I()}let e=this.component._._meta.shadowRoot||this.shadowEl.shadowRoot;if(e){Array.from(e.childNodes).forEach(t=>{t.nodeName!=="STYLE"&&e.removeChild(t)}),N(this);try{this.childShadowVdom._render(e)}finally{I()}}this.lastError=null,this.component.built&&this.component.built()}catch(e){if(e instanceof B)return;this.handleError(e)}}renderErrorBox(e){let t=document.createElement("div");t.style.cssText=`
|
|
12
12
|
background-color: rgba(255, 0, 0, 0.9);
|
|
13
13
|
color: white;
|
|
14
14
|
padding: 20px;
|
|
@@ -21,6 +21,6 @@ ${e}}`;let s=this.formatPropsForBlock(t.style);return`${e}${t.selector} { ${s} }
|
|
|
21
21
|
position: relative;
|
|
22
22
|
overflow: auto;
|
|
23
23
|
max-height: 90vh;
|
|
24
|
-
`;let s=document.createElement("h2");s.textContent="DOThtml HMR Error",s.style.marginTop="0px",t.appendChild(s);let i=document.createElement("div");if(i.textContent=e.message||e,i.style.cssText="font-weight: bold; font-size: 1.2em; margin-bottom: 10px;",t.appendChild(i),e.stack){let r=document.createElement("pre");r.textContent=e.stack,r.style.cssText="font-size: 0.9em; opacity: 0.8;",t.appendChild(r)}if(this.shadowEl){let r=this.shadowEl.shadowRoot;r&&(r.innerHTML="",r.appendChild(t))}}validateProps(){try{let e=this.component.constructor.props;if(!e)return;let t=this.component.constructor.name,s=this.component.props||{};for(let i in e){let r=e[i],o=s[i];if(o instanceof f&&(o=o.value),o instanceof c&&(o=o._get()),r.required&&o===void 0)throw new Error(`[${t}] Prop "${i}" is required.`);if(o===void 0&&r.default!==void 0&&(o=typeof r.default=="function"?r.default():r.default,s[i]=o),o!==void 0){if(r.type){let l=o===null?"null":Array.isArray(o)?"array":typeof o,d="";if(r.type===String?d="string":r.type===Number?d="number":r.type===Boolean?d="boolean":r.type===Array?d="array":r.type===Object?d="object":r.type===Function&&(d="function"),d&&l!==d&&(o!==null||r.required))throw new Error(`[${t}] Prop "${i}" expected ${d}, but got ${l}.`)}if(r.validator&&!r.validator(o))throw new Error(`[${t}] Prop "${i}" failed custom validation.`)}}}catch(e){throw e.isPropValidationError=!0,e}}setupCustomElement(e){let t=this.component._._meta.tagName;if(e.defaultView.customElements.get(t)){let r=this.component.constructor._cachedStyles;r&&(this.component.constructor._cachedStyles=r);return}let s=this,i=class extends e.defaultView.HTMLElement{static{a(this,"CustomElementConstructor")}_component;_isMounted=!1;constructor(){super(),this.attachShadow({mode:"open"})}set component(o){this._component=o,this._isMounted&&this._renderComponent(o)}get component(){return this._component}connectedCallback(){this._isMounted=!0,this._component&&this._renderComponent(this._component)}_renderComponent(o){let l=this.shadowRoot;if(!l)return;let d=o._.cvdom;if(d)try{let h=new ve;d._dot._theme&&h.setTheme(d._dot._theme);let p=o.constructor.styles;p&&typeof p=="function"&&p(h);let b=o.constructor.hostStyles;b&&typeof b=="function"&&b(h),o.hostStyle&&h.rule(":host",m=>o.hostStyle(m));let S=d._dot.globalStyles||[];for(let m of S)if(typeof m=="string"){let y=e.createElement("style");y.textContent=m.replace(/\b(html|body)\b/g,":host"),l.appendChild(y)}if(o.stylize){let m=o.stylize(h);if(typeof m=="string"){let y=e.createElement("style");y.textContent=m,l.appendChild(y)}else if(m instanceof f||m instanceof c||m instanceof C){let y=e.createElement("style");y.id="--dh-dynamic-style",l.appendChild(y);let k=a(()=>{h.clearRules();let P=o.stylize(h),se="";if(typeof P=="string")se=P;else if(P instanceof f||P instanceof c||P instanceof C){let U=P instanceof c?P._get():P instanceof f?P.value:P;typeof U=="string"?se=U:se=h.toString()}else se=h.toString();y.textContent=se;let ze=h.getGhostVars();ze.length>0&&ze.forEach(U=>{let mt=U.value instanceof c?U.value._get():U.value instanceof f?U.value.value:U.value;this.style.setProperty(U.name,`${mt}`)}),h.hasRules()&&typeof P!="string"&&(y.textContent+=h.toString())},"update"),K=m.subscribe(k);d.registerDisposable(()=>{m instanceof c?m._unsubscribe(K):m.unsubscribe(K)}),k()}}if(h.hasRules()){let m=e.createElement("style");m.textContent=h.toString(),l.appendChild(m),o.constructor._cachedStyles=h.toString();let y=h.getGhostVars();y.length>0&&y.forEach(k=>{let K=k.value instanceof c?k.value._get():k.value instanceof f?k.value.value:k.value;if(this.style.setProperty(k.name,`${K}`),k.value instanceof f||k.value instanceof c){let P=k.value.subscribe(se=>{this.style.setProperty(k.name,`${se}`)});d.registerDisposable(()=>{k.value instanceof c?k.value._unsubscribe(P):k.value.unsubscribe(P)})}}),d.registerDisposable(()=>h.dispose())}if(d.childShadowVdom._isRendered)return;{o._._meta.shadowRoot=l;let m=h.getGhostVars();m.length>0&&m.forEach(y=>{let k=y.value instanceof c?y.value._get():y.value instanceof f?y.value.value:y.value;if(this.style.setProperty(y.name,`${k}`),y.value instanceof f||y.value instanceof c){let K=y.value.subscribe(P=>{this.style.setProperty(y.name,`${P}`)});d.registerDisposable(()=>{y.value instanceof c?y.value._unsubscribe(K):y.value.unsubscribe(K)})}}),N(d);try{d.childShadowVdom._render(l)}finally{I()}}}catch(h){try{d.handleError(h)}catch(p){if(p instanceof M)return;throw p}}}};e.defaultView.customElements.define(t,i)}_render(e){try{if(!this.component._)throw new Error("Invalid component. Ensure components are created through the component factory or through decoration.");if(this.component._?._meta?.isRendered)throw new Error("Individual component instances cannot be rendered twice at once.");this.component._._meta||(this.component._._meta={}),this.component._._meta.isRendered=!0;let t=e.ownerDocument;if(this.setupCustomElement(t),this.shadowEl=t.createElement(this.component._._meta.tagName),this.shadowEl.cvdom=this,this.shadowEl.setAttribute("cvdom",""),this.shadowEl.component=this.component,this.init(),this.lastError){Z&&this.renderErrorBox(this.lastError),e.appendChild(this.shadowEl);return}N(this);try{this.component.mounting&&this.component.mounting()}finally{I()}e.appendChild(this.shadowEl),this.ref&&(typeof this.ref=="function"?this.ref(this.component):this.ref.value=this.component);for(let s in this.slots){let i=this.slots[s];if(typeof i!="function"&&(i._render(this.shadowEl),s!=="default")){let r=i._getNodes();for(let o of r)o&&o.setAttribute&&o.setAttribute("slot",s)}}for(let s=0;s<this.events.length;s++){let i=this.events[s];this.renderEvent(i.name,i.callback,i.modifiers)}N(this);try{this.component.mounted&&this.component.mounted()}finally{I()}this._onEnterHook&&this._onEnterHook(this.shadowEl),this.component.onEnter&&this.component.onEnter()}catch(t){if(this.shadowEl&&!this.shadowEl.parentElement&&e.appendChild(this.shadowEl),t instanceof M)return;this.handleError(t)}}_unrender(){N(this);try{this.component.unmounting&&this.component.unmounting()}finally{I()}this.childShadowVdom._unrender();for(let t in this.slots){let s=this.slots[t];s instanceof u&&s._unrender()}this.shadowEl&&(this.shadowEl.parentNode?.removeChild(this.shadowEl),delete this.shadowEl.component);for(let t of this.computedSignals)t.dispose();this.computedSignals=[];for(let t of this.buildComputedSignals)t.dispose();this.buildComputedSignals=[];for(let t of this.effects)t.dispose&&t.dispose();this.effects=[];for(let t of this.disposables)t();this.disposables=[],this.ref&&(typeof this.ref=="function"?this.ref(null):this.ref.value=null);let e=this.component.constructor.__hmrId;Z&&e&&Je(e,this),this.component._&&(this.component._._meta.isRendered=!1),this.shadowEl=null,this._isRendered=!1,N(this);try{this.component.unmounted&&this.component.unmounted()}finally{I()}}_unrenderAsync(){let e=null;if(this._onLeaveHook&&this.shadowEl){let t=this._onLeaveHook(this.shadowEl);t instanceof Promise&&(e=t)}if(this.component.onLeave){let t=this.component.onLeave();t instanceof Promise&&(e=e?e.then(()=>t):t)}if(e)return e.then(()=>this._unrender());this._unrender()}_getNodes(){return this.shadowEl?[this.shadowEl]:[]}_getLastChild(){return this}addEventListener(e,t,s=[]){this.events.push({name:e,callback:t,modifiers:s}),this.shadowEl&&this.renderEvent(e,t,s)}renderEvent(e,t,s=[]){ee.getForDocument(this.shadowEl.ownerDocument).addListener(this.shadowEl,e.toLowerCase(),t,s)}generateStyles(e){return""}};var fe=class extends u{static{a(this,"ReactiveVdom")}binding;beforeNode=null;afterNode=null;currentVdom=null;observerId=0;_isReactiveVdom=!0;constructor(e,t){super(e),this.binding=t}_toVdom(e){if(e==null)return new A("");if(e instanceof u)return e;if(typeof e=="object"&&e.build){let t=new F(this._dot,e);return t.init(),t}if(Array.isArray(e)){let t=new v(this._dot);for(let s of e)t._addChild(this._toVdom(s));return t}return new A(e)}_render(e){this._isRendered=!0,this.beforeNode=e.ownerDocument.createTextNode(""),this.afterNode=e.ownerDocument.createTextNode(""),e.appendChild(this.beforeNode),e.appendChild(this.afterNode);let t=this.binding._get();this.update(t),this.observerId=this.binding._subscribe(this)}update(e){this._isRendered&&(this.currentVdom&&this.currentVdom._unrender(),he(this.beforeNode,this.afterNode),this.currentVdom=this._toVdom(e),this.currentVdom._renderBefore(this.afterNode))}_unrender(){this._isRendered&&(this._isRendered=!1,this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null),this.observerId&&(this.binding._unsubscribe(this.observerId),this.observerId=0),he(this.beforeNode,this.afterNode),this.beforeNode.parentElement&&this.beforeNode.parentElement.removeChild(this.beforeNode),this.afterNode.parentElement&&this.afterNode.parentElement.removeChild(this.afterNode),this.beforeNode=null,this.afterNode=null)}_getNodes(){if(!this._isRendered)return[];let e=[this.beforeNode];return this.currentVdom&&e.push(...this.currentVdom._getNodes()),e.push(this.afterNode),e}_getLastChild(){return this}toString(){return this.currentVdom?this.currentVdom.toString():""}};var Ce=class{static{a(this,"Effect")}callback;cleanup;dependencies=new Map;isQueued=!1;isEvaluating=!1;active=!0;dirty=!0;newDependencies=new Set;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.dirty&&this.run()},"update")};constructor(e){this.callback=e,this.run()}addDependency(e){this.active&&(this.newDependencies.has(e)||this.newDependencies.add(e))}requestUpdate(){this.active&&(this.dirty=!0,this.isQueued||(this.isQueued=!0,x.enqueue(this.updateSubscription,w.Normal)))}run(){if(!this.active)return;if(this.isEvaluating)throw new Error("Circular dependency detected in effect.");if(this.cleanup){try{this.cleanup()}catch(t){console.error("Error during effect cleanup:",t)}this.cleanup=void 0}this.isEvaluating=!0,this.dirty=!1,this.newDependencies.clear(),J.push(this);try{let t=this.callback();typeof t=="function"&&(this.cleanup=t)}catch(t){console.error("Error during effect execution:",t)}finally{J.pop(),this.isEvaluating=!1}let e=[];for(let[t,s]of this.dependencies)this.newDependencies.has(t)||(t.unsubscribe(s),e.push(t));for(let t of e)this.dependencies.delete(t);for(let t of this.newDependencies)if(!this.dependencies.has(t)){let s=t.subscribe(()=>this.requestUpdate(),!0);this.dependencies.set(t,s)}}dispose(){if(this.active){if(this.active=!1,this.cleanup){try{this.cleanup()}catch(e){console.error("Error during effect disposal cleanup:",e)}this.cleanup=void 0}for(let[e,t]of this.dependencies)e.unsubscribe(t);this.dependencies.clear()}}};function tt(n){let e=class extends n{static{a(this,"decorated")}constructor(...t){let s={computedSignals:[],effects:[],disposables:[],registerComputed(i){this.computedSignals.push(i)},registerEffect(i){this.effects.push(i)},registerDisposable(i){this.disposables.push(i)}};N(s);try{super(...t)}finally{I()}t[0]&&typeof t[0]=="object"&&!t[0].build&&n.props&&(this.props||(this.props={}),Object.assign(this.props,t[0])),this._trackedComputeds=s.computedSignals,this._trackedEffects=s.effects,this._trackedDisposables=s.disposables}};Object.defineProperty(e,"name",{value:n.name});for(let t of Object.getOwnPropertyNames(n))t!=="prototype"&&t!=="name"&&t!=="length"&&(e[t]=n[t]);return e}a(tt,"component");var st=new WeakMap;function Oe(n,e){let t="";if(n instanceof e.defaultView?.CSSStyleSheet)return n;if(typeof n=="string")t=n;else if(typeof n=="function"){let l=n(null);typeof l=="string"&&(t=l)}let s=st.get(e);if(s||(s=new Map,st.set(e,s)),s.has(t))return s.get(t);let i=e.defaultView?.CSSStyleSheet;if(i)try{let o=new i;if(o.replaceSync)return o.replaceSync(t),s.set(t,o),o}catch{}let r=e.createElement("style");return r.innerHTML=t,r}a(Oe,"renderStylesheet");var Pt=1,xe=class n{static{a(this,"WindowWrapper")}window;document;title;root;_vdom;width;height;isOpen=!1;tether=!1;syncStyles=!1;position=null;static tetheredWindows=new Set;eventListeners=[];wrapperEventListeners=[];constructor(e){this.root=e.content,this.width=e.width||e.height||600,this.height=e.height||e.width||400,this.title=e.title||"Window",this.tether=e.tether||!1,this.syncStyles=e.syncStyles||!1,this.position=e.position||null}async open(){if(this.isOpen){console.warn("Window is already open.");return}let e=0,t=0,s=`width=${this.width},height=${this.height}`;if(this.position&&(typeof this.position=="object"?(e=this.position.left,t=this.position.top):this.position==="center"?(e=(window.screen.width-this.width)/2,t=(window.screen.height-this.height)/2):this.position==="parent-center"?(e=window.screenX+(window.outerWidth-this.width)/2,t=window.screenY+(window.outerHeight-this.height)/2):this.position==="beside-parent"&&(e=window.screenX+window.outerWidth,t=window.screenY),s+=`,left=${e},top=${t}`),this.window=window.open("",this.title,s),!this.window)throw new Error("Popup window could not be opened.");this.setupDocument(),this.isOpen=!0,this.tether&&(n.tetheredWindows.add(this),n.tetheredWindows.size===1&&(window.addEventListener("pagehide",n.closeAllTethered),window.addEventListener("beforeunload",n.closeAllTethered),window.addEventListener("unload",n.closeAllTethered)))}setupDocument(){this._vdom&&(this._vdom._unrender(),this._vdom=null),this.document=this.window.document,this.document._dotId=`${Pt++}`;let e=document.createElement("div");e.textContent=this.title;let t=e.innerHTML;this.document.open?(this.document.open(),this.document.write(`<!DOCTYPE html><html><head><title>${t}</title></head><body></body></html>`),this.document.close()):this.document.documentElement.innerHTML=`<head><title>${t}</title></head><body></body>`,this.document=this.window.document;let s=this.document.body;s.innerHTML="",delete s[W],this.syncStyles&&this.syncStylesWithParent(),this._vdom=g(s,this.window).mount(this.root);for(let{name:i,callback:r}of this.eventListeners)this.document.addEventListener(i,r);this.window.addEventListener("unload",()=>{this.isOpen&&setTimeout(()=>{this.window&&!this.window.closed?this.setupDocument():(this.isOpen=!1,this.tether&&n.tetheredWindows.delete(this),this.emit("close"))},100)})}on(e,t){return e==="close"?this.wrapperEventListeners.push({name:e,callback:t}):(this.eventListeners.push({name:e,callback:t}),this.document&&this.document.addEventListener(e,t)),this}emit(e,t){for(let{name:s,callback:i}of this.wrapperEventListeners)s===e&&i(t)}focus(){this.window&&this.window.focus()}bringToFront(){this.window&&this.window.focus()}resizeTo(e,t){this.window&&this.window.resizeTo(e,t),this.width=e,this.height=t}moveTo(e,t){this.window&&this.window.moveTo(e,t)}static closeAllTethered=a(()=>{n.tetheredWindows.forEach(e=>e.close()),n.tetheredWindows.clear()},"closeAllTethered");syncStylesWithParent(){this.document.body.className=document.body.className;let e=getComputedStyle(document.documentElement);for(let s=0;s<document.documentElement.style.length;s++){let i=document.documentElement.style[s];i.startsWith("--")&&this.document.documentElement.style.setProperty(i,e.getPropertyValue(i))}if(this.document.adoptedStyleSheets&&document.adoptedStyleSheets){let s=[];for(let i of document.adoptedStyleSheets)try{let r=new this.window.CSSStyleSheet,o="";for(let l=0;l<i.cssRules.length;l++)o+=i.cssRules[l].cssText+`
|
|
25
|
-
`;r.replaceSync(o),s.push(r)}catch(r){console.warn("Failed to clone adopted stylesheet:",r)}this.document.adoptedStyleSheets=s}document.head.querySelectorAll("style, link[rel='stylesheet']").forEach(s=>{this.document.head.appendChild(s.cloneNode(!0))})}close(){this.window&&(this._vdom&&(this._vdom._unrender(),this._vdom=null),this.window.close(),this.window=null,this.document=null,this.isOpen=!1,this.tether&&n.tetheredWindows.delete(this),this.emit("close"))}};var Ee=class{static{a(this,"RefCollection")}_refs=new Map;get(e){return this._refs.has(e)||this._refs.set(e,new Q),this._refs.get(e)}get elements(){let e={};return this._refs.forEach((t,s)=>{e[s]=t.value}),e}forEach(e){this._refs.forEach((t,s)=>{e(t.value,s)})}map(e){let t=[];return this._refs.forEach((s,i)=>{t.push(e(s.value,i))}),t}};var te=new Map;function nt(n){let{id:e,state:t,getters:s,actions:i}=n;if(e&&te.has(e))return()=>te.get(e);let r=a(()=>{let l={$id:e,_state:{},_getters:{},_effects:[]},d={computedSignals:[],effects:[],disposables:[],registerComputed(h){this.computedSignals.push(h)},registerEffect(h){this.effects.push(h)},registerDisposable(h){this.disposables.push(h)}};N(d);try{if(t){let h=t();for(let p in h){let b=h[p],S=b instanceof f?b:new f;S!==b&&(S.value=b),l._state[p]=S,Object.defineProperty(l,p,{get:a(()=>l._state[p],"get"),enumerable:!0,configurable:!0})}}if(s){for(let h in s)Object.defineProperty(l,h,{get:a(()=>l._getters[h],"get"),enumerable:!0,configurable:!0});for(let h in s){let p=new C(()=>s[h].call(l,l));l._getters[h]=p}}if(i)for(let h in i)l[h]=(...p)=>{N(d);try{return i[h].apply(l,p)}finally{I()}}}finally{I()}return l._getters_list=d.computedSignals,l._effects=d.effects,l._disposables=d.disposables,l.$dispose=()=>{for(let h in l._getters)l._getters[h].dispose();for(let h of l._getters_list||[])h.dispose();for(let h of l._effects||[])h.dispose();for(let h of l._disposables||[])h();e&&te.delete(e),l._state={},l._getters={},l._effects=[]},e&&te.set(e,l),l},"createInstance"),o;return e&&(o=r()),()=>{let l=e?o:r();if(!e){let d=B();d&&d.registerDisposable&&d.registerDisposable(()=>l.$dispose())}return l}}a(nt,"createStore");function it(n){return te.get(n)}a(it,"getStore");function rt(){te.forEach(n=>n.$dispose()),te.clear()}a(rt,"clearStores");function ot(){let n={};return te.forEach((e,t)=>{n[t]=e}),n}a(ot,"getStores");var pe=["a","aside","abbr","address","area","article","audio","b","bdi","bdo","blockQuote","body","br","button","canvas","caption","cite","code","col","colGroup","content","data","dataList","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldSet","figCaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","i","iFrame","img","input","ins","kbd","keyGen","label","legend","li","main","map","mark","menu","menuItem","meter","nav","object","ol","optGroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","svg","sub","summary","sup","table","tBody","td","textArea","tFoot","th","tHead","time","tr","track","u","ul","var","video","wbr"],at=new Set(pe),$e=["each","html","mount","text","md","when","on"];var le=class extends u{static{a(this,"SlotVdom")}name;fallbackOrScope;fallback=null;scopedContent=null;element=null;component;constructor(e,t,s){super(e),this.name=t||"default",this.fallbackOrScope=s,this.component=B()}_render(e){this._isRendered=!0;let t=e.ownerDocument,i=(this.component||B())?.slots?.[this.name];typeof i=="function"?(this.scopedContent=new v(this._dot),$(this._dot,this.scopedContent,i(this.fallbackOrScope))):this.fallbackOrScope!==void 0&&(this.fallback=new v(this._dot),$(this._dot,this.fallback,this.fallbackOrScope)),this.scopedContent?this.scopedContent._render(e):(this.element=t.createElement("slot"),this.name!=="default"&&(this.element.name=this.name),this.fallback&&this.fallback._render(this.element),e.appendChild(this.element))}_unrender(){this.scopedContent?this.scopedContent._unrender():this.element&&(this.fallback&&this.fallback._unrender(),this.element.remove(),this.element=null),this._isRendered=!1}_getNodes(){return this.scopedContent?this.scopedContent._getNodes():this.element?[this.element]:[]}_getLastChild(){return this}};var j=class n extends u{static{a(this,"DotChain")}_root;constructor(e,t){super(e),this._root=t}_addChild(e){if(this._root instanceof v)this._root._addChild(e);else if(this._root instanceof T)this._root._children.push(e);else{let t=new T(this._dot);t._children.push(this._root),t._children.push(e),this._root=t}return this}_render(e){this._root._render(e)}_unrender(){this._root._unrender()}_unrenderAsync(){return this._root._unrenderAsync()}_renderBefore(e){this._root._renderBefore(e)}_renderAfter(e){this._root._renderAfter(e)}_moveBefore(e,t){this._root._moveBefore(e,t)}get _isRendered(){return this._root._isRendered}set _isRendered(e){this._root._isRendered=e}_getNodes(){return this._root._getNodes()}_getLastChild(){return this._root._getLastChild()}get _children(){return this._root instanceof v?this._root._children:this._root instanceof T?this._root._children:[]}slot(e,t){let s=this._getLastChild();for(;s instanceof n;)s=s._root;return s instanceof F?(typeof e!="string"&&(t=e,e="default"),s.addSlot(e||"default",t)):(typeof e!="string"&&(t=e,e=void 0),this._addChild(new le(this._dot,e,t))),this}};function de(n){return n instanceof f?n.bind():n}a(de,"reduceReactive");function Ne(n){return n instanceof j?n:new j(n._dot,n)}a(Ne,"promote");u.prototype._addChild=function(n){return Ne(this)._addChild(n)};u.prototype.text=function(n){let e=de(n);return e instanceof c?this._addChild(new fe(this._dot,e)):this._addChild(new A(e))};u.prototype.html=function(n){return this._addChild(new ce(de(n)))};u.prototype.md=function(n){return this.text(n)};u.prototype.slot=function(n,e){let t=this._getLastChild();for(;t instanceof j;)t=t._root;return t instanceof F?(typeof n!="string"&&n!==void 0&&(e=n,n="default"),t.addSlot(n||"default",e),this):(typeof n!="string"&&n!==void 0&&(e=n,n=void 0),this._addChild(new le(this._dot,n,e)))};u.prototype.mount=function(n,...e){let t=new F(this._dot,n);for(let s=0;s<e.length;s++){let i=e[s];if(De(i))t.addSlot("default",i);else if(i&&typeof i=="object")for(let r in i){let o=i[r];if(r==="ref")t.setRef(o);else if(r.startsWith("on")&&typeof o=="function"){let l=r,d=[];if(r.includes(".")){let h=r.split(".");l=h[0],d=h.slice(1)}t.addEventListener(l.substring(2).toLowerCase(),o,d)}else{let l=n.constructor.props;l&&l[r]?(n.props||(n.props={}),n.props[r]=o):typeof o=="function"||o instanceof u||o?._root||o?._children?t.addSlot(r,o):(n.props||(n.props={}),n.props[r]=o)}}}return this._addChild(t)};u.prototype.when=function(n,e){let t=new ie(this._dot),s;return e instanceof u?s=e:typeof e=="object"&&e?.build?(s=new T(this._dot),s.mount(e)):(s=new T(this._dot),s._children.push(new A(de(e)))),t.addCondition(de(n),s),this._addChild(t)};u.prototype.each=function(n,e){let t=new ne(this._dot,de(n),e);return this._addChild(t)};u.prototype.otherwiseWhen=function(n,e,t=!1){let s=this._getLastChild();if(s instanceof ie){let i;e instanceof u?i=e:typeof e=="object"&&e?.build?(i=new T(this._dot),i.mount(e)):i=new A(de(e)),s.addCondition(de(n),i,t)}else throw new Error("Can't branch off of a non-conditional node.");return this};u.prototype.otherwise=function(n){return this.otherwiseWhen(!0,n,!0)};u.prototype.attr=function(n,e){let t=this._getLastChild();if(t instanceof R)t.setAttr(n,e);else throw new Error(`Invalid node to set ${n} attribute.`);return this};u.prototype.style=function(n){if(typeof n=="function"){let e=new E;n(e),this.attr("style",e)}else this.attr("style",n);return this};u.prototype.on=function(n,e){let t=this._getLastChild();if(t&&(t instanceof R||t instanceof F))t.addEventListener(n,e);else throw new Error(`Invalid node to set ${n} listener.`);return this};u.prototype.onEnter=function(n){let e=this._getLastChild();if(e&&(e._onEnterHook=n,e._isRendered)){let s=e._getNodes().find(i=>i instanceof HTMLElement);s&&n(s)}return this};u.prototype.onLeave=function(n){let e=this._getLastChild();return e&&(e._onLeaveHook=n),this};u.prototype.empty=function(){let n=this;for(;n instanceof j;)n=n._root;let e=n._getLastChild();for(;e instanceof j;)e=e._root;return e instanceof R?(e.element&&(e.element.innerHTML=""),e.children._unrender(),e.children._children=[],e.children._isRendered=!0):n instanceof v&&(n._unrender(),n._children=[],n._isRendered=!0,n._parent instanceof R&&n._parent.element&&(n._parent.element.innerHTML="")),this};u.prototype.remove=function(){let n=this;for(;n instanceof j;)n=n._root;let e=n._getLastChild();for(;e instanceof j;)e=e._root;e instanceof R||e instanceof F?e._unrender():n instanceof v&&n._parent instanceof R?n._parent._unrender():n instanceof u&&n._unrender()};u.prototype.fade=function(n=300){return this.onEnter(e=>{e.animate([{opacity:0},{opacity:1}],{duration:n})}).onLeave(async e=>{await e.animate([{opacity:1},{opacity:0}],{duration:n}).finished})};u.prototype.slide=function(n=300){return this.onEnter(e=>{e.animate([{height:"0",opacity:0,overflow:"hidden"},{height:e.scrollHeight+"px",opacity:1,overflow:"hidden"}],{duration:n})}).onLeave(async e=>{await e.animate([{height:e.scrollHeight+"px",opacity:1,overflow:"hidden"},{height:"0",opacity:0,overflow:"hidden"}],{duration:n}).finished})};for(let n=0;n<pe.length;n++){let e=pe[n];u.prototype[e]=function(...t){return this._addChild(Me(this._dot,e,t))}}var lt=a((n,e)=>{n[e]=function(){if(at.has(e))return Ne(Me(n,e,arguments));{let t=new v(n);return t[e](...arguments),Ne(t)}}},"makeCoreWrapper"),At=a(()=>{let n=a(function(e,t=window){if(e?.ownerDocument?.defaultView){let s=e,i=s[W];return i||(i=new R(n,s.tagName.toLocaleLowerCase()),i.element=s,i._isRendered=!0,i.children._parent=i,i.children._isRendered=!0,s[W]=i),Ne(i.children)}else{if(typeof e=="string")return n(t.document.querySelectorAll(e)[0]);throw new Error("Invalid render target.")}},"_dot");n.onError=null,n.state=function(e,t){let s=new f;return s.key=t,s.value=e,s},n.computed=function(e){let t=new C(e),s=B();return s&&s.registerComputed(t),t},n.effect=function(e){let t=new Ce(e),s=B();return s&&(s.registerEffect?s.registerEffect(t):s.registerComputed(t)),()=>t.dispose()},n.component=tt,n.hmr={swap(e,t){let s=et(e);for(let i of s)i._hmrSwap(t)}},n.slot=function(e,t){return typeof e!="string"&&e!==void 0&&(t=e,e=void 0),new le(n,e,t)},n.getCurrentComponent=B,n.store=nt,n.getStore=it,n.clearStores=rt,Object.defineProperty(n,"stores",{get:a(()=>ot(),"get")}),n.create=function(e,...t){let s={computedSignals:[],effects:[],disposables:[],registerComputed(r){this.computedSignals.push(r)},registerEffect(r){this.effects.push(r)},registerDisposable(r){this.disposables.push(r)}};N(s);let i;try{i=new e(...t)}finally{I()}return i._trackedComputeds?i._trackedComputeds.push(...s.computedSignals):i._trackedComputeds=s.computedSignals,i._trackedEffects?i._trackedEffects.push(...s.effects):i._trackedEffects=s.effects,i._trackedDisposables?i._trackedDisposables.push(...s.disposables):i._trackedDisposables=s.disposables,i},n.ref=function(){return new Q},n.refCollection=function(){return new Ee},n.alpha=function(e,t){return new C(()=>{let s=e instanceof c?e._get():e instanceof f?e.value:e,i=t instanceof c?t._get():t instanceof f?t.value:t,r=Math.round(Math.max(0,Math.min(100,(1-i)*100))*100)/100;return`color-mix(in srgb, ${s}, transparent ${r}%)`})},n.globalStyles=[],n.useGlobalStyles=e=>{let t=Array.isArray(e)?e:[e];for(let s of t)n.globalStyles.push(s),typeof document<"u"&&n.useStyles(document,s)},n.css=new E,n._theme=null,n.setTheme=e=>{n._theme=e},n.useStyles=(e,t)=>{e&&!t&&(typeof e=="string"||e.call&&e.apply)&&(t=e,e=document);let s=Oe(t,e);s instanceof e.defaultView?.CSSStyleSheet?e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]:s instanceof HTMLElement&&e.head.appendChild(s)},typeof document<"u"&&new O(n.css).render(document.documentElement),n.window=e=>new xe(e),n.flushSync=()=>{x.flushSync()},n.setSync=e=>{x.setSync(e)},x.onError=e=>{n.onError?n.onError(e):console.error("DOThtml Error:",e)};for(let e=0;e<pe.length;e++){let t=pe[e];lt(n,t)}for(let e=0;e<$e.length;e++){let t=$e[e];lt(n,t)}return n},"makeDot"),dt=At();Z&&typeof window<"u"&&(window.dot=dt);var g=dt;var Be=a(()=>{if(typeof window>"u")return{path:"/",search:"",hash:""};let n=window.location.pathname,e=window.location.search,t=window.location.hash;if(t.startsWith("#/")){let s=t.substring(1),i=s.search(/[?#]/);if(i===-1)n=s,e="",t="";else{n=s.substring(0,i);let r=s.substring(i),o=r.indexOf("#");o===-1?(e=r,t=""):(e=r.substring(0,o),t=r.substring(o))}}return{path:n,search:e,hash:t}},"getRouteInfo"),Ae=Be(),V=g.state(Ae.path),z=g.state(Ae.path),me=g.state(Ae.search),G=g.state(Ae.hash);function X(n,e=!1){if(typeof window>"u")return;z.value=V.value,e?window.history.replaceState({},"",n):window.history.pushState({},"",n);let t=Be();V.value=t.path,me.value=t.search,G.value=t.hash}a(X,"navigate");function Fe(){return g.computed(()=>{let n=me.value,e=new URLSearchParams(n),t={};return e.forEach((s,i)=>{t[i]=s}),t})}a(Fe,"useQueryParams");function We(){return g.computed(()=>{let n=G.value;return n.startsWith("#")?n.substring(1):n})}a(We,"useHash");if(typeof window<"u"){let n=a(()=>{let e=Be();z.value=V.value,V.value=e.path,me.value=e.search,G.value=e.hash},"updateState");window.addEventListener("popstate",n),window.addEventListener("hashchange",n)}var He=[],Ie=[],ht=g.state([]);function ct(n){ht.value=n}a(ct,"setGlobalRoutes");function qe(){return ht.value}a(qe,"getGlobalRoutes");function ut(n,e,t=""){let i=(e.startsWith(t)?e.slice(t.length):e).split("/").filter(r=>r!=="");for(let r of n){let o=r.path.split("/").filter(b=>b!==""),l={},d=!0,h=o.indexOf("*")!==-1,p=!!(r.children&&r.children.length>0);if(!(!h&&!p&&o.length!==i.length)&&!(o.length>i.length)){for(let b=0;b<o.length;b++){let S=o[b],m=i[b];if(S==="*"){d=!0;break}if(m===void 0){d=!1;break}if(S!=="+"){if(S.startsWith("{")&&S.endsWith("}")){let y=S.slice(1,-1);l[y]=m;continue}if(S.startsWith(":")){let y=S.slice(1);l[y]=m;continue}if(S!==m){d=!1;break}}}if(d){let b=i.slice(0,o.length),S=(t.endsWith("/")?t.slice(0,-1):t)+"/"+b.join("/");return{route:r,params:l,matchedPath:S}}}}return null}a(ut,"matchRoute");var ge=g.component(class{static props={routes:{type:Array,required:!0},notFound:{type:Object,default:null},loading:{type:Object,default:null},basePath:{type:String,default:""}};props;resolvedComponent=g.state(null);currentMatch=null;lastPath="";subId=-1;loaderCache=new Map;mounting(){this.subId=V.subscribe(()=>{this._?.cvdom.requestUpdate()})}unmounting(){V.unsubscribe(this.subId)}build(n){ct(this.props.routes);let e=V.value,t=ut(this.props.routes,e,this.props.basePath);this.currentMatch=t;let s=a(o=>{if(!t)return;let l=t.route.title;if(typeof l=="function"&&(l=l(t.params)),l&&(document.title=l),typeof o=="function"&&!o.prototype?.build){if(this.loaderCache.has(o)){this.resolvedComponent.value=this.loaderCache.get(o),Ie.forEach(h=>h(e,z.value));return}let d=o();if(d instanceof Promise){d.then(h=>{let p=h.default||h;this.loaderCache.set(o,p),this.resolvedComponent.value=p,this._?.cvdom.requestUpdate(),Ie.forEach(b=>b(e,z.value))}),this.resolvedComponent.value=this.props.loading||n.div("Loading...");return}}this.resolvedComponent.value=o,Ie.forEach(d=>d(e,z.value))},"proceed");if(!t)this.resolvedComponent.value=this.props.notFound||n.div("404 - Not Found");else if(t.route.redirect){let o=typeof t.route.redirect=="function"?t.route.redirect(t.params):t.route.redirect;return X(o,!0),n.div()}else{let o=[...He];t.route.beforeEnter&&o.push(t.route.beforeEnter);let l=a(async d=>{if(d>=o.length){s(t.route.component);return}let h=o[d],p=!1,b=a(m=>{p||(p=!0,m===!1?X(z.value,!0):typeof m=="string"?X(m,!0):l(d+1))},"handleNext"),S=h(e,z.value,b);if(S instanceof Promise){let m=await S;p||(m===!1||typeof m=="string"?b(m):b())}else S!==void 0&&!p&&b(S)},"runGuards");l(0)}let i=this.resolvedComponent.value;if(!i)return n.div();let r=this.currentMatch;return typeof i=="function"&&i.prototype?.build?n.mount(new i,{routeParams:r?.params,basePath:r?.matchedPath}):typeof i=="object"&&i.build?n.mount(i,{routeParams:r?.params,basePath:r?.matchedPath}):i instanceof u?i:n.div(i)}});ge.beforeEach=n=>{He.push(n)};ge.afterEach=n=>{Ie.push(n)};ge.clearHooks=()=>{He.length=0,Ie.length=0};function Re(n,e,t={},s=""){for(let i of n){let r=(s.endsWith("/")?s.slice(0,-1):s)+(i.path.startsWith("/")?"":"/")+i.path;if(i.name===e){let o=r;for(let l in t){let d=t[l];o=o.replace(new RegExp(`\\{${l}\\}`,"g"),d),o=o.replace(new RegExp(`:${l}`,"g"),d)}return o}if(i.children){let o=Re(i.children,e,t,r);if(o)return o}}return null}a(Re,"generatePath");var je=g.component(class{static props={to:{type:String,default:""},name:{type:String,default:""},params:{type:Object,default:a(()=>({}),"default")},activeClass:{type:String,default:"active"},exact:{type:Boolean,default:!1},label:{type:String,default:""}};props;slots;getResolvedPath(){return this.props.name?Re(qe(),this.props.name,this.props.params)||"":this.props.to}build(){let n=g.computed(()=>this.getResolvedPath());return g.a({hRef:n,class:g.computed(()=>{let e=V.value,t=n.value;return t.startsWith("#/")?t=t.substring(1).split(/[?#]/)[0]:t=t.split(/[?#]/)[0],(this.props.exact?e===t:e.startsWith(t))?this.props.activeClass:""}),onClick:a(e=>{(e.button===0||e.button===void 0)&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(e.preventDefault(),X(n.value))},"onClick")},this.props.label||this.slots?.default)}});function Ue(n,e=document){let t=e.getElementById(n);if(t)return t;let s=e.querySelectorAll("*");for(let i=0;i<s.length;i++){let r=s[i].shadowRoot;if(r&&(t=Ue(n,r),t))return t}return null}a(Ue,"getElementByIdDeep");var pt=new Map,Te=null;function Rt(n,e=!1){let t=G.value;if(t&&t.startsWith("#")){let i=t.substring(1),r=Ue(i);if(r){let o=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;r.scrollIntoView({behavior:e&&!o?"smooth":"auto"});return}}let s=pt.get(n);s?window.scrollTo(s.x,s.y):window.scrollTo(0,0)}a(Rt,"performScroll");function ft(n,e){Te&&clearTimeout(Te),Te=setTimeout(()=>{Rt(n,e),Te=null},0)}a(ft,"scheduleScroll");function Ye(){if(typeof window>"u")return;window.addEventListener("scroll",()=>{pt.set(V.value,{x:window.pageXOffset,y:window.pageYOffset})},{passive:!0}),g.computed(()=>({path:V.value,hash:G.value})).subscribe(e=>{ft(e.path,!0)}),ft(V.value,!1)}a(Ye,"initScrollManager");var Qe=class{static{a(this,"DotComponent")}props;refs={};_;constructor(e){this.props=e||{}}emit(e,t){}effect(e){g.effect(e)}};g.version="6.0.0";Ye();g.currentPath=V;g.currentSearch=me;g.currentHash=G;g.navigate=X;g.useQueryParams=Fe;g.useHash=We;g.Router=ge;g.Link=je;window.dot=g;document._dotId="default";0&&(module.exports={DotComponent,Link,Priority,Router,currentHash,currentPath,currentSearch,dot,generatePath,getGlobalRoutes,initScrollManager,matchRoute,navigate,previousPath,setGlobalRoutes,useHash,useQueryParams});
|
|
24
|
+
`;let s=document.createElement("h2");s.textContent="DOThtml HMR Error",s.style.marginTop="0px",t.appendChild(s);let i=document.createElement("div");if(i.textContent=e.message||e,i.style.cssText="font-weight: bold; font-size: 1.2em; margin-bottom: 10px;",t.appendChild(i),e.stack){let r=document.createElement("pre");r.textContent=e.stack,r.style.cssText="font-size: 0.9em; opacity: 0.8;",t.appendChild(r)}if(this.shadowEl){let r=this.shadowEl.shadowRoot;r&&(r.innerHTML="",r.appendChild(t))}}validateProps(){try{let e=this.component.constructor.props;if(!e)return;let t=this.component.constructor.name,s=this.component.props||{};for(let i in e){let r=e[i],o=s[i];if(o instanceof p&&(o=o.value),o instanceof u&&(o=o._get()),r.required&&o===void 0)throw new Error(`[${t}] Prop "${i}" is required.`);if(o===void 0&&r.default!==void 0&&(o=typeof r.default=="function"?r.default():r.default,s[i]=o),o!==void 0){if(r.type){let l=o===null?"null":Array.isArray(o)?"array":typeof o,d="";if(r.type===String?d="string":r.type===Number?d="number":r.type===Boolean?d="boolean":r.type===Array?d="array":r.type===Object?d="object":r.type===Function&&(d="function"),d&&l!==d&&(o!==null||r.required))throw new Error(`[${t}] Prop "${i}" expected ${d}, but got ${l}.`)}if(r.validator&&!r.validator(o))throw new Error(`[${t}] Prop "${i}" failed custom validation.`)}}}catch(e){throw e.isPropValidationError=!0,e}}setupCustomElement(e){let t=this.component._._meta.tagName;if(e.defaultView.customElements.get(t)){let r=this.component.constructor._cachedStyles;r&&(this.component.constructor._cachedStyles=r);return}let s=this,i=class extends e.defaultView.HTMLElement{static{a(this,"CustomElementConstructor")}_component;_isMounted=!1;constructor(){super(),this.attachShadow({mode:"open"})}set component(o){this._component=o,this._isMounted&&this._renderComponent(o)}get component(){return this._component}connectedCallback(){this._isMounted=!0,this._component&&this._renderComponent(this._component)}_renderComponent(o){let l=this.shadowRoot;if(!l)return;let d=o._.cvdom;if(d)try{let h=new Se;d._dot._theme&&h.setTheme(d._dot._theme);let f=o.constructor.styles;f&&typeof f=="function"&&f(h);let m=o.constructor.hostStyles;m&&typeof m=="function"&&m(h),o.hostStyle&&h.rule(":host",g=>o.hostStyle(g));let S=d._dot.globalStyles||[];for(let g of S)if(typeof g=="string"){let _=e.createElement("style");_.textContent=g.replace(/\b(html|body)\b/g,":host"),l.appendChild(_)}if(o.stylize){let g=o.stylize(h);if(typeof g=="string"){let _=e.createElement("style");_.textContent=g,l.appendChild(_)}else if(g instanceof p||g instanceof u||g instanceof C){let _=e.createElement("style");_.id="--dh-dynamic-style",l.appendChild(_);let k=a(()=>{h.clearRules();let A=o.stylize(h),te="";if(typeof A=="string")te=A;else if(A instanceof p||A instanceof u||A instanceof C){let U=A instanceof u?A._get():A instanceof p?A.value:A;typeof U=="string"?te=U:te=h.toString()}else te=h.toString();_.textContent=te;let ze=h.getGhostVars();ze.length>0&&ze.forEach(U=>{let gt=U.value instanceof u?U.value._get():U.value instanceof p?U.value.value:U.value;this.style.setProperty(U.name,`${gt}`)}),h.hasRules()&&typeof A!="string"&&(_.textContent+=h.toString())},"update"),X=g.subscribe(k);d.registerDisposable(()=>{g instanceof u?g._unsubscribe(X):g.unsubscribe(X)}),k()}}if(h.hasRules()){let g=e.createElement("style");g.textContent=h.toString(),l.appendChild(g),o.constructor._cachedStyles=h.toString();let _=h.getGhostVars();_.length>0&&_.forEach(k=>{let X=k.value instanceof u?k.value._get():k.value instanceof p?k.value.value:k.value;if(this.style.setProperty(k.name,`${X}`),k.value instanceof p||k.value instanceof u){let A=k.value.subscribe(te=>{this.style.setProperty(k.name,`${te}`)});d.registerDisposable(()=>{k.value instanceof u?k.value._unsubscribe(A):k.value.unsubscribe(A)})}}),d.registerDisposable(()=>h.dispose())}if(d.childShadowVdom._isRendered)return;{o._._meta.shadowRoot=l;let g=h.getGhostVars();g.length>0&&g.forEach(_=>{let k=_.value instanceof u?_.value._get():_.value instanceof p?_.value.value:_.value;if(this.style.setProperty(_.name,`${k}`),_.value instanceof p||_.value instanceof u){let X=_.value.subscribe(A=>{this.style.setProperty(_.name,`${A}`)});d.registerDisposable(()=>{_.value instanceof u?_.value._unsubscribe(X):_.value.unsubscribe(X)})}}),N(d);try{d.childShadowVdom._render(l)}finally{I()}}}catch(h){try{d.handleError(h)}catch(f){if(f instanceof B)return;throw f}}}};e.defaultView.customElements.define(t,i)}_render(e){try{if(!this.component._)throw new Error("Invalid component. Ensure components are created through the component factory or through decoration.");if(this.component._?._meta?.isRendered)throw new Error("Individual component instances cannot be rendered twice at once.");this.component._._meta||(this.component._._meta={}),this.component._._meta.isRendered=!0;let t=e.ownerDocument;if(this.setupCustomElement(t),this.shadowEl=t.createElement(this.component._._meta.tagName),this.shadowEl.cvdom=this,this.shadowEl.setAttribute("cvdom",""),this.shadowEl.component=this.component,this.init(),this.lastError){K&&this.renderErrorBox(this.lastError),e.appendChild(this.shadowEl);return}N(this);try{this.component.mounting&&this.component.mounting()}finally{I()}e.appendChild(this.shadowEl),this.ref&&(typeof this.ref=="function"?this.ref(this.component):this.ref.value=this.component);for(let s in this.slots){let i=this.slots[s];if(typeof i!="function"&&(i._render(this.shadowEl),s!=="default")){let r=i._getNodes();for(let o of r)o&&o.setAttribute&&o.setAttribute("slot",s)}}for(let s=0;s<this.events.length;s++){let i=this.events[s];this.renderEvent(i.name,i.callback,i.modifiers)}N(this);try{this.component.mounted&&this.component.mounted()}finally{I()}this._onEnterHook&&this._onEnterHook(this.shadowEl),this.component.onEnter&&this.component.onEnter()}catch(t){if(this.shadowEl&&!this.shadowEl.parentElement&&e.appendChild(this.shadowEl),t instanceof B)return;this.handleError(t)}}_unrender(){N(this);try{this.component.unmounting&&this.component.unmounting()}finally{I()}this.childShadowVdom._unrender();for(let t in this.slots){let s=this.slots[t];s instanceof c&&s._unrender()}this.shadowEl&&(this.shadowEl.parentNode?.removeChild(this.shadowEl),delete this.shadowEl.component);for(let t of this.computedSignals)t.dispose();this.computedSignals=[];for(let t of this.buildComputedSignals)t.dispose();this.buildComputedSignals=[];for(let t of this.effects)t.dispose&&t.dispose();this.effects=[];for(let t of this.buildEffects)t.dispose&&t.dispose();this.buildEffects=[];for(let t of this.disposables)t();this.disposables=[];for(let t of this.buildDisposables)t();this.buildDisposables=[],this.ref&&(typeof this.ref=="function"?this.ref(null):this.ref.value=null);let e=this.component.constructor.__hmrId;K&&e&&Je(e,this),this.component._&&(this.component._._meta.isRendered=!1),this.shadowEl=null,this._isRendered=!1,N(this);try{this.component.unmounted&&this.component.unmounted()}finally{I()}}_unrenderAsync(){let e=null;if(this._onLeaveHook&&this.shadowEl){let t=this._onLeaveHook(this.shadowEl);t instanceof Promise&&(e=t)}if(this.component.onLeave){let t=this.component.onLeave();t instanceof Promise&&(e=e?e.then(()=>t):t)}if(e)return e.then(()=>this._unrender());this._unrender()}_getNodes(){return this.shadowEl?[this.shadowEl]:[]}_getLastChild(){return this}addEventListener(e,t,s=[]){this.events.push({name:e,callback:t,modifiers:s}),this.shadowEl&&this.renderEvent(e,t,s)}renderEvent(e,t,s=[]){J.getForDocument(this.shadowEl.ownerDocument).addListener(this.shadowEl,e.toLowerCase(),t,s)}generateStyles(e){return""}};var pe=class extends c{static{a(this,"ReactiveVdom")}binding;beforeNode=null;afterNode=null;currentVdom=null;observerId=0;_isReactiveVdom=!0;constructor(e,t){super(e),this.binding=t}_toVdom(e){if(e==null)return new R("");if(e instanceof c)return e;if(typeof e=="object"&&e.build){let t=new q(this._dot,e);return t.init(),t}if(Array.isArray(e)){let t=new v(this._dot);for(let s of e)t._addChild(this._toVdom(s));return t}return new R(e)}_render(e){this._isRendered=!0,this.beforeNode=e.ownerDocument.createTextNode(""),this.afterNode=e.ownerDocument.createTextNode(""),e.appendChild(this.beforeNode),e.appendChild(this.afterNode);let t=this.binding._get();this.update(t),this.observerId=this.binding._subscribe(this)}update(e){this._isRendered&&(this.currentVdom&&this.currentVdom._unrender(),ue(this.beforeNode,this.afterNode),this.currentVdom=this._toVdom(e),this.currentVdom._renderBefore(this.afterNode))}_unrender(){this._isRendered&&(this._isRendered=!1,this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null),this.observerId&&(this.binding._unsubscribe(this.observerId),this.observerId=0),ue(this.beforeNode,this.afterNode),this.beforeNode.parentElement&&this.beforeNode.parentElement.removeChild(this.beforeNode),this.afterNode.parentElement&&this.afterNode.parentElement.removeChild(this.afterNode),this.beforeNode=null,this.afterNode=null)}_getNodes(){if(!this._isRendered)return[];let e=[this.beforeNode];return this.currentVdom&&e.push(...this.currentVdom._getNodes()),e.push(this.afterNode),e}_getLastChild(){return this}toString(){return this.currentVdom?this.currentVdom.toString():""}};var xe=class{static{a(this,"Effect")}callback;cleanup;dependencies=new Map;isQueued=!1;isEvaluating=!1;active=!0;dirty=!0;newDependencies=new Set;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.dirty&&this.run()},"update")};constructor(e){this.callback=e,this.run()}addDependency(e){this.active&&(this.newDependencies.has(e)||this.newDependencies.add(e))}requestUpdate(){this.active&&(this.dirty=!0,this.isQueued||(this.isQueued=!0,x.enqueue(this.updateSubscription,w.Normal)))}run(){if(!this.active)return;if(this.isEvaluating)throw new Error("Circular dependency detected in effect.");if(this.cleanup){try{this.cleanup()}catch(t){console.error("Error during effect cleanup:",t)}this.cleanup=void 0}this.isEvaluating=!0,this.dirty=!1,this.newDependencies.clear(),Z.push(this);try{let t=this.callback();typeof t=="function"&&(this.cleanup=t)}catch(t){console.error("Error during effect execution:",t)}finally{Z.pop(),this.isEvaluating=!1}let e=[];for(let[t,s]of this.dependencies)this.newDependencies.has(t)||(t.unsubscribe(s),e.push(t));for(let t of e)this.dependencies.delete(t);for(let t of this.newDependencies)if(!this.dependencies.has(t)){let s=t.subscribe(()=>this.requestUpdate(),!0);this.dependencies.set(t,s)}}dispose(){if(this.active){if(this.active=!1,this.cleanup){try{this.cleanup()}catch(e){console.error("Error during effect disposal cleanup:",e)}this.cleanup=void 0}for(let[e,t]of this.dependencies)e.unsubscribe(t);this.dependencies.clear()}}};function tt(n){let e=class extends n{static{a(this,"decorated")}constructor(...t){let s={computedSignals:[],effects:[],disposables:[],registerComputed(i){this.computedSignals.push(i)},registerEffect(i){this.effects.push(i)},registerDisposable(i){this.disposables.push(i)}};N(s);try{super(...t)}finally{I()}t[0]&&typeof t[0]=="object"&&!t[0].build&&n.props&&(this.props||(this.props={}),Object.assign(this.props,t[0])),this._trackedComputeds=s.computedSignals,this._trackedEffects=s.effects,this._trackedDisposables=s.disposables}};Object.defineProperty(e,"name",{value:n.name});for(let t of Object.getOwnPropertyNames(n))t!=="prototype"&&t!=="name"&&t!=="length"&&(e[t]=n[t]);return e}a(tt,"component");var st=new WeakMap;function Me(n,e){let t="";if(n instanceof e.defaultView?.CSSStyleSheet)return n;if(typeof n=="string")t=n;else if(typeof n=="function"){let l=n(null);typeof l=="string"&&(t=l)}let s=st.get(e);if(s||(s=new Map,st.set(e,s)),s.has(t))return s.get(t);let i=e.defaultView?.CSSStyleSheet;if(i)try{let o=new i;if(o.replaceSync)return o.replaceSync(t),s.set(t,o),o}catch{}let r=e.createElement("style");return r.innerHTML=t,r}a(Me,"renderStylesheet");var At=1,Ee=class n{static{a(this,"WindowWrapper")}window;document;title;root;_vdom;width;height;isOpen=!1;tether=!1;syncStyles=!1;position=null;static tetheredWindows=new Set;eventListeners=[];wrapperEventListeners=[];constructor(e){this.root=e.content,this.width=e.width||e.height||600,this.height=e.height||e.width||400,this.title=e.title||"Window",this.tether=e.tether||!1,this.syncStyles=e.syncStyles||!1,this.position=e.position||null}async open(){if(this.isOpen){console.warn("Window is already open.");return}let e=0,t=0,s=`width=${this.width},height=${this.height}`;if(this.position&&(typeof this.position=="object"?(e=this.position.left,t=this.position.top):this.position==="center"?(e=(window.screen.width-this.width)/2,t=(window.screen.height-this.height)/2):this.position==="parent-center"?(e=window.screenX+(window.outerWidth-this.width)/2,t=window.screenY+(window.outerHeight-this.height)/2):this.position==="beside-parent"&&(e=window.screenX+window.outerWidth,t=window.screenY),s+=`,left=${e},top=${t}`),this.window=window.open("",this.title,s),!this.window)throw new Error("Popup window could not be opened.");this.setupDocument(),this.isOpen=!0,this.tether&&(n.tetheredWindows.add(this),n.tetheredWindows.size===1&&(window.addEventListener("pagehide",n.closeAllTethered),window.addEventListener("beforeunload",n.closeAllTethered),window.addEventListener("unload",n.closeAllTethered)))}setupDocument(){this._vdom&&(this._vdom._unrender(),this._vdom=null),this.document=this.window.document,this.document._dotId=`${At++}`;let e=document.createElement("div");e.textContent=this.title;let t=e.innerHTML;this.document.open?(this.document.open(),this.document.write(`<!DOCTYPE html><html><head><title>${t}</title></head><body></body></html>`),this.document.close()):this.document.documentElement.innerHTML=`<head><title>${t}</title></head><body></body>`,this.document=this.window.document;let s=this.document.body;s.innerHTML="",delete s[F],this.syncStyles&&this.syncStylesWithParent(),this._vdom=b(s,this.window).mount(this.root);for(let{name:i,callback:r}of this.eventListeners)this.document.addEventListener(i,r);this.window.addEventListener("unload",()=>{this.isOpen&&setTimeout(()=>{this.window&&!this.window.closed?this.setupDocument():(this.isOpen=!1,this.tether&&n.tetheredWindows.delete(this),this.emit("close"))},100)})}on(e,t){return e==="close"?this.wrapperEventListeners.push({name:e,callback:t}):(this.eventListeners.push({name:e,callback:t}),this.document&&this.document.addEventListener(e,t)),this}emit(e,t){for(let{name:s,callback:i}of this.wrapperEventListeners)s===e&&i(t)}focus(){this.window&&this.window.focus()}bringToFront(){this.window&&this.window.focus()}resizeTo(e,t){this.window&&this.window.resizeTo(e,t),this.width=e,this.height=t}moveTo(e,t){this.window&&this.window.moveTo(e,t)}static closeAllTethered=a(()=>{n.tetheredWindows.forEach(e=>e.close()),n.tetheredWindows.clear()},"closeAllTethered");syncStylesWithParent(){this.document.body.className=document.body.className;let e=getComputedStyle(document.documentElement);for(let s=0;s<document.documentElement.style.length;s++){let i=document.documentElement.style[s];i.startsWith("--")&&this.document.documentElement.style.setProperty(i,e.getPropertyValue(i))}if(this.document.adoptedStyleSheets&&document.adoptedStyleSheets){let s=[];for(let i of document.adoptedStyleSheets)try{let r=new this.window.CSSStyleSheet,o="";for(let l=0;l<i.cssRules.length;l++)o+=i.cssRules[l].cssText+`
|
|
25
|
+
`;r.replaceSync(o),s.push(r)}catch(r){console.warn("Failed to clone adopted stylesheet:",r)}this.document.adoptedStyleSheets=s}document.head.querySelectorAll("style, link[rel='stylesheet']").forEach(s=>{this.document.head.appendChild(s.cloneNode(!0))})}close(){this.window&&(this._vdom&&(this._vdom._unrender(),this._vdom=null),this.window.close(),this.window=null,this.document=null,this.isOpen=!1,this.tether&&n.tetheredWindows.delete(this),this.emit("close"))}};var ae=class extends p{static{a(this,"Ref")}_dot;_isRef=!0;constructor(e){return super(),this._value=null,this._dot=e,new Proxy(this,{get(t,s,i){if(s in t)return Reflect.get(t,s,i);let r=t.value;if(r&&typeof r[s]=="function")return(...o)=>r[s].apply(r,o)},set(t,s,i,r){return s in t?Reflect.set(t,s,i):Reflect.set(t,s,i,r)}})}get element(){return this.value}async ready(){return this.value?this.value:new Promise(e=>{let t=this.subscribe(s=>{s&&(this.unsubscribe(t),e(s))})})}append(e){if(this.value instanceof HTMLElement){let t=this._dot||globalThis.dot;t?t(this.value).append(e):console.warn("DOThtml: Ref.append called but dot instance is not available.")}return this}prepend(e){if(this.value instanceof HTMLElement){let t=this._dot||globalThis.dot;t?t(this.value).prepend(e):console.warn("DOThtml: Ref.prepend called but dot instance is not available.")}return this}};var Ne=class{static{a(this,"RefCollection")}_refs=new Map;_dot;constructor(e){this._dot=e}get(e){return this._refs.has(e)||this._refs.set(e,new ae(this._dot)),this._refs.get(e)}get elements(){let e={};return this._refs.forEach((t,s)=>{e[s]=t.value}),e}forEach(e){this._refs.forEach((t,s)=>{e(t.value,s)})}map(e){let t=[];return this._refs.forEach((s,i)=>{t.push(e(s.value,i))}),t}};var ee=new Map;function nt(n){let{id:e,state:t,getters:s,actions:i}=n;if(e&&ee.has(e))return()=>ee.get(e);let r=a(()=>{let l={$id:e,_state:{},_getters:{},_effects:[]},d={computedSignals:[],effects:[],disposables:[],registerComputed(h){this.computedSignals.push(h)},registerEffect(h){this.effects.push(h)},registerDisposable(h){this.disposables.push(h)}};N(d);try{if(t){let h=t();for(let f in h){let m=h[f],S=m instanceof p?m:new p;S!==m&&(S.value=m),l._state[f]=S,Object.defineProperty(l,f,{get:a(()=>l._state[f],"get"),enumerable:!0,configurable:!0})}}if(s){for(let h in s)Object.defineProperty(l,h,{get:a(()=>l._getters[h],"get"),enumerable:!0,configurable:!0});for(let h in s){let f=new C(()=>s[h].call(l,l));l._getters[h]=f}}if(i)for(let h in i)l[h]=(...f)=>{N(d);try{return i[h].apply(l,f)}finally{I()}}}finally{I()}return l._getters_list=d.computedSignals,l._effects=d.effects,l._disposables=d.disposables,l.$dispose=()=>{for(let h in l._getters)l._getters[h].dispose();for(let h of l._getters_list||[])h.dispose();for(let h of l._effects||[])h.dispose();for(let h of l._disposables||[])h();e&&ee.delete(e),l._state={},l._getters={},l._effects=[]},e&&ee.set(e,l),l},"createInstance"),o;return e&&(o=r()),()=>{let l=e?o:r();if(!e){let d=$();d&&d.registerDisposable&&d.registerDisposable(()=>l.$dispose())}return l}}a(nt,"createStore");function it(n){return ee.get(n)}a(it,"getStore");function rt(){ee.forEach(n=>n.$dispose()),ee.clear()}a(rt,"clearStores");function ot(){let n={};return ee.forEach((e,t)=>{n[t]=e}),n}a(ot,"getStores");var me=["a","aside","abbr","address","area","article","audio","b","bdi","bdo","blockQuote","body","br","button","canvas","caption","cite","code","col","colGroup","content","data","dataList","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldSet","figCaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","i","iFrame","img","input","ins","kbd","keyGen","label","legend","li","main","map","mark","menu","menuItem","meter","nav","object","ol","optGroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","svg","sub","summary","sup","table","tBody","td","textArea","tFoot","th","tHead","time","tr","track","u","ul","var","video","wbr"],at=new Set(me),Oe=["each","html","mount","text","md","when","on"];var le=class extends c{static{a(this,"SlotVdom")}name;fallbackOrScope;fallback=null;scopedContent=null;element=null;component;constructor(e,t,s){super(e),this.name=t||"default",this.fallbackOrScope=s,this.component=$()}_render(e){this._isRendered=!0;let t=e.ownerDocument,i=(this.component||$())?.slots?.[this.name];typeof i=="function"?(this.scopedContent=new v(this._dot),O(this._dot,this.scopedContent,i(this.fallbackOrScope))):this.fallbackOrScope!==void 0&&(this.fallback=new v(this._dot),O(this._dot,this.fallback,this.fallbackOrScope)),this.scopedContent?this.scopedContent._render(e):(this.element=t.createElement("slot"),this.name!=="default"&&(this.element.name=this.name),this.fallback&&this.fallback._render(this.element),e.appendChild(this.element))}_unrender(){this.scopedContent?this.scopedContent._unrender():this.element&&(this.fallback&&this.fallback._unrender(),this.element.remove(),this.element=null),this._isRendered=!1}_getNodes(){return this.scopedContent?this.scopedContent._getNodes():this.element?[this.element]:[]}_getLastChild(){return this}};var j=class n extends c{static{a(this,"DotChain")}_root;constructor(e,t){super(e),this._root=t}_addChild(e){if(this._root instanceof v)this._root._addChild(e);else if(this._root instanceof T)this._root._children.push(e);else{let t=new T(this._dot);t._children.push(this._root),t._children.push(e),this._root=t}return this}_prependChild(e){if(this._root instanceof v)this._root._prependChild(e);else if(this._root instanceof T)this._root._children.unshift(e);else{let t=new T(this._dot);t._children.push(e),t._children.push(this._root),this._root=t}return this}_render(e){this._root._render(e)}_unrender(){this._root._unrender()}_unrenderAsync(){return this._root._unrenderAsync()}_renderBefore(e){this._root._renderBefore(e)}_renderAfter(e){this._root._renderAfter(e)}_moveBefore(e,t){this._root._moveBefore(e,t)}get _isRendered(){return this._root._isRendered}set _isRendered(e){this._root._isRendered=e}_getNodes(){return this._root._getNodes()}_getLastChild(){return this._root._getLastChild()}get _children(){return this._root instanceof v?this._root._children:this._root instanceof T?this._root._children:[]}slot(e,t){let s=this._getLastChild();for(;s instanceof n;)s=s._root;return s instanceof q?(typeof e!="string"&&(t=e,e="default"),s.addSlot(e||"default",t)):(typeof e!="string"&&(t=e,e=void 0),this._addChild(new le(this._dot,e,t))),this}};function de(n){return n instanceof p?n.bind():n}a(de,"reduceReactive");function he(n){return n instanceof j?n:new j(n._dot,n)}a(he,"promote");function dt(n,e,t){let s=de(e);if(s instanceof c||s?._root)return he(s);if(typeof s=="string"||s instanceof u||typeof s=="number"||typeof s=="boolean"||s===null||s===void 0||Array.isArray(s))return new ce(s,n);let i=new q(n,s);for(let r=0;r<t.length;r++){let o=t[r];if(De(o))i.addSlot("default",o);else if(o&&typeof o=="object")for(let l in o){let d=o[l];if(l==="ref")i.setRef(d);else if(l.startsWith("on")&&typeof d=="function"){let h=l,f=[];if(l.includes(".")){let m=l.split(".");h=m[0],f=m.slice(1)}i.addEventListener(h.substring(2).toLowerCase(),d,f)}else{let h=e.constructor.props;h&&h[l]?(e.props||(e.props={}),e.props[l]=d):typeof d=="function"||d instanceof c||d?._root||d?._children?i.addSlot(l,d):(e.props||(e.props={}),e.props[l]=d)}}}return i}a(dt,"createMountable");c.prototype._addChild=function(n){return he(this)._addChild(n)};c.prototype._prependChild=function(n){return he(this)._prependChild(n)};c.prototype.text=function(n){let e=de(n);return e instanceof u?this._addChild(new pe(this._dot,e)):this._addChild(new R(e))};c.prototype.html=function(n){return this.mount(n)};c.prototype.md=function(n){return this.text(n)};c.prototype.slot=function(n,e){let t=this._getLastChild();for(;t instanceof j;)t=t._root;return t instanceof q?(typeof n!="string"&&n!==void 0&&(e=n,n="default"),t.addSlot(n||"default",e),this):(typeof n!="string"&&n!==void 0&&(e=n,n=void 0),this._addChild(new le(this._dot,n,e)))};c.prototype.mount=function(n,...e){return this._addChild(dt(this._dot,n,e))};c.prototype.append=function(n){let e=this;for(;e instanceof j;)e=e._root;return e instanceof L?(e.children.mount(n),this):this.mount(n)};c.prototype.prepend=function(n){let e=this;for(;e instanceof j;)e=e._root;return e instanceof L?(e.children.prepend(n),this):this._prependChild(dt(this._dot,n,[]))};c.prototype.when=function(n,e){let t=new ne(this._dot),s;return e instanceof c?s=e:typeof e=="object"&&e?.build?(s=new T(this._dot),s.mount(e)):(s=new T(this._dot),s._children.push(new R(de(e)))),t.addCondition(de(n),s),this._addChild(t)};c.prototype.each=function(n,e){let t=new se(this._dot,de(n),e);return this._addChild(t)};c.prototype.otherwiseWhen=function(n,e,t=!1){let s=this._getLastChild();if(s instanceof ne){let i;e instanceof c?i=e:typeof e=="object"&&e?.build?(i=new T(this._dot),i.mount(e)):i=new R(de(e)),s.addCondition(de(n),i,t)}else throw new Error("Can't branch off of a non-conditional node.");return this};c.prototype.otherwise=function(n){return this.otherwiseWhen(!0,n,!0)};c.prototype.attr=function(n,e){let t=this._getLastChild();if(t instanceof L)t.setAttr(n,e);else throw new Error(`Invalid node to set ${n} attribute.`);return this};c.prototype.style=function(n){if(typeof n=="function"){let e=new E;n(e),this.attr("style",e)}else this.attr("style",n);return this};c.prototype.on=function(n,e){let t=this._getLastChild();if(t&&(t instanceof L||t instanceof q))t.addEventListener(n,e);else throw new Error(`Invalid node to set ${n} listener.`);return this};c.prototype.onEnter=function(n){let e=this._getLastChild();if(e&&(e._onEnterHook=n,e._isRendered)){let s=e._getNodes().find(i=>i instanceof HTMLElement);s&&n(s)}return this};c.prototype.onLeave=function(n){let e=this._getLastChild();return e&&(e._onLeaveHook=n),this};c.prototype.empty=function(){let n=this;for(;n instanceof j;)n=n._root;let e=n instanceof v?n:n instanceof L?n.children:null;return e&&(e._unrender(),e._children=[],e._isRendered=!0,e._parent instanceof L&&e._parent.element&&(e._parent.element.innerHTML="")),this};c.prototype.remove=function(){let n=this;for(;n instanceof j;)n=n._root;n instanceof v&&n._parent instanceof L?n._parent._unrender():n._unrender()};c.prototype.fade=function(n=300){return this.onEnter(e=>{e.animate([{opacity:0},{opacity:1}],{duration:n})}).onLeave(async e=>{await e.animate([{opacity:1},{opacity:0}],{duration:n}).finished})};c.prototype.slide=function(n=300){return this.onEnter(e=>{e.animate([{height:"0",opacity:0,overflow:"hidden"},{height:e.scrollHeight+"px",opacity:1,overflow:"hidden"}],{duration:n})}).onLeave(async e=>{await e.animate([{height:e.scrollHeight+"px",opacity:1,overflow:"hidden"},{height:"0",opacity:0,overflow:"hidden"}],{duration:n}).finished})};for(let n=0;n<me.length;n++){let e=me[n];c.prototype[e]=function(...t){return this._addChild(Be(this._dot,e,t))}}var lt=a((n,e)=>{n[e]=function(){if(at.has(e))return he(Be(n,e,arguments));{let t=new v(n);return t[e](...arguments),he(t)}}},"makeCoreWrapper"),Rt=a(()=>{let n=a(function(e,t=window){if(e?.ownerDocument?.defaultView){let s=e,i=s[F];return i||(i=new L(n,s.tagName.toLocaleLowerCase()),i.element=s,i._isRendered=!0,i.children._parent=i,i.children._isRendered=!0,s[F]=i),he(i.children)}else{if(typeof e=="string")return n(t.document.querySelectorAll(e)[0]);throw new Error("Invalid render target.")}},"_dot");n.onError=null,n.state=function(e,t){let s=new p;return s.key=t,s.value=e,s},n.computed=function(e){let t=new C(e),s=$();return s&&s.registerComputed(t),t},n.effect=function(e){let t=new xe(e),s=$();return s&&(s.registerEffect?s.registerEffect(t):s.registerComputed(t)),()=>t.dispose()},n.component=tt,n.hmr={swap(e,t){let s=et(e);for(let i of s)i._hmrSwap(t)}},n.slot=function(e,t){return typeof e!="string"&&e!==void 0&&(t=e,e=void 0),new le(n,e,t)},n.getCurrentComponent=$,n.store=nt,n.getStore=it,n.clearStores=rt,Object.defineProperty(n,"stores",{get:a(()=>ot(),"get")}),n.create=function(e,...t){let s={computedSignals:[],effects:[],disposables:[],registerComputed(r){this.computedSignals.push(r)},registerEffect(r){this.effects.push(r)},registerDisposable(r){this.disposables.push(r)}};N(s);let i;try{i=new e(...t)}finally{I()}return i._trackedComputeds?i._trackedComputeds.push(...s.computedSignals):i._trackedComputeds=s.computedSignals,i._trackedEffects?i._trackedEffects.push(...s.effects):i._trackedEffects=s.effects,i._trackedDisposables?i._trackedDisposables.push(...s.disposables):i._trackedDisposables=s.disposables,i},n.ref=function(){return new ae(n)},n.refCollection=function(){return new Ne(n)},n.alpha=function(e,t){return new C(()=>{let s=e instanceof u?e._get():e instanceof p?e.value:e,i=t instanceof u?t._get():t instanceof p?t.value:t,r=Math.round(Math.max(0,Math.min(100,(1-i)*100))*100)/100;return`color-mix(in srgb, ${s}, transparent ${r}%)`})},n.globalStyles=[],n.useGlobalStyles=e=>{let t=Array.isArray(e)?e:[e];for(let s of t)n.globalStyles.push(s),typeof document<"u"&&n.useStyles(document,s)},n.css=new E,n._theme=null,n.setTheme=e=>{n._theme=e},n.useStyles=(e,t)=>{e&&!t&&(typeof e=="string"||e.call&&e.apply)&&(t=e,e=document);let s=Me(t,e);s instanceof e.defaultView?.CSSStyleSheet?e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]:s instanceof HTMLElement&&e.head.appendChild(s)},typeof document<"u"&&new M(n.css).render(document.documentElement),n.window=e=>new Ee(e),n.flushSync=()=>{x.flushSync()},n.setSync=e=>{x.setSync(e)},x.onError=e=>{n.onError?n.onError(e):console.error("DOThtml Error:",e)};for(let e=0;e<me.length;e++){let t=me[e];lt(n,t)}for(let e=0;e<Oe.length;e++){let t=Oe[e];lt(n,t)}return n},"makeDot"),ht=Rt();K&&typeof window<"u"&&(window.dot=ht);var b=ht;var $e=a(()=>{if(typeof window>"u")return{path:"/",search:"",hash:""};let n=window.location.pathname,e=window.location.search,t=window.location.hash;if(t.startsWith("#/")){let s=t.substring(1),i=s.search(/[?#]/);if(i===-1)n=s,e="",t="";else{n=s.substring(0,i);let r=s.substring(i),o=r.indexOf("#");o===-1?(e=r,t=""):(e=r.substring(0,o),t=r.substring(o))}}return{path:n,search:e,hash:t}},"getRouteInfo"),Ae=$e(),P=b.state(Ae.path),Q=b.state(Ae.path),ge=b.state(Ae.search),z=b.state(Ae.hash);function G(n,e=!1){if(typeof window>"u")return;Q.value=P.value,e?window.history.replaceState({},"",n):window.history.pushState({},"",n);let t=$e();P.value=t.path,ge.value=t.search,z.value=t.hash}a(G,"navigate");function Fe(){return b.computed(()=>{let n=ge.value,e=new URLSearchParams(n),t={};return e.forEach((s,i)=>{t[i]=s}),t})}a(Fe,"useQueryParams");function We(){return b.computed(()=>{let n=z.value;return n.startsWith("#")?n.substring(1):n})}a(We,"useHash");if(typeof window<"u"){let n=a(()=>{let e=$e();Q.value=P.value,P.value=e.path,ge.value=e.search,z.value=e.hash},"updateState");window.addEventListener("popstate",n),window.addEventListener("hashchange",n)}var He=[],Ie=[],ut=b.state([]);function ct(n){ut.value=n}a(ct,"setGlobalRoutes");function qe(){return ut.value}a(qe,"getGlobalRoutes");function ft(n,e,t=""){let i=(e.startsWith(t)?e.slice(t.length):e).split("/").filter(r=>r!=="");for(let r of n){let o=r.path.split("/").filter(m=>m!==""),l={},d=!0,h=o.indexOf("*")!==-1,f=!!(r.children&&r.children.length>0);if(!(!h&&!f&&o.length!==i.length)&&!(o.length>i.length)){for(let m=0;m<o.length;m++){let S=o[m],g=i[m];if(S==="*"){d=!0;break}if(g===void 0){d=!1;break}if(S!=="+"){if(S.startsWith("{")&&S.endsWith("}")){let _=S.slice(1,-1);l[_]=g;continue}if(S.startsWith(":")){let _=S.slice(1);l[_]=g;continue}if(S!==g){d=!1;break}}}if(d){let m=i.slice(0,o.length),S=(t.endsWith("/")?t.slice(0,-1):t)+"/"+m.join("/");return{route:r,params:l,matchedPath:S}}}}return null}a(ft,"matchRoute");var be=b.component(class{static props={routes:{type:Array,required:!0},notFound:{type:Object,default:null},loading:{type:Object,default:null},basePath:{type:String,default:""}};props;resolvedComponent=b.state(null);currentMatch=null;lastPath="";subId=-1;loaderCache=new Map;mounting(){this.subId=P.subscribe(()=>{this._?.cvdom.requestUpdate()})}unmounting(){P.unsubscribe(this.subId)}build(n){ct(this.props.routes);let e=P.value,t=ft(this.props.routes,e,this.props.basePath);this.currentMatch=t;let s=a(o=>{if(!t)return;let l=t.route.title;if(typeof l=="function"&&(l=l(t.params)),l&&(document.title=l),typeof o=="function"&&!o.prototype?.build){if(this.loaderCache.has(o)){this.resolvedComponent.value=this.loaderCache.get(o),Ie.forEach(h=>h(e,Q.value));return}let d=o();if(d instanceof Promise){d.then(h=>{let f=h.default||h;this.loaderCache.set(o,f),this.resolvedComponent.value=f,this._?.cvdom.requestUpdate(),Ie.forEach(m=>m(e,Q.value))}),this.resolvedComponent.value=this.props.loading||n.div("Loading...");return}}this.resolvedComponent.value=o,Ie.forEach(d=>d(e,Q.value))},"proceed");if(!t)this.resolvedComponent.value=this.props.notFound||n.div("404 - Not Found");else if(t.route.redirect){let o=typeof t.route.redirect=="function"?t.route.redirect(t.params):t.route.redirect;return G(o,!0),n.div()}else{let o=[...He];t.route.beforeEnter&&o.push(t.route.beforeEnter);let l=a(async d=>{if(d>=o.length){s(t.route.component);return}let h=o[d],f=!1,m=a(g=>{f||(f=!0,g===!1?G(Q.value,!0):typeof g=="string"?G(g,!0):l(d+1))},"handleNext"),S=h(e,Q.value,m);if(S instanceof Promise){let g=await S;f||(g===!1||typeof g=="string"?m(g):m())}else S!==void 0&&!f&&m(S)},"runGuards");l(0)}let i=this.resolvedComponent.value;if(!i)return n.div();let r=this.currentMatch;return typeof i=="function"&&i.prototype?.build?n.mount(new i,{routeParams:r?.params,basePath:r?.matchedPath}):typeof i=="object"&&i.build?n.mount(i,{routeParams:r?.params,basePath:r?.matchedPath}):i instanceof c?i:n.div(i)}});be.beforeEach=n=>{He.push(n)};be.afterEach=n=>{Ie.push(n)};be.clearHooks=()=>{He.length=0,Ie.length=0};function Re(n,e,t={},s=""){for(let i of n){let r=(s.endsWith("/")?s.slice(0,-1):s)+(i.path.startsWith("/")?"":"/")+i.path;if(i.name===e){let o=r;for(let l in t){let d=t[l];o=o.replace(new RegExp(`\\{${l}\\}`,"g"),d),o=o.replace(new RegExp(`:${l}`,"g"),d)}return o}if(i.children){let o=Re(i.children,e,t,r);if(o)return o}}return null}a(Re,"generatePath");var je=b.component(class{static props={to:{type:String,default:""},name:{type:String,default:""},params:{type:Object,default:a(()=>({}),"default")},activeClass:{type:String,default:"active"},exact:{type:Boolean,default:!1},label:{type:String,default:""}};props;slots;getResolvedPath(){return this.props.name?Re(qe(),this.props.name,this.props.params)||"":this.props.to}build(){let n=b.computed(()=>this.getResolvedPath());return b.a({hRef:n,class:b.computed(()=>{let e=P.value,t=n.value;return t.startsWith("#/")?t=t.substring(1).split(/[?#]/)[0]:t=t.split(/[?#]/)[0],(this.props.exact?e===t:e.startsWith(t))?this.props.activeClass:""}),onClick:a(e=>{(e.button===0||e.button===void 0)&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(e.preventDefault(),G(n.value))},"onClick")},this.props.label||this.slots?.default)}});function Ue(n,e=document){let t=e.getElementById(n);if(t)return t;let s=e.querySelectorAll("*");for(let i=0;i<s.length;i++){let r=s[i].shadowRoot;if(r&&(t=Ue(n,r),t))return t}return null}a(Ue,"getElementByIdDeep");var mt=new Map,Te=null;function Tt(n,e=!1){let t=z.value;if(t&&t.startsWith("#")){let i=t.substring(1),r=Ue(i);if(r){let o=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;r.scrollIntoView({behavior:e&&!o?"smooth":"auto"});return}}let s=mt.get(n);s?window.scrollTo(s.x,s.y):window.scrollTo(0,0)}a(Tt,"performScroll");function pt(n,e){Te&&clearTimeout(Te),Te=setTimeout(()=>{Tt(n,e),Te=null},0)}a(pt,"scheduleScroll");function Ye(){if(typeof window>"u")return;window.addEventListener("scroll",()=>{mt.set(P.value,{x:window.pageXOffset,y:window.pageYOffset})},{passive:!0}),b.computed(()=>({path:P.value,hash:z.value})).subscribe(e=>{pt(e.path,!0)}),pt(P.value,!1)}a(Ye,"initScrollManager");var Qe=class{static{a(this,"DotComponent")}props;refs={};_;constructor(e){this.props=e||{}}emit(e,t){}effect(e){b.effect(e)}};b.version="6.0.0-debug";Ye();b.currentPath=P;b.currentSearch=ge;b.currentHash=z;b.navigate=G;b.useQueryParams=Fe;b.useHash=We;b.Router=be;b.Link=je;window.dot=b;document._dotId="default";0&&(module.exports={DotComponent,Link,Priority,Router,currentHash,currentPath,currentSearch,dot,generatePath,getGlobalRoutes,initScrollManager,matchRoute,navigate,previousPath,setGlobalRoutes,useHash,useQueryParams});
|
|
26
26
|
//# sourceMappingURL=index.cjs.map
|