dothtml 6.0.0-beta.8 → 6.0.0

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.
Files changed (64) hide show
  1. package/dist/index.cjs +26 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.mts +129 -0
  4. package/dist/index.d.ts +129 -0
  5. package/dist/index.global.js +26 -0
  6. package/dist/index.global.js.map +1 -0
  7. package/dist/index.js +26 -0
  8. package/dist/index.js.map +1 -0
  9. package/package.json +81 -57
  10. package/build_module/constants.d.ts +0 -1
  11. package/build_module/constants.js +0 -2
  12. package/build_module/constants.js.map +0 -1
  13. package/build_module/css/css.d.ts +0 -0
  14. package/build_module/css/css.js +0 -1
  15. package/build_module/css/css.js.map +0 -1
  16. package/build_module/decoration/component.d.ts +0 -14
  17. package/build_module/decoration/component.js +0 -27
  18. package/build_module/decoration/component.js.map +0 -1
  19. package/build_module/decoration/style.d.ts +0 -0
  20. package/build_module/decoration/style.js +0 -1
  21. package/build_module/decoration/style.js.map +0 -1
  22. package/build_module/decoration/use-styles.d.ts +0 -14
  23. package/build_module/decoration/use-styles.js +0 -32
  24. package/build_module/decoration/use-styles.js.map +0 -1
  25. package/build_module/dot.d.ts +0 -3
  26. package/build_module/dot.js +0 -516
  27. package/build_module/dot.js.map +0 -1
  28. package/build_module/helpers.d.ts +0 -2
  29. package/build_module/helpers.js +0 -49
  30. package/build_module/helpers.js.map +0 -1
  31. package/build_module/index.d.ts +0 -7
  32. package/build_module/index.js +0 -5
  33. package/build_module/index.js.map +0 -1
  34. package/build_module/reactive.d.ts +0 -37
  35. package/build_module/reactive.js +0 -120
  36. package/build_module/reactive.js.map +0 -1
  37. package/build_module/v-dom-node.d.ts +0 -0
  38. package/build_module/v-dom-node.js +0 -1
  39. package/build_module/v-dom-node.js.map +0 -1
  40. package/build_module/vdom-nodes/collection-vdom.d.ts +0 -24
  41. package/build_module/vdom-nodes/collection-vdom.js +0 -154
  42. package/build_module/vdom-nodes/collection-vdom.js.map +0 -1
  43. package/build_module/vdom-nodes/component-vdom.d.ts +0 -14
  44. package/build_module/vdom-nodes/component-vdom.js +0 -61
  45. package/build_module/vdom-nodes/component-vdom.js.map +0 -1
  46. package/build_module/vdom-nodes/conditional-vdom.d.ts +0 -14
  47. package/build_module/vdom-nodes/conditional-vdom.js +0 -97
  48. package/build_module/vdom-nodes/conditional-vdom.js.map +0 -1
  49. package/build_module/vdom-nodes/container-vdom.d.ts +0 -23
  50. package/build_module/vdom-nodes/container-vdom.js +0 -85
  51. package/build_module/vdom-nodes/container-vdom.js.map +0 -1
  52. package/build_module/vdom-nodes/element-vdom.d.ts +0 -18
  53. package/build_module/vdom-nodes/element-vdom.js +0 -88
  54. package/build_module/vdom-nodes/element-vdom.js.map +0 -1
  55. package/build_module/vdom-nodes/html-vdom.d.ts +0 -13
  56. package/build_module/vdom-nodes/html-vdom.js +0 -53
  57. package/build_module/vdom-nodes/html-vdom.js.map +0 -1
  58. package/build_module/vdom-nodes/text-vdom.d.ts +0 -11
  59. package/build_module/vdom-nodes/text-vdom.js +0 -37
  60. package/build_module/vdom-nodes/text-vdom.js.map +0 -1
  61. package/build_module/vdom-nodes/vdom.d.ts +0 -7
  62. package/build_module/vdom-nodes/vdom.js +0 -28
  63. package/build_module/vdom-nodes/vdom.js.map +0 -1
  64. package/readme.md +0 -26
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ var rt=Object.defineProperty;var a=(n,e)=>rt(n,"name",{value:e,configurable:!0});var $="_dotVDom",z=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")}_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 W=class{static{a(this,"VMetaNode")}};function oe(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[$]?t[$]._unrender():t.parentNode?.removeChild(t),t=s}}a(oe,"removeNodesBetween");function Ce(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)||!Ce(n[s],e[s],t))return!1;for(let s in e)if(!n.hasOwnProperty(s))return!1;return!0}a(Ce,"deepEqual");var fe=new RegExp("[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?","g");var f=class{static{a(this,"Vdom")}_dot;_onEnterHook;_onLeaveHook;constructor(e){this._dot=e}async _unrenderAsync(){let t=this._getNodes().find(s=>s instanceof HTMLElement);this._onLeaveHook&&t&&await this._onLeaveHook(t),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){if(e&&this.__isRendered)throw new Error("Internal Error: Node is already rendered.");if(!e&&!this.__isRendered)throw new Error("Internal Error: Node is not rendered.");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}};var I=class extends f{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 A=class extends f{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 _=(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 ot=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=_.Normal){e.isQueued||(e.isQueued=!0,this.queues[t].add(e)),t===_.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(){this.startTime=performance.now(),this.isPending=!1,this.flushQueues()&&this.scheduleFlush()}flushQueues(){for(let e=_.Immediate;e<=_.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=_.Immediate;e<=_.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=_.Immediate;s<=_.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){this.onError?this.onError(l):console.error("Scheduler error (sync):",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}},w=new ot;var J=class n extends f{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=w.shouldYield;w.shouldYield=()=>!1;try{this.updateList()}finally{w.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&&!Ce(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 f?r=i:typeof i=="object"&&i?.build?(r=new A(this._dot),r.mount(i)):r=new I(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)}async removeItem(e){await e.vdom._unrenderAsync(),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&&(Ce(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,c)=>i?h[i]:c):Object.keys(e).map((h,c)=>i?e[h][i]:h),l=this.getTailAppendPrefixLength(o),d=new Map;for(let h=0;h<this.mappedItems.length;h++){let c=this.mappedItems[h];h>=l&&d.set(c.keyValue,c)}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),c;h instanceof f?c=h:typeof h=="object"&&h?.build?(c=new A(this._dot),c.mount(h)):c=new I(h),c._root&&(c=c._root);let m=this.startNode.ownerDocument.createTextNode("");s.nextMappedItems.push({vdom:c,value:i,keyValue:r,afterNode:m,observableIndex:d})}}if(s.currentIndex++,w.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(w.shouldYield())return!0}return this.updateState=null,!1}};var ee=class extends f{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)}async performUpdate(e){let t=this.renderedIndex;if(this.renderedIndex=e,t!=-1){let s=this.conditions[t];this.currentUpdatePromise=Promise.resolve(s.vNode._unrenderAsync()),await this.currentUpdatePromise,this.currentUpdatePromise=null}if(this.nextIndex!==null){let s=this.nextIndex;if(this.nextIndex=null,s!==this.renderedIndex){this.performUpdate(s);return}}if(this.renderedIndex!=-1){let s=this.conditions[this.renderedIndex];s.vNode._renderBefore(s.endAnchor)}if(this.nextIndex!==null){let s=this.nextIndex;this.nextIndex=null,s!==this.renderedIndex&&this.performUpdate(s)}}};var ae=class extends f{static{a(this,"HtmlVdom")}beforeNode;afterNode;_html;observerId=0;constructor(e){super(),this._html=e}updateHtml(e){if(this.beforeNode){oe(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 u?(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;oe(this.beforeNode,this.afterNode),e.removeChild(this.beforeNode),e.removeChild(this.afterNode),this.beforeNode=null,this.afterNode=null}this.observerId&&this._html instanceof u&&(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 u?this._html._get():this._html}};var te=class{static{a(this,"ReactiveAttr")}elementVdom;attribute;constructor(e,t){this.elementVdom=e,this.attribute=t}};var pe=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 I)this.item.textNode.textContent=e??"";else if(this.item._isReactiveVdom)this.item.update(e);else if(this.item instanceof ae)this.item.updateHtml(e);else if(this.item instanceof te)this.item.elementVdom.updateReactiveAttr(this.item.attribute,e);else if(this.item instanceof W)this.item.update();else{if(this.item instanceof J)return this.item.updateList();this.item instanceof ee?this.item.updateConditions():this.item instanceof Function&&this.item(e)}}};var Q=[];var at=7,xs=at+1,p=class{static{a(this,"Signal")}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=Q[Q.length-1];return e&&e.addDependency&&e.addDependency(this),this._value}set value(e){this.setValue(e)}getValue(){return this.value}setValue(e,t=_.Normal){this._value!==e&&(this._value=e,this.updater(this._value,t))}updater(e,t=_.Normal){for(let s of this.subscribers.values())s.sync?s.update():(!s.isQueued||t===_.Immediate)&&w.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 pe(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=_.Normal){let t=this.value;this.updater(t,e)}updateObservers(e=_.Normal){this.refresh(e)}};var se=class extends W{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))}this.target.setAttribute(this.attr,e.join(" "))}unrender(){this.target=null;for(let e in this.observables)this.observables[e]._unsubscribe(Number(e));this.observables={}}};var De={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"},lt="Cm|Mm|In|Px|Pt|Pc|Ch|Em|Ex|Lh|Rem|Vh|Vw|Vmin|Vmax|Cqw|Cqh|Cqi|Cqb|Cqmin|Cqmax|P".split("|"),dt="Ms|S".split("|"),ht="Deg|Grad|Rad|Turn".split("|"),ct="Hz|Khz".split("|"),le={};for(let n in De){let e=De[n].split("|");for(let t of e){let s=t.split("-").join("");switch(n){case"hybrid":case"length":{for(let i of lt)le[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i=="P"?"%":i.toLowerCase()};break}case"time":{for(let i of dt)le[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i.toLowerCase()};break}case"angle":{for(let i of ht)le[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i.toLowerCase()};break}case"frequency":{for(let i of ct)le[`${s}${i}`]={dotName:s,cssName:t.toLowerCase(),type:n,unit:i.toLowerCase()};break}default:break}le[s]={dotName:s,cssName:t.toLowerCase(),type:n,unit:void 0}}}var ne=le;var S=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 b(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=>b(s,e)).join(" ");isNaN(n)||(n=n+e);let t=n.trim().split(" ");if(t.length>1)return t.map(s=>b(s,e)).join(" ");{let s=Number(n.match(fe)[0]),i=n.split(fe)[1]||e;return`${s}${i}`}}a(b,"formatCssLength");function xe(n){if(n=n||"0%",n instanceof u&&(n=n._get()),n instanceof p&&(n=n.value),n instanceof Array)return n.map(t=>xe(t)).join(" ");let e=n.trim().split(" ");return e.length>1?e.map(t=>xe(t)).join(" "):isNaN(n)?n:`${n}%`}a(xe,"formatCssPercentage");function $e(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($e,"formatCssColor");function P(n){if(n=n||"0deg",n instanceof u&&(n=n._get()),n instanceof p&&(n=n.value),n instanceof Array)return n.map(t=>P(t)).join(" ");isNaN(n)||(n=`${n}deg`);let e=n.trim().split(" ");if(e.length>1)return e.map(t=>P(t)).join(" ");{let t=Number(n.match(fe)[0]),s=n.split(fe)[1]||"deg";return`${t}${s}`}}a(P,"formatCssAngle");var O=class extends S{static{a(this,"FilterVStyle")}blur(e){return this.appendFunction("blur",[{v:e,f:b}])}brightness(e){return this.appendFunction("brightness",[{v:e,f:xe}])}contrast(e){return this.appendFunction("contrast",[{v:e,f:b}])}dropShadow(e,t,s,i){return this.appendFunction("drop-shadow",[{v:e,f:b},{v:t,f:b},{v:s,f:b},{v:i,f:$e}])}grayscale(e){return this.appendFunction("grayscale",[{v:e,f:b}])}hueRotate(e){return this.appendFunction("hue-rotate",[{v:e,f:b}])}invert(e){return this.appendFunction("invert",[{v:e,f:b}])}opacity(e){return this.appendFunction("opacity",[{v:e,f:b}])}sepia(e){return this.appendFunction("sepia",[{v:e,f:b}])}saturate(e){return this.appendFunction("saturate",[{v:e,f:b}])}};var M=class extends S{static{a(this,"TransformVStyle")}matrix3d(e,t,s,i,r,o,l,d,h,c,m,g,N,D,vt,St){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:b,v:e}]):this.appendFunction("translate",[{f:b,v:e},{f:b,v:t}])}translate3d(e,t,s){return this.appendFunction("translate3d",[{f:b,v:e},{f:b,v:t},{f:b,v:s}])}translateX(e){return this.appendFunction("translateX",[{f:b,v:e}])}translateY(e){return this.appendFunction("translateY",[{f:b,v:e}])}translateZ(e){return this.appendFunction("translateZ",[{f:b,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:P,v:e}])}rotate3d(e,t,s,i){return this.appendFunction("rotate3d",[e,t,s,{f:P,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:P,v:e}])}rotateY(e){return this.appendFunction("rotateY",[{f:P,v:e}])}rotateZ(e){return this.appendFunction("rotateZ",[{f:P,v:e}])}skew(e,t){return arguments.length==1?this.appendFunction("skew",[{f:P,v:e}]):this.appendFunction("skew",[{f:P,v:e},{f:P,v:t}])}skewX(e){return this.appendFunction("skewX",[{f:P,v:e}])}skewY(e){return this.appendFunction("skewY",[{f:P,v:e}])}perspective(e){return this.appendFunction("perspective",[{f:b,v:e}])}};var v=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 ne)v.prototype[n]=function(e){return this.setProp(n,e)};var V=class extends W{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 v&&this.styleSource._setOnUpdate(()=>this.update()),this.extractObservables()}extractObservables(){let e=this.styleSource instanceof v?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 S)){let i;switch(e){case"filter":{i=new O(e);break}case"transform":{i=new M(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 c of d)this.tryExtractObservable(c);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,w.enqueue(this.updateSubscription,_.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 v?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 S)s=t.toString();else if(typeof t=="object"&&t!==null&&(e==="transform"||e==="filter")){let l=e==="transform"?new M(e):new O(e);this.applyObjectToBuilder(l,t),s=l.toString()}else s=t;let i=e,r,o=ne[e];o&&(i=o.cssName,r=o.unit,(o.type==="length"||o.type==="hybrid")&&typeof s=="number"?o.type==="hybrid"&&r===void 0||(s=b(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 v?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 S)s=s.toString();else if(typeof s=="object"&&s!==null&&(e==="transform"||e==="filter")){let l=e==="transform"?new M(e):new O(e);this.applyObjectToBuilder(l,s),s=l.toString()}let i=e,r,o=ne[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=b(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 me=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 H=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 me(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 f{static{a(this,"ElementVdom")}_children=null;get children(){return this._children||(this._children=new E(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[$]=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=H.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 V){i.unrender();let r=this.styleVNodes.indexOf(i);r!==-1&&this.styleVNodes.splice(r,1)}if(i instanceof se){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 instanceof p||t instanceof v))switch(e){case"style":{t=new V(t);break}case"ref":break;default:{t=new se(e,t);break}}if(typeof t=="function"&&e==="style"){let r=new v;t(r),t=new V(r)}t instanceof v&&e==="style"&&(t=new V(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){if(this.renderAttr(e,t._get(),s,i),!this.attributeObserverIds.some(r=>r.attr===e&&r.observable===t)){let r=t._subscribe(new te(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],c=d._get(),m=this.lastSyncedValues[l];c==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=H.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 se?(t.render(s),this.attrVNodes.push(t)):t instanceof V&&(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=[]){H.getForDocument(this.element.ownerDocument).addListener(this.element,e.toLowerCase(),t,s)}};var E=class extends f{static{a(this,"ContainerVdom")}_children=[];_parent=null;constructor(e){super(e)}_addChild(e){return this._children.push(e),this._parent&&this._parent instanceof R&&this._parent.element&&e._render(this._parent.element),this}_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 q=class extends p{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 Oe={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 ke=a(n=>n instanceof E||n instanceof f||n?._root||n?._children||typeof n=="object"&&n?.build||n instanceof p||n instanceof u||typeof n=="string"||typeof n=="number"||typeof n=="boolean"||Array.isArray(n),"isContent"),j=a((n,e,t)=>{let s=e instanceof R?e.children:e;if(Array.isArray(t))for(let i=0;i<t.length;i++)j(n,e,t[i]);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?._root)j(n,e,t._root);else if(t instanceof f)s._addChild(t);else if(typeof t=="object"&&t?.build)s.mount(t);else if(t!=null){let i=t;i instanceof p&&(i=i.bind()),i instanceof u?s._addChild(new de(n,i)):s._addChild(new I(i))}},"applyContent"),ut=a((n,e)=>{for(let t in e){let s=e[t];s instanceof p&&!(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(Oe[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"),Le=a((n,e,t)=>{let s=new R(n,e);for(let i=0;i<t.length;i++){let r=t[i];ke(r)?j(n,s,r):r&&typeof r=="object"&&ut(s,r)}return s},"createElement");var Me=new WeakMap;function he(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=Me.get(e);if(s||(s=new Map,Me.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(he,"renderStylesheet");var Ee=[],B=a(()=>Ee[Ee.length-1]||null,"getCurrentComponent"),C=a(n=>Ee.push(n),"pushComponent"),x=a(()=>Ee.pop(),"popComponent");var k=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,w.enqueue(this.updateSubscription,_.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(),Q.push(this);let e,t=!1;try{e=this.getter()}catch(i){this.error=i,t=!0}finally{Q.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 ge=class{static{a(this,"KeyframesBuilder")}sheet;steps=[];constructor(e){this.sheet=e}step(e,t){let s=new v;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 U=class n{static{a(this,"StyleSheetBuilder")}rules=[];theme=null;ghostVars=[];varCounter=0;getGhostVars(){return this.ghostVars}setTheme(e){return this.theme=e,this}template(e,...t){return new k(()=>{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 v;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 ge(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=ne[t.prop],i=t.prop,r=t.value;if(typeof r=="object"&&r!==null&&!(r instanceof S)&&!(r instanceof p)&&!(r instanceof u)){let o;switch(t.prop){case"filter":{o=new O(t.prop);break}case"transform":{o=new M(t.prop);break}}o&&(this.applyObjectToBuilder(o,r),r=o)}if(r instanceof p||r instanceof u||r instanceof S){let o=r instanceof p||r instanceof u;if(r instanceof S)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=`--dh-v${++this.varCounter}`,d=r,h=r;(t.prop==="transform"||t.prop==="filter")&&!(d instanceof S)?h=new k(()=>{let c=d instanceof u?d._get():d.value;if(typeof c=="object"&&c!==null){let m=t.prop==="transform"?new M(t.prop):new O(t.prop);return this.applyObjectToBuilder(m,c),m.toString()}return c}):s&&s.unit&&!(d instanceof S)?h=new k(()=>{let c=d instanceof u?d._get():d.value;return typeof c=="number"?`${c}${s.unit}`:c}):s&&(s.type==="length"||s.type==="hybrid")&&!(d instanceof S)?h=new k(()=>{let c=d instanceof u?d._get():d.value;return typeof c=="number"?b(c,s.unit):c}):d instanceof S&&(h=new k(()=>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=b(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
+ ${t.builder.toString(e+" ")}
4
+ ${e}}`;if(t.type==="container")return`${e}@container ${t.condition} {
5
+ ${t.builder.toString(e+" ")}
6
+ ${e}}`;if(t.type==="supports")return`${e}@supports ${t.condition} {
7
+ ${t.builder.toString(e+" ")}
8
+ ${e}}`;if(t.type==="keyframes")return`${e}@keyframes ${t.name} {
9
+ ${t.builder.toString(e+" ")}
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 k?e.value.dispose():e.value instanceof u&&e.value._source instanceof k&&e.value._source.dispose();for(let e of this.rules)(e.type==="media"||e.type==="container"||e.type==="supports")&&e.builder.dispose()}};var Y=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 ye=new Map;function Be(n,e){ye.has(n)||ye.set(n,new Set),ye.get(n).add(e)}a(Be,"registerInstance");function Fe(n,e){ye.get(n)?.delete(e)}a(Fe,"unregisterInstance");function We(n){return ye.get(n)||new Set}a(We,"getInstances");var T=class n extends Error{static{a(this,"HandledError")}constructor(){super("Error handled by error boundary."),Object.setPrototypeOf(this,n.prototype)}},ft=65536;function pt(n){return`dothtml-${n.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}`}a(pt,"getStableTagName");var F=class extends f{static{a(this,"ComponentVdom")}component;shadowEl;childShadowVdom;events=[];styleVNodes=[];isQueued=!1;isBuilding=!1;computedSignals=[];buildComputedSignals=[];effects=[];disposables=[];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.childShadowVdom=new E(e),this.parentComponent=B(),t._?._meta)throw new Error("Component has already been added to the VDOM.");if(!t.constructor._dotHtmlComponent){t.constructor._dotHtmlComponent={};let s=t.constructor.__hmrId;if(z&&s)t.constructor._dotHtmlComponent.tagName=pt(s);else{let i=Math.floor(performance.now()*1e13).toString(16),r=(ft++).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(z){let s=t.constructor.__hmrId;s&&Be(s,this)}}registerComputed(e){this.isBuilding?this.buildComputedSignals.push(e):this.computedSignals.push(e)}registerEffect(e){this.effects.push(e)}registerDisposable(e){this.disposables.push(e)}setRef(e){this.ref=e}init(){try{this.validateProps(),C(this),this.isBuilding=!0;try{this.childShadowVdom=this.component.build(this._dot)}finally{this.isBuilding=!1,x()}this.component.built&&this.component.built(),this.subscribeToProps()}catch(e){if(e instanceof T)return;this.handleError(e)}}handleError(e){if(this.lastError=e,z&&!this.component.errorCaught)throw this.shadowEl&&this.renderErrorBox(e),new T;if(this.component.errorCaught)try{let t=this.component.errorCaught(e);if(t){if(this.childShadowVdom=new E(this._dot),j(this._dot,this.childShadowVdom,t),this.shadowEl){let s=this.component._._meta.shadowRoot;if(s){s.innerHTML="",C(this);try{this.childShadowVdom._render(s)}finally{x()}}}throw new T}}catch(t){if(t instanceof T)throw t;e=t}if(this.parentComponent&&this.parentComponent.handleError)this.parentComponent.handleError(e);else throw this._dot.onError?(this._dot.onError(e),new T):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.requestUpdate())}}requestUpdate(){this.isQueued||(this.isQueued=!0,w.enqueue(this.updateSubscription,_.Normal))}rebuild(){if(this.shadowEl)try{this.childShadowVdom._unrender();for(let t of this.buildComputedSignals)t.dispose();this.buildComputedSignals=[],this.validateProps(),C(this),this.isBuilding=!0;try{this.childShadowVdom=this.component.build(this._dot)}finally{this.isBuilding=!1,x()}let e=this.component._._meta.shadowRoot;e&&this.lastError&&(e.innerHTML=""),C(this);try{this.childShadowVdom._render(e)}finally{x()}this.lastError=null,this.component.built&&this.component.built()}catch(e){if(e instanceof T)return;this.handleError(e)}}renderErrorBox(e){if(!this.shadowEl)return;let t=this.component._._meta.shadowRoot;if(!t)return;t.innerHTML="";let s=document.createElement("div");s.setAttribute("style",`
12
+ background-color: rgba(255, 0, 0, 0.9);
13
+ color: white;
14
+ padding: 20px;
15
+ margin: 10px;
16
+ border-radius: 8px;
17
+ font-family: monospace;
18
+ white-space: pre-wrap;
19
+ box-shadow: 0 4px 15px rgba(0,0,0,0.5);
20
+ z-index: 10000;
21
+ position: relative;
22
+ overflow: auto;
23
+ max-height: 90vh;
24
+ `);let i=document.createElement("h2");i.textContent="DOThtml HMR Error",i.style.marginTop="0",s.appendChild(i);let r=document.createElement("div");if(r.style.fontWeight="bold",r.style.fontSize="1.2em",r.style.marginBottom="10px",r.textContent=e.message||e,s.appendChild(r),e.stack){let o=document.createElement("pre");o.style.fontSize="0.9em",o.style.opacity="0.8",o.textContent=e.stack,s.appendChild(o)}t.appendChild(s)}validateProps(){let e=this.component.constructor.props;if(!e)return;let t=this.component.props||{},s=this.component.constructor.name;for(let i in e){let r=e[i],o=t[i];if(o===void 0&&r.default!==void 0&&(typeof r.default=="function"&&(r.type===Object||r.type===Array)?o=r.default():o=r.default,t[i]=o),r.required&&o===void 0)throw new Error(`[${s}] Prop "${i}" is required.`);let l=o;if((o instanceof p||o instanceof u)&&(l=o.value),l!=null&&r.type){let d=typeof l;if(r.type===String&&d!=="string")throw new Error(`[${s}] Prop "${i}" expected string, but got ${d}.`);if(r.type===Number&&d!=="number")throw new Error(`[${s}] Prop "${i}" expected number, but got ${d}.`);if(r.type===Boolean&&d!=="boolean")throw new Error(`[${s}] Prop "${i}" expected boolean, but got ${d}.`);if(r.type===Function&&d!=="function")throw new Error(`[${s}] Prop "${i}" expected function, but got ${d}.`);if(r.type===Array&&!Array.isArray(l))throw new Error(`[${s}] Prop "${i}" expected array, but got ${d}.`);if(r.type===Object&&(d!=="object"||Array.isArray(l)))throw new Error(`[${s}] Prop "${i}" expected object, but got ${Array.isArray(l)?"array":d}.`)}if(l!==void 0&&typeof r.validator=="function"&&!r.validator(l))throw new Error(`[${s}] Prop "${i}" failed custom validation.`)}this.component.props=t}setupCustomElement(e){let t=e.defaultView.customElements.get(this.component._._meta.tagName);if(t==null){let s=e.defaultView.HTMLElement,i=this;t=class extends s{static{a(this,"CustomElementConstructor")}_component;get component(){return this._component}set component(r){this._component=r,this._renderComponent()}cvdom;_renderComponent(){try{if(this.cvdom instanceof f){let r=this.shadowRoot||this.attachShadow({mode:"open"}),o=this._component.constructor._cachedStyles;o||(o=i.generateStyles(e),this._component.constructor._cachedStyles=o),r.adoptedStyleSheets=[...o.allSharedStylesheets];let l=r.querySelectorAll("style:not(#--dh-dynamic-style)");for(let d of Array.from(l))d.remove();for(let d=0;d<o.allStyleTags.length;d++)r.appendChild(o.allStyleTags[d].cloneNode(!0));if(this._component._._meta.shadowRoot=r,this._component.constructor._isDynamicStyle){let d=a(()=>{let c=new U;this.cvdom._dot._theme&&c.setTheme(this.cvdom._dot._theme);let m=this._component.stylize(c),g=m instanceof u?m._get():m instanceof p?m.value:m,N=g;(g===c||!g&&c.hasRules())&&(N=c.toString());let D=r.getElementById("--dh-dynamic-style");D||(D=e.createElement("style"),D.id="--dh-dynamic-style",r.appendChild(D)),D.textContent=N},"updateDynamicStyle"),h=this._component.stylize(new U);if(h instanceof p||h instanceof u){let c=h.subscribe(d);this.cvdom.registerDisposable(()=>h.unsubscribe(c))}d()}else if(this._component.stylize){let d=new U;this.cvdom._dot._theme&&d.setTheme(this.cvdom._dot._theme),this._component.stylize(d),d.toString();let h=d.getGhostVars();if(h.length>0){let c={};for(let g of h)c[g.name]=g.value;let m=new V(c);m.render(this),this.cvdom.styleVNodes.push(m),this.cvdom.registerDisposable(()=>d.dispose())}}else if(this._component.stylize){let d=new U;this.cvdom._dot._theme&&d.setTheme(this.cvdom._dot._theme),this._component.stylize(d),d.toString();let h=d.getGhostVars();if(h.length>0){let c={};for(let g of h)c[g.name]=g.value;let m=new V(c);m.render(this),this.cvdom.styleVNodes.push(m),this.cvdom.registerDisposable(()=>d.dispose())}}if(this.cvdom.childShadowVdom._isRendered)this.cvdom.rebuild();else{C(this.cvdom);try{this.cvdom.childShadowVdom._render(r)}finally{x()}}}else throw new Error("Component build function returned invalid object.")}catch(r){if(r instanceof T)return;this.cvdom.handleError(r)}}},e.defaultView.customElements.define(this.component._._meta.tagName,t)}}generateStyles(e){let t=new U;this._dot._theme&&t.setTheme(this._dot._theme);let s=this.component.stylize&&this.component.stylize(t)||[];(s instanceof p||s instanceof u)&&(this.component.constructor._isDynamicStyle=!0,s=null),(s===t||!s&&t.hasRules())&&(s=t.toString()),typeof s=="string"&&(s=[s]);let i=[],r=[];if(s)for(let c=0;c<s.length;c++){let m=he(s[c],e);m instanceof e.defaultView.CSSStyleSheet?i.push(m):r.push(m)}let o=t.getGhostVars();t.dispose();let l=[...i],d=[...r],h=this._dot.globalStyles||[];for(let c of h)if(c instanceof e.defaultView.CSSStyleSheet)l.push(c);else if(typeof c=="string"){let m=c.replace(/\b(html|body)(?=[\s,{.#[:]|$)/g,":host"),g=he(m,e);g instanceof e.defaultView.CSSStyleSheet?l.push(g):d.push(g)}return{allSharedStylesheets:l,allStyleTags:d,ghostVars:o}}addSlot(e,t){if(typeof t=="function"){this.component.slots||(this.component.slots={}),this.component.slots[e]=t,this.shadowEl&&this.requestUpdate();return}this.slots[e]||(this.slots[e]=new E(this._dot)),j(this._dot,this.slots[e],t),this.shadowEl&&(this.slots[e]._render(this.shadowEl),this.applySlotAttribute(e))}applySlotAttribute(e){if(e!=="default"){let t=this.slots[e]._getNodes();for(let s of t)s instanceof HTMLElement&&s.setAttribute("slot",e)}}_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={}),C(this);try{this.component.mounting&&this.component.mounting()}finally{x()}this.component._._meta.isRendered=!0;let t=e.ownerDocument;this.setupCustomElement(t),this.shadowEl=t.createElement(this.component._._meta.tagName),this.shadowEl.cvdom=this,this.shadowEl.setAttribute("cvdom",""),e.appendChild(this.shadowEl),this.shadowEl.component=this.component,z&&this.lastError&&this.renderErrorBox(this.lastError);for(let s=0;s<this.events.length;s++){let i=this.events[s];this.renderEvent(i.name,i.callback,i.modifiers)}C(this);try{this.component.mounted&&this.component.mounted()}finally{x()}this._onEnterHook&&this._onEnterHook(this.shadowEl),this.component.onEnter&&this.component.onEnter()}catch(t){if(t instanceof T)return;this.handleError(t)}}_unrender(){C(this);try{this.component.unmounting&&this.component.unmounting()}finally{x()}this.childShadowVdom._unrender();for(let e in this.slots)this.slots[e]._unrender();if(this.shadowEl){let e=H.getForDocument(this.shadowEl.ownerDocument);for(let t=0;t<this.events.length;t++){let s=this.events[t];e.removeListener(this.shadowEl,s.name.toLowerCase(),s.callback)}this.shadowEl.remove(),this.shadowEl=null}for(let e=0;e<this.styleVNodes.length;e++)this.styleVNodes[e].unrender();this.styleVNodes=[];for(let e of this.computedSignals)e.dispose();this.computedSignals=[];for(let e of this.buildComputedSignals)e.dispose();this.buildComputedSignals=[];for(let e of this.effects)e.dispose();this.effects=[];for(let e of this.disposables)e();this.disposables=[],delete this.component._._meta,C(this);try{this.component.unmounted&&this.component.unmounted()}finally{x()}if(this.ref&&(typeof this.ref=="function"?this.ref(null):this.ref.value=null),z){let e=this.component.constructor.__hmrId;e&&Fe(e,this)}}_hmrSwap(e){let t=this.component,s=t.props,i=t.refs;C(this);try{t.unmounting&&t.unmounting()}finally{x()}for(let o of this.computedSignals)o.dispose();this.computedSignals=[];for(let o of this.effects)o.dispose();this.effects=[];for(let o of this.disposables)o();this.disposables=[];let r=new e;r.props=s,r.refs=i;for(let o in t){if(o==="props"||o==="refs"||o==="_")continue;let l=t[o],d=r[o];l instanceof p&&d instanceof p?d.isWritable&&(d.value=l.value):l instanceof Y&&d instanceof Y&&(r[o]=l)}if(r._=t._,r._.cvdom=this,this.component=r,r._trackedComputeds){for(let o of r._trackedComputeds)this.registerComputed(o);delete r._trackedComputeds}if(r._trackedEffects){for(let o of r._trackedEffects)this.registerEffect(o);delete r._trackedEffects}if(r._trackedDisposables){for(let o of r._trackedDisposables)this.registerDisposable(o);delete r._trackedDisposables}if(e._cachedStyles&&delete e._cachedStyles,this.shadowEl){this.shadowEl.component=r,C(this);try{this.component.mounted&&this.component.mounted()}finally{x()}}else this.rebuild()}_getNodes(){return this.shadowEl?[this.shadowEl]:[]}_getLastChild(){return this}async _unrenderAsync(){this._onLeaveHook&&this.shadowEl&&await this._onLeaveHook(this.shadowEl),this.component.onLeave&&await this.component.onLeave(),this._unrender()}_moveTo(e){let t=this.shadowEl?.ownerDocument,s=e.ownerDocument;t&&s&&t!==s&&this.setupCustomElement(s),super._moveTo(e)}addEventListener(e,t,s=[]){this.events.push({name:e,callback:t,modifiers:s}),this.shadowEl&&this.renderEvent(e,t,s)}renderEvent(e,t,s=[]){H.getForDocument(this.shadowEl.ownerDocument).addListener(this.shadowEl,e.toLowerCase(),t,s)}on(e,t){return this.addEventListener(e,t),this}toString(){return`<${this.component._._meta.tagName}></${this.component._._meta.tagName}>`}};var de=class extends f{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 I("");if(e instanceof f)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 E(this._dot);for(let s of e)t._addChild(this._toVdom(s));return t}return new I(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(),oe(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),oe(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 be=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,w.enqueue(this.updateSubscription,_.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(),Q.push(this);try{let t=this.callback();typeof t=="function"&&(this.cleanup=t)}catch(t){console.error("Error during effect execution:",t)}finally{Q.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 He(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)}};C(s);try{super(...t)}finally{x()}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(He,"component");var mt=1,_e=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=`${mt++}`;let e=document.createElement("div");e.textContent=this.title;let t=e.innerHTML;this.document.open(),this.document.write(`<!DOCTYPE html><html><head><title>${t}</title></head><body></body></html>`),this.document.close(),this.document=this.window.document;let s=this.document.body;s.innerHTML="",delete s[$],this.syncStyles&&this.syncStylesWithParent(),this._vdom=y(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 G=new Map;function qe(n){let{id:e,state:t,getters:s,actions:i}=n;if(e&&G.has(e))return()=>G.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)}};C(d);try{if(t){let h=t();for(let c in h){let m=h[c],g=m instanceof p?m:new p;g!==m&&(g.value=m),l._state[c]=g,Object.defineProperty(l,c,{get:a(()=>l._state[c],"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 c=new k(()=>s[h].call(l,l));l._getters[h]=c}}if(i)for(let h in i)l[h]=(...c)=>{C(d);try{return i[h].apply(l,c)}finally{x()}}}finally{x()}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&&G.delete(e),l._state={},l._getters={},l._effects=[]},e&&G.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(qe,"createStore");function je(n){return G.get(n)}a(je,"getStore");function Ue(){G.forEach(n=>n.$dispose()),G.clear()}a(Ue,"clearStores");function ze(){let n={};return G.forEach((e,t)=>{n[t]=e}),n}a(ze,"getStores");var ce=["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"],Qe=new Set(ce),Ve=["each","html","mount","text","md","when","on"];var ie=class extends f{static{a(this,"SlotVdom")}name;fallbackOrScope;fallback=null;scopedContent=null;element=null;constructor(e,t,s){super(e),this.name=t||"default",this.fallbackOrScope=s}_render(e){this._isRendered=!0;let t=e.ownerDocument,i=B()?.component?.slots?.[this.name];typeof i=="function"?(this.scopedContent=new E(this._dot),j(this._dot,this.scopedContent,i(this.fallbackOrScope))):this.fallbackOrScope!==void 0&&(this.fallback=new E(this._dot),j(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 ue=class n extends f{static{a(this,"DotChain")}_root;constructor(e,t){super(e),this._root=t}_addChild(e){if(this._root instanceof A)this._root._children.push(e);else{let t=new A(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()}get _isRendered(){return this._root._isRendered}set _isRendered(e){this._root._isRendered=e}_getNodes(){return this._root._getNodes()}_getLastChild(){return this._root._getLastChild()}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 ie(this._dot,e,t))),this}};function re(n){return n instanceof p?n.bind():n}a(re,"reduceReactive");function gt(n){return n instanceof ue?n:new ue(n._dot,n)}a(gt,"promote");f.prototype._addChild=function(n){return gt(this)._addChild(n)};f.prototype.text=function(n){let e=re(n);return e instanceof u?this._addChild(new de(this._dot,e)):this._addChild(new I(e))};f.prototype.html=function(n){return this._addChild(new ae(re(n)))};f.prototype.md=function(n){return this.text(n)};f.prototype.slot=function(n,e){let t=this._getLastChild();for(;t instanceof ue;)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 ie(this._dot,n,e)))};f.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(ke(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 n.props||(n.props={}),n.props[r]=o}}try{t.init()}catch(s){if(!(s instanceof T))throw s}return this._addChild(t)};f.prototype.when=function(n,e){let t=new ee(this._dot),s;return e instanceof f?s=e:typeof e=="object"&&e?.build?(s=new A(this._dot),s.mount(e)):(s=new A(this._dot),s._children.push(new I(re(e)))),t.addCondition(re(n),s),this._addChild(t)};f.prototype.each=function(n,e){let t=new J(this._dot,re(n),e);return this._addChild(t)};f.prototype.otherwiseWhen=function(n,e,t=!1){let s=this._getLastChild();if(s instanceof ee){let i;e instanceof f?i=e:typeof e=="object"&&e?.build?(i=new A(this._dot),i.mount(e)):i=new I(re(e)),s.addCondition(re(n),i,t)}else throw new Error("Can't branch off of a non-conditional node.");return this};f.prototype.otherwise=function(n){return this.otherwiseWhen(!0,n,!0)};f.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};f.prototype.style=function(n){if(typeof n=="function"){let e=new v;n(e),this.attr("style",e)}else this.attr("style",n);return this};f.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};f.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};f.prototype.onLeave=function(n){let e=this._getLastChild();return e&&(e._onLeaveHook=n),this};f.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})};f.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<ce.length;n++){let e=ce[n];f.prototype[e]=function(...t){return this._addChild(Le(this._dot,e,t))}}var Ye=a((n,e)=>{n[e]=function(){if(Qe.has(e))return Le(n,e,arguments);{let t=new E(n);return t[e](...arguments),t}}},"makeCoreWrapper"),yt=a(()=>{let n=a(function(e,t=window){if(e?.ownerDocument?.defaultView){let s=e,i=s[$];return i||(i=new R(n,s.tagName.toLocaleLowerCase()),i.element=s,i.children._parent=i,i.children._isRendered=!0,s[$]=i),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 k(e),s=B();return s&&s.registerComputed(t),t},n.effect=function(e){let t=new be(e),s=B();return s&&(s.registerEffect?s.registerEffect(t):s.registerComputed(t)),()=>t.dispose()},n.component=He,n.hmr={swap(e,t){let s=We(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 ie(n,e,t)},n.getCurrentComponent=B,n.store=qe,n.getStore=je,n.clearStores=Ue,Object.defineProperty(n,"stores",{get:a(()=>ze(),"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)}};C(s);let i;try{i=new e(...t)}finally{x()}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 Y},n.alpha=function(e,t){return new k(()=>{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 v,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=he(t,e);s instanceof e.defaultView?.CSSStyleSheet?e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]:s instanceof HTMLElement&&e.head.appendChild(s)},typeof document<"u"&&new V(n.css).render(document.documentElement),n.window=e=>new _e(e),n.flushSync=()=>{w.flushSync()},n.setSync=e=>{w.setSync(e)},w.onError=e=>{n.onError?n.onError(e):console.error("DOThtml Error:",e)};for(let e=0;e<ce.length;e++){let t=ce[e];Ye(n,t)}for(let e=0;e<Ve.length;e++){let t=Ve[e];Ye(n,t)}return n},"makeDot"),Ge=yt();z&&typeof window<"u"&&(window.dot=Ge);var y=Ge;var Pe=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"),Ne=Pe(),L=y.state(Ne.path),X=y.state(Ne.path),we=y.state(Ne.search),K=y.state(Ne.hash);function Z(n,e=!1){if(typeof window>"u")return;X.value=L.value,e?window.history.replaceState({},"",n):window.history.pushState({},"",n);let t=Pe();L.value=t.path,we.value=t.search,K.value=t.hash}a(Z,"navigate");function Xe(){return y.computed(()=>{let n=we.value,e=new URLSearchParams(n),t={};return e.forEach((s,i)=>{t[i]=s}),t})}a(Xe,"useQueryParams");function Ke(){return y.computed(()=>{let n=K.value;return n.startsWith("#")?n.substring(1):n})}a(Ke,"useHash");if(typeof window<"u"){let n=a(()=>{let e=Pe();X.value=L.value,L.value=e.path,we.value=e.search,K.value=e.hash},"updateState");window.addEventListener("popstate",n),window.addEventListener("hashchange",n)}var Ae=[],ve=[],Ze=y.state([]);function bt(n){Ze.value=n}a(bt,"setGlobalRoutes");function Je(){return Ze.value}a(Je,"getGlobalRoutes");function _t(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,c=!!(r.children&&r.children.length>0);if(!(!h&&!c&&o.length!==i.length)&&!(o.length>i.length)){for(let m=0;m<o.length;m++){let g=o[m],N=i[m];if(g==="*"){d=!0;break}if(N===void 0){d=!1;break}if(g!=="+"){if(g.startsWith("{")&&g.endsWith("}")){let D=g.slice(1,-1);l[D]=N;continue}if(g.startsWith(":")){let D=g.slice(1);l[D]=N;continue}if(g!==N){d=!1;break}}}if(d){let m=i.slice(0,o.length),g=(t.endsWith("/")?t.slice(0,-1):t)+"/"+m.join("/");return{route:r,params:l,matchedPath:g}}}}return null}a(_t,"matchRoute");var Se=y.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=y.state(null);currentMatch=null;lastPath="";subId=-1;loaderCache=new Map;mounting(){this.subId=L.subscribe(()=>{this._?.cvdom.requestUpdate()})}unmounting(){L.unsubscribe(this.subId)}build(n){bt(this.props.routes);let e=L.value,t=_t(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),ve.forEach(h=>h(e,X.value));return}let d=o();if(d instanceof Promise){d.then(h=>{let c=h.default||h;this.loaderCache.set(o,c),this.resolvedComponent.value=c,this._?.cvdom.requestUpdate(),ve.forEach(m=>m(e,X.value))}),this.resolvedComponent.value=this.props.loading||n.div("Loading...");return}}this.resolvedComponent.value=o,ve.forEach(d=>d(e,X.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 Z(o,!0),n.div()}else{let o=[...Ae];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],c=!1,m=a(N=>{c||(c=!0,N===!1?Z(X.value,!0):typeof N=="string"?Z(N,!0):l(d+1))},"handleNext"),g=h(e,X.value,m);if(g instanceof Promise){let N=await g;c||(N===!1||typeof N=="string"?m(N):m())}else g!==void 0&&!c&&m(g)},"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 f?i:n.div(i)}});Se.beforeEach=n=>{Ae.push(n)};Se.afterEach=n=>{ve.push(n)};Se.clearHooks=()=>{Ae.length=0,ve.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 et=y.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(Je(),this.props.name,this.props.params)||"":this.props.to}build(){let n=y.computed(()=>this.getResolvedPath());return y.a({hRef:n,class:y.computed(()=>{let e=L.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(),Z(n.value))},"onClick")},this.props.label||this.slots?.default)}});function Te(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=Te(n,r),t))return t}return null}a(Te,"getElementByIdDeep");var st=new Map,Ie=null;function wt(n,e=!1){let t=K.value;if(t&&t.startsWith("#")){let i=t.substring(1),r=Te(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=st.get(n);s?window.scrollTo(s.x,s.y):window.scrollTo(0,0)}a(wt,"performScroll");function tt(n,e){Ie&&clearTimeout(Ie),Ie=setTimeout(()=>{wt(n,e),Ie=null},0)}a(tt,"scheduleScroll");function nt(){if(typeof window>"u")return;window.addEventListener("scroll",()=>{st.set(L.value,{x:window.pageXOffset,y:window.pageYOffset})},{passive:!0}),y.computed(()=>({path:L.value,hash:K.value})).subscribe(e=>{tt(e.path,!0)}),tt(L.value,!1)}a(nt,"initScrollManager");var it=class{static{a(this,"DotComponent")}props;refs={};_;constructor(e){this.props=e||{}}emit(e,t){}effect(e){y.effect(e)}};y.version="6.0.0";nt();y.currentPath=L;y.currentSearch=we;y.currentHash=K;y.navigate=Z;y.useQueryParams=Xe;y.useHash=Ke;y.Router=Se;y.Link=et;window.dot=y;document._dotId="default";export{it as DotComponent,et as Link,_ as Priority,Se as Router,K as currentHash,L as currentPath,we as currentSearch,y as dot,Re as generatePath,Je as getGlobalRoutes,nt as initScrollManager,_t as matchRoute,Z as navigate,X as previousPath,bt as setGlobalRoutes,Ke as useHash,Xe as useQueryParams};
26
+ //# sourceMappingURL=index.js.map