ouider 0.1.7 → 0.1.8

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  `:n instanceof nt&&(e+=`${s} {
4
4
  ${n.toString()}}
5
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(`
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(),l.flushMounted();}),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;