ouider 0.1.5 → 0.1.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 +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -5
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
`:"";for(let s in this.data){let
|
|
3
|
-
`:
|
|
4
|
-
${
|
|
5
|
-
`);}return e}static of(e,...s){return new
|
|
6
|
-
`))}};w(Q,"StyleData");var tt=Q;function ut(c,e,s){return new c(e,s)}w(ut,"createComponent");var ht=class ht{constructor(e={},s={}){f(this,"state");f(this,"parent");f(this,"emits");f(this,"props");f(this,"provides",new Map);this.state=new Z(this),this.props=e,this.emits=new X(s);}onActivated(){}onDeactivated(){}onMounted(){}willMount(){}willUnmount(){}provide(e,s){this.provides.set(e,s);}inject(e){let s=this;for(;s;){if(s.provides.has(e))return s.provides.get(e);s=s.parent;}}decorateHostElement(e){return Promise.resolve()}};w(ht,"OComponent");var $=ht;function W(c){let e=Date.now();return `${(1e3+Math.floor(Math.random()*9e3)+c.length).toString(16)}-${e.toString(16)}`}w(W,"generateUIID");function lt(c){return new Promise(e=>setTimeout(e,c))}w(lt,"delay");(function(c){var A,N,k,O,P,I,m,g,T,x,j,V;let e=(A=class{constructor(){f(this,"actions",[]);}async exec(){await this.commit();}add(u){return this.actions.push(u),this}async commit(){let u=this.actions;this.actions=[],await Promise.all(u.map(async t=>await t()));}},w(A,"BatchActions"),A);c.BatchActions=e;let s=(N=class{constructor(u){f(this,"node");f(this,"operations",[]);this.node=u;}accept(u){this.operations.push(...u.operations),u.operations=[];}async exec(){let u=this.operations;this.operations=[];let t=[],n=u.map(a=>typeof a=="object"?(t.push({fn:a.fn,args:[a.node.uid,...a.args.map(l=>l instanceof i?l.uid:l)]}),null):a()).filter(a=>a!=null);if(t.length>0){let a={},l=[];t.forEach(p=>{let E=`${p.fn}.${p.args.map(S=>S==null?void 0:S.toString()).join(",")}`;a[E]&&!["invoke","setProperty","dispatchEvent"].includes(p.fn)||(a[E]=p,l.push(p));}),n.unshift(v.batchActions(l));}try{await Promise.all(n);}catch(a){console.error("Error while batch updates");}}append(u,...t){return this.operations.push({fn:u,args:t,node:this.node}),this}add(u,t,...n){return typeof u=="function"?this.operations.push(u):this.operations.push({fn:u,args:n,node:t}),this}addEventListener(u,t,n,a){return this.add(()=>{this.node.addEventListener(u,t,{options:n,policy:a});})}setProperty(u,t){return this.append("setProperty",u,t)}dettachEventListener(u){return this.append("dettachEventListener",u)}invoke(u,...t){return this.append("invoke",u,...t.map(n=>n instanceof i?n.ref:n))}dispatchEvent(u,t,n){return this.append("dispatchEvent",u,t,n)}addClass(...u){return this.append("addClass",...u)}removeClass(...u){return this.append("removeClass",...u)}setAttribute(u,t){return this.append("setAttribute",u,t)}removeAttribute(u){return this.append("removeAttribute",u)}appendChild(u){return this.append("appendChild",u.uid)}removeChild(u){return this.append("removeChild",u.uid)}remove(){return this.append("remove")}removeAndRelease(){return this.append("remove").append("release")}release(){return this.append("release")}innerHTML(u){return this.append("setHTML",u)}replaceChildNode(u,t){return this.append("replaceChildNode",u,t)}replaceWith(u){return this.append("replaceWith",u.uid)}after(u){return this.append("after",u.uid)}setInnerText(u){return this.append("setInnerText",u)}setContentText(u){return this.append("setContentText",u)}insertBefore(u,t){return this.append("insertBefore",u.uid,t.uid)}setInputValue(u){return this.append("setInputValue",u)}setStyle(u,t){return this.append("setStyle",u,t)}},w(N,"BatchUpdates"),N);c.BatchUpdates=s;let i=(k=class{constructor(u,t){f(this,"uid");f(this,"tag");this.uid=u,this.tag=t;}static toInstance(u){return new k(u.uid,u.tag)}async release(){await v.call("releaseNode",this.uid);}async addEventListener(u,t,n){return v.addEventListener(this,u,t,{options:n==null?void 0:n.options,policy:n==null?void 0:n.policy})}async dettachEventListener(u){await v.dettachEventListener(u);}async invoke(u,...t){return await v.call("invokeObjectMethod",this.uid,u,...t)}async invokeAndHold(u,...t){let n=await v.call("invokeObjectMethodAndHold",this.uid,u,...t);return n&&new k(n.uid,n.tag)}async getProperty(u){return await v.call("getObjectProperty",this.uid,u)}async getPropertyAndHold(u){let t=await v.call("getObjectPropertyAndHold",this.uid,u);return t&&new k(t.uid,t.tag)}async setProperty(u,t){await v.call("setObjectProperty",this.uid,u,t);}async dispatchEvent(u,t,n){await v.call("dispatchEvent",this.uid,u,t,n);}updates(){return new s(this)}batches(){return new s(this)}get ref(){return {__ref__:this.uid}}},w(k,"OObject"),k);c.OObject=i;let r=(O=class extends i{constructor(t){super(t.uid,t.tag);f(this,"textContent");f(this,"type","Unknown");f(this,"attributes");f(this,"children");f(this,"classes");f(this,"style");for(let p in t)this[p]=t[p];(this.attributes)!=null||(this.attributes=[]),(this.classes)!=null||(this.classes=[]),(this.style)!=null||(this.style="");}},w(O,"ONode"),O);c.ONode=r;let o=(P=class extends r{constructor(t){super(t);f(this,"_hydrated",false);}async addClass(...t){await v.call("addClass",this.uid,...t);}async removeClass(...t){await v.call("removeClass",this.uid,...t);}async setAttribute(t,n){let a=await v.call("setAttribute",this.uid,t,n);a&&(this.attributes=a);}async removeAttribute(t){let n=await v.call("removeAttribute",this.uid,t);n&&(this.attributes=n);}async appendChild(t){await v.call("appendChild",this.uid,t.uid);}set innerHTML(t){this.setHTML(t);}async cloneNode(t){let n=await v.call("cloneNode",this.uid,t);return n?new P(n):null}async remove(){await v.call("removeNode",this.uid);}async removeAndRelease(){await this.remove(),await this.release();}async removeChild(t){await v.call("removeChild",this.uid,t.uid);}async replaceChildNode(t,n){await v.call("replaceChildNode",this.uid,t.uid,n.uid);}async replaceWith(t){await v.call("replaceWith",this.uid,t.uid);}async after(t){await v.call("insertAfter",this.uid,t.uid);}async setHTML(t){await v.call("setInnerHTML",this.uid,t);}async HTML(){var t;return (t=await v.call("getInnerHTML",this.uid))!=null?t:""}async setInnerText(t){await v.call("setInnerText",this.uid,t);}async setContentText(t){await v.call("setContentText",this.uid,t);}async getContentText(){var t;return (t=await v.call("getContentText",this.uid))!=null?t:""}async content(){var t;try{return (t=await v.call("getInnerText",this.uid))!=null?t:""}catch(n){return console.error(n),""}}async childNodes(){var t,n;return (n=(t=await v.call("childNodes",this.uid))==null?void 0:t.map(a=>new P(a)))!=null?n:[]}hasAttribute(t){return !!this.attributes.find(n=>n.name===t)}async getAttribute(t){var n;return (n=await v.call("getAttribte",this.uid,t))!=null?n:""}attribute(t){var n,a;return (a=(n=this.attributes.find(l=>l.name===t))==null?void 0:n.value)!=null?a:null}async nextSibling(){let t=await v.call("nextSibling",this.uid);return t?new P(t):null}async getAttributeNames(){var t;return (t=await v.call("getAttributeNames",this.uid))!=null?t:[]}async parentNode(){let t=await v.call("parentNode",this.uid);return t?new P(t):null}async insertBefore(t,n){await v.call("insertBefore",this.uid,t.uid,n.uid);}async setInputValue(t){await v.call("setInputValue",this.uid,t);}async inputValue(){var t;return (t=await v.call("inputValue",this.uid))!=null?t:""}get hydrated(){return this._hydrated}hydrate(){this._hydrated=true,this.addClass("hydrated");}async query(t,n){return await v.query(t,n,this.uid)}async queryAll(t,n){return await v.queryAll(t,n,this.uid)}async setStyle(t,n){await v.call("setStyle",this.uid,t,n);}},w(P,"OElement"),P);c.OElement=o;let h=(I=class extends i{constructor(u){super(u.uid,u.tag);}addColorStop(u,t){return this.invoke("addColorStop",u,t),this}},w(I,"CanvasGradient"),I);c.CanvasGradient=h;let d=(m=class extends i{constructor(t){super(t.uid,t.tag);f(this,"batch",new s(this));}static async new(t){let n=typeof t!="undefined"?await v.newObject("DOMMatrix",t):await v.newObject("DOMMatrix");return n?new m(n):null}invertSelf(){return this.batch.invoke("invertSelf"),this}multiplySelf(t){return this.batch.invoke("multiplySelf",...t?[t.ref]:[]),this}premultiplySelf(t){return this.batch.invoke("premultiplySelf",...t?[t.ref]:[]),this}rotateAxisAngleSelf(t,n,a,l){let p=[];return t&&p.push(t),n&&p.push(n),a&&p.push(a),l&&p.push(l),this.batch.invoke("rotateAxisAngleSelf",...p),this}rotateFromVectorSelf(t,n){let a=[];return t&&a.push(t),n&&a.push(n),this.batch.invoke("rotateFromVectorSelf",...a),this}rotateSelf(t,n,a){let l=[];return t&&l.push(t),n&&l.push(n),a&&l.push(a),this.batch.invoke("rotateFromVectorSelf",...l),this}scale3dSelf(t,n,a,l){let p=[];return t&&p.push(t),n&&p.push(n),a&&p.push(a),l&&p.push(l),this.batch.invoke("scale3dSelf",...p),this}scaleSelf(t,n,a,l,p,E){let S=[];return t&&S.push(t),n&&S.push(n),a&&S.push(a),l&&S.push(l),p&&S.push(p),E&&S.push(E),this.batch.invoke("scaleSelf",...S),this}setMatrixValue(t){return this.invoke("setMatrixValue",t),this}skewXSelf(t){return this.batch.invoke("skewXSelf",t),this}skewYSelf(t){return this.batch.invoke("skewYSelf",t),this}translateSelf(t,n,a){return this.batch.invoke("translateSelf",t,n,...a?[a]:[]),this}async commit(){await this.batch.exec();}async is2D(){var t;return (t=await this.invoke("is2D"))!=null?t:false}async isIdentity(){var t;return (t=await this.invoke("isIdentity"))!=null?t:false}async flipX(){let t=await this.invokeAndHold("flipX");return t?new m(t):null}async flipY(){let t=await this.invokeAndHold("flipY");return t?new m(t):null}async inverse(){let t=await this.invokeAndHold("inverse");return t?new m(t):null}async multiply(t){let n=await this.invokeAndHold("multiply",...t?[t.ref]:[]);return n?new m(n):null}async rotate(t,n,a){let l=[];t&&l.push(t),n&&l.push(n),a&&l.push(a);let p=await this.invokeAndHold("rotate",...l);return p?new m(p):null}async rotateAxisAngle(t,n,a,l){let p=[];t&&p.push(t),n&&p.push(n),a&&p.push(a),l&&p.push(l);let E=await this.invokeAndHold("rotateAxisAngle",...p);return E?new m(E):null}async rotateFromVector(t,n){let a=[];t&&a.push(t),n&&a.push(n);let l=await this.invokeAndHold("rotateFromVector",...a);return l?new m(l):null}async scale(t,n,a,l,p,E){let S=[];t&&S.push(t),n&&S.push(n),a&&S.push(a),l&&S.push(l),p&&S.push(p),E&&S.push(E);let U=await this.invokeAndHold("scale",...S);return U?new m(U):null}async scale3d(t,n,a,l){let p=[];t&&p.push(t),n&&p.push(n),a&&p.push(a),l&&p.push(l);let E=await this.invokeAndHold("scale",...p);return E?new m(E):null}async skewX(t){let n=[];t&&n.push(t);let a=await this.invokeAndHold("skewX",...n);return a?new m(a):null}async skewY(t){let n=[];t&&n.push(t);let a=await this.invokeAndHold("skewY",...n);return a?new m(a):null}toJSON(){return this.invoke("toJSON")}async toString(){return this.invoke("toString")}async translate(t,n,a){let l=[];t&&l.push(t),n&&l.push(n),a&&l.push(a);let p=await this.invokeAndHold("translate",...l);return p?new m(p):null}},w(m,"DOMMatrix"),m);c.DOMMatrix=d;let b=(g=class extends i{constructor(u){super(u.uid,u.tag);}setTransform(u){this.invoke("setTransform",u.ref);}},w(g,"CanvasPattern"),g);c.CanvasPattern=b;let y=(T=class extends i{constructor(t){super(t,"unknown");f(this,"batch",new s(this));}arc(t,n,a,l,p,E=false){return this.batch.invoke("arc",t,n,a,l,p,E),this}arcTo(t,n,a,l,p){return this.batch.invoke("arcTo",t,n,a,l,p),this}bezierCurveTo(t,n,a,l,p,E){return this.batch.invoke("bezierCurveTo",t,n,a,l,p,E),this}clearRect(t,n,a,l){return this.batch.invoke("clearRect",t,n,a,l),this}clip(t,n){let a=[];return typeof t=="string"?a.push(t):t instanceof D&&(t.commit(this.batch),a.push(t.ref)),typeof n=="string"&&a.push(n),this.batch.invoke("clip",...a),this}beginPath(){return this.batch.invoke("beginPath"),this}closePath(){return this.batch.invoke("closePath"),this}async createConicGradient(t,n,a){let l=await this.invokeAndHold("createConicGradient",t,n,a);return l?new h(l):null}async createLinearGradient(t,n,a,l){let p=await this.invokeAndHold("createLinearGradient",t,n,a,l);return p?new h(p):null}async createPattern(t,n=""){let a=await this.invokeAndHold("createPattern",t.ref,n);return a?new b(a):null}async createRadialGradient(t,n,a,l,p,E){let S=await this.invokeAndHold("createRadialGradient",t,n,a,l,p,E);return S?new h(S):null}drawImage(t,n,a,l,p,E,S,U,At){let q=[t.ref];return typeof E=="undefined"?(q.push(n,a),l&&q.push(l),p&&q.push(p),this.batch.invoke("drawImage",...q),this):(q.push(n,a,l,p,E,S,U,At),this.batch.invoke("drawImage",...q),this)}ellipse(t,n,a,l,p,E,S,U=false){return this.batch.invoke("ellipse",t,n,a,l,p,E,S,U),this}fill(t,n){let a=[];return t&&a.push(typeof t=="string"?t:(t.commit(this.batch),t.ref)),n&&a.push(n),this.batch.invoke("fill",...a),this}fillRect(t,n,a,l){return this.batch.invoke("fillRect",t,n,a,l),this}fillText(t,n,a,l){return this.batch.invoke("fillText",t,n,a,...l?[l]:[]),this}getImageData(t,n,a,l,p){return this.invokeAndHold("getImageData",t,n,a,l,...p?[p]:[])}getLineDash(){return this.invoke("getLineDash")}async getTransform(){let t=await this.invokeAndHold("getTransform");return t?new d(t):null}async isContextLost(){return await this.invoke("isContextLost")}async isPointInPath(t,n,a,l){let p=[];return typeof t=="number"?(p.push(t,n),a&&p.push(a)):(await t.commit(this.batch),p.push(t.ref,n,a),l&&p.push(l)),await this.invoke("isPointInPath",...p)}async isPointInStroke(t,n,a){var p;let l=[];return typeof t=="number"?l.push(t,n):(await t.commit(),l.push(t.ref,n,a)),(p=await this.invoke("isPointInStroke",...l))!=null?p:false}lineTo(t,n){return this.batch.invoke("lineTo",t,n),this}async measureText(t){var n;return (n=await this.invoke("measureText",t))!=null?n:0}moveTo(t,n){return this.batch.invoke("moveTo",t,n),this}putImageData(t,n,a,l,p,E,S){let U=[t.ref,n,a];return l&&U.push(l),p&&U.push(p),E&&U.push(E),S&&U.push(S),this.batch.invoke("putImageData",...U),this}quadraticCurveTo(t,n,a,l){return this.batch.invoke("quadraticCurveTo",t,n,a,l),this}rect(t,n,a,l){return this.batch.invoke("rect",t,n,a,l),this}reset(){this.invoke("reset");}resetTransform(){this.invoke("resetTransform");}restore(){return this.batch.invoke("restore")}rotate(t){return this.batch.invoke("rotate",t),this}roundRect(t,n,a,l,p){return this.batch.invoke("roundRect",t,n,a,l,p),this}save(){return this.batch.invoke("save")}scale(t,n){return this.batch.invoke("scale",t,n),this}setLineDash(t){return this.invoke("setLineDash",t)}async setTransform(t,n,a,l,p,E){typeof t=="number"?await this.invoke("setTransform",t,n,a,l,p,E):await this.invoke("setTransform",t.ref);}stroke(t){return this.batch.invoke("stroke",...t?[(t.commit(this.batch),t.ref)]:[]),this}strokeRect(t,n,a,l){return this.batch.invoke("strokeRect",t,n,a,l),this}strokeText(t,n,a,l){return this.batch.invoke("strokeText",t,n,a,...l?[l]:[]),this}transform(t,n,a,l,p,E){return this.batch.invoke("transform",t,n,a,l,p,E),this}translate(t,n){return this.batch.invoke("translate",t,n),this}set fillStyle(t){this.setFillStyle(t);}setFillStyle(t){return this.batch.setProperty("fillStyle",typeof t=="string"?t:t instanceof i?t.ref:t),this}set filter(t){this.setFilter(t);}setFilter(t){return this.batch.setProperty("filter",t),this}set font(t){this.setFont(t);}setFont(t){return this.batch.setProperty("font",t),this}set fontKerning(t){this.setFontKerning(t);}setFontKerning(t){return this.batch.setProperty("fontKerning",t),this}set fontStretch(t){this.setFontStretch(t);}setFontStretch(t){return this.batch.setProperty("fontStretch",t),this}set fontVariantCaps(t){this.setFontVariantCaps(t);}setFontVariantCaps(t){return this.batch.setProperty("fontVariantCaps",t),this}set globalAlpha(t){this.setGlobalAlpha(t);}setGlobalAlpha(t){return this.batch.setProperty("globalAlpha",t),this}set globalCompositeOperation(t){this.setGlobalCompositeOperation(t);}setGlobalCompositeOperation(t){return this.batch.setProperty("globalCompositeOperation",t),this}set imageSmoothingEnabled(t){this.setImageSmoothingEnabled(t);}setImageSmoothingEnabled(t){return this.batch.setProperty("imageSmoothingEnabled",t),this}set imageSmoothingQuality(t){this.setImageSmoothingQuality(t);}setImageSmoothingQuality(t){return this.batch.setProperty("imageSmoothingQuality",t),this}set letterSpacing(t){this.setLetterSpacing(t);}setLetterSpacing(t){return this.batch.setProperty("letterSpacing",t),this}set lineCap(t){this.setLineCap(t);}setLineCap(t){return this.batch.setProperty("lineCap",t),this}set lineDashOffset(t){this.setLineDashOffset(t);}setLineDashOffset(t){return this.batch.setProperty("lineDashOffset",t),this}set lineJoin(t){this.setLineJoin(t);}setLineJoin(t){return this.batch.setProperty("lineJoin",t),this}set lineWidth(t){this.setLineWidth(t);}setLineWidth(t){return this.batch.setProperty("lineWidth",t),this}set miterLimit(t){this.setMiterLimit(t);}setMiterLimit(t){return this.batch.setProperty("miterLimit",t),this}set shadowBlur(t){this.setShadowBlur(t);}setShadowBlur(t){return this.batch.setProperty("shadowBlur",t),this}set shadowColor(t){this.setShadowColor(t);}setShadowColor(t){return this.batch.setProperty("shadowColor",t),this}set shadowOffsetX(t){this.setShadowOffsetX(t);}setShadowOffsetX(t){return this.batch.setProperty("shadowOffsetX",t),this}set shadowOffsetY(t){this.setShadowOffsetY(t);}setShadowOffsetY(t){return this.batch.setProperty("shadowOffsetY",t),this}set strokeStyle(t){this.setStrokeStyle(t);}setStrokeStyle(t){return this.batch.setProperty("strokeStyle",typeof t=="string"?t:t instanceof i?t.ref:t),this}set textAlign(t){this.setTextAlign(t);}setTextAlign(t){return this.batch.setProperty("textAlign",t),this}set textBaseline(t){this.setTextBaseline(t);}setTextBaseline(t){return this.batch.setProperty("textBaseline",t),this}set wordSpacing(t){this.setWordSpacing(t);}setWordSpacing(t){return this.batch.setProperty("wordSpacing",t),this}set textRendering(t){this.setTextRendering(t);}setTextRendering(t){return this.batch.setProperty("textRendering",t),this}async commit(){await this.batch.exec();}},w(T,"Canvas2DContext"),T);c.Canvas2DContext=y;let C=(x=class extends i{constructor(u){super(u.uid,u.tag);}static async new(u,t){let n=[];u&&n.push(u),t&&n.push(t);let a=await v.newObject("Image",...n);return a?new x(a):null}async width(){var u;return (u=await this.getProperty("width"))!=null?u:0}async height(){var u;return (u=await this.getProperty("height"))!=null?u:0}async naturalWidth(){var u;return (u=await this.getProperty("naturalWidth"))!=null?u:0}async naturalHeight(){var u;return (u=await this.getProperty("naturalHeight"))!=null?u:0}async src(){return await this.getProperty("src")}async currentSrc(){return await this.getProperty("currentSrc")}async setSrc(u){await this.setProperty("src",u);}},w(x,"Image"),x);c.Image=C;let D=(j=class extends i{constructor(t){super(t.uid,t.tag);f(this,"batch",new s(this));}static async create(){let t=await v.newObject("Path2D");return t?new j(t):null}addPath(t){return this.batch.invoke("addPath",t.ref),this}arc(t,n,a,l,p,E=false){return this.batch.invoke("arc",t,n,a,l,p,E),this}arcTo(t,n,a,l,p){return this.batch.invoke("arcTo",t,n,a,l,p),this}bezierCurveTo(t,n,a,l,p,E){return this.batch.invoke("bezierCurveTo",t,n,a,l,p,E),this}quadraticCurveTo(t,n,a,l){return this.batch.invoke("quadraticCurveTo",t,n,a,l),this}closePath(){return this.batch.invoke("closePath"),this}ellipse(t,n,a,l,p,E,S,U=false){return this.batch.invoke("ellipse",t,n,a,l,p,E,S,U),this}moveTo(t,n){return this.batch.invoke("moveTo",t,n),this}lineTo(t,n){return this.batch.invoke("lineTo",t,n),this}rect(t,n,a,l){return this.batch.invoke("rect",t,n,a,l),this}roundRect(t,n,a,l,p){return this.batch.invoke("roundRect",t,n,a,l,p),this}commit(t){return t?(t.accept(this.batch),Promise.resolve()):this.batch.exec()}},w(j,"CanvasPath2D"),j);c.CanvasPath2D=D;let M=(V=class extends o{constructor(u){super(u);}async width(){return this.getProperty("width")}async height(){return this.getProperty("height")}async setWidth(u){this.setProperty("width",u);}async setHeight(u){this.setProperty("height",u);}async getContext(u){let t=await this.invokeAndHold("getContext",u);return t&&new y(t.uid)}static async of(u,t,n){let a=await v.query(u,t);return a?new V(a):null}},w(V,"CanvasElement"),V);c.CanvasElement=M;})(exports.ODOM||(exports.ODOM={}));var pt=class pt{constructor(){f(this,"callbacks",new Map);f(this,"DOM_EVENT_LISTENERS",new Map);f(this,"timers",new Map);f(this,"_config");f(this,"listeners",new Map);this.subscribe("__ouid_native_event_success__",(e,s)=>{let i=this.callbacks.get(e);if(i)return this.callbacks.delete(e),i.success(...JSON.parse(s))}),this.subscribe("__ouid_native_event_error__",(e,s)=>{let i=this.callbacks.get(e);if(i)return this.callbacks.delete(e),i.error(...JSON.parse(s))}),this.subscribe("__ouid_web_event__",(e,s)=>{let i=this.DOM_EVENT_LISTENERS.get(e),r=JSON.parse(s);if(i){let o=r[1];return o&&typeof o=="object"&&(o.target=o!=null&&o.target?new exports.ODOM.OElement(o.target):null,o.currentTarget=o!=null&&o.currentTarget?new exports.ODOM.OElement(o.currentTarget):null,o.relatedTarget=o!=null&&o.relatedTarget?new exports.ODOM.OElement(o.relatedTarget):null),i(o)}else console.error("No cb found for ",e,r[0]);});}config(e){return this._config=e,this}invoke(e,...s){let i=W(e);return new Promise((r,o)=>{this.callbacks.set(i,{success:r,error:o});try{if(!WebOUID)throw new Error("NativeOUID bridge not available");WebOUID.invoke(i,e,JSON.stringify(s));}catch(h){console.error(h),this.callbacks.delete(i);}})}registerComponent(e,s){B.register(e,s);}unregisterComponent(e,s){B.unregister(e);}async call(e,...s){try{return (await this.invoke(`_ouid_${e}`,...s)).data}catch(i){return console.error(i),null}}emit(e,s){WebOUID==null||WebOUID.invoke("event",e,JSON.stringify(s));}subscribe(e,s){this.listeners.has(e)||(this.listeners.set(e,[]),globalThis[e]=(i,r)=>{var o;(o=this.listeners.get(e))==null||o.forEach(h=>h(i,r));}),this.listeners.get(e).push(s);}async query(e,s,i){let r=await this.call("query",e,s,i);return r?new exports.ODOM.OElement(r):null}async queryAll(e,s,i){let r=await this.call("queryAll",e,s,i);return r?r.map(o=>new exports.ODOM.OElement(o)):[]}async createElement(e,s={}){let i=await this.call("createElement",e,s);return i?new exports.ODOM.OElement(i):null}async createComment(e){let s=await this.call("createComment",e);return s?new exports.ODOM.OElement(s):null}async addEventListener(e,s,i,r){let o=W(s+(typeof e=="string"?e:e.tag));return this.DOM_EVENT_LISTENERS.set(o,i),await v.call("attachEventListener",typeof e=="string"?e:e.uid,o,s,r==null?void 0:r.options,r==null?void 0:r.policy),o}async dettachEventListener(e){this.DOM_EVENT_LISTENERS.delete(e),await v.call("dettachEventListener",e);}async createComponentStyles(e,s=true){let i=await v.call("createComponentStyles",e,s);return i?new exports.ODOM.OElement(i):null}async appendComponentStyles(e){await v.call("appendComponentStyles",e);}async rejectComponentStyles(e){await v.call("rejectComponentStyles",e.uid);}async getOObject(e){let s=await v.call("getOObject",e);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async acquireObject(e){let s=await v.call("acquireObject",e);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async setTimeout(e,s){var o;let i=W("setTimeout"+s);this.DOM_EVENT_LISTENERS.set(i,()=>{e();let h=this.timers.get(r);h&&(this.timers.delete(r),this.DOM_EVENT_LISTENERS.delete(h));});let r=(o=await v.call("setTimeout",i,s))!=null?o:-1;return r>=0&&this.timers.set(r,i),r}async clearTimeout(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await v.call("clearTimeout",e));}async setInterval(e,s){var o;let i=W("setInterval"+s);this.DOM_EVENT_LISTENERS.set(i,e);let r=(o=await v.call("setInterval",i,s))!=null?o:-1;return r>=0&&this.timers.set(r,i),r}async clearInterval(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await v.call("clearInterval",e));}async fetch(e,s,i="json"){let r=await v.call("fetch",e,s,i);return i==="buffer"||i==="bytes"?exports.ODOM.OObject.toInstance(r):r}async alert(e){console.log("Alerting:::",e),await v.call("alert",e);}async prompt(e){await v.call("prompt",e);}async newObject(e,...s){return v.call("newObject",e,...s)}async requestAnimationFrame(e){var r;let s=W("requestAnimationFrame");this.DOM_EVENT_LISTENERS.set(s,o=>{e(o);let h=this.timers.get(i);h&&(this.DOM_EVENT_LISTENERS.delete(h),this.timers.delete(i));});let i=(r=await v.call("requestAnimationFrame",s))!=null?r:-1;return i>=0&&this.timers.set(i,s),i}async cancelAnimationFrame(e){let s=this.timers.get(e);s&&(this.timers.delete(e),await v.call("cancelAnimationFrame",e),this.DOM_EVENT_LISTENERS.delete(s));}async batchActions(e){await v.call("batchActions",e);}};w(pt,"OUIDBridge");var dt=pt,v=new Proxy(new dt,{get:w((c,e)=>e in c?c[e]:async(...s)=>await c.call(e,...s),"get")});globalThis.OUID=v;exports.ODOM=void 0;function Rt(c){return c.replace(/-([a-z])/g,(e,s)=>s.toUpperCase())}w(Rt,"toCamelCase");function Mt(c){return c.replace(/(?!^)([A-Z])/g,(e,s)=>`-${s.toLowerCase()}`)}w(Mt,"toSnakeCase");function _(c){return at(c)?c.value:c}w(_,"normaliseValue");var jt=typeof globalThis.queueMicrotask=="function",G=w(c=>c?jt?queueMicrotask(c):Promise.resolve().then(c):Promise.resolve(),"deferMicro"),St=w(()=>new Promise(c=>setTimeout(c,0)),"deferMacro");function Ut(c){return typeof c=="function"&&!("prototype"in c)}w(Ut,"isLazyLoader");var kt=new Map,Et=new Map,Ct=new WeakMap;function _t(c){var i;if(!c||typeof c!="object"&&typeof c!="function")return {};let e=Ct.get(c);if(e)return e;let s=Object.create(null);for(let r=c;r&&r!==Object.prototype;r=Object.getPrototypeOf(r))for(let o of Object.getOwnPropertyNames(r)){if(o==="constructor"||o.startsWith("__")||o.endsWith("__")||o in s)continue;let h=Object.getOwnPropertyDescriptor(r,o);if(!h)continue;let d=(i=h.value)!=null?i:h.get?h.get.call(c):void 0;s[o]=typeof d=="function"?d.bind(c):d;}return Ct.set(c,s),s}w(_t,"getMethodsView");function Tt(c,e){let s=kt.get(c);return s||(s=new Function("s","with (s) { return ("+c+"); }"),kt.set(c,s)),s(e)}w(Tt,"evalInScope");function Vt(c){let e=Et.get(c);if(e)return e;let s=[],i=0;for(;i<c.length;){let r=c.indexOf("{{",i);if(r<0){s.push({t:c.slice(i)});break}r>i&&s.push({t:c.slice(i,r)});let o=c.indexOf("}}",r+2),h=o>=0?c.slice(r+2,o).trim():c.slice(r+2).trim();s.push({e:h}),i=o>=0?o+2:c.length;}return e=w(r=>{let o="";for(let h of s)if(h.t!==void 0)o+=h.t;else if(h.e!==void 0){let d=_(Tt(h.e,r));o+=d==null?"":String(d);}return o},"fn"),Et.set(c,e),e}w(Vt,"compileInterpolated");var Ot,R=class R{constructor(e,s,i,...r){f(this,"app");f(this,"component");f(this,"parentContext");f(this,"bindings",[]);f(this,"directives",[]);f(this,"mountedComponents",(Ot=st(R.MOUNTED_COMPONENTS_TOKEN))!=null?Ot:new Map);f(this,"componentsRegistry",new J);f(this,"updatingDirectives",false);f(this,"updatingBindings",false);f(this,"_stack",[]);f(this,"flatStack",Object.create(null));f(this,"viewUpdates");f(this,"mountedQueue",[]);this.app=e,this.component=s,this.parentContext=i;for(let o of r)this.push(o);}get hostElement(){return this.component._hostElement}get stack(){return this._stack}set stack(e){this.flatStack=Object.create(null),this._stack=[];for(let s of e)this.push(s);}getRoot(){let e=this;for(;e.parentContext;)e=e.parentContext;return e}enqueueMounted(e){this.getRoot().mountedQueue.push(e);}async flushMounted(){let e=this.getRoot(),s=e.mountedQueue;e.mountedQueue=[];for(let i of s)try{i();}catch(r){console.error("onMounted error:",r);}}getMountedComponent(e){return this.mountedComponents.get(e.uid)}bind(e){this.bindings.push(e);}directive(e){this.directives.push(e);}evaluateExpression(e){return this.resolve(e)}resolveScope(...e){var r,o;let s=(o=(r=this.component.state)==null?void 0:r.value)!=null?o:{},i=_t(s);return new Proxy(Object.create(null),{get:w((h,d)=>{for(let b=e.length-1;b>=0;b--)if(d in e[b])return _(e[b][d]);return d in this.flatStack?_(this.flatStack[d]):d in i?_(i[d]):_(s[d])},"get"),set:w((h,d,b)=>{let y=null;for(let C=e.length-1;C>=0;C--)if(d in e[C]){y=e[C][d];break}return y||(d in this.flatStack?y=this.flatStack[d]:d in i?y=i[d]:y=s[d]),y&&at(y)?(y.value=b,true):false},"set"),has:w((h,d)=>e.some(b=>d in b)||d in this.flatStack||d in i||d in s,"has")})}resolve(e,...s){if(!e)return;let i=this.resolveScope(...s);try{return Tt(e,i)}catch(r){return}}updateValue(e,s){this.resolve(`${e}=__o_model_value__`,{__o_model_value__:s}),this.component.state.didChange(e,void 0,s);}push(e){this._stack.unshift(e),Object.assign(this.flatStack,e);}pop(){let e=this._stack.shift();if(e)for(let s of Object.keys(e))delete this.flatStack[s];}resolveTag(e){var i;let s=this;for(;;){if(s.componentsRegistry.has(e))return s.componentsRegistry.get(e);if(s=(i=s==null?void 0:s.parentContext)!=null?i:null,!s)break}return B.get(e)}async updateBindings(){if(!this.updatingBindings){this.updatingBindings=true;for(let e of this.bindings)this.updateBinding(e);this.updatingBindings=false;}}updateBinding(e){if(e.type==="model"){e.node.setProperty("value",_(e.context.resolve(e.key)));return}if(e.type==="interpolation"){let s=e.templateFn(e.context.resolveScope());this.viewUpdates.add("setContentText",e.node,s);return}if(e.type==="attribute"){let s=e.key,i=_(this.resolve(e.template));s==="class"?this.expandClass(e.node,i):s==="style"?this.expandStyle(e.node,i):typeof i!="object"&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="undefined"&&this.viewUpdates.add("setAttribute",e.node,s,i.toString());return}if(e.type==="prop"&&e.context.component){let s=_(this.resolve(e.template));try{e.context.component.props[e.key]=s,Promise.all([e.context.updateBindings(),e.context.updateDirectives()]).then(()=>{e.context.viewUpdates.exec();});}catch(i){console.error(i);}return}}async updateDirectives(){var i;if(this.updatingDirectives)return;let e=new exports.ODOM.BatchActions;this.updatingDirectives=true;for(let r of this.directives){if(r.type==="if"){if(!_(r.context.evaluateExpression(r.expr))){if(r.active===false)continue;r.active=false,r.renderedNode&&(r.destroy?this.unmountComponent(r.renderedNode):this.viewUpdates.add("addClass",r.renderedNode,"oui-hidden"));continue}if(r.active===true)continue;r.active=true;let h=r.renderedNode;if(!h||r.destroy){let d=await r.node.cloneNode(true);r.renderedNode=d,await r.context.render(d),this.viewUpdates.add("after",r.placeholder,d);}else this.viewUpdates.add("removeClass",h,"oui-hidden");}if(r.type==="for"){let o=(i=r.children)!=null?i:new Map,h=new Map,d=w((N,k)=>r.key?_(r.context.resolve(r.key,{[r.item]:N})):k,"keyFn"),b=_(r.context.resolve(r.list))||[],y=new exports.ODOM.BatchActions,C=32,D=0,M=r.placeholder;for(let N=0;N<b.length;N++){let k=b[N],O=d(k,N),P=o.get(O),I,m,g=M;if(P){I=P.node,m=P.ctx,m.stack=[{[r.item]:k},...r.context.stack];let T=await M.nextSibling();I.uid!==(T==null?void 0:T.uid)&&y.add(()=>g.after(I)),await Promise.all([m.updateBindings(),m.updateDirectives()]);}else m=new R(this.app,this.component,this),m.viewUpdates=this.viewUpdates,m.stack=[{[r.item]:k},...r.context.stack],I=await r.node.cloneNode(true),y.add(async()=>{await g.after(I);}),await m.render(I),await m.updateDirectives();M=I,h.set(O,{node:I,ctx:m}),++D>=C&&(D=0,await y.commit(),await G());}let A=[];for(let[N,k]of o.entries())h.has(N)||A.push(this.unmountComponent(k.node));await Promise.all(A),await y.commit(),r.children=h;}}await e.commit(),this.updatingDirectives=false;}async render(e,s){if(e.hydrated||s!=null&&s.skipSlotted&&e.hasAttribute("slotted"))return;switch(e.type){case "Text":this.handleTextNode(e);break;case "Element":await this.handleElementNode(e,s);break;}let i=new exports.ODOM.BatchActions;await Promise.all([this.updateBindings(),this.updateDirectives()]),i.commit(),this.viewUpdates.add("addClass",e,"hydrated");}async expandClass(e,s){let i;typeof s=="object"?Array.isArray(s)?i=s:i=Object.keys(s).filter(r=>s[r]):i=s.toString().split(/\s+/),i.length>0&&this.viewUpdates.add("addClass",e,...i);}expandStyle(e,s){let i=s;typeof s=="object"&&!Array.isArray(s)&&(i=Object.keys(s).filter(r=>s[r]).map(r=>`${Mt(r)}: ${s[r]}`).join(";")),i&&this.viewUpdates.add("setAttribute",e,"style",i);}expandStandardAttributes(e){[...e.attributes].filter(s=>s.name.startsWith(":")).forEach(s=>{let i=s.name.substring(1);this.bind({type:"attribute",node:e,key:i,context:this,template:s.value.trim()}),this.viewUpdates.add("removeAttribute",e,s.name);});}setRefValue(e,s){let i=e.trim();this.updateValue(i,s);}async handleElementNode(e,s){var N;let i=await e.parentNode(),r=null,o=e.hasAttribute("o-if")?"o-if":e.hasAttribute("o-show")?"o-show":null;if(o){let k=await e.getAttribute(o),O=await OUID.createComment(o+":"+k),P=o==="o-if";await i.insertBefore(e,O),await e.updates().removeAttribute(o).remove().exec(),this.directive({type:"if",expr:k,node:e,placeholder:O,context:this,active:void 0,destroy:P}),r="if";return}if(e.hasAttribute("o-for")){if(r==="if")throw new Error("Can't have o-if and o-for on the same component");let k=await e.getAttribute("o-for"),[O,P]=k.split(" of ").map(g=>g.trim()),I=await OUID.createComment("for:"+k),m=(N=e.attribute(":key"))!=null?N:"";await(i==null?void 0:i.insertBefore(e,I)),await e.updates().removeAttribute("o-for").removeAttribute(":key").remove().exec(),this.directive({type:"for",item:O,list:P,node:e,placeholder:I,context:this,key:m}),r="for";return}let h=e.tag.toLowerCase(),d=this.resolveTag(h),b=e.updates();[...e.attributes].forEach(async k=>{if(k.name==="o-model"){let O=k.value.trim();b.setInputValue(_(this.resolve(O))).addEventListener("input",async I=>{let m=await I.target.getProperty("value");this.updateValue(O,m);}),this.bind({node:e,key:O,type:"model",context:this}),b.removeAttribute(k.name);}else k.name==="ref"&&(d||this.setRefValue(k.value,e));});let y={},C={},{props:D,events:M}=this.componentAttributes(e,this);if(y=D,C=M,this.expandStandardAttributes(e),Object.keys(C).forEach(async k=>{let O=C[k];d||b.addEventListener(k,P=>{typeof O=="function"&&O.apply(this.component,[P]);}),b.removeAttribute("@"+k);}),this.viewUpdates.accept(b),d){await this.mountComponent(e,d,this,y,C);return}let A=await e.childNodes();s!=null&&s.skipSlotted&&(A=A.filter(k=>!k.hasAttribute("slotted")));for(let k of A)await this.render(k,s);}handleTextNode(e){var i;let s=(i=e.textContent)!=null?i:"";s.includes("{{")&&this.bind({type:"interpolation",node:e,key:"__template__",templateFn:Vt(s),context:this});}componentAttributes(e,s){let i={},r={},o=["import","interface","module","o-model","o-if","o-for"];return [...e.attributes].filter(h=>!o.includes(h.name)).forEach(h=>{let d=h.name;if(d.startsWith("@")){let C=s==null?void 0:s.resolve(h.value);if(typeof C!="function")throw new Error("Event handler can only be function");d=d.substring(1),r[d]=C;return}let b=null,y=h.value;d.startsWith(":")&&(b=h.value,d=d.substring(1),y=_(s==null?void 0:s.resolve(h.value))),d=Rt(d),i[d]={name:d,value:y,expr:b};}),{props:i,events:r}}async mountComponent(e,s,i,r={},o={}){var M,A,N,k,O,I;if(this.viewUpdates=(A=(M=this.viewUpdates)!=null?M:i==null?void 0:i.viewUpdates)!=null?A:new exports.ODOM.BatchUpdates(e),this.mountedComponents.has(e.uid))return this.mountedComponents.get(e.uid);let h=new R(this.app,{},this);h.viewUpdates=this.viewUpdates;let d={},b;for(let m of Object.keys(r)){let g=r[m];if(g.name==="ref"&&!g.expr){b=g;continue}g.expr&&this.bind({type:"prop",node:e,key:m,context:h,template:g.expr}),d[m]=g.value;}let y=await Bt(s,d,o);h.component=y,h.stack=[],this.mountedComponents.set(e.uid,y),b&&this.setRefValue(b.value,y);{let m=e.updates();for(let T of Object.keys(r))r[T].expr||m.setAttribute(T,r[T].value);let g=(N=y.hostClasses)!=null?N:[];g&&(g=typeof g=="string"?[g]:g),g.push("o-component-host"),e.tag.toLowerCase()!=="div"&&g.push("c-"+e.tag.toLowerCase()),m.addClass(...g),this.viewUpdates.accept(m);}G(async()=>{try{await y.decorateHostElement(e);}catch(m){}});{let m=(k=y.use)!=null?k:{};for(let g of Object.keys(m))h.componentsRegistry.register(g,m[g]);}if(y.willMount(),!s.cssInstance){let m=y.style?(O=y.style())==null?void 0:O.toString():y.css;m&&((s.cssInstance)!=null||(s.cssInstance=await OUID.createComponentStyles(m,false)));}G(()=>{var g;let m=s.cssInstance;if(m){let T=(g=R.STYLE_REF.get(m))!=null?g:0;T===0&&OUID.appendComponentStyles(m.uid),R.STYLE_REF.set(m,T+1),y.cssInstance=m;}});let C=await e.childNodes();if(y.render){let m=await y.render(h);m&&m.attachTo(e);}else await e.setHTML(y.template.trim());let D=await e.queryAll("slot");D&&D.length&&await Promise.all(D.filter(m=>{var g;return !((g=m.classes)!=null&&g.includes("hydrated"))}).map(async m=>{let g=m.attribute("name"),T=C.filter(x=>g?x.type==="Element"&&x.attribute("slot")===g:x.type!=="Element"||!x.hasAttribute("slot"));if(T.length){for(let x of T)this.viewUpdates.add("setAttribute",x,"slotted","true"),this.viewUpdates.add("appendChild",m,x);await this.viewUpdates.exec(),await Promise.all(T.map(x=>this.render(x)));}})),y._hostElement=e,y.parent=(I=i==null?void 0:i.component)!=null?I:void 0,y.provide(R.PROVIDE_TOKEN,this);{let m=await e.childNodes(),g=6,T=0;for(;T<m.length;){let x=m.slice(T,T+g);await Promise.all(x.map(j=>h.render(j,{skipSlotted:true}))),T+=g;}}return h.viewUpdates.add("addClass",e,"hydrated"),this.enqueueMounted(()=>{try{y.onMounted();}catch(m){}}),await h.viewUpdates.exec(),y.state.watch(async()=>{await Promise.all([h.updateBindings(),h.updateDirectives()]),await h.viewUpdates.exec();}),y}async unmountComponent(e){var r,o;let s=this.mountedComponents.get(e.uid);if(await e.removeAndRelease(),s){let h=s.cssInstance;if(h){let d=(r=R.STYLE_REF.get(h))!=null?r:1;d===1?(await OUID.rejectComponentStyles(h),R.STYLE_REF.delete(h)):R.STYLE_REF.set(h,d-1);}s.willUnmount(),s._hostElement=null,s.cssInstance=null;}let i=(o=await e.queryAll("*"))!=null?o:[];for(let h of i)await this.unmountComponent(h);this.mountedComponents.delete(e.uid),e.hasAttribute("ref")&&this.setRefValue(e.attribute("ref"),null);}};w(R,"RenderContext"),f(R,"PROVIDE_TOKEN","RENDER_CONTEXT"),f(R,"MOUNTED_COMPONENTS_TOKEN","RENDER_CONTEXT_MOUNTED_COMPONENTS"),f(R,"STYLE_REF",new WeakMap);var H=R;async function me(c,e,s=[],i){let r=e!=null?e:{},o=await OUID.createElement(c,Object.keys(r).reduce((h,d)=>(h[d]=r[d],h),{}));return Object.keys(i!=null?i:{}).forEach(h=>{o==null||o.addEventListener(h,d=>{let b=i[h];typeof b=="function"&&b(d);});}),new F(o,s)}w(me,"node");function Bt(c,e,s){return Ut(c)?c().then(i=>ut(i.default,e,s)):ut(c,e,s)}w(Bt,"o");function Ht(c){return typeof c=="function"}w(Ht,"isProvideFunction");var z=class z{constructor(e,s){f(this,"root");f(this,"options");f(this,"providers",new Map);this.root=e,this.options=s,z.currentApp=this;}provide(e,s){if(this.providers.has(e)){console.warn(`[OUID] - Provider ${e} already exists`);return}this.providers.set(e,Ht(s)?{provide:s}:{value:s});}inject(e){var s;return (s=this.providers.get(e))==null?void 0:s.value}use(e,s){return e.install(this,s),this}async mount(e){var r;if(!globalThis.__OUI_PUR_JS_CONTEXT__)return;(r=this.options)!=null&&r.css&&await OUID.createComponentStyles(this.options.css),await OUID.createComponentStyles(`
|
|
1
|
+
'use strict';var Xt=require('route-parser');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Xt__default=/*#__PURE__*/_interopDefault(Xt);var Pt=Object.defineProperty;var Vt=(u,e,s)=>e in u?Pt(u,e,{enumerable:true,configurable:true,writable:true,value:s}):u[e]=s;var f=(u,e)=>Pt(u,"name",{value:e,configurable:true});var m=(u,e,s)=>Vt(u,typeof e!="symbol"?e+"":e,s);var pt=class pt{constructor(){m(this,"components",new Map);}register(e,s){console.log(`[OUID] - Registering component: ${e}`);let n=e.toLocaleLowerCase();this.components.has(n)||this.components.set(n,s);}unregister(e){let s=e.toLocaleLowerCase();this.components.delete(s);}get(e){return this.components.get(e.toLocaleLowerCase())}has(e){return this.components.has(e)}getAll(){return Array.from(this.components.entries())}};f(pt,"ComponentsRegistry");var et=pt,W=new et;var ft=class ft{constructor(e){m(this,"events");this.events=e;}emit(e,...s){let n=this.events[e];n?n(...s):console.log("Not handler found for ",e);}};f(ft,"Emits");var ot=ft;var wt=class wt{constructor(e){m(this,"value");this.value=e;}};f(wt,"Stated");var st=wt;function mt(u){return typeof u=="object"&&!Array.isArray(u)&&"value"in u&&u instanceof st}f(mt,"isStated");function Bt(u,e){let s=f((n,r=new Map)=>{if(r.has(n))return r.get(n);let c=new Proxy(n,{set:f((l,d,v)=>{let y=l[d];return typeof v=="object"?l[d]=s(v):l[d]=v,e.didChange(d,y,v),true},"set"),get:f((l,d)=>Reflect.get(l,d),"get")});r.set(n,c);for(let l=n;l;l=Object.getPrototypeOf(l))Object.keys(l).forEach(d=>{let v=n[d];typeof v=="object"&&(n[d]=s(v,r));});return c},"proxify");if(typeof u=="function")throw new Error("Can't create reactive element over a function");return typeof u!="object"&&typeof u!="symbol"?new Proxy(new st(u),{set:f((n,r,c)=>{if(r!=="value")throw new Error(`Undefined property ${String(r)} access`);let l=n[r];return n[r]=c,e.didChange(r,l,c),true},"set"),get:f((n,r)=>{if(r!=="value")throw new Error(`Undefined property ${String(r)} access`);return n[r]},"get")}):new st(u&&typeof u=="object"?s(u):u)}f(Bt,"stated");var yt=class yt{constructor(e){m(this,"THRESHOLD_TIME",20);m(this,"debounceTime",new Date().getTime());m(this,"state");m(this,"listeners",[]);m(this,"timer",null);this.state=new Proxy(e,{set:f((s,n,r)=>{let c=s[n];return s[n]=r,this.didChange(n,c,r),true},"set"),get:f((s,n)=>s[n],"get")});}wrap(e){return Bt(e,this)}has(e){return e in this.state}setValue(e,s){this.state[e]=s;}getValue(e){return this.state[e]}get value(){return this.state}dispatchChanges(e,s,n){for(let r of this.listeners)r(e,s,n);}async didChange(e,s,n){let r=Date.now();r-this.debounceTime<=this.THRESHOLD_TIME&&this.timer&&await OUID.clearTimeout(this.timer),this.debounceTime=r,this.timer=await OUID.setTimeout(()=>{this.dispatchChanges(e,s,n);},this.THRESHOLD_TIME);}watch(e){return this.listeners.push(e),this.listeners.length-1}unwatch(e){if(typeof e=="number"){this.listeners.splice(e,1);return}this.listeners.splice(this.listeners.indexOf(e),1);}};f(yt,"State");var ct=yt;var Ht=0;function At(u){return function(e){var r;let s=(r=class extends e{constructor(){super(...arguments);m(this,"template",u.template);m(this,"css",u.css);m(this,"tag",u.tag);m(this,"use",u.use);m(this,"hostClasses",u.hostClasses);m(this,"hash","component-"+Ht+"-"+u.tag);}},f(r,"WithDecoration"),r),n=s;return n.tag=u.tag,s}}f(At,"Component");var ht=class ht{constructor(e,s=[]){m(this,"node");m(this,"children");this.node=e,this.children=s;}attachTo(e){if(typeof this.node=="string"){e.innerHTML=this.node;return}let s=this.node;for(let n of this.children)n.attachTo(s);e.appendChild(s);}static of(e,s=[]){return new ht(e,s)}addChild(e){return this.children.push(e),this}};f(ht,"RenderNode");var X=ht,nt=class nt{constructor(e,s){m(this,"data");m(this,"css");this.data=e,this.css=s;}toString(){let e=this.css?this.css+`
|
|
2
|
+
`:"";for(let s in this.data){let n=this.data[s];typeof n=="string"?e+=`${s} { ${n} }
|
|
3
|
+
`:n instanceof nt&&(e+=`${s} {
|
|
4
|
+
${n.toString()}}
|
|
5
|
+
`);}return e}static of(e,...s){return new nt(e,s.join(`
|
|
6
|
+
`))}};f(nt,"StyleData");var ut=nt;function vt(u,e,s){return new u(e,s)}f(vt,"createComponent");var gt=class gt{constructor(e={},s={}){m(this,"state");m(this,"parent");m(this,"emits");m(this,"props");m(this,"provides",new Map);this.state=new ct(this),this.props=e,this.emits=new ot(s);}onActivated(){}onDeactivated(){}onMounted(){}willMount(){}willUnmount(){}provide(e,s){this.provides.set(e,s);}inject(e){let s=this;for(;s;){if(s.provides.has(e))return s.provides.get(e);s=s.parent;}}decorateHostElement(e){return Promise.resolve()}};f(gt,"OComponent");var Z=gt;function tt(u){let e=Date.now();return `${(1e3+Math.floor(Math.random()*9e3)+u.length).toString(16)}-${e.toString(16)}`}f(tt,"generateUIID");function bt(u){return new Promise(e=>setTimeout(e,u))}f(bt,"delay");(function(u){var T,N,D,B,H,K,j,J,Q,q,F,$;let e=(T=class{constructor(){m(this,"actions",[]);}async exec(){await this.commit();}add(o){return this.actions.push(o),this}async commit(){let o=this.actions;this.actions=[],await Promise.all(o.map(async t=>await t()));}},f(T,"BatchActions"),T);u.BatchActions=e;let s=new Set(["invoke","dispatchEvent","setProperty"]),n=[],r=new Map,c=false,l=null;function d(){if(c)return;c=true;let z=f(()=>{c=false,v();},"runner");setTimeout(()=>z(),0);}f(d,"scheduleBatchFlush");async function v(){let z=n;n=[],r.clear();let o=l;l=null;try{z.length&&await w.batchActions(z),o==null||o.resolve();}catch(t){o==null||o.reject(t);}}f(v,"flushBatchQueue");function y(z){for(let o of z){if(s.has(o.fn)){n.push(o);continue}let t=`${o.fn}|${o.args.map(a=>typeof a=="object"?JSON.stringify(a):String(a)).join("|")}`,i=r.get(t);i!==void 0?n[i]=o:(r.set(t,n.length),n.push(o));}if(!l){let o,t,i=new Promise((a,h)=>{o=a,t=h;});return l={resolve:o,reject:t},d(),i}return d(),new Promise((o,t)=>{let i=l;l={resolve:f(()=>{i==null||i.resolve(),o();},"resolve"),reject:f(a=>{i==null||i.reject(a),t(a);},"reject")};})}f(y,"enqueueBatchActions");let k=(N=class{constructor(o){m(this,"node");m(this,"operations",[]);this.node=o;}accept(o){this.operations.push(...o.operations),o.operations=[];}async exec(o=false){let t=this.operations;this.operations=[];let i=[],a=t.map(h=>typeof h=="object"?(i.push({fn:h.fn,args:[h.node.uid,...h.args.map(p=>p instanceof S?p.uid:p)]}),null):h()).filter(h=>h!=null);if(i.length>0){let h={},p=[];i.forEach(E=>{let O=`${E.fn}.${E.args.map(L=>L==null?void 0:L.toString()).join(",")}`;h[O]&&!["invoke","setProperty","dispatchEvent"].includes(E.fn)||(h[O]=E,p.push(E));}),o?a.unshift(w.batchActions(p)):a.unshift(y(p));}try{await Promise.all(a);}catch(h){console.error("Error while batch updates");}}append(o,...t){return this.operations.push({fn:o,args:t,node:this.node}),this}add(o,t,...i){return typeof o=="function"?this.operations.push(o):this.operations.push({fn:o,args:i,node:t}),this}addEventListener(o,t,i,a){return this.add(()=>{this.node.addEventListener(o,t,{options:i,policy:a});})}setProperty(o,t){return this.append("setProperty",o,t)}dettachEventListener(o){return this.append("dettachEventListener",o)}invoke(o,...t){return this.append("invoke",o,...t.map(i=>i instanceof S?i.ref:i))}dispatchEvent(o,t,i){return this.append("dispatchEvent",o,t,i)}addClass(...o){return this.append("addClass",...o)}removeClass(...o){return this.append("removeClass",...o)}setAttribute(o,t){return this.append("setAttribute",o,t)}removeAttribute(o){return this.append("removeAttribute",o)}appendChild(o){return this.append("appendChild",o.uid)}removeChild(o){return this.append("removeChild",o.uid)}remove(){return this.append("remove")}removeAndRelease(){return this.append("remove").append("release")}release(){return this.append("release")}innerHTML(o){return this.append("setHTML",o)}replaceChildNode(o,t){return this.append("replaceChildNode",o,t)}replaceWith(o){return this.append("replaceWith",o.uid)}after(o){return this.append("after",o.uid)}setInnerText(o){return this.append("setInnerText",o)}setContentText(o){return this.append("setContentText",o)}insertBefore(o,t){return this.append("insertBefore",o.uid,t.uid)}setInputValue(o){return this.append("setInputValue",o)}setStyle(o,t){return this.append("setStyle",o,t)}},f(N,"BatchUpdates"),N);u.BatchUpdates=k;let S=(D=class{constructor(o,t){m(this,"uid");m(this,"tag");this.uid=o,this.tag=t;}static toInstance(o){return new D(o.uid,o.tag)}async release(){await w.call("releaseNode",this.uid);}async addEventListener(o,t,i){return w.addEventListener(this,o,t,{options:i==null?void 0:i.options,policy:i==null?void 0:i.policy})}async dettachEventListener(o){await w.dettachEventListener(o);}async invoke(o,...t){return await w.call("invokeObjectMethod",this.uid,o,...t)}async invokeAndHold(o,...t){let i=await w.call("invokeObjectMethodAndHold",this.uid,o,...t);return i&&new D(i.uid,i.tag)}async getProperty(o){return await w.call("getObjectProperty",this.uid,o)}async getPropertyAndHold(o){let t=await w.call("getObjectPropertyAndHold",this.uid,o);return t&&new D(t.uid,t.tag)}async setProperty(o,t){await w.call("setObjectProperty",this.uid,o,t);}async dispatchEvent(o,t,i){await w.call("dispatchEvent",this.uid,o,t,i);}updates(){return new k(this)}batches(){return new k(this)}get ref(){return {__ref__:this.uid}}},f(D,"OObject"),D);u.OObject=S;let M=(B=class extends S{constructor(t){super(t.uid,t.tag);m(this,"textContent");m(this,"type","Unknown");m(this,"attributes");m(this,"children");m(this,"classes");m(this,"style");for(let p in t)this[p]=t[p];(this.attributes)!=null||(this.attributes=[]),(this.classes)!=null||(this.classes=[]),(this.style)!=null||(this.style="");}},f(B,"ONode"),B);u.ONode=M;let U=(H=class extends M{constructor(t){super(t);m(this,"_hydrated",false);}async addClass(...t){await w.call("addClass",this.uid,...t);}async removeClass(...t){await w.call("removeClass",this.uid,...t);}async setAttribute(t,i){let a=await w.call("setAttribute",this.uid,t,i);a&&(this.attributes=a);}async removeAttribute(t){let i=await w.call("removeAttribute",this.uid,t);i&&(this.attributes=i);}async appendChild(t){await w.call("appendChild",this.uid,t.uid);}set innerHTML(t){this.setHTML(t);}async cloneNode(t){let i=await w.call("cloneNode",this.uid,t);return i?new H(i):null}async remove(){await w.call("removeNode",this.uid);}async removeAndRelease(){await this.remove(),await this.release();}async removeChild(t){await w.call("removeChild",this.uid,t.uid);}async replaceChildNode(t,i){await w.call("replaceChildNode",this.uid,t.uid,i.uid);}async replaceWith(t){await w.call("replaceWith",this.uid,t.uid);}async after(t){await w.call("insertAfter",this.uid,t.uid);}async setHTML(t){await w.call("setInnerHTML",this.uid,t);}async HTML(){var t;return (t=await w.call("getInnerHTML",this.uid))!=null?t:""}async setInnerText(t){await w.call("setInnerText",this.uid,t);}async setContentText(t){await w.call("setContentText",this.uid,t);}async getContentText(){var t;return (t=await w.call("getContentText",this.uid))!=null?t:""}async content(){var t;try{return (t=await w.call("getInnerText",this.uid))!=null?t:""}catch(i){return console.error(i),""}}async childNodes(){var t,i;return (i=(t=await w.call("childNodes",this.uid))==null?void 0:t.map(a=>new H(a)))!=null?i:[]}hasAttribute(t){return !!this.attributes.find(i=>i.name===t)}async getAttribute(t){var i;return (i=await w.call("getAttribte",this.uid,t))!=null?i:""}attribute(t){var i,a;return (a=(i=this.attributes.find(h=>h.name===t))==null?void 0:i.value)!=null?a:null}async nextSibling(){let t=await w.call("nextSibling",this.uid);return t?new H(t):null}async getAttributeNames(){var t;return (t=await w.call("getAttributeNames",this.uid))!=null?t:[]}async parentNode(){let t=await w.call("parentNode",this.uid);return t?new H(t):null}async insertBefore(t,i){await w.call("insertBefore",this.uid,t.uid,i.uid);}async setInputValue(t){await w.call("setInputValue",this.uid,t);}async inputValue(){var t;return (t=await w.call("inputValue",this.uid))!=null?t:""}get hydrated(){return this._hydrated}hydrate(){this._hydrated=true,this.addClass("hydrated");}async query(t,i){return await w.query(t,i,this.uid)}async queryAll(t,i){return await w.queryAll(t,i,this.uid)}async setStyle(t,i){await w.call("setStyle",this.uid,t,i);}},f(H,"OElement"),H);u.OElement=U;let x=(K=class extends S{constructor(o){super(o.uid,o.tag);}addColorStop(o,t){return this.invoke("addColorStop",o,t),this}},f(K,"CanvasGradient"),K);u.CanvasGradient=x;let C=(j=class extends S{constructor(t){super(t.uid,t.tag);m(this,"batch",new k(this));}static async new(t){let i=typeof t!="undefined"?await w.newObject("DOMMatrix",t):await w.newObject("DOMMatrix");return i?new j(i):null}invertSelf(){return this.batch.invoke("invertSelf"),this}multiplySelf(t){return this.batch.invoke("multiplySelf",...t?[t.ref]:[]),this}premultiplySelf(t){return this.batch.invoke("premultiplySelf",...t?[t.ref]:[]),this}rotateAxisAngleSelf(t,i,a,h){let p=[];return t&&p.push(t),i&&p.push(i),a&&p.push(a),h&&p.push(h),this.batch.invoke("rotateAxisAngleSelf",...p),this}rotateFromVectorSelf(t,i){let a=[];return t&&a.push(t),i&&a.push(i),this.batch.invoke("rotateFromVectorSelf",...a),this}rotateSelf(t,i,a){let h=[];return t&&h.push(t),i&&h.push(i),a&&h.push(a),this.batch.invoke("rotateFromVectorSelf",...h),this}scale3dSelf(t,i,a,h){let p=[];return t&&p.push(t),i&&p.push(i),a&&p.push(a),h&&p.push(h),this.batch.invoke("scale3dSelf",...p),this}scaleSelf(t,i,a,h,p,E){let O=[];return t&&O.push(t),i&&O.push(i),a&&O.push(a),h&&O.push(h),p&&O.push(p),E&&O.push(E),this.batch.invoke("scaleSelf",...O),this}setMatrixValue(t){return this.invoke("setMatrixValue",t),this}skewXSelf(t){return this.batch.invoke("skewXSelf",t),this}skewYSelf(t){return this.batch.invoke("skewYSelf",t),this}translateSelf(t,i,a){return this.batch.invoke("translateSelf",t,i,...a?[a]:[]),this}async commit(){await this.batch.exec();}async is2D(){var t;return (t=await this.invoke("is2D"))!=null?t:false}async isIdentity(){var t;return (t=await this.invoke("isIdentity"))!=null?t:false}async flipX(){let t=await this.invokeAndHold("flipX");return t?new j(t):null}async flipY(){let t=await this.invokeAndHold("flipY");return t?new j(t):null}async inverse(){let t=await this.invokeAndHold("inverse");return t?new j(t):null}async multiply(t){let i=await this.invokeAndHold("multiply",...t?[t.ref]:[]);return i?new j(i):null}async rotate(t,i,a){let h=[];t&&h.push(t),i&&h.push(i),a&&h.push(a);let p=await this.invokeAndHold("rotate",...h);return p?new j(p):null}async rotateAxisAngle(t,i,a,h){let p=[];t&&p.push(t),i&&p.push(i),a&&p.push(a),h&&p.push(h);let E=await this.invokeAndHold("rotateAxisAngle",...p);return E?new j(E):null}async rotateFromVector(t,i){let a=[];t&&a.push(t),i&&a.push(i);let h=await this.invokeAndHold("rotateFromVector",...a);return h?new j(h):null}async scale(t,i,a,h,p,E){let O=[];t&&O.push(t),i&&O.push(i),a&&O.push(a),h&&O.push(h),p&&O.push(p),E&&O.push(E);let L=await this.invokeAndHold("scale",...O);return L?new j(L):null}async scale3d(t,i,a,h){let p=[];t&&p.push(t),i&&p.push(i),a&&p.push(a),h&&p.push(h);let E=await this.invokeAndHold("scale",...p);return E?new j(E):null}async skewX(t){let i=[];t&&i.push(t);let a=await this.invokeAndHold("skewX",...i);return a?new j(a):null}async skewY(t){let i=[];t&&i.push(t);let a=await this.invokeAndHold("skewY",...i);return a?new j(a):null}toJSON(){return this.invoke("toJSON")}async toString(){return this.invoke("toString")}async translate(t,i,a){let h=[];t&&h.push(t),i&&h.push(i),a&&h.push(a);let p=await this.invokeAndHold("translate",...h);return p?new j(p):null}},f(j,"DOMMatrix"),j);u.DOMMatrix=C;let A=(J=class extends S{constructor(o){super(o.uid,o.tag);}async setTransform(o){await this.invoke("setTransform",o.ref);}},f(J,"CanvasPattern"),J);u.CanvasPattern=A;let P=(Q=class extends S{constructor(t){super(t,"unknown");m(this,"batch",new k(this));}arc(t,i,a,h,p,E=false){return this.batch.invoke("arc",t,i,a,h,p,E),this}arcTo(t,i,a,h,p){return this.batch.invoke("arcTo",t,i,a,h,p),this}bezierCurveTo(t,i,a,h,p,E){return this.batch.invoke("bezierCurveTo",t,i,a,h,p,E),this}clearRect(t,i,a,h){return this.batch.invoke("clearRect",t,i,a,h),this}clip(t,i){let a=[];return typeof t=="string"?a.push(t):t instanceof g&&(t.commit(this.batch),a.push(t.ref)),typeof i=="string"&&a.push(i),this.batch.invoke("clip",...a),this}beginPath(){return this.batch.invoke("beginPath"),this}closePath(){return this.batch.invoke("closePath"),this}async createConicGradient(t,i,a){let h=await this.invokeAndHold("createConicGradient",t,i,a);return h?new x(h):null}async createLinearGradient(t,i,a,h){let p=await this.invokeAndHold("createLinearGradient",t,i,a,h);return p?new x(p):null}async createPattern(t,i=""){let a=await this.invokeAndHold("createPattern",t.ref,i);return a?new A(a):null}async createRadialGradient(t,i,a,h,p,E){let O=await this.invokeAndHold("createRadialGradient",t,i,a,h,p,E);return O?new x(O):null}drawImage(t,i,a,h,p,E,O,L,_t){let Y=[t.ref];return typeof E=="undefined"?(Y.push(i,a),h&&Y.push(h),p&&Y.push(p),this.batch.invoke("drawImage",...Y),this):(Y.push(i,a,h,p,E,O,L,_t),this.batch.invoke("drawImage",...Y),this)}ellipse(t,i,a,h,p,E,O,L=false){return this.batch.invoke("ellipse",t,i,a,h,p,E,O,L),this}fill(t,i){let a=[];return t&&a.push(typeof t=="string"?t:(t.commit(this.batch),t.ref)),i&&a.push(i),this.batch.invoke("fill",...a),this}fillRect(t,i,a,h){return this.batch.invoke("fillRect",t,i,a,h),this}fillText(t,i,a,h){return this.batch.invoke("fillText",t,i,a,...h?[h]:[]),this}getImageData(t,i,a,h,p){return this.invokeAndHold("getImageData",t,i,a,h,...p?[p]:[])}getLineDash(){return this.invoke("getLineDash")}async getTransform(){let t=await this.invokeAndHold("getTransform");return t?new C(t):null}async isContextLost(){return await this.invoke("isContextLost")}async isPointInPath(t,i,a,h){let p=[];return typeof t=="number"?(p.push(t,i),a&&p.push(a)):(await t.commit(this.batch),p.push(t.ref,i,a),h&&p.push(h)),await this.invoke("isPointInPath",...p)}async isPointInStroke(t,i,a){var p;let h=[];return typeof t=="number"?h.push(t,i):(await t.commit(),h.push(t.ref,i,a)),(p=await this.invoke("isPointInStroke",...h))!=null?p:false}lineTo(t,i){return this.batch.invoke("lineTo",t,i),this}async measureText(t){var i;return (i=await this.invoke("measureText",t))!=null?i:0}moveTo(t,i){return this.batch.invoke("moveTo",t,i),this}putImageData(t,i,a,h,p,E,O){let L=[t.ref,i,a];return h&&L.push(h),p&&L.push(p),E&&L.push(E),O&&L.push(O),this.batch.invoke("putImageData",...L),this}quadraticCurveTo(t,i,a,h){return this.batch.invoke("quadraticCurveTo",t,i,a,h),this}rect(t,i,a,h){return this.batch.invoke("rect",t,i,a,h),this}reset(){this.invoke("reset");}resetTransform(){this.invoke("resetTransform");}restore(){return this.batch.invoke("restore")}rotate(t){return this.batch.invoke("rotate",t),this}roundRect(t,i,a,h,p){return this.batch.invoke("roundRect",t,i,a,h,p),this}save(){return this.batch.invoke("save")}scale(t,i){return this.batch.invoke("scale",t,i),this}setLineDash(t){return this.invoke("setLineDash",t)}setTransform(t,i,a,h,p,E){typeof t=="number"?this.batch.invoke("setTransform",t,i,a,h,p,E):this.batch.invoke("setTransform",t.ref);}stroke(t){return this.batch.invoke("stroke",...t?[(t.commit(this.batch),t.ref)]:[]),this}strokeRect(t,i,a,h){return this.batch.invoke("strokeRect",t,i,a,h),this}strokeText(t,i,a,h){return this.batch.invoke("strokeText",t,i,a,...h?[h]:[]),this}transform(t,i,a,h,p,E){return this.batch.invoke("transform",t,i,a,h,p,E),this}translate(t,i){return this.batch.invoke("translate",t,i),this}set fillStyle(t){this.setFillStyle(t);}setFillStyle(t){return this.batch.setProperty("fillStyle",typeof t=="string"?t:t instanceof S?t.ref:t),this}set filter(t){this.setFilter(t);}setFilter(t){return this.batch.setProperty("filter",t),this}set font(t){this.setFont(t);}setFont(t){return this.batch.setProperty("font",t),this}set fontKerning(t){this.setFontKerning(t);}setFontKerning(t){return this.batch.setProperty("fontKerning",t),this}set fontStretch(t){this.setFontStretch(t);}setFontStretch(t){return this.batch.setProperty("fontStretch",t),this}set fontVariantCaps(t){this.setFontVariantCaps(t);}setFontVariantCaps(t){return this.batch.setProperty("fontVariantCaps",t),this}set globalAlpha(t){this.setGlobalAlpha(t);}setGlobalAlpha(t){return this.batch.setProperty("globalAlpha",t),this}set globalCompositeOperation(t){this.setGlobalCompositeOperation(t);}setGlobalCompositeOperation(t){return this.batch.setProperty("globalCompositeOperation",t),this}set imageSmoothingEnabled(t){this.setImageSmoothingEnabled(t);}setImageSmoothingEnabled(t){return this.batch.setProperty("imageSmoothingEnabled",t),this}set imageSmoothingQuality(t){this.setImageSmoothingQuality(t);}setImageSmoothingQuality(t){return this.batch.setProperty("imageSmoothingQuality",t),this}set letterSpacing(t){this.setLetterSpacing(t);}setLetterSpacing(t){return this.batch.setProperty("letterSpacing",t),this}set lineCap(t){this.setLineCap(t);}setLineCap(t){return this.batch.setProperty("lineCap",t),this}set lineDashOffset(t){this.setLineDashOffset(t);}setLineDashOffset(t){return this.batch.setProperty("lineDashOffset",t),this}set lineJoin(t){this.setLineJoin(t);}setLineJoin(t){return this.batch.setProperty("lineJoin",t),this}set lineWidth(t){this.setLineWidth(t);}setLineWidth(t){return this.batch.setProperty("lineWidth",t),this}set miterLimit(t){this.setMiterLimit(t);}setMiterLimit(t){return this.batch.setProperty("miterLimit",t),this}set shadowBlur(t){this.setShadowBlur(t);}setShadowBlur(t){return this.batch.setProperty("shadowBlur",t),this}set shadowColor(t){this.setShadowColor(t);}setShadowColor(t){return this.batch.setProperty("shadowColor",t),this}set shadowOffsetX(t){this.setShadowOffsetX(t);}setShadowOffsetX(t){return this.batch.setProperty("shadowOffsetX",t),this}set shadowOffsetY(t){this.setShadowOffsetY(t);}setShadowOffsetY(t){return this.batch.setProperty("shadowOffsetY",t),this}set strokeStyle(t){this.setStrokeStyle(t);}setStrokeStyle(t){return this.batch.setProperty("strokeStyle",typeof t=="string"?t:t instanceof S?t.ref:t),this}set textAlign(t){this.setTextAlign(t);}setTextAlign(t){return this.batch.setProperty("textAlign",t),this}set textBaseline(t){this.setTextBaseline(t);}setTextBaseline(t){return this.batch.setProperty("textBaseline",t),this}set wordSpacing(t){this.setWordSpacing(t);}setWordSpacing(t){return this.batch.setProperty("wordSpacing",t),this}set textRendering(t){this.setTextRendering(t);}setTextRendering(t){return this.batch.setProperty("textRendering",t),this}async commit(){await this.batch.exec();}},f(Q,"Canvas2DContext"),Q);u.Canvas2DContext=P;let I=(q=class extends S{constructor(o){super(o.uid,o.tag);}static async new(o,t){let i=[];o&&i.push(o),t&&i.push(t);let a=await w.newObject("Image",...i);return a?new q(a):null}async width(){var o;return (o=await this.getProperty("width"))!=null?o:0}async height(){var o;return (o=await this.getProperty("height"))!=null?o:0}async naturalWidth(){var o;return (o=await this.getProperty("naturalWidth"))!=null?o:0}async naturalHeight(){var o;return (o=await this.getProperty("naturalHeight"))!=null?o:0}async src(){return await this.getProperty("src")}async currentSrc(){return await this.getProperty("currentSrc")}async setSrc(o){await this.setProperty("src",o);}},f(q,"Image"),q);u.Image=I;let g=(F=class extends S{constructor(t){super(t.uid,t.tag);m(this,"batch",new k(this));}static async create(){let t=await w.newObject("Path2D");return t?new F(t):null}addPath(t){return this.batch.invoke("addPath",t.ref),this}arc(t,i,a,h,p,E=false){return this.batch.invoke("arc",t,i,a,h,p,E),this}arcTo(t,i,a,h,p){return this.batch.invoke("arcTo",t,i,a,h,p),this}bezierCurveTo(t,i,a,h,p,E){return this.batch.invoke("bezierCurveTo",t,i,a,h,p,E),this}quadraticCurveTo(t,i,a,h){return this.batch.invoke("quadraticCurveTo",t,i,a,h),this}closePath(){return this.batch.invoke("closePath"),this}ellipse(t,i,a,h,p,E,O,L=false){return this.batch.invoke("ellipse",t,i,a,h,p,E,O,L),this}moveTo(t,i){return this.batch.invoke("moveTo",t,i),this}lineTo(t,i){return this.batch.invoke("lineTo",t,i),this}rect(t,i,a,h){return this.batch.invoke("rect",t,i,a,h),this}roundRect(t,i,a,h,p){return this.batch.invoke("roundRect",t,i,a,h,p),this}commit(t){return t?(t.accept(this.batch),Promise.resolve()):this.batch.exec()}},f(F,"CanvasPath2D"),F);u.CanvasPath2D=g;let b=($=class extends U{constructor(o){super(o);}async width(){return this.getProperty("width")}async height(){return this.getProperty("height")}async setWidth(o){this.setProperty("width",o);}async setHeight(o){this.setProperty("height",o);}async getContext(o){let t=await this.invokeAndHold("getContext",o);return t&&new P(t.uid)}static async of(o,t,i){let a=await w.query(o,t);return a?new $(a):null}},f($,"CanvasElement"),$);u.CanvasElement=b;})(exports.ODOM||(exports.ODOM={}));var Et=class Et{constructor(){m(this,"callbacks",new Map);m(this,"DOM_EVENT_LISTENERS",new Map);m(this,"timers",new Map);m(this,"_config");m(this,"listeners",new Map);this.subscribe("__ouid_native_event_success__",(e,s)=>{let n=this.callbacks.get(e);if(n)return this.callbacks.delete(e),n.success(...JSON.parse(s))}),this.subscribe("__ouid_native_event_error__",(e,s)=>{let n=this.callbacks.get(e);if(n)return this.callbacks.delete(e),n.error(...JSON.parse(s))}),this.subscribe("__ouid_web_event__",(e,s)=>{let n=this.DOM_EVENT_LISTENERS.get(e),r=JSON.parse(s);if(n){let c=r[1];return c&&typeof c=="object"&&(c.target=c!=null&&c.target?new exports.ODOM.OElement(c.target):null,c.currentTarget=c!=null&&c.currentTarget?new exports.ODOM.OElement(c.currentTarget):null,c.relatedTarget=c!=null&&c.relatedTarget?new exports.ODOM.OElement(c.relatedTarget):null),n(c)}else console.error("No cb found for ",e,r[0]);});}config(e){return this._config=e,this}invoke(e,...s){let n=tt(e);return new Promise((r,c)=>{this.callbacks.set(n,{success:r,error:c});try{if(!WebOUID)throw new Error("NativeOUID bridge not available");WebOUID.invoke(n,e,JSON.stringify(s));}catch(l){console.error(l),this.callbacks.delete(n);}})}registerComponent(e,s){W.register(e,s);}unregisterComponent(e,s){W.unregister(e);}async call(e,...s){try{return (await this.invoke(`_ouid_${e}`,...s)).data}catch(n){return console.error(n),null}}emit(e,s){WebOUID==null||WebOUID.invoke("event",e,JSON.stringify(s));}subscribe(e,s){this.listeners.has(e)||(this.listeners.set(e,[]),globalThis[e]=(n,r)=>{var c;(c=this.listeners.get(e))==null||c.forEach(l=>l(n,r));}),this.listeners.get(e).push(s);}async query(e,s,n){let r=await this.call("query",e,s,n);return r?new exports.ODOM.OElement(r):null}async queryAll(e,s,n){let r=await this.call("queryAll",e,s,n);return r?r.map(c=>new exports.ODOM.OElement(c)):[]}async createElement(e,s={}){let n=await this.call("createElement",e,s);return n?new exports.ODOM.OElement(n):null}async createComment(e){let s=await this.call("createComment",e);return s?new exports.ODOM.OElement(s):null}async addEventListener(e,s,n,r){let c=tt(s+(typeof e=="string"?e:e.tag));return this.DOM_EVENT_LISTENERS.set(c,n),await w.call("attachEventListener",typeof e=="string"?e:e.uid,c,s,r==null?void 0:r.options,r==null?void 0:r.policy),c}async dettachEventListener(e){this.DOM_EVENT_LISTENERS.delete(e),await w.call("dettachEventListener",e);}async createComponentStyles(e,s=true){let n=await w.call("createComponentStyles",e,s);return n?new exports.ODOM.OElement(n):null}async appendComponentStyles(e){await w.call("appendComponentStyles",e);}async rejectComponentStyles(e){await w.call("rejectComponentStyles",e.uid);}async getOObject(e){let s=await w.call("getOObject",e);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async acquireObject(e){let s=await w.call("acquireObject",e);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async setTimeout(e,s){var c;let n=tt("setTimeout"+s);this.DOM_EVENT_LISTENERS.set(n,()=>{e();let l=this.timers.get(r);l&&(this.timers.delete(r),this.DOM_EVENT_LISTENERS.delete(l));});let r=(c=await w.call("setTimeout",n,s))!=null?c:-1;return r>=0&&this.timers.set(r,n),r}async clearTimeout(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await w.call("clearTimeout",e));}async setInterval(e,s){var c;let n=tt("setInterval"+s);this.DOM_EVENT_LISTENERS.set(n,e);let r=(c=await w.call("setInterval",n,s))!=null?c:-1;return r>=0&&this.timers.set(r,n),r}async clearInterval(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await w.call("clearInterval",e));}async fetch(e,s,n="json"){let r=await w.call("fetch",e,s,n);return n==="buffer"||n==="bytes"?exports.ODOM.OObject.toInstance(r):r}async alert(e){console.log("Alerting:::",e),await w.call("alert",e);}async prompt(e){await w.call("prompt",e);}async newObject(e,...s){return w.call("newObject",e,...s)}async requestAnimationFrame(e){var r;let s=tt("requestAnimationFrame");this.DOM_EVENT_LISTENERS.set(s,c=>{e(c);let l=this.timers.get(n);l&&(this.DOM_EVENT_LISTENERS.delete(l),this.timers.delete(n));});let n=(r=await w.call("requestAnimationFrame",s))!=null?r:-1;return n>=0&&this.timers.set(n,s),n}async cancelAnimationFrame(e){let s=this.timers.get(e);s&&(this.timers.delete(e),await w.call("cancelAnimationFrame",e),this.DOM_EVENT_LISTENERS.delete(s));}async batchActions(e){await w.call("batchActions",e);}};f(Et,"OUIDBridge");var kt=Et,w=new Proxy(new kt,{get:f((u,e)=>e in u?u[e]:async(...s)=>await u.call(e,...s),"get")});globalThis.OUID=w;exports.ODOM=void 0;function qt(u){return u.replace(/-([a-z])/g,(e,s)=>s.toUpperCase())}f(qt,"toCamelCase");function Ft(u){return u.replace(/(?!^)([A-Z])/g,(e,s)=>`-${s.toLowerCase()}`)}f(Ft,"toSnakeCase");function V(u){return mt(u)?u.value:u}f(V,"normaliseValue");var $t=typeof globalThis.queueMicrotask=="function",it=f(u=>u?$t?queueMicrotask(u):Promise.resolve().then(u):Promise.resolve(),"deferMicro"),Se=f(()=>new Promise(u=>setTimeout(u,0)),"deferMacro");function Wt(u){return typeof u=="function"&&!("prototype"in u)}f(Wt,"isLazyLoader");var It=new Map,Nt=new Map,Dt=new WeakMap;function Gt(u){var n;if(!u||typeof u!="object"&&typeof u!="function")return {};let e=Dt.get(u);if(e)return e;let s=Object.create(null);for(let r=u;r&&r!==Object.prototype;r=Object.getPrototypeOf(r))for(let c of Object.getOwnPropertyNames(r)){if(c==="constructor"||c.startsWith("__")||c.endsWith("__")||c in s)continue;let l=Object.getOwnPropertyDescriptor(r,c);if(!l)continue;let d=(n=l.value)!=null?n:l.get?l.get.call(u):void 0;s[c]=typeof d=="function"?d.bind(u):d;}return Dt.set(u,s),s}f(Gt,"getMethodsView");function Lt(u,e){let s=It.get(u);return s||(s=new Function("s","with (s) { return ("+u+"); }"),It.set(u,s)),s(e)}f(Lt,"evalInScope");function Kt(u){let e=Nt.get(u);if(e)return e;let s=[],n=0;for(;n<u.length;){let r=u.indexOf("{{",n);if(r<0){s.push({t:u.slice(n)});break}r>n&&s.push({t:u.slice(n,r)});let c=u.indexOf("}}",r+2),l=c>=0?u.slice(r+2,c).trim():u.slice(r+2).trim();s.push({e:l}),n=c>=0?c+2:u.length;}return e=f(r=>{let c="";for(let l of s)if(l.t!==void 0)c+=l.t;else if(l.e!==void 0){let d=V(Lt(l.e,r));c+=d==null?"":String(d);}return c},"fn"),Nt.set(u,e),e}f(Kt,"compileInterpolated");var jt,_=class _{constructor(e,s,n,...r){m(this,"app");m(this,"component");m(this,"parentContext");m(this,"bindings",[]);m(this,"directives",[]);m(this,"mountedComponents",(jt=lt(_.MOUNTED_COMPONENTS_TOKEN))!=null?jt:new Map);m(this,"componentsRegistry",new et);m(this,"updatingDirectives",false);m(this,"updatingBindings",false);m(this,"_stack",[]);m(this,"flatStack",Object.create(null));m(this,"viewUpdates");m(this,"mountedQueue",[]);this.app=e,this.component=s,this.parentContext=n;for(let c of r)this.push(c);}get hostElement(){return this.component._hostElement}get stack(){return this._stack}set stack(e){this.flatStack=Object.create(null),this._stack=[];for(let s of e)this.push(s);}getRoot(){let e=this;for(;e.parentContext;)e=e.parentContext;return e}enqueueMounted(e){this.getRoot().mountedQueue.push(e);}async flushMounted(){let e=this.getRoot(),s=e.mountedQueue;e.mountedQueue=[];for(let n of s)try{n();}catch(r){console.error("onMounted error:",r);}}getMountedComponent(e){return this.mountedComponents.get(e.uid)}bind(e){this.bindings.push(e);}directive(e){this.directives.push(e);}evaluateExpression(e){return this.resolve(e)}resolveScope(...e){var r,c;let s=(c=(r=this.component.state)==null?void 0:r.value)!=null?c:{},n=Gt(s);return new Proxy(Object.create(null),{get:f((l,d)=>{for(let v=e.length-1;v>=0;v--)if(d in e[v])return V(e[v][d]);return d in this.flatStack?V(this.flatStack[d]):d in n?V(n[d]):V(s[d])},"get"),set:f((l,d,v)=>{let y=null;for(let k=e.length-1;k>=0;k--)if(d in e[k]){y=e[k][d];break}return y||(d in this.flatStack?y=this.flatStack[d]:d in n?y=n[d]:y=s[d]),y&&mt(y)?(y.value=v,true):false},"set"),has:f((l,d)=>e.some(v=>d in v)||d in this.flatStack||d in n||d in s,"has")})}resolve(e,...s){if(!e)return;let n=this.resolveScope(...s);try{return Lt(e,n)}catch(r){return}}updateValue(e,s){this.resolve(`${e}=__o_model_value__`,{__o_model_value__:s}),this.component.state.didChange(e,void 0,s);}push(e){this._stack.unshift(e),Object.assign(this.flatStack,e);}pop(){let e=this._stack.shift();if(e)for(let s of Object.keys(e))delete this.flatStack[s];}resolveTag(e){var n;let s=this;for(;;){if(s.componentsRegistry.has(e))return s.componentsRegistry.get(e);if(s=(n=s==null?void 0:s.parentContext)!=null?n:null,!s)break}return W.get(e)}async updateBindings(){if(!this.updatingBindings){this.updatingBindings=true;for(let e of this.bindings)this.updateBinding(e);this.updatingBindings=false;}}updateBinding(e){if(e.type==="model"){e.node.setProperty("value",V(e.context.resolve(e.key)));return}if(e.type==="interpolation"){let s=e.templateFn(e.context.resolveScope());this.viewUpdates.add("setContentText",e.node,s);return}if(e.type==="attribute"){let s=e.key,n=V(this.resolve(e.template));s==="class"?this.expandClass(e.node,n):s==="style"?this.expandStyle(e.node,n):typeof n!="object"&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="undefined"&&this.viewUpdates.add("setAttribute",e.node,s,n.toString());return}if(e.type==="prop"&&e.context.component){let s=V(this.resolve(e.template));try{e.context.component.props[e.key]=s,Promise.all([e.context.updateBindings(),e.context.updateDirectives()]).then(()=>{e.context.viewUpdates.exec();});}catch(n){console.error(n);}return}}async updateDirectives(){var n;if(this.updatingDirectives)return;let e=new exports.ODOM.BatchActions;this.updatingDirectives=true;for(let r of this.directives){if(r.type==="if"){if(!V(r.context.evaluateExpression(r.expr))){if(r.active===false)continue;r.active=false,r.renderedNode&&(r.destroy?this.unmountComponent(r.renderedNode):this.viewUpdates.add("addClass",r.renderedNode,"oui-hidden"));continue}if(r.active===true)continue;r.active=true;let l=r.renderedNode;if(!l||r.destroy){let d=await r.node.cloneNode(true);r.renderedNode=d,await r.context.render(d),this.viewUpdates.add("after",r.placeholder,d);}else this.viewUpdates.add("removeClass",l,"oui-hidden");}if(r.type==="for"){let c=(n=r.children)!=null?n:new Map,l=new Map,d=f((x,C)=>r.key?V(r.context.resolve(r.key,{[r.item]:x})):C,"keyFn"),v=V(r.context.resolve(r.list))||[],y=new exports.ODOM.BatchActions,k=32,S=0,M=r.placeholder;for(let x=0;x<v.length;x++){let C=v[x],A=d(C,x),P=c.get(A),I,g,b=M;if(P){I=P.node,g=P.ctx,g.stack=[{[r.item]:C},...r.context.stack];let T=await M.nextSibling();I.uid!==(T==null?void 0:T.uid)&&y.add(()=>b.after(I)),await Promise.all([g.updateBindings(),g.updateDirectives()]);}else g=new _(this.app,this.component,this),g.viewUpdates=this.viewUpdates,g.stack=[{[r.item]:C},...r.context.stack],I=await r.node.cloneNode(true),y.add(async()=>{await b.after(I);}),await g.render(I),await g.updateDirectives();M=I,l.set(A,{node:I,ctx:g}),++S>=k&&(S=0,await y.commit(),await it());}let U=[];for(let[x,C]of c.entries())l.has(x)||U.push(this.unmountComponent(C.node));await Promise.all(U),await y.commit(),r.children=l;}}await e.commit(),this.updatingDirectives=false;}async render(e,s){if(e.hydrated||s!=null&&s.skipSlotted&&e.hasAttribute("slotted"))return;switch(e.type){case "Text":this.handleTextNode(e);break;case "Element":await this.handleElementNode(e,s);break;}let n=new exports.ODOM.BatchActions;await Promise.all([this.updateBindings(),this.updateDirectives()]),n.commit(),this.viewUpdates.add("addClass",e,"hydrated");}async expandClass(e,s){let n;typeof s=="object"?Array.isArray(s)?n=s:n=Object.keys(s).filter(r=>s[r]):n=s.toString().split(/\s+/),n.length>0&&this.viewUpdates.add("addClass",e,...n);}expandStyle(e,s){let n=s;typeof s=="object"&&!Array.isArray(s)&&(n=Object.keys(s).filter(r=>s[r]).map(r=>`${Ft(r)}: ${s[r]}`).join(";")),n&&this.viewUpdates.add("setAttribute",e,"style",n);}expandStandardAttributes(e){[...e.attributes].filter(s=>s.name.startsWith(":")).forEach(s=>{let n=s.name.substring(1);this.bind({type:"attribute",node:e,key:n,context:this,template:s.value.trim()}),this.viewUpdates.add("removeAttribute",e,s.name);});}setRefValue(e,s){let n=e.trim();this.updateValue(n,s);}async handleElementNode(e,s){var x;let n=await e.parentNode(),r=null,c=e.hasAttribute("o-if")?"o-if":e.hasAttribute("o-show")?"o-show":null;if(c){let C=await e.getAttribute(c),A=await OUID.createComment(c+":"+C),P=c==="o-if";await n.insertBefore(e,A),await e.updates().removeAttribute(c).remove().exec(),this.directive({type:"if",expr:C,node:e,placeholder:A,context:this,active:void 0,destroy:P}),r="if";return}if(e.hasAttribute("o-for")){if(r==="if")throw new Error("Can't have o-if and o-for on the same component");let C=await e.getAttribute("o-for"),[A,P]=C.split(" of ").map(b=>b.trim()),I=await OUID.createComment("for:"+C),g=(x=e.attribute(":key"))!=null?x:"";await(n==null?void 0:n.insertBefore(e,I)),await e.updates().removeAttribute("o-for").removeAttribute(":key").remove().exec(),this.directive({type:"for",item:A,list:P,node:e,placeholder:I,context:this,key:g}),r="for";return}let l=e.tag.toLowerCase(),d=this.resolveTag(l),v=e.updates();[...e.attributes].forEach(async C=>{if(C.name==="o-model"){let A=C.value.trim();v.setInputValue(V(this.resolve(A))).addEventListener("input",async I=>{let g=await I.target.getProperty("value");this.updateValue(A,g);}),this.bind({node:e,key:A,type:"model",context:this}),v.removeAttribute(C.name);}else C.name==="ref"&&(d||this.setRefValue(C.value,e));});let y={},k={},{props:S,events:M}=this.componentAttributes(e,this);if(y=S,k=M,this.expandStandardAttributes(e),Object.keys(k).forEach(async C=>{let A=k[C];d||v.addEventListener(C,P=>{typeof A=="function"&&A.apply(this.component,[P]);}),v.removeAttribute("@"+C);}),this.viewUpdates.accept(v),d){await this.mountComponent(e,d,this,y,k);return}let U=await e.childNodes();s!=null&&s.skipSlotted&&(U=U.filter(C=>!C.hasAttribute("slotted")));for(let C of U)await this.render(C,s);}handleTextNode(e){var n;let s=(n=e.textContent)!=null?n:"";s.includes("{{")&&this.bind({type:"interpolation",node:e,key:"__template__",templateFn:Kt(s),context:this});}componentAttributes(e,s){let n={},r={},c=["import","interface","module","o-model","o-if","o-for"];return [...e.attributes].filter(l=>!c.includes(l.name)).forEach(l=>{let d=l.name;if(d.startsWith("@")){let k=s==null?void 0:s.resolve(l.value);if(typeof k!="function")throw new Error("Event handler can only be function");d=d.substring(1),r[d]=k;return}let v=null,y=l.value;d.startsWith(":")&&(v=l.value,d=d.substring(1),y=V(s==null?void 0:s.resolve(l.value))),d=qt(d),n[d]={name:d,value:y,expr:v};}),{props:n,events:r}}async mountComponent(e,s,n,r={},c={}){var M,U,x,C,A,I;if(this.viewUpdates=(U=(M=this.viewUpdates)!=null?M:n==null?void 0:n.viewUpdates)!=null?U:new exports.ODOM.BatchUpdates(e),this.mountedComponents.has(e.uid))return this.mountedComponents.get(e.uid);let l=new _(this.app,{},this);l.viewUpdates=this.viewUpdates;let d={},v;for(let g of Object.keys(r)){let b=r[g];if(b.name==="ref"&&!b.expr){v=b;continue}b.expr&&this.bind({type:"prop",node:e,key:g,context:l,template:b.expr}),d[g]=b.value;}let y=await Jt(s,d,c);l.component=y,l.stack=[],this.mountedComponents.set(e.uid,y),v&&this.setRefValue(v.value,y);{let g=e.updates();for(let T of Object.keys(r))r[T].expr||g.setAttribute(T,r[T].value);let b=(x=y.hostClasses)!=null?x:[];b&&(b=typeof b=="string"?[b]:b),b.push("o-component-host"),e.tag.toLowerCase()!=="div"&&b.push("c-"+e.tag.toLowerCase()),g.addClass(...b),this.viewUpdates.accept(g);}it(async()=>{try{await y.decorateHostElement(e);}catch(g){}});{let g=(C=y.use)!=null?C:{};for(let b of Object.keys(g))l.componentsRegistry.register(b,g[b]);}if(y.willMount(),!s.cssInstance){let g=y.style?(A=y.style())==null?void 0:A.toString():y.css;g&&((s.cssInstance)!=null||(s.cssInstance=await OUID.createComponentStyles(g,false)));}it(()=>{var b;let g=s.cssInstance;if(g){let T=(b=_.STYLE_REF.get(g))!=null?b:0;T===0&&OUID.appendComponentStyles(g.uid),_.STYLE_REF.set(g,T+1),y.cssInstance=g;}});let k=await e.childNodes();if(y.render){let g=await y.render(l);g&&g.attachTo(e);}else await e.setHTML(y.template.trim());let S=await e.queryAll("slot");S&&S.length&&await Promise.all(S.filter(g=>{var b;return !((b=g.classes)!=null&&b.includes("hydrated"))}).map(async g=>{let b=g.attribute("name"),T=k.filter(N=>b?N.type==="Element"&&N.attribute("slot")===b:N.type!=="Element"||!N.hasAttribute("slot"));if(T.length){for(let N of T)this.viewUpdates.add("setAttribute",N,"slotted","true"),this.viewUpdates.add("appendChild",g,N);await this.viewUpdates.exec(),await Promise.all(T.map(N=>this.render(N)));}})),y._hostElement=e,y.parent=(I=n==null?void 0:n.component)!=null?I:void 0,y.provide(_.PROVIDE_TOKEN,this);{let g=await e.childNodes(),b=6,T=0;for(;T<g.length;){let N=g.slice(T,T+b);await Promise.all(N.map(D=>l.render(D,{skipSlotted:true}))),T+=b;}}return l.viewUpdates.add("addClass",e,"hydrated"),this.enqueueMounted(()=>{try{y.onMounted();}catch(g){}}),await l.viewUpdates.exec(),y.state.watch(async()=>{await Promise.all([l.updateBindings(),l.updateDirectives()]),await l.viewUpdates.exec();}),y}async unmountComponent(e){var r,c;let s=this.mountedComponents.get(e.uid);if(await e.removeAndRelease(),s){let l=s.cssInstance;if(l){let d=(r=_.STYLE_REF.get(l))!=null?r:1;d===1?(await OUID.rejectComponentStyles(l),_.STYLE_REF.delete(l)):_.STYLE_REF.set(l,d-1);}s.willUnmount(),s._hostElement=null,s.cssInstance=null;}let n=(c=await e.queryAll("*"))!=null?c:[];for(let l of n)await this.unmountComponent(l);this.mountedComponents.delete(e.uid),e.hasAttribute("ref")&&this.setRefValue(e.attribute("ref"),null);}};f(_,"RenderContext"),m(_,"PROVIDE_TOKEN","RENDER_CONTEXT"),m(_,"MOUNTED_COMPONENTS_TOKEN","RENDER_CONTEXT_MOUNTED_COMPONENTS"),m(_,"STYLE_REF",new WeakMap);var G=_;async function Te(u,e,s=[],n){let r=e!=null?e:{},c=await OUID.createElement(u,Object.keys(r).reduce((l,d)=>(l[d]=r[d],l),{}));return Object.keys(n!=null?n:{}).forEach(l=>{c==null||c.addEventListener(l,d=>{let v=n[l];typeof v=="function"&&v(d);});}),new X(c,s)}f(Te,"node");function Jt(u,e,s){return Wt(u)?u().then(n=>vt(n.default,e,s)):vt(u,e,s)}f(Jt,"o");function Qt(u){return typeof u=="function"}f(Qt,"isProvideFunction");var rt=class rt{constructor(e,s){m(this,"root");m(this,"options");m(this,"providers",new Map);this.root=e,this.options=s,rt.currentApp=this;}provide(e,s){if(this.providers.has(e)){console.warn(`[OUID] - Provider ${e} already exists`);return}this.providers.set(e,Qt(s)?{provide:s}:{value:s});}inject(e){var s;return (s=this.providers.get(e))==null?void 0:s.value}use(e,s){return e.install(this,s),this}async mount(e){var r;if(!globalThis.__OUI_PUR_JS_CONTEXT__)return;(r=this.options)!=null&&r.css&&await OUID.createComponentStyles(this.options.css),await OUID.createComponentStyles(`
|
|
7
7
|
* {
|
|
8
8
|
${e} * {
|
|
9
9
|
visibility: hidden;
|
|
@@ -14,7 +14,7 @@ ${i.toString()}}
|
|
|
14
14
|
.oui-hidden {
|
|
15
15
|
display: none !important;
|
|
16
16
|
}
|
|
17
|
-
`),
|
|
17
|
+
`),zt(G.MOUNTED_COMPONENTS_TOKEN,new Map);let s=await OUID.query(e);if(!s)throw new Error("No selector found for "+e);let n=new G(this,{},null);n.mountComponent(s,this.root,null).then(async()=>{n.updateBindings(),n.updateDirectives(),await n.flushMounted();});}};f(rt,"App"),m(rt,"currentApp",null);var dt=rt;function zt(u,e){var s;(s=dt.currentApp)==null||s.provide(u,e);}f(zt,"provide");function lt(u){var e,s;return (s=(e=dt.currentApp)==null?void 0:e.inject(u))!=null?s:void 0}f(lt,"inject");function Yt(u,e,s,n){var r=arguments.length,c=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(u,e,s,n);else for(var d=u.length-1;d>=0;d--)(l=u[d])&&(c=(r<3?l(c):r>3?l(e,s,c):l(e,s))||c);return r>3&&c&&Object.defineProperty(e,s,c),c}f(Yt,"_ts_decorate");var Tt=class Tt extends Z{constructor(){super(...arguments);m(this,"router");}willMount(){}onMounted(){var s;this.router=Zt(),(s=this.router)==null||s.bind(this).then(n=>{n==null||n();});}willUnmount(){var s;(s=this.router)==null||s.unbind();}};f(Tt,"ORouter");exports.ORouter=Tt;exports.ORouter=Yt([At({tag:"o-router",template:`
|
|
18
18
|
<div id="router-view"></div>
|
|
19
19
|
`,css:`
|
|
20
20
|
#router-view {
|
|
@@ -58,11 +58,11 @@ ${i.toString()}}
|
|
|
58
58
|
.route-pop-end {
|
|
59
59
|
transform: translateX(100%);
|
|
60
60
|
}
|
|
61
|
-
`})],exports.ORouter);var
|
|
61
|
+
`})],exports.ORouter);var Mt="OROUTER_TOKEN",Ct="ACTIVE_ROUTE",Rt=250;function Zt(){return lt(Mt)}f(Zt,"useRouter");function Ue(u){return new St(u)}f(Ue,"createRouter");function te(u){u&&(u.__isActive=true,typeof u.onActivated=="function"&&u.onActivated());}f(te,"activate");function ee(u){u&&(u.__isActive=false,typeof u.onDeactivated=="function"&&u.onDeactivated());}f(ee,"deactivate");var Ot=class Ot{constructor(e){m(this,"routes");m(this,"windowObject",null);m(this,"guards",[]);m(this,"eventRegistration",null);m(this,"compiled");m(this,"outletEl",null);m(this,"stack",[]);m(this,"pendingNav",null);m(this,"lastDirection","none");m(this,"historyIndex",0);this.routes=e,this.compiled=e.map(s=>({route:s,parser:new Xt__default.default(s.path)}));}install(e){e.provide(Mt,this),w.registerComponent("o-router",exports.ORouter);}resolveByName(e){for(let s of this.compiled)if(s.route.name===e)return {route:s.route,params:{},query:{},parser:s.parser};return null}resolve(e){let[s,n=""]=e.split("?"),r=n?n.split("&").reduce((c,l)=>{let[d,v=""]=l.split("=");return d&&(c[d]=decodeURIComponent(v)),c},{}):{};for(let c of this.compiled){let l=c.parser.match(s);if(l)return c.route.redirectTo?typeof c.route.redirectTo=="string"?this.resolve(c.route.redirectTo):this.resolveByName(c.route.redirectTo.name):{route:c.route,params:l,query:r,parser:c.parser}}return null}replace(e){this.push(e,true);}push(e,s=false){var r,c;if(!e.path&&!e.name){console.warn("[OUID-Router]: no path or name provided to push");return}this.lastDirection="forward";let n=f((l,d=true)=>{var y,k,S;let v={navIndex:s?this.historyIndex:this.historyIndex+1};s?(y=this.windowObject)==null||y.invoke("history.replaceState",v,"",l):(k=this.windowObject)==null||k.invoke("history.pushState",v,"",l),d&&((S=this.windowObject)==null||S.dispatchEvent("popstate","PopStateEvent",{state:v}));},"dispatchPushEvent");if(e.name){let l=this.resolveByName(e.name);if(!l){console.warn("[OUID-Router]: No matched route name found");return}let d=l.parser.reverse((r=e.params)!=null?r:{});d&&n(d);return}if(e.absolute&&e.path&&n(e.path,false),e.path){let l=this.resolve(e.path);if(l){let d=l.parser.reverse((c=e.params)!=null?c:{});d&&n(d);return}}}async pop(){var s,n;this.lastDirection="back",(s=this.windowObject)==null||s.invoke("history.back");let e={navIndex:this.historyIndex-1};await((n=this.windowObject)==null?void 0:n.invoke("history.pushState",e,""));}async beforeRouteGoing(e,s){for(let n of this.guards.filter(r=>r.type==="before")){let r=await n.fn(e,s);if(r)return r}}async afterRouteGoing(e,s){for(let n of this.guards.filter(r=>r.type==="after")){let r=await n.fn(e,s);if(r)return r}}async bind(e){this.windowObject=await w.acquireObject("window");let s=f(async d=>{var T,N;this.windowObject||(this.windowObject=await w.acquireObject("window"));let v=d!=null?d:await this.windowObject.getProperty("location.pathname"),y=this.resolve(v);if(!y){console.warn(`[Router] No route found for: ${v}`);return}let k=e.inject(G.PROVIDE_TOKEN);this.outletEl||(this.outletEl=await k.hostElement.query("#router-view"));let S=this.outletEl;if(!S)return;let M=await this.beforeRouteGoing({url:v,path:v,name:y.route.name},e.inject(Ct));if(M){typeof M=="object"&&"name"in M&&this.push({name:M.name,params:M.params});return}e.provide(Ct,{params:y.params,query:y.query});let U=await S.childNodes(),x=(T=U[U.length-1])!=null?T:null,C=x&&(N=k.getMountedComponent(x))!=null?N:null,A=this.getNavMode(),P,I,g=this.stack.length,b=this.stack[g-2];if(this.lastDirection==="back"&&b){P=b.host,I=b.inst;let D=S.updates();U.some(B=>B.uid===P.uid),D.add("appendChild",S,P),D.add("removeClass",P,"route-hidden"),await D.exec(),await Promise.all([b.ctx.updateBindings(),b.ctx.updateDirectives()]);}else {let D=await w.createElement("div",{class:"route-view route-hidden"});await S.appendChild(D);let B=await k.mountComponent(D,y.route.component,k);P=D,I=B,k==null||k.flushMounted(),this.lastDirection==="forward"&&this.stack.push({host:D,ctx:k,inst:B});}A==="push"?await this.runTransitionPush(S,x,P):A==="pop"&&x&&await this.runTransitionPop(S,x,P),x&&C&&this.lastDirection==="back"&&(this.stack.pop(),ee(C),await k.unmountComponent(x)),te(I),await this.afterRouteGoing({url:v,path:v,name:y.route.name},e.inject(Ct)),await it();},"handler"),n=f(async d=>{let v=await this.windowObject.getProperty("location.pathname");return this.pendingNav?this.pendingNav:(this.pendingNav=(async()=>{try{let y=(d==null?void 0:d.state)||await this.windowObject.getProperty("history.state"),k=0;y&&typeof y.navIndex=="number"&&(k=y.navIndex),k>this.historyIndex?this.lastDirection="forward":k<this.historyIndex?this.lastDirection="back":this.lastDirection="none",this.historyIndex=k,await s(v);}finally{this.pendingNav=null;}})(),this.pendingNav)},"run"),r=await this.windowObject.getProperty("location.pathname"),c=await this.windowObject.getProperty("history.state");(!c||typeof c.navIndex!="number")&&await this.windowObject.invoke("history.replaceState",{navIndex:this.historyIndex},"",r);let l=await this.windowObject.addEventListener("popstate",n);return this.eventRegistration=l,s}unbind(){var e;this.eventRegistration&&((e=this.windowObject)==null||e.dettachEventListener(this.eventRegistration));}async runTransitionPush(e,s,n){if(!s){await n.updates().removeClass("route-hidden","route-transitioning","route-push-start").addClass("route-view","route-push-end").exec();return}let r=n.updates();r.addClass("route-view"),s&&r.add("addClass",s,"route-view"),r.removeClass("route-hidden","route-push-end","route-pop-end").addClass("route-push-start"),await r.exec(),await new Promise(d=>{w.requestAnimationFrame(()=>d());});let c=n.updates();c.addClass("route-transitioning").removeClass("route-push-start").addClass("route-push-end"),await c.exec(),await bt(Rt+40);let l=n.updates();l.removeClass("route-transitioning","route-push-start"),s&&l.add("addClass",s,"route-hidden"),await l.exec();}async runTransitionPop(e,s,n){let r=s.updates();r.addClass("route-view"),r.add("addClass",n,"route-view"),r.add("removeClass",n,"route-hidden"),r.addClass("route-pop-start").removeClass("route-push-end","route-pop-end"),await r.exec(),await new Promise(d=>{w.requestAnimationFrame(()=>d());});let c=s.updates();c.addClass("route-transitioning"),c.removeClass("route-pop-start").addClass("route-pop-end"),await c.exec(),await bt(Rt+40);let l=s.updates();l.addClass("route-hidden").removeClass("route-transitioning","route-pop-start"),await l.exec();}getNavMode(){return this.lastDirection==="back"?"pop":"push"}beforeEach(e){let s={fn:e,type:"before"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}afterEach(e){let s={fn:e,type:"after"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}};f(Ot,"Router");var St=Ot;var xt=class xt extends Z{render(e){return X.of('<i class="o-icon"><slot></slot></i>')}style(){return ut.of({i:`
|
|
62
62
|
display: inline-block;
|
|
63
63
|
width: 1em;
|
|
64
64
|
height: 1em;
|
|
65
65
|
vertical-align: -0.15em;
|
|
66
66
|
overflow: hidden;
|
|
67
|
-
`})}};
|
|
67
|
+
`})}};f(xt,"OIcon");var Ut=xt;function $e(){return W.getAll().reduce((e,[s,n])=>(e[s]=n,e),{})}f($e,"components");exports.ACTIVE_ROUTE_TOKEN=Ct;exports.App=dt;exports.Component=At;exports.Emits=ot;exports.OComponent=Z;exports.OIcon=Ut;exports.OUID=w;exports.OUIDBridge=kt;exports.ROUTER_INJECTION_TOKEN=Mt;exports.RenderContext=G;exports.RenderNode=X;exports.Router=St;exports.State=ct;exports.Stated=st;exports.StyleData=ut;exports.components=$e;exports.createComponent=vt;exports.createRouter=Ue;exports.deferMacro=Se;exports.deferMicro=it;exports.inject=lt;exports.isStated=mt;exports.node=Te;exports.o=Jt;exports.provide=zt;exports.stated=Bt;exports.useRouter=Zt;//# sourceMappingURL=index.cjs.map
|
|
68
68
|
//# sourceMappingURL=index.cjs.map
|