objs-core 2.0.3 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/objs.built.min.js CHANGED
@@ -1,66 +1,76 @@
1
1
  /**
2
2
  * @fileoverview Objs-core library
3
- * @version 2.0
3
+ * @version 2.2
4
4
  * @author Roman Torshin
5
5
  * @license Apache-2.0
6
- */const Y=!0,t=n=>{let e={els:[],ie:{},delegated:{},parented:{},store:{},refs:{},states:[],isDebug:!1,currentState:"",savedStates:{},isRoot:!1,_parent:null},o=1,r=2,c=3,w="boolean",a="object",h="function",S="string",C="number",l="notEmptyString",k="undefined",m="dangerouslySetInnerHTML",E,f=t.D,v=-1,u=0,y=0,x=typeof process<"u"||t.D===t.DocumentMVP,b=0,D=0;const I=e,O=s=>typeof s,R=(s,i)=>{for(const g in s)Object.hasOwn(s,g)&&i(g,s)},U=t.onError,L=s=>t.verify(s),$=(s,i="")=>(...g)=>{(t.debug||e.isDebug)&&console.log(i?`${i}()`:s,g.length?"with "+g.join(", "):"without parameters");try{const p=s(g[0],g[o],g[r],g[c]);return p!==E?p:e}catch(p){U(p,i)}},N=s=>{for(b=u;b<=v;b++)s()},M=s=>s?.els?s.el:(O(s)!==a&&(s=t.first(s).el),s),P=(s=!0,i=e.els)=>{const g=i.length;e.length=g,v=g-o,u=0,e.el=g?i[0]:E,e.last=g?i[v]:E,s&&(R(e.states,(p,d)=>{delete e[d[p]]}),e.states=[],e.ie={})};e.reset=t;const H=(s,i,g)=>{R(i,p=>{let d=i[p];O(d)===h&&(d=d(g)),p==="append"&&O(d)===a&&(d.els&&(d=[d]),d[0]?.els&&(valueBuff=[],R(d,T=>{valueBuff.push(...d[T].els)}),d=valueBuff)),d!==E&&s.getAttribute(p)!==d&&!["tag","tagName","name","sample","state","events","ssr","nodeName","revertChildren","root","ref"].includes(p)&&(["html","innerHTML"].includes(p)?s.innerHTML=d:p==="className"?s.setAttribute("class",d):p==="dataset"&&O(d)===a?R(d,T=>{s.dataset[T]=d[T]}):p==="toggleClass"?s.classList.toggle(d):p==="addClass"?O(d)===a?s.classList.add(...d):s.classList.add(d):p==="removeClass"?s.classList.remove(d):p==="style"&&O(d)===a?R(d,T=>{s.style[T]=d[T]}):(p==="append"||p==="children"||p==="childNodes")&&O(d)===a?R(d.length?d:[d],T=>{p==="append"||!s.childNodes[T]?s.appendChild(d[T]):s.childNodes[T]!==d[T]&&s.childNodes[T].replaceWith(d[T])}):s.setAttribute(p,d))}),s.dataset.oState=i.state,t.autotag&&i.name&&(s.dataset[t.autotag]=t.camelToKebab(i.name))};e.debug=$(()=>{e.isDebug=!0},"debug ON"),e.saveAs=$(s=>{L([[s,[l]]]),t.getSaved[s]?(t.debug||e.isDebug)&&console.warn("the key exists (not saved):"+s):t.getSaved[s]=e},"saveAs"),e.unmount=()=>((t.debug||e.isDebug)&&console.log("unmount() for initID:"+e.initID),O(e.remove)===h?e.remove():e.els?.length&&e.els.forEach(s=>{s?.parentNode&&s.parentNode.removeChild(s)}),t.inits[e.initID]=void 0,e={},!0),e.init=$(s=>{L([[s,[a,h]]]);const i=e.initID||t.inits.length||0;if(e.initID=i,P(),t.inits[e.initID]=e,O(s)==="function"){e.render=$(p=>{const d=f.createElement("div");setTimeout(()=>{t.reactRender(s,d,p)}),e.add(d)});return}(O(s)!==a||s.render===E)&&(s={render:s}),R(s,p=>{e?.render&&p==="render"||(e.states.push(p),e[p]=$((d=[{}])=>{e.currentState=p;const T=s[p]||{tag:"div"},A=Array.isArray(e.els)?e.els.slice(u,v+o):[],B=A.length?A:e.els||[];O(T)===a&&(T.state=p,T["data-o-init"]=i);const q=(_,F={})=>{if(O(T)===a)return f.createElement(T.tag||T.tagName||"div");{const j=f.createElement("div");return j.innerHTML=O(T)===h?T(F):T,j.children.length>o||!j.firstElementChild?(j.dataset.oInit=_,j):(j.firstElementChild.dataset.oInit=_,j.firstElementChild)}},z=d;d.length||(d=[d]);const X=!B[0]&&p==="render";d=d.map((_,F)=>{const j=Object.assign({},O(_)===a?_:{},{self:e,o:t,i:_.i===E?F:_.i,parent:e._parent,data:Array.isArray(z)?z[F]:z});return X&&(!T.ssr||x)&&B.push(q(i,j)),j}),X&&(e.els=B,P(!1));const V=()=>{R(T.events,_=>{e.on(_,T.events[_])})};B&&(D=B.length===d.length,B.map((_,F)=>{d[D?F:0].i=F+u;const j=O(T)===h?T(d[D?F:0]):T;O(j)===a&&(j.state=p,X&&(j["data-o-init"]=i,j["data-o-init-i"]=F),H(_,j,d[D?F:0]))}),X&&(e.refs={},e.els.forEach(_=>{_.querySelectorAll&&_.querySelectorAll("[ref]").forEach(F=>{e.refs[F.getAttribute("ref")]=t(F),F.removeAttribute("ref")})}))),X&&O(T)===a&&T.events&&!x&&!T.ssr&&V()}))});const g=s.render||s;!x&&O(g)===a&&g.events&&g.ssr&&(e.initSSRAfterGettingSSR=()=>{e.refs={},e.els.forEach(p=>{p.querySelectorAll&&p.querySelectorAll("[ref]").forEach(d=>{e.refs[d.getAttribute("ref")]=t(d),d.removeAttribute("ref")})}),R(g.events,p=>{e.on(p,g.events[p])})})},"init"),e.connect=$((s,i="render",g)=>{L([[s,[a]],[i,[l]],[g,[S,k]]]),s.connect(I,i,g)},"connect"),e.getSSR=$(s=>{L([[s,[C,k]]]);const i=s!==void 0?s:e.initID;if(x||O(s)===k&&O(e.initID)===k)return;const g=t.D.querySelectorAll(`[data-o-init="${i}"]`);g.length&&!e.els.length&&(e.els=Array.from(g),e.initID=s,t.inits[s]=e,P(!1),O(e.initSSRAfterGettingSSR)===h&&(e.initSSRAfterGettingSSR(),delete e.initSSRAfterGettingSSR))},"getSSR"),e.initState=$((s,i)=>{L([[s,[a]],[i,[a,k]]]),e.init(s).render(i)},"initState");const J=(s,i,g)=>{const p=s.attributes,d={tagName:s.tagName.toLowerCase()};for(const T of p)d[T.nodeName]=T.value;if(g){d.innerHTML=s.innerHTML,d.revertChildren=[];const T=s.querySelectorAll("[data-o-init]");for(const A of T){const B=A.getAttribute("data-o-init");d.revertChildren.push(B),t.inits[B]?.saveState(i,!1)}}return d};return e.saveState=$((s,i=!0)=>{if(L([[s,[l,k]],[i,[w]]]),!e.el)throw Error("saveState(): There are no elements to save");const g=s||"fastSavedState",p={els:[],parentNode:e.el.parentNode,root:i};N(()=>{p.els.push(J(e.els[b],g,i))}),p.ie=Object.assign({},e.ie),p.delegated=Object.assign({},e.delegated),p.store=Object.assign({},e.store),e.isRoot=e.isRoot||i,e.savedStates[g]=p},"saveState"),e.revertState=$(s=>{L([[s,[l,k]]]);const i=s||"fastSavedState";if(!e.savedStates[i])throw Error(`revertState(): The state "${i}" should have been saved by saveState()`);const g=e.savedStates[i];e.offAll(),e.offDelegate(),e.store=Object.assign({},g.store),g.els.forEach((p,d)=>{if(!e.els[d]){const T=t.D.createElement(p.tagName);g.parentNode&&(d?e.els[d-1].after(T):g.parentNode.append(T)),e.add(T)}H(e.els[d],p)}),e.delegated=Object.assign({},g.delegated),e.ie=Object.assign({},g.ie),e.onAll(),R(g.delegated,p=>{g.delegated[p].forEach(d=>{N(()=>{e.els[b].addEventListener(p,d)})})}),e.currentState=i,g.root&&g.els.forEach(({rootElement:p})=>{p.revertChildren.forEach(d=>{t.inits[d]?.revertState(i),t('[data-o-init="'+d+'"]').els.forEach((T,A)=>{T.replaceWith(t.inits[d]?.els[A])})})})},"revertState"),e.loseState=$(s=>{L([[s,[l]]]),e.savedStates[s]&&(delete e.savedStates[s],N(()=>{const i=e.els[b].querySelectorAll("[data-o-init]");for(const g of i){const p=g.getAttribute("data-o-init");t.inits[p]?.loseState(s)}}))},"sample"),e.sample=$((s="render")=>(L([[s,[l]]]),{[s]:J(e.els[u])}),"sample"),e.select=$(s=>{L([[s,[C,k]]]),s===E&&(s=e.length-o),v=s,u=s,e.el=e.els[s],y=o},"select"),e.all=$(()=>{v=e.length-o,u=0,e.el=e.els[0],y=0},"all"),e.remove=$(s=>{if(L([[s,[C,k]]]),s===E&&y&&(s=u),s!==E){const i=e.els[s];i?.parentNode?i.parentNode.removeChild(i):i===void 0&&s>=e.els.length&&t.onError&&t.onError("remove("+s+"): index out of bounds","remove")}else N(()=>{const i=e.els[b];i?.parentNode&&i.parentNode.removeChild(i)});P(!1)},"remove"),e.skip=$(s=>{L([[s,[C,k]]]),s===E&&(s=u),e.els.splice(b,o),P()},"skip"),e.add=$(s=>{L([[s,[S,a,C]]]),e.initID===E&&(O(s)==="string"&&s!==""?e.els.push(...Array.from(f.querySelectorAll(s))):O(s)===a?s.tagName?e.els.push(s):s.els?e.els.push(...s.els):s.length&&s[0].tagName&&e.els.push(...s):O(s)==="number"&&t.inits[s]&&(e=t.inits[s]),P(!1),e.initID!==E&&e.dataset({oInit:e.initID}))},"add"),e.appendInside=$(s=>{L([[s,[a,l]]]),s?.els&&(e._parent=s),N(()=>{M(s).appendChild(e.els[b])})},"appendInside"),e.appendBefore=$(s=>{L([[s,[a,l]]]),N(()=>{M(s).parentNode.insertBefore(e.els[b],M(s))})},"appendBefore"),e.appendAfter=$(s=>{L([[s,[a,l]]]),N(()=>{M(s).after(...e.els)})},"appendAfter"),e.find=$((s="")=>{L([[s,S]]);const i=[];return N(()=>{i.push(...Array.from(e.els[b].querySelectorAll(":scope "+s)))}),t(i)},"find"),e.first=$((s="")=>{L([[s,S]]);let i=E;const g=[];return N(()=>{i=e.els[b].querySelector(s),i&&g.push(i)}),t(g)},"first"),e.attr=$((s,i)=>{if(i!==null&&L([[s,S],[i,[S,k]]]),i===E){const g=[];return N(()=>{g[b]=e.els[b].getAttribute(s)}),y?g[0]:g}else N(i!==null?()=>{e.els[b].setAttribute(s,i)}:()=>{e.els[b].removeAttribute(s)})},"attr"),e.attrs=$(()=>{const s=[];return N(()=>{const i={};[...e.els[b].attributes].forEach(g=>{i[g.nodeName]=g.nodeValue}),s.push(i)}),y?s[0]:s},"attrs"),e.dataset=$(s=>{if(L([[s,[a,k]]]),typeof s===a)N(()=>{R(s,i=>{e.els[b].dataset[i]=s[i]})});else{const i=[];return N(()=>{i.push({...e.els[b].dataset})}),y?i[0]:i}},"dataset"),e.style=$(s=>{s!==null&&L([[s,[S,k]]]),e.attr("style",s)},"style"),e.css=$((s={})=>{if(s===null){e.style(null);return}L([[s,a]]);let i="";R(s,g=>{i+=g+":"+s[g].replace('"',"'")+";"}),e.style(i||null)},"css"),e.setClass=$(s=>{L([[s,S]]),N(()=>{e.els[b].setAttribute("class",s)})},"setClass"),e.addClass=$((...s)=>{N(()=>{e.els[b].classList.add(...s)})},"addClass"),e.removeClass=$((...s)=>{N(()=>{e.els[b].classList.remove(...s)})},"removeClass"),e.toggleClass=$((s,i)=>{L([[s,l],[i,[w,k]]]),N(()=>{e.els[b].classList.toggle(s,i)})},"toggleClass"),e.haveClass=s=>{L([[s,l]]);let i=!0;return N(()=>{e.els[b].classList.contains(s)||(i=!1)}),(e.isDebug||t.debug)&&console.log("haveClass() with",s),i},e.innerHTML=$(s=>{if(L([[s,[S,k]]]),s!==E)N(()=>{e.els[b].innerHTML=s});else{let i="";return N(()=>{i+=x&&e.els[b].innerHTML.length===0?t.D.parseElement(e.els[b],!1):e.els[b].innerHTML}),i}},"innerHTML"),e.innerText=$(s=>{L([[s,[S]]]),N(()=>{e.els[b].innerText=s})},"innerText"),e.textContent=$(s=>{L([[s,[S]]]),N(()=>{e.els[b].textContent=s})},"textContent"),e.html=$(s=>{if(L([[s,[S,k]]]),s!==void 0)e.innerHTML(s);else{let i="";return N(()=>{i+=x?e.els[b].outerHTML():e.els[b].outerHTML}),i}},"html"),e.val=$(s=>{if(s===void 0)return e.el?.value;N(()=>{e.els[b].value=s})},"val"),e.forEach=$(s=>{L([[s,[h]]]),N(()=>{s({self:e,i:b,o:t,el:e.els[b]})})},"forEach"),e.prepareFor=$((s,i)=>{L([[s,[a,h,k]],[i,[h,k]]]);const g=s&&O(s)===a&&s.createElement;if(!g&&O(s)!==h)throw Error("prepareFor(): pass React (full object) or React.createElement as first argument");const p=g?s.createElement:s,d=g?s.useEffect:void 0;return T=>{if(T.ref===E)throw Error("No ref property to convert Objs to React");const A=Object.assign({},T),B=p("div",{ref:T.ref});return delete A.ref,d(()=>{R(A,q=>{if(q.substring(0,1)==="on"){const z=t.camelToKebab(q).split("-")[1];e.on(z,A[q]),delete A[q]}}),e.render(A),e.appendInside(B.ref.current)},[]),B}},"prepareFor"),e.on=$((s,i,g,p)=>{L([[s,[l]],[i,[h]],[g,[a,k]],[p,[w,k]]]),s.split(", ").forEach(d=>{N(()=>{e.els[b].addEventListener(d,i,g,p)}),e.ie[d]||(e.ie[d]=[]),e.ie[d].push([i,g,p])})},"on"),e.off=$((s,i,g)=>{L([[s,[l]],[i,[h]],[g,[a,k]]]),s.split(", ").forEach(p=>{N(()=>{e.els[b].removeEventListener(p,i,g)}),e.ie[p]&&(e.ie[p]=e.ie[p].filter(d=>d[0]!==i))})},"off"),e.onDelegate=$((s,i,g)=>{L([[s,[l]],[i,[l]],[g,[h]]]),s.split(", ").forEach(p=>{const d=T=>{const A=T.target.closest(i);A&&(T.delegate=A,T.objs=e,g(T))};N(()=>{e.els[b].addEventListener(p,d)}),e.delegated[p]||(e.delegated[p]=[]),e.delegated[p].push(d)})},"onDelegate"),e.offDelegate=$(s=>{L([[s,[l]]]),R(e.delegated,i=>{if(!s||s===i)for(;e.delegated[i].length;){const g=e.delegated[i].pop();N(()=>{e.els[b].removeEventListener(i,g)})}}),e.delegated={}},"offDelegate"),e.onParent=$((s,i,g)=>{L([[s,[l]],[i,[l,a]],[g,[h]]]);const p=O(i)===a?i:t.D.querySelector(i);s.split(", ").forEach(d=>{const T=A=>{A.objs=e,g(A)};p.addEventListener(d,T),e.parented[d]||(e.parented[d]=[]),e.parented[d].push(T)})},"onParent"),e.offParent=$((s,i)=>{L([[s,[l]],[i,[l,a]]]);const g=O(i)===a?i:t.D.querySelector(i);R(e.parented,p=>{(!s||s===p)&&(e.parented[p].forEach(d=>{g.removeEventListener(p,d)}),delete e.parented[p])})},"offParent"),e.onAll=$((s,i)=>{L([[s,[l,k]],[i,[w,k]]]),R(e.ie,(g,p)=>{(!s||s===g)&&p[g].forEach(d=>{N(()=>{i?e.els[b].removeEventListener(g,d[0]):e.els[b].addEventListener(g,d[0],d[o],d[r])})})})},"onAll"),e.offAll=$(s=>{L([[s,[l]]]),e.onAll(s,o)},"offAll"),n&&e.add(n),e.take=s=>{if(L([[s,[S,a,C]]]),e.add(s),e.el){const i=e.el.dataset.oInit;if(i!==E&&t.inits[i])return e.length===o?(D=e.els[0],Object.assign(e,t.inits[i]),e.els=[D]):e=t.inits[i],P(!1,e.els),e}},e};t.first=n=>(t.verify([[n,["notEmptyString"]]]),t.debug&&console.log(n," -> ","o.first()"),t(t.D.querySelector(n)).select(0)),t.inits=[],t.getSaved={},t.errors=[],t.showErrors=!1,t.logErrors=()=>{t.errors.length?t.errors.forEach(n=>console.error(n)):console.log("No errors")},t.onError=(n,e)=>{t.showErrors?console.error(n,e):(t.errors.push(n),e&&t.errors.push(e))},t.reactRender=()=>new Error("React render function is not defined"),t.autotag=void 0,t.reactQA=n=>({["data-"+(t.autotag||"qa")]:n.replace(/([A-Z])/g,(e,o)=>"-"+o.toLowerCase()).replace(/^-/,"")}),t.specialTypes={notEmptyString:(n,e)=>e==="string"&&n.length,array:n=>Array.isArray(n),promise:n=>n instanceof Promise||!!(n&&typeof n.then=="function")},t.verify=(n,e=!1)=>{for(const o of n){const r=typeof o[0];let c=Array.isArray(o[1])?o[1]:[o[1]],w=!1;if(c.includes(r))return!0;c=c.filter(a=>!!t.specialTypes[a]);for(const a of c)if(w=t.specialTypes[a](o[0],r),w)return!0}return e?!1:new Error("Type verification failed")},t.safeVerify=n=>t.verify(n,!0),t.init=(n,e)=>t().init(n,e),t.initState=(n,e)=>t().init(n).render(e),t.take=n=>t().take(n),t.getStates=()=>t.inits.reduce((n,e)=>(n.push(e?.states),n),[]),t.getStores=()=>t.inits.reduce((n,e)=>(n.push(e?.store),n),[]),t.getListeners=()=>t.inits.reduce((n,e)=>(n.push(e?.ie),n),[]),t.createStore=n=>{const e=Object.assign({},n);return e._defaults=Object.assign({},n),e._listeners=[],e.subscribe=function(o,r){return this._listeners.push(c=>o[r]?.(c)),this},e.notify=function(){this._listeners.forEach(o=>o(this))},e.reset=function(){const o={_listeners:1,subscribe:1,notify:1,_defaults:1,reset:1};for(const r of Object.keys(this._defaults))o[r]||(this[r]=this._defaults[r])},e},t.U=void 0,t.W=2,t.H=100,t.F=!1,t.C=(n,e)=>Object.hasOwn(n,e),t.kebabToCamel=n=>n.replace(/-./g,e=>e.toUpperCase()[1]),t.camelToKebab=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),t.route=(n,e)=>{t.verify([[n,["notEmptyString","function","boolean"]],[e,["function","object"]]]);const o=typeof n=="function"?n(window.location.pathname):n;return o===!0||window.location.pathname===o?e?typeof e=="function"?(e(),!0):e:t:typeof e=="function"?!1:{}},t.router=(n={})=>{t.verify([[n,["object"]]]);for(const e in n)if(t.C(n,e)&&window.location.pathname===e)return typeof n[e]=="function"?(n[e](),!0):n[e];return!1},t.DocumentMVP={addEventListener:()=>{},parseElement:(n,e=!0)=>{t.verify([[n,["object","string"]],[e,["boolean"]]]);const o=(r,c="")=>{let w="";for(const a in r)t.C(r,a)&&(w+=` ${c}${t.camelToKebab(a)}="${typeof r[a]!="object"?r[a]:Object.entries(r[a]).map(h=>`${h[0]}: ${h[1]};`).join(" ")}"`);return w};if(typeof n=="string")return n;if(e){const r=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],c=n.tagName.toLowerCase(),w=n.attributes["data-o-init"],a=w!==void 0?` data-o-init="${w}"`:"";return`<${c}${n.className?` class="${n.className}"`:""}${o(n.attributes)}${a}${o(n.dataset,"data-")}${r.includes(c)?"/":""}>${r.includes(c)?"":n.innerHTML.length?n.innerHTML:n.children.map(h=>t.D.parseElement(h)).join("")}${r.includes(c)?"":`</${c}>`}`}return n.innerHTML.length?n.innerHTML:n.children.map(r=>t.D.parseElement(r)).join("")},createElement:n=>{t.verify([[n,["notEmptyString"]]]);const e={tagName:n.toUpperCase(),attributes:{},innerHTML:"",children:[],dataset:{},className:"",classArray:[],style:{},addEventListener:()=>{},removeEventListener:()=>{}};return e.classList={add:(...o)=>{t.verify([[o,["array"]]]),e.classArray.push(o),e.className=e.classArray.join(" ")},has:o=>(t.verify([[o,["notEmptyString"]]]),e.classArray.includes(o)),remove:o=>{t.verify([[o,["notEmptyString"]]]),e.classArray=e.classArray.filter(r=>o!==r),e.className=e.classArray.join(" ")}},e.classList.toggle=o=>{t.verify([[o,["notEmptyString"]]]),e.classList.has(o)?e.classList.remove(o):e.classList.add(o)},e.setAttribute=(o,r)=>{t.verify([[o,["notEmptyString"]],[r,["string","number","boolean","undefined"]]]),e.attributes[o]=r},e.getAttribute=o=>(t.verify([[o,["notEmptyString"]]]),e.attributes[o]),e.removeAttribute=o=>{t.verify([[o,["notEmptyString"]]]),delete e.attributes[o]},e.appendChild=o=>{t.verify([[o,["object"]]]),e.children.push(o),e.firstElementChild=e.children[0]},e.outerHTML=()=>t.D.parseElement(e),e}},t.D=typeof document<"u"&&typeof process>"u"?document:t.DocumentMVP,t.setCookie=(n,e="",o={})=>{if(t.verify([[n,["notEmptyString"]],[e,["string","number","boolean"]],[o,["object"]]]),t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}let r=encodeURIComponent(n)+"="+encodeURIComponent(e);o={path:"/",...o},o.expires instanceof Date?o.expires=o.expires.toUTCString():typeof o.expires=="number"&&(o.expires=new Date(o.expires).toUTCString());for(const c in o){r+="; "+c;const w=o[c];w!==!0&&(r+="="+w)}t.D.cookie=r},t.getCookie=n=>{if(t.verify([[n,["notEmptyString"]]]),t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}const e=t.D.cookie.match(RegExp("(?:^|; )"+n.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0},t.deleteCookie=n=>{t.verify([[n,["notEmptyString"]]]),t.setCookie(n,"",{"max-age":0})},t.clearCookies=()=>{if(t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}const n=t.D.cookie.split(";");for(;n.length;){let e=n.pop();for(;e.charAt(0)===" ";)e=e.substring(1);const o=e.split("=")[0];t.deleteCookie(o)}},t.clearLocalStorage=n=>{if(t.verify([[n,["boolean","undefined"]]]),!(typeof localStorage>"u"))if(n)localStorage.clear();else for(let e=localStorage.length-1;e>=0;e--){const o=localStorage.key(e);o.indexOf("oInc-")===-1&&o.indexOf("oTest-")===-1&&localStorage.removeItem(o)}},t.clearSessionStorage=n=>{if(t.verify([[n,["boolean","undefined"]]]),!(typeof sessionStorage>"u"))if(!n)sessionStorage.clear();else for(let e=sessionStorage.length-1;e>=0;e--){const o=sessionStorage.key(e);o&&o.indexOf("oTest-")===0&&sessionStorage.removeItem(o)}},t.clearTestsStorage=()=>{t.clearSessionStorage(1)},t.clearAfterTests=()=>{t.clearCookies(),t.clearLocalStorage(!1),t.clearTestsStorage()},t.ajax=(n,e={})=>{t.verify([[n,["notEmptyString"]],[e,["object"]]]);const o=new URLSearchParams;if(e.data&&typeof e.data=="object"){for(const r in e.data)t.C(e.data,r)&&(typeof e.data[r]=="object"?o.set(r,encodeURIComponent(JSON.stringify(e.data[r]))):o.set(r,e.data[r]));e.method.toLowerCase()==="get"?n+="?"+o.toString():e.body||(e.body=o),delete e.data}return e.headers||(e.headers={"X-Requested-With":"XMLHttpRequest"}),fetch(n,e)},t.get=(n,e={})=>(t.verify([[n,["notEmptyString"]],[e,["object"]]]),t.ajax(n,{...e,method:"GET"})),t.post=(n,e={})=>(t.verify([[n,["notEmptyString"]],[e,["object"]]]),t.ajax(n,{...e,method:"POST"})),t.newLoader=n=>{t.verify([[n,["promise","undefined"]]]);let e=[],o=null,r=!1,c=!1;const w=a=>{r=!1,c=!1,o=null,setTimeout(()=>{a.then(h=>{r=!0,!h.ok&&typeof h.ok<"u"?(c=!0,e.forEach(([S,C,l])=>{l&&S[l](h)})):typeof h.json=="function"?h.json().then(S=>{o=S,e.forEach(([C,l])=>{C[l](o)})}):(o=h,e.forEach(([S,C])=>{S[C](o)}))}).catch(h=>{c=!0,e.forEach(([S,C,l])=>{l&&S[l](h)})})},33)};return n&&w(n),{reload:w,isObjsLoader:!0,listeners:e,isFinished:()=>r,getStore:()=>o,connect:(a,h="render",S)=>{t.verify([[a,["object"]],[h,["notEmptyString"]],[S,["string","undefined"]]]),r?c?S&&a[S]():typeof a[h]=="function"&&a[h](o):e.push([a,h,S])},disconnect:a=>{t.verify([[a,["object"]]]),e=e.filter(([h])=>h!==a)}}},t.getParams=n=>{t.verify([[n,["string","undefined"]]]);const e={},o=new URLSearchParams(window.location.search).entries();for(const r of o)e[r[0]]=r[1];return n?e[n]:e},t.incCache=!0,t.incCacheExp=1e3*60*60*24,t.incTimeout=6e3,t.incSource="",t.incForce=t.F,t.incAsync=!0,t.incCors=t.F,t.incSeparator="?",t.incFns={},t.incSet=[0],t.incReady=[0],t.incN=0,t.incGetHash=n=>n.split(t.incSeparator)[1]||"",t.incCheck=(n=0,e,o=0)=>(t.verify([[n,["number"]],[e,["number","undefined"]],[o,["number"]]]),!o&&n&&e===t.U&&t.incReady[n]?t.incSet[n]===1:t.incReady[n]===t.U||t.incReady[n][e]===t.U?t.F:(t.incReady[n][e].loaded=o,t.incFns[t.incReady[n][e].name]=o,t.incReady[n][0]+=o,n&&t.incReady[n].length===t.incReady[n][0]&&(typeof t.incSet[n]=="function"&&t.incSet[n](n),t.incSet[n]=1),t.incSet[n]===1)),t.incCacheClear=(n=t.F)=>{t.verify([[n,["boolean"]]]);for(const e in t.incFns)t.C(t.incFns,e)&&(localStorage.removeItem("oInc-"+e),localStorage.removeItem("oInc-"+e+"-expires"));return n&&(t.incReady.forEach((e,o)=>{o&&e.forEach((r,c)=>{c&&t("#oInc-"+o+"-"+c).remove()})}),t.incN=0,t.incFns={},t.incSet=[0],t.incReady=[0]),!0},t.inc=(n,e,o)=>{if(t.verify([[n,["object","undefined"]],[e,["function","undefined"]],[o,["function","undefined"]]]),typeof localStorage>"u")return;let r=0,c=0,w="",a=!1;const h="function",S=-1;if(typeof n!="object"||!n)return t.incSet[0];t.incSet[0]++;const C=t.incSet[0];t.incSet[C]=e||0,t.incReady[C]=[];const l=t.incReady[C];l[0]=1;const k={};for(const m in n)if(t.C(n,m)){if(m==="preload"){a=!0;continue}w=t.incGetHash(n[m]),r++,t.incN++;const E=n[m].indexOf(".css")>S?"style":"script";if(n[m]=(t.incSource?t.incSource+"/":"")+n[m],Number.isNaN(Number(m))&&t.C(t.incFns,m)&&t.incFns[m]&&!t.incForce){l[r]={name:m,loaded:1},c++;continue}if(l[r]={name:m,loaded:0},Number.isNaN(Number(m))&&(t.incFns[m]=0),Number.isNaN(Number(m))&&t.incCache&&(n[m].substring(0,4)!=="http"||!t.incCors)&&window.location.protocol!=="file:"&&(n[m].indexOf(".css")>S||n[m].indexOf(".js")>S)){const f=localStorage,v=f.getItem("oInc-"+m),u=f.getItem("oInc-"+m+"-expires"),y=f.getItem("oInc-"+m+"-hash");v&&u&&Date.now()<u&&y===w?(a||t.initState({tag:E,id:"oInc-"+C+"-"+r,innerHTML:v,"data-o-inc":C}).appendInside("head"),l[r].loaded=1,t.incFns[m]=1,c++):(k[m]=r,t.get(n[m],{mode:t.incCors?"cors":"same-origin"}).then(x=>{if(x.status!==200){t.onError&&t.onError({message:t.incSource+n[m]+" was not loaded"});return}x.text().then(b=>{f.setItem("oInc-"+m,b),f.setItem("oInc-"+m+"-expires",Date.now()+t.incCacheExp),f.setItem("oInc-"+m+"-hash",w),a||t.initState({tag:E,id:"oInc-"+C+"-"+k[m],innerHTML:b,"data-o-inc":C}).appendInside("head"),t.incCheck(C,k[m],1)})}))}else{const f={tag:E,id:"oInc-"+C+"-"+r,"data-o-inc":C,async:t.incAsync,onload:"o.incCheck("+C+","+r+",1)"};n[m].indexOf(".css")>S?(f.tag="link",f.rel="stylesheet",f.href=n[m]):(n[m].indexOf(".js")>S||(f.tag="img",f.style="display:none;"),f.src=n[m]),t.initState(f).appendInside(f.style?"body":"head")}}return l[0]+=c,r!==0&&(c===r?typeof e===h&&e(C):setTimeout(m=>{t.incReady[m]&&t.incReady[m].length<t.incReady[m][0]&&(t.incSet[m]=0,typeof o===h&&o(C))},t.incTimeout,C)),t.incSet[0]},t.connectRedux=(n,e,o,r="render")=>{t.verify([[n,["object"]],[e,["function"]],[o,["object"]],[r,["notEmptyString"]]]);const c=()=>{if(typeof o[r]=="function"){const w=e(n.getState());o[r](w!==null&&typeof w=="object"?w:{value:w})}};return c(),n.subscribe(c)},t.connectMobX=(n,e,o,r,c="render")=>(t.verify([[n,["object"]],[e,["object"]],[o,["function"]],[r,["object"]],[c,["notEmptyString"]]]),n.autorun(()=>{if(typeof r[c]=="function"){const w=o(e);r[c](w!==null&&typeof w=="object"?w:{value:w})}})),t.ObjsContext=null,t.withReactContext=(n,e,o,r,c="render")=>function(){const a=n.useContext(e);return n.useEffect(()=>{if(typeof r[c]=="function"){const h=o(a);r[c](h!==null&&typeof h=="object"?h:{value:h})}},[a]),null},t.debug=!1,t.tLog=[],t.tRes=[],t.tStatus=[],t.tFns=[],t.tShowOk=t.F,t.tStyled=t.F,t.tTime=2e3,t.tests=[],t.tAutolog=t.F,t.tBeforeEach=void 0,t.tAfterEach=void 0,t.addTest=(n,...e)=>{t.verify([[n,["notEmptyString"]],[e,["array"]]]);let o={};e.length&&typeof e[e.length-1]=="object"&&!Array.isArray(e[e.length-1])&&(o=e.pop());const r=t.tests.length;return t.tests[r]={title:n,tests:e,hooks:o},{run:()=>{typeof o.before=="function"&&(t.tBeforeEach=o.before),typeof o.after=="function"&&(t.tAfterEach=o.after),t.runTest(r)},autorun:()=>{typeof o.before=="function"&&(t.tBeforeEach=o.before),typeof o.after=="function"&&(t.tAfterEach=o.after),t.runTest(r,!0)},testId:r}},t.updateLogs=()=>{for(let n=0;n<t.tests.length;n++)t.tLog[n]=t.tLog[testN]=sessionStorage.getItem(`oTest-Log-${testN}`)||"";return t.tLog},t.runTest=(n=0,e,o)=>{if(t.verify([[n,["number"]],[e,["boolean","undefined"]],[o,["boolean","undefined"]]]),!t.tests[n])return;o||(sessionStorage?.removeItem(`oTest-Log-${n}`),sessionStorage?.removeItem(`oTest-Res-${n}`),sessionStorage?.removeItem(`oTest-Status-${n}`)),sessionStorage?.setItem("oTest-Run",n),e?sessionStorage?.setItem("oTest-Autorun",e):sessionStorage?.removeItem("oTest-Autorun");const r=t.tests[n];let c=r.tests.pop();typeof c!="function"&&(r.tests.push(c),c=()=>{}),r.tests.push(w=>{c(w),sessionStorage.setItem("dddd",1),sessionStorage?.removeItem("oTest-Run"),e&&t.runTest(n+1,e)}),t.test(r.title,...r.tests)},t.tPre='<div style="font-family:monospace;text-align:left;">',t.tOk='<span style="background:#cfc;padding: 0 15px;">OK</span> ',t.tXx='<div style="background:#fcc;padding:3px;">',t.tDc="</div>",t.test=(n="",...e)=>{t.verify([[n,["notEmptyString"]],[e,["array"]]]);const o=sessionStorage?.getItem("oTest-Run"),r=o||t.tLog.length;let c=0,w="\u251C OK: ",a="\u251C \u2718 ",h=`
7
- `,S=`
8
- `,C="",l=e.length,k=0;const m=(E="",f=!1,v=!1)=>{t.tAutolog&&(f?console.error(E):(t.tShowOk||v)&&console.log(E))};if(typeof e[l-1]=="function"&&(t.tFns[r]=e[l-1],l--),o){t.tLog[r]=sessionStorage.getItem(`oTest-Log-${r}`)||"",t.tRes[r]=sessionStorage.getItem(`oTest-Res-${r}`)||!1,t.tStatus[r]=JSON.parse(sessionStorage.getItem(`oTest-Status-${r}`)||"[]");for(let E=0;E<t.tStatus[r].length;E++){const f=t.tStatus[r][E];(f===!0||f===!1)&&k++}}t.tStyled&&(w=t.tPre+t.tOk,a=t.tPre+t.tXx,h=t.tDc,S=h+h),(!o||t.tLog[r].length===0)&&(m("\u2552 "+n+" #"+r,!1,!0),t.tStyled?t.tLog[r]="<div><b>"+n+" #"+r+"</b></div>":t.tLog[r]="\u2552 "+n+" #"+r+`
9
- `,t.tRes[r]=t.F,t.tStatus[r]=[]);for(let E=t.tStatus[r].length;E<l;E++){const f={n:r,i:E,title:e[E][0],tShowOk:t.tShowOk,tStyled:t.tStyled};let v=e[E][1];if(typeof v>"u"){t.tStyled?t.tLog[r]+="<div>"+f.title+"</div>":t.tLog[r]+=f.title+`
10
- `,m("\u251C "+f.title,!1,!0),t.tStatus[r][E]=!0,k++;continue}if(typeof t.tBeforeEach=="function"&&t.tBeforeEach(f),typeof v=="function")try{v=v(f)}catch(u){v=u.message,t.onError&&t.onError(u)}if(typeof t.tAfterEach=="function"&&t.tAfterEach(f,v),v&&typeof v.then=="function"){c++;const u=setTimeout(()=>{f.title+=" (timeout)",t.testUpdate(f)},t.tTime);v.then(y=>{clearTimeout(u);const x=y===!0||y&&y.ok===!0,b=y&&y.errors&&y.errors.length?y.errors.join("; "):typeof y=="string"?y:"";t.testUpdate(f,x,x?"":b?": "+b:"")}).catch(y=>{clearTimeout(u),t.testUpdate(f,!1,y.message||"Promise rejected")});continue}if(typeof t.tStatus[r][E]>"u")t.tStatus[r][E]=typeof v=="string"?t.F:v;else{sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]));return}v===!0?(k++,t.tShowOk&&(t.tLog[r]+=w+e[E][0]+h,m("\u251C OK: "+e[E][0]))):v!==t.U?(t.tLog[r]+=a+e[E][0]+(v!==t.F?": "+v:"")+S,m("\u251C \u2718 "+e[E][0]+(v!==t.F?": "+v:""),!0)):(c++,setTimeout(u=>{u.title+=" (timeout)",t.testUpdate(u)},t.tTime,f))}return t.tRes[r]=k===l,C=c?"\u251C ":"\u2558 ",C+="DONE "+k+"/"+l+(c?", waiting: "+c:""),m(C,k+c!==l),c||m(),t.tStyled?t.tLog[r]+=t.tPre+'<div style="color:'+(k+c!==l?"red":"green")+';"><b>DONE '+k+"/"+l+(c?", waiting: "+c:"")+"</b>"+t.tDc+t.tDc:t.tLog[r]+=C+`
11
- `,o&&(sessionStorage.setItem(`oTest-Log-${r}`,t.tLog[r]),sessionStorage.setItem(`oTest-Res-${r}`,t.tRes[r]),sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]))),!c&&typeof t.tFns[r]=="function"&&t.tFns[r](r),r},t.testUpdate=(n,e=t.F,o="")=>{t.verify([[n,["object"]],[e,["boolean","string"]],[o,["string"]]]);let r="";const c=n.n,w=(a="",h=!1)=>{t.tAutolog&&(h?console.error(a):console.log(a))};if(t.tStatus[c][n.i]===t.U||t.tStatus[c][n.i]===null){t.tStatus[c][n.i]=e===!0,e===!0?n.tShowOk&&(r="\u251C OK: "+n.title+o,w(r),n.tStyled?t.tLog[c]+=t.tPre+t.tOk+n.title+o+t.tDc:t.tLog[c]+=r+`
12
- `):(t.tRes[c]=t.F,r="\u251C \u2718 "+n.title+(e?": "+e:"")+o,w(r,!0),n.tStyled?t.tLog[c]+=t.tPre+t.tXx+n.title+o+(e?": "+e:"")+t.tDc+t.tDc:t.tLog[c]+=r+`
13
- `);let a=0,h=0;for(const S of t.tStatus[c]){if(S===t.U||S===null)return;S||a++,h++}if(sessionStorage?.getItem("oTest-Run")===c&&(sessionStorage.setItem(`oTest-Log-${c}`,t.tLog[c]),sessionStorage.setItem(`oTest-Res-${c}`,t.tRes[c]),sessionStorage.setItem(`oTest-Status-${c}`,JSON.stringify(t.tStatus[c])),h<t.tests[c].tests.length))return;t.tRes[c]=!a,r=a?"FAILED "+a+"/"+h:"DONE "+h+"/"+h,w("\u2558 "+r,!!a),w(),n.tStyled?t.tLog[c]+=t.tPre+'<b style="color:'+(a?"red":"green")+';">'+r+"</b>"+t.tDc:t.tLog[c]+="\u2558 "+r+`
14
- `,typeof t.tFns[c]=="function"&&t.tFns[c](c)}},sessionStorage?.getItem("oTest-Run")&&window?.addEventListener("load",()=>{t.runTest(sessionStorage?.getItem("oTest-Run"),sessionStorage?.getItem("oTest-Autorun")||t.F,!0)},!1),t.measure=n=>{if(!n)return{};const e=n.getBoundingClientRect(),o=window.getComputedStyle(n);return{width:e.width,height:e.height,top:e.top,left:e.left,visible:o.display!=="none"&&o.visibility!=="hidden"&&e.width>0,opacity:o.opacity,zIndex:o.zIndex}},t.assertVisible=n=>!!t.measure(n).visible,t.assertSize=(n,e={})=>{if(!n)return"element is null";const o=t.measure(n);if(e.w!==void 0&&Math.round(o.width)!==e.w)return`width: expected ${e.w}, got ${Math.round(o.width)}`;if(e.h!==void 0&&Math.round(o.height)!==e.h)return`height: expected ${e.h}, got ${Math.round(o.height)}`;const r=c=>{const w=window.getComputedStyle(n).getPropertyValue(c);return w?parseFloat(w):0};return e.padding!==void 0&&r("padding-top")!==e.padding?`padding: expected ${e.padding}, got ${r("padding-top")}`:e.paddingTop!==void 0&&r("padding-top")!==e.paddingTop?`paddingTop: expected ${e.paddingTop}, got ${r("padding-top")}`:e.paddingRight!==void 0&&r("padding-right")!==e.paddingRight?`paddingRight: expected ${e.paddingRight}, got ${r("padding-right")}`:e.paddingBottom!==void 0&&r("padding-bottom")!==e.paddingBottom?`paddingBottom: expected ${e.paddingBottom}, got ${r("padding-bottom")}`:e.paddingLeft!==void 0&&r("padding-left")!==e.paddingLeft?`paddingLeft: expected ${e.paddingLeft}, got ${r("padding-left")}`:e.margin!==void 0&&r("margin-top")!==e.margin?`margin: expected ${e.margin}, got ${r("margin-top")}`:e.marginTop!==void 0&&r("margin-top")!==e.marginTop?`marginTop: expected ${e.marginTop}, got ${r("margin-top")}`:e.marginRight!==void 0&&r("margin-right")!==e.marginRight?`marginRight: expected ${e.marginRight}, got ${r("margin-right")}`:e.marginBottom!==void 0&&r("margin-bottom")!==e.marginBottom?`marginBottom: expected ${e.marginBottom}, got ${r("margin-bottom")}`:e.marginLeft!==void 0&&r("margin-left")!==e.marginLeft?`marginLeft: expected ${e.marginLeft}, got ${r("margin-left")}`:!0},t.recorder={active:!1,actions:[],mocks:{},initialData:{},assertions:[],observeRoot:null,_originalFetch:null,_listeners:[],_observer:null},t.startRecording=(n,e,o)=>{if(t.recorder.active)return;const r=["click","mouseover","scroll","input","change"],c={click:100,mouseover:50,scroll:30,input:50,change:50},w=e||r,a=Object.assign({},c,o||{}),h={scroll:30,mouseover:50},S=t.recorder;S.active=!0,S.actions=[],S.mocks={},S.stepDelays=a,S.initialData={url:window.location.href,timestamp:Date.now()},S.observeRoot=n||null,S.assertions=[],t.inits.forEach((f,v)=>{f?.store&&(S.initialData["init_"+v]=JSON.parse(JSON.stringify(f.store)))}),S._originalFetch=window.fetch,window.fetch=async(f,v={})=>{const u=(v.method||"GET").toUpperCase();let y;try{y=v.body?JSON.parse(v.body):void 0}catch{y=v.body}const x=await S._originalFetch(f,v),b=x.clone();let D;try{D=await b.json()}catch{D=await b.text().catch(()=>null)}const I=u+":"+f;return S.mocks[I]={url:f,method:u,request:y,response:D,status:x.status},x};const C={"data-o-init":1,"data-o-init-i":1,"data-o-state":1},l=(f,v)=>{if(t.D.querySelectorAll(f).length<=1)return f;let u=v;for(;u&&u!==t.D.body;){let y=u.id?"#"+u.id:null;if(!y&&u.attributes){const x=t.autotag?"data-"+t.autotag:null;if(x){const b=u.getAttribute(x);b!=null&&(y=`[${x}="${b}"]`)}if(!y){for(const b of u.attributes)if(b.name.startsWith("data-")&&!C[b.name]){y=`[${b.name}="${b.value}"]`;break}}}if(y){const x=y+" "+f;if(t.D.querySelectorAll(x).length===1)return x}u=u.parentElement}return f},k=f=>{if(!f||f.nodeType!==1)return"";let v="";if(f.dataset){const u=t.autotag&&f.dataset[t.autotag];u&&(v=l(`[data-${t.autotag}="${u}"]`,f.parentElement))}if(!v&&f.tagName){const u=f.id?"#"+f.id:f.className?f.tagName.toLowerCase()+"."+[...f.classList].join("."):f.tagName.toLowerCase();v=f.id?u:l(u,f.parentElement)}return v},m=n&&t.D.querySelector(n)||t.D.body;S._observer=new MutationObserver(f=>{const v=S.actions.length-1;v<0||f.forEach(u=>{const y=(x,b)=>{let D,I;if(x&&m&&m.querySelectorAll(x).length>1){let R=b;for(;R&&R!==m&&R.nodeType===1;){const U=t.autotag&&R.dataset&&R.dataset[t.autotag];if(U){const L=`[data-${t.autotag}="${U}"]`,$=m.querySelectorAll(L);if($.length>1){const N=[...$].indexOf(R);if(N!==-1){D=L,I=N;break}}}R=R.parentElement}}return{listSelector:D,index:I}};if(u.type==="childList"&&u.addedNodes.forEach(x=>{if(x.nodeType!==1||!x.offsetParent)return;const b=k(x);if(!b||S.assertions.some(L=>L.actionIdx===v&&L.selector===b&&L.type==="visible"))return;const I=((x.querySelector?.(".task-text")||x).textContent?.trim()||x.textContent?.trim()||"").slice(0,80)||void 0,{listSelector:O,index:R}=y(b,x),U={actionIdx:v,type:"visible",selector:b,text:I};O!=null&&(U.listSelector=O),R!=null&&(U.index=R),S.assertions.push(U)}),u.type==="attributes"){const x=k(u.target);if(!x||S.assertions.some(O=>O.actionIdx===v&&O.selector===x&&O.type==="class"))return;const{listSelector:b,index:D}=y(x,u.target),I={actionIdx:v,type:"class",selector:x,className:u.target.className};b!=null&&(I.listSelector=b),D!=null&&(I.index=D),S.assertions.push(I)}})}),S._observer.observe(m,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","disabled","aria-expanded","aria-checked"]});const E={};w.forEach(f=>{const v=u=>{const y=u.target;if(n&&m&&y?.nodeType===1&&!m.contains(y))return;let x="";if(y?.dataset){const N=t.autotag&&y.dataset[t.autotag];N&&(x=l(`[data-${t.autotag}="${N}"]`,y.parentElement))}if(!x&&y?.tagName){const N=y.id?"#"+y.id:y.className?y.tagName.toLowerCase()+"."+[...y.classList].join("."):y.tagName.toLowerCase();x=y.id?N:l(N,y.parentElement)}let b,D;if(x&&m&&m.querySelectorAll(x).length>1){let M=y;for(;M&&M!==m&&M.nodeType===1;){const P=t.autotag&&M.dataset&&M.dataset[t.autotag];if(P){const H=`[data-${t.autotag}="${P}"]`,J=m.querySelectorAll(H);if(J.length>1){const s=[...J].indexOf(M);if(s!==-1){b=H,D=s;break}}}M=M.parentElement}}const I=y?.tagName?y.tagName.toLowerCase()+(y.type?":"+y.type:""):void 0,O=f==="scroll"?window.scrollY:void 0,R=f==="input"||f==="change"?y?.value:void 0,U=f==="change"&&(y?.type==="checkbox"||y?.type==="radio")?y?.checked:void 0,L=a[f]!==void 0?a[f]:h[f]??0,$=()=>{const N={type:f,target:x,time:Date.now()};I&&(N.targetType=I),O!==void 0&&(N.scrollY=O),R!==void 0&&(N.value=R),U!==void 0&&(N.checked=U),b!=null&&(N.listSelector=b),D!=null&&(N.targetIndex=D),S.actions.push(N)};L===0?$():(clearTimeout(E[f]),E[f]=setTimeout($,L))};t.D.addEventListener(f,v,!0),S._listeners.push({ev:f,handler:v})})},t.stopRecording=()=>{const n=t.recorder;return n.active=!1,n._originalFetch&&(window.fetch=n._originalFetch,n._originalFetch=null),n._listeners.forEach(({ev:e,handler:o})=>{t.D.removeEventListener(e,o,!0)}),n._listeners=[],n._observer&&(n._observer.disconnect(),n._observer=null),{actions:[...n.actions],mocks:{...n.mocks},initialData:{...n.initialData},stepDelays:{...n.stepDelays},assertions:[...n.assertions||[]],observeRoot:n.observeRoot||null}},t.clearRecording=n=>{if(n!==void 0)sessionStorage?.removeItem("oTest-Recording-"+n);else for(let e=sessionStorage?.length-1;e>=0;e--){const o=sessionStorage?.key(e);o&&o.indexOf("oTest-Recording-")===0&&sessionStorage?.removeItem(o)}},t.exportTest=n=>{const e=n.actions.map(r=>{let c;return r.type==="scroll"?c=` window.scrollTo(0, ${r.scrollY||0}); return true;
15
- `:r.type==="input"||r.type==="change"?c=(r.value!==void 0?` el.value = ${JSON.stringify(r.value)};
16
- `:"")+(r.checked!==void 0?` el.checked = ${r.checked};
17
- `:"")+` el.dispatchEvent(new Event('${r.type}', {bubbles:true})); return true;
18
- `:c=r.type==="click"?` el.click(); return true;
19
- `:` el.dispatchEvent(new MouseEvent('${r.type}', {bubbles:true,cancelable:true})); return true;
20
- `,` ['${r.type} on ${r.target}', () => {
21
- const el = document.querySelector('${r.target}');
22
- if (!el) return 'element not found';
23
- `+c+" }],"}).join(`
24
- `);return`// Auto-generated by o.exportTest() \u2014 review and anonymize mocks before committing
25
- const recordingMocks = ${Object.keys(n.mocks).length?JSON.stringify(n.mocks,null,2):"{}"};
6
+ */const ee=!0,t=n=>{let e={els:[],ie:{},delegated:{},parented:{},store:{},refs:{},_refsByIndex:[],states:[],isDebug:!1,currentState:"",savedStates:{},isRoot:!1,_parent:null},i=1,r=2,d=3,w="boolean",u="object",x="function",v="string",I="number",f="notEmptyString",S="undefined",m="dangerouslySetInnerHTML",O,y=t.D,C=-1,s=0,c=0,g=typeof process<"u"||t.D===t.DocumentMVP,a=0,L=0;const k=e,p=o=>typeof o,D=(o,l)=>{for(const h in o)Object.hasOwn(o,h)&&l(h,o)},N=t.onError,$=o=>t.verify(o),T=(o,l="")=>(...h)=>{(t.debug||e.isDebug)&&console.log(l?`${l}()`:o,h.length?"with "+h.join(", "):"without parameters");try{const E=o(h[0],h[i],h[r],h[d]);return E!==O?E:e}catch(E){N(E,l)}},R=o=>{for(a=s;a<=C;a++)o()},U=o=>o?.els?o.el:(p(o)!==u&&(o=t.first(o).el),o),J=(o=!0,l=e.els)=>{const h=l.length;if(e.length=h,C=h-i,s=0,e.el=h?l[0]:O,e.last=h?l[C]:O,o&&(D(e.states,(E,b)=>{delete e[b[E]]}),e.states=[],e.ie={}),Array.isArray(e._refsByIndex)){const E=e._refsByIndex.length;if(E>h)D(e._refsByIndex,b=>{const A=+b;A>=h&&delete e._refsByIndex[A]}),e._refsByIndex.length=h;else if(E<h)for(let b=E;b<h;b++)e._refsByIndex[b]={}}};e.reset=t;const G=o=>{if(g||!o.querySelectorAll)return;const l=o.querySelectorAll("[data-o-init]"),h={};l.forEach(E=>{const b=E.getAttribute("data-o-init");b!==null&&(h[b]||(h[b]=[]),h[b].push(E))}),D(h,E=>{const b=t.inits[E];b&&b.getSSR(Number(E),h[E])})},V=(o,l,h)=>{D(l,E=>{let b=l[E];p(b)===x&&(b=b(h)),E==="append"&&p(b)===u&&(b.els&&(b=[b]),b[0]?.els&&(valueBuff=[],D(b,A=>{valueBuff.push(...b[A].els)}),b=valueBuff)),b!==O&&o.getAttribute(E)!==b&&!["tag","tagName","name","sample","state","events","ssr","nodeName","revertChildren","root","ref"].includes(E)&&(["html","innerHTML"].includes(E)?(o.innerHTML=b,!g&&G(o)):E==="className"?o.setAttribute("class",b):E==="dataset"&&p(b)===u?D(b,A=>{o.dataset[A]=b[A]}):E==="toggleClass"?o.classList.toggle(b):E==="addClass"?p(b)===u?o.classList.add(...b):o.classList.add(b):E==="removeClass"?o.classList.remove(b):E==="style"&&p(b)===u?D(b,A=>{o.style[A]=b[A]}):(E==="append"||E==="children"||E==="childNodes")&&p(b)===u?D(b.length?b:[b],A=>{E==="append"||!o.childNodes[A]?o.appendChild(b[A]):o.childNodes[A]!==b[A]&&o.childNodes[A].replaceWith(b[A])}):o.setAttribute(E,b))}),o.dataset.oState=l.state,t.autotag&&l.name&&(o.dataset[t.autotag]=t.camelToKebab(l.name))};e.debug=T(()=>{e.isDebug=!0},"debug ON"),e.saveAs=T(o=>{$([[o,[f]]]),t.getSaved[o]?(t.debug||e.isDebug)&&console.warn("the key exists (not saved):"+o):t.getSaved[o]=e},"saveAs"),e.unmount=()=>((t.debug||e.isDebug)&&console.log("unmount() for initID:"+e.initID),p(e.remove)===x?e.remove():e.els?.length&&e.els.forEach(o=>{o?.parentNode&&o.parentNode.removeChild(o)}),t.inits[e.initID]=void 0,e={},!0),e.init=T(o=>{$([[o,[u,x]]]);const l=e.initID||t.inits.length||0;if(e.initID=l,J(),t.inits[e.initID]=e,p(o)==="function"){e.render=T(A=>{const _=y.createElement("div");setTimeout(()=>{t.reactRender(o,_,A)}),e.add(_)});return}(p(o)!==u||o.render===O)&&(o={render:o}),D(o,A=>{e?.render&&A==="render"||(e.states.push(A),e[A]=T((_=[{}])=>{e.currentState=A;const F=o[A]||{tag:"div"},j=Array.isArray(e.els)?e.els.slice(s,C+i):[],H=j.length?j:e.els||[];p(F)===u&&(F.state=A,F["data-o-init"]=l);const z=(q,P={})=>{const B=p(F)===x?F(P):F;if(p(B)===u)return y.createElement(B.tag||B.tagName||"div");const M=y.createElement("div");return M.innerHTML=B,M.children.length>i||!M.firstElementChild?(M.dataset.oInit=q,M):(M.firstElementChild.dataset.oInit=q,M.firstElementChild)},W=_;Array.isArray(_)||(_=[_]),_.length||(_=[_]);const K=!H[0]&&A==="render";_=_.map((q,P)=>{const B=Object.assign({},p(q)===u?q:{},{self:e,o:t,i:q.i===O?P:q.i,parent:e._parent,data:Array.isArray(W)?W[P]:W});return K&&(!F.ssr||g)&&H.push(z(l,B)),B}),K&&(e.els=H,J(!1));const Q=()=>{D(F.events,q=>{e.on(q,F.events[q])})};H&&(L=H.length===_.length,H.map((q,P)=>{_[L?P:0].i=P+s;const B=p(F)===x?F(_[L?P:0]):F;p(B)===u&&(B.state=A,K&&(B["data-o-init"]=l,B["data-o-init-i"]=P,B.events&&(e._hydrateEvents=e._hydrateEvents||[],e._hydrateEvents[P]=B.events)),V(q,B,_[L?P:0]))}),K&&(e._refsByIndex=[],e.refs={},e.els.forEach((q,P)=>{if(!q.querySelectorAll)return;const B={};q.querySelectorAll("[ref]").forEach(M=>{const Z=M.getAttribute("ref"),Y=t(M);B[Z]=Y,P===0&&(e.refs[Z]=Y)}),e._refsByIndex[P]=B}),!g&&e._hydrateEvents&&(e._hydrateEvents.forEach((q,P)=>{q&&(e.select(P),D(q,B=>{const M=q[B];if(p(M)===u&&M.targetRef&&p(M.handler)===x){const Y=(e._refsByIndex?.[P]??e.refs)?.[M.targetRef];Y&&Y.on(B,M.handler)}else p(M)===x&&e.on(B,M)}))}),e.all()))),K&&p(F)===u&&F.events&&!g&&!F.ssr&&Q()}))});const h=o.render||o,E=!g&&p(h)===u&&h.events,b=!g&&e._hydrateEvents&&e._hydrateEvents.length;(E||b)&&(e.initSSRAfterGettingSSR=()=>{e._refsByIndex=[],e.refs={},e.els.forEach((A,_)=>{if(!A.querySelectorAll)return;const F={};A.querySelectorAll("[ref]").forEach(j=>{const H=j.getAttribute("ref"),z=t(j);F[H]=z,_===0&&(e.refs[H]=z),j.removeAttribute("ref")}),e._refsByIndex[_]=F,_===0&&(e.refs=F)}),E&&D(h.events,A=>{e.on(A,h.events[A])}),e._hydrateEvents&&(e._hydrateEvents.forEach((A,_)=>{A&&(e.select(_),D(A,F=>{const j=A[F];if(p(j)===u&&j.targetRef&&p(j.handler)===x){const z=(e._refsByIndex?.[_]??e.refs)?.[j.targetRef];z&&z.on(F,j.handler)}else p(j)===x&&e.on(F,j)}))}),e.all())})},"init"),e.connect=T((o,l="render",h)=>{$([[o,[u]],[l,[f]],[h,[v,S]]]),o.connect(k,l,h)},"connect"),e.getSSR=T((o,l)=>{$([[o,[I,S]]]);const h=o!==void 0?o:e.initID;if(g||p(o)===S&&p(e.initID)===S)return;const E=l&&l.length?l:t.D.querySelectorAll(`[data-o-init="${h}"]`);E.length&&(e.els=Array.from(E),o!==void 0&&(e.initID=o,t.inits[o]=e),J(!1),p(e.initSSRAfterGettingSSR)===x?e.initSSRAfterGettingSSR():l&&l.length&&(e._refsByIndex=[],e.refs={},e.els.forEach((b,A)=>{if(!b.querySelectorAll)return;const _={};b.querySelectorAll("[ref]").forEach(F=>{const j=F.getAttribute("ref");_[j]=t(F),A===0&&(e.refs[j]=_[j]),F.removeAttribute("ref")}),e._refsByIndex[A]=_,A===0&&(e.refs=_)})))},"getSSR"),e.initState=T((o,l)=>{$([[o,[u]],[l,[u,S]]]),e.init(o).render(l)},"initState");const X=(o,l,h)=>{const E=o.attributes,b={tagName:o.tagName.toLowerCase()};for(const A of E)b[A.nodeName]=A.value;if(h){b.innerHTML=o.innerHTML,b.revertChildren=[];const A=o.querySelectorAll("[data-o-init]");for(const _ of A){const F=_.getAttribute("data-o-init");b.revertChildren.push(F),t.inits[F]?.saveState(l,!1)}}return b};return e.saveState=T((o,l=!0)=>{if($([[o,[f,S]],[l,[w]]]),!e.el)throw Error("saveState(): There are no elements to save");const h=o||"fastSavedState",E={els:[],parentNode:e.el.parentNode,root:l};R(()=>{E.els.push(X(e.els[a],h,l))}),E.ie=Object.assign({},e.ie),E.delegated=Object.assign({},e.delegated),E.store=Object.assign({},e.store),e.isRoot=e.isRoot||l,e.savedStates[h]=E},"saveState"),e.revertState=T(o=>{$([[o,[f,S]]]);const l=o||"fastSavedState";if(!e.savedStates[l])throw Error(`revertState(): The state "${l}" should have been saved by saveState()`);const h=e.savedStates[l];e.offAll(),e.offDelegate(),e.store=Object.assign({},h.store),h.els.forEach((E,b)=>{if(!e.els[b]){const A=t.D.createElement(E.tagName);h.parentNode&&(b?e.els[b-1].after(A):h.parentNode.append(A)),e.add(A)}V(e.els[b],E)}),e.delegated=Object.assign({},h.delegated),e.ie=Object.assign({},h.ie),e.onAll(),D(h.delegated,E=>{h.delegated[E].forEach(b=>{R(()=>{e.els[a].addEventListener(E,b)})})}),e.currentState=l,h.root&&h.els.forEach(({rootElement:E})=>{E.revertChildren.forEach(b=>{t.inits[b]?.revertState(l),t('[data-o-init="'+b+'"]').els.forEach((A,_)=>{A.replaceWith(t.inits[b]?.els[_])})})})},"revertState"),e.loseState=T(o=>{$([[o,[f]]]),e.savedStates[o]&&(delete e.savedStates[o],R(()=>{const l=e.els[a].querySelectorAll("[data-o-init]");for(const h of l){const E=h.getAttribute("data-o-init");t.inits[E]?.loseState(o)}}))},"sample"),e.sample=T((o="render")=>($([[o,[f]]]),{[o]:X(e.els[s])}),"sample"),e.select=T(o=>{let l=o;l!=null&&p(l)===u&&l.target&&e.els.length&&(l=e.els.findIndex(h=>h===l.target||h.contains(l.target)),l<0&&(l=0)),$([[l,[I,S]]]),l===O&&(l=e.length-i),C=l,s=l,e.el=e.els[l],c=i,Array.isArray(e._refsByIndex)&&e._refsByIndex[l]&&(e.refs=e._refsByIndex[l])},"select"),e.all=T(()=>{C=e.length-i,s=0,e.el=e.els[0],c=0,Array.isArray(e._refsByIndex)&&e._refsByIndex.length&&(e.refs=e._refsByIndex[0]||{})},"all"),e.remove=T(o=>{if($([[o,[I,S]]]),o===O&&c&&(o=s),o!==O){const l=e.els[o];l?.parentNode?l.parentNode.removeChild(l):l===void 0&&o>=e.els.length&&t.onError&&t.onError("remove("+o+"): index out of bounds","remove")}else R(()=>{const l=e.els[a];l?.parentNode&&l.parentNode.removeChild(l)});J(!1)},"remove"),e.skip=T(o=>{$([[o,[I,S]]]),o===O&&(o=s),e.els.splice(o,i),Array.isArray(e._refsByIndex)&&e._refsByIndex.splice(o,i),J()},"skip"),e.add=T(o=>{$([[o,[v,u,I]]]),e.initID===O&&(p(o)==="string"&&o!==""?e.els.push(...Array.from(y.querySelectorAll(o))):p(o)===u?o.tagName?e.els.push(o):o.els?e.els.push(...o.els):o.length&&o[0].tagName&&e.els.push(...o):p(o)==="number"&&t.inits[o]&&(e=t.inits[o]),J(!1),e.initID!==O&&e.dataset({oInit:e.initID}))},"add"),e.appendInside=T(o=>{$([[o,[u,f]]]),o?.els&&(e._parent=o),R(()=>{U(o).appendChild(e.els[a])})},"appendInside"),e.appendBefore=T(o=>{$([[o,[u,f]]]),R(()=>{U(o).parentNode.insertBefore(e.els[a],U(o))})},"appendBefore"),e.appendAfter=T(o=>{$([[o,[u,f]]]),R(()=>{U(o).after(...e.els)})},"appendAfter"),e.find=T((o="")=>{$([[o,v]]);const l=[];return R(()=>{l.push(...Array.from(e.els[a].querySelectorAll(":scope "+o)))}),t(l)},"find"),e.first=T((o="")=>{$([[o,v]]);let l=O;const h=[];return R(()=>{l=e.els[a].querySelector(o),l&&h.push(l)}),t(h)},"first"),e.attr=T((o,l)=>{if(l!==null&&$([[o,v],[l,[v,S]]]),l===O){const h=[];return R(()=>{h[a]=e.els[a].getAttribute(o)}),c?h[0]:h}else R(l!==null?()=>{e.els[a].setAttribute(o,l)}:()=>{e.els[a].removeAttribute(o)})},"attr"),e.attrs=T(()=>{const o=[];return R(()=>{const l={};[...e.els[a].attributes].forEach(h=>{l[h.nodeName]=h.nodeValue}),o.push(l)}),c?o[0]:o},"attrs"),e.dataset=T(o=>{if($([[o,[u,S]]]),typeof o===u)R(()=>{D(o,l=>{e.els[a].dataset[l]=o[l]})});else{const l=[];return R(()=>{l.push({...e.els[a].dataset})}),c?l[0]:l}},"dataset"),e.style=T(o=>{o!==null&&$([[o,[v,S]]]),e.attr("style",o)},"style"),e.css=T((o={})=>{if(o===null){e.style(null);return}$([[o,u]]);let l="";D(o,h=>{l+=h+":"+o[h].replace('"',"'")+";"}),e.style(l||null)},"css"),e.setClass=T(o=>{$([[o,v]]),R(()=>{e.els[a].setAttribute("class",o)})},"setClass"),e.addClass=T((...o)=>{R(()=>{e.els[a].classList.add(...o)})},"addClass"),e.removeClass=T((...o)=>{R(()=>{e.els[a].classList.remove(...o)})},"removeClass"),e.toggleClass=T((o,l)=>{$([[o,f],[l,[w,S]]]),R(()=>{e.els[a].classList.toggle(o,l)})},"toggleClass"),e.haveClass=o=>{$([[o,f]]);let l=!0;return R(()=>{e.els[a].classList.contains(o)||(l=!1)}),(e.isDebug||t.debug)&&console.log("haveClass() with",o),l},e.innerHTML=T(o=>{if($([[o,[v,S]]]),o!==O)R(()=>{e.els[a].innerHTML=o});else{let l="";return R(()=>{l+=g&&e.els[a].innerHTML.length===0?t.D.parseElement(e.els[a],!1):e.els[a].innerHTML}),l}},"innerHTML"),e.innerText=T(o=>{$([[o,[v]]]),R(()=>{e.els[a].innerText=o})},"innerText"),e.textContent=T(o=>{$([[o,[v]]]),R(()=>{e.els[a].textContent=o})},"textContent"),e.html=T(o=>{if($([[o,[v,S]]]),o!==void 0)e.innerHTML(o);else{let l="";return R(()=>{l+=g?e.els[a].outerHTML():e.els[a].outerHTML}),l}},"html"),e.toString=function(){return e.html()},e[Symbol.toPrimitive]=function(o){return o==="string"||o==="default"?e.html():o==="number"?e.els?.length??0:e.html()},e.val=T(o=>{if(o===void 0)return e.el?.value;R(()=>{e.els[a].value=o})},"val"),e.forEach=T(o=>{$([[o,[x]]]),R(()=>{o({self:e,i:a,o:t,el:e.els[a]})})},"forEach"),e.prepareFor=T((o,l)=>{$([[o,[u,x,S]],[l,[x,S]]]);const h=o&&p(o)===u&&o.createElement;if(!h&&p(o)!==x)throw Error("prepareFor(): pass React (full object) or React.createElement as first argument");const E=h?o.createElement:o,b=h?o.useEffect:void 0;return A=>{if(A.ref===O)throw Error("No ref property to convert Objs to React");const _=Object.assign({},A),F=E("div",{ref:A.ref});return delete _.ref,b(()=>{D(_,j=>{if(j.substring(0,1)==="on"){const H=t.camelToKebab(j).split("-")[1];e.on(H,_[j]),delete _[j]}}),e.render(_),e.appendInside(F.ref.current)},[]),F}},"prepareFor"),e.on=T((o,l,h,E)=>{$([[o,[f]],[l,[x]],[h,[u,S]],[E,[w,S]]]),o.split(", ").forEach(b=>{R(()=>{e.els[a].addEventListener(b,l,h,E)}),e.ie[b]||(e.ie[b]=[]),e.ie[b].push([l,h,E])})},"on"),e.off=T((o,l,h)=>{$([[o,[f]],[l,[x]],[h,[u,S]]]),o.split(", ").forEach(E=>{R(()=>{e.els[a].removeEventListener(E,l,h)}),e.ie[E]&&(e.ie[E]=e.ie[E].filter(b=>b[0]!==l))})},"off"),e.onDelegate=T((o,l,h)=>{$([[o,[f]],[l,[f]],[h,[x]]]),o.split(", ").forEach(E=>{const b=A=>{const _=A.target.closest(l);_&&(A.delegate=_,A.objs=e,h(A))};R(()=>{e.els[a].addEventListener(E,b)}),e.delegated[E]||(e.delegated[E]=[]),e.delegated[E].push(b)})},"onDelegate"),e.offDelegate=T(o=>{$([[o,[f]]]),D(e.delegated,l=>{if(!o||o===l)for(;e.delegated[l].length;){const h=e.delegated[l].pop();R(()=>{e.els[a].removeEventListener(l,h)})}}),e.delegated={}},"offDelegate"),e.onParent=T((o,l,h)=>{$([[o,[f]],[l,[f,u]],[h,[x]]]);const E=p(l)===u?l:t.D.querySelector(l);o.split(", ").forEach(b=>{const A=_=>{_.objs=e,h(_)};E.addEventListener(b,A),e.parented[b]||(e.parented[b]=[]),e.parented[b].push(A)})},"onParent"),e.offParent=T((o,l)=>{$([[o,[f]],[l,[f,u]]]);const h=p(l)===u?l:t.D.querySelector(l);D(e.parented,E=>{(!o||o===E)&&(e.parented[E].forEach(b=>{h.removeEventListener(E,b)}),delete e.parented[E])})},"offParent"),e.onAll=T((o,l)=>{$([[o,[f,S]],[l,[w,S]]]),D(e.ie,(h,E)=>{(!o||o===h)&&E[h].forEach(b=>{R(()=>{l?e.els[a].removeEventListener(h,b[0]):e.els[a].addEventListener(h,b[0],b[i],b[r])})})})},"onAll"),e.offAll=T(o=>{$([[o,[f]]]),e.onAll(o,i)},"offAll"),n&&e.add(n),e.take=o=>{if($([[o,[v,u,I]]]),e.add(o),e.el){const l=e.el.dataset.oInit;if(l!==O&&t.inits[l])return e.length===i?(L=e.els[0],Object.assign(e,t.inits[l]),e.els=[L]):e=t.inits[l],J(!1,e.els),e}},e};t.first=n=>(t.verify([[n,["notEmptyString"]]]),t.debug&&console.log(n," -> ","o.first()"),t(t.D.querySelector(n)).select(0)),t.inits=[],t.getSaved={},t.errors=[],t.showErrors=!1,t.logErrors=()=>{t.errors.length?t.errors.forEach(n=>console.error(n)):console.log("No errors")},t.onError=(n,e)=>{t.showErrors?console.error(n,e):(t.errors.push(n),e&&t.errors.push(e))},t.reactRender=()=>new Error("React render function is not defined"),t.autotag=void 0,t.reactQA=n=>({["data-"+(t.autotag||"qa")]:n.replace(/([A-Z])/g,(e,i)=>"-"+i.toLowerCase()).replace(/^-/,"")}),t.specialTypes={notEmptyString:(n,e)=>e==="string"&&n.length,array:n=>Array.isArray(n),promise:n=>n instanceof Promise||!!(n&&typeof n.then=="function")},t.verify=(n,e=!1)=>{for(const i of n){const r=typeof i[0];let d=Array.isArray(i[1])?i[1]:[i[1]],w=!1;if(d.includes(r))return!0;d=d.filter(u=>!!t.specialTypes[u]);for(const u of d)if(w=t.specialTypes[u](i[0],r),w)return!0}return e?!1:new Error("Type verification failed")},t.safeVerify=n=>t.verify(n,!0),t.init=(n,e)=>t().init(n,e),t.initState=(n,e)=>t().init(n).render(e),t.take=n=>t().take(n),t.getStates=()=>t.inits.reduce((n,e)=>(n.push(e?.states),n),[]),t.getStores=()=>t.inits.reduce((n,e)=>(n.push(e?.store),n),[]),t.getListeners=()=>t.inits.reduce((n,e)=>(n.push(e?.ie),n),[]),t.createStore=n=>{const e=Object.assign({},n);return e._defaults=Object.assign({},n),e._listeners=[],e.subscribe=function(i,r){return this._listeners.push(d=>i[r]?.(d)),this},e.notify=function(){this._listeners.forEach(i=>i(this))},e.reset=function(){const i={_listeners:1,subscribe:1,notify:1,_defaults:1,reset:1};for(const r of Object.keys(this._defaults))i[r]||(this[r]=this._defaults[r])},e},t.U=void 0,t.W=2,t.H=100,t.F=!1,t.C=(n,e)=>Object.hasOwn(n,e),t.kebabToCamel=n=>n.replace(/-./g,e=>e.toUpperCase()[1]),t.camelToKebab=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),t.route=(n,e)=>{t.verify([[n,["notEmptyString","function","boolean"]],[e,["function","object"]]]);const i=typeof n=="function"?n(window.location.pathname):n;return i===!0||window.location.pathname===i?e?typeof e=="function"?(e(),!0):e:t:typeof e=="function"?!1:{}},t.router=(n={})=>{t.verify([[n,["object"]]]);for(const e in n)if(t.C(n,e)&&window.location.pathname===e)return typeof n[e]=="function"?(n[e](),!0):n[e];return!1},t.DocumentMVP={addEventListener:()=>{},parseElement:(n,e=!0)=>{t.verify([[n,["object","string"]],[e,["boolean"]]]);const i=(r,d="")=>{let w="";for(const u in r)t.C(r,u)&&(w+=` ${d}${t.camelToKebab(u)}="${typeof r[u]!="object"?r[u]:Object.entries(r[u]).map(x=>`${x[0]}: ${x[1]};`).join(" ")}"`);return w};if(typeof n=="string")return n;if(e){const r=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],d=n.tagName.toLowerCase(),w=n.attributes["data-o-init"],u=w!==void 0?` data-o-init="${w}"`:"";return`<${d}${n.className?` class="${n.className}"`:""}${i(n.attributes)}${u}${i(n.dataset,"data-")}${r.includes(d)?"/":""}>${r.includes(d)?"":n.innerHTML.length?n.innerHTML:n.children.map(x=>t.D.parseElement(x)).join("")}${r.includes(d)?"":`</${d}>`}`}return n.innerHTML.length?n.innerHTML:n.children.map(r=>t.D.parseElement(r)).join("")},createElement:n=>{t.verify([[n,["notEmptyString"]]]);const e={tagName:n.toUpperCase(),attributes:{},innerHTML:"",children:[],dataset:{},className:"",classArray:[],style:{},addEventListener:()=>{},removeEventListener:()=>{}};return e.classList={add:(...i)=>{t.verify([[i,["array"]]]),e.classArray.push(i),e.className=e.classArray.join(" ")},has:i=>(t.verify([[i,["notEmptyString"]]]),e.classArray.includes(i)),remove:i=>{t.verify([[i,["notEmptyString"]]]),e.classArray=e.classArray.filter(r=>i!==r),e.className=e.classArray.join(" ")}},e.classList.toggle=i=>{t.verify([[i,["notEmptyString"]]]),e.classList.has(i)?e.classList.remove(i):e.classList.add(i)},e.setAttribute=(i,r)=>{t.verify([[i,["notEmptyString"]],[r,["string","number","boolean","undefined"]]]),e.attributes[i]=r},e.getAttribute=i=>(t.verify([[i,["notEmptyString"]]]),e.attributes[i]),e.removeAttribute=i=>{t.verify([[i,["notEmptyString"]]]),delete e.attributes[i]},e.appendChild=i=>{t.verify([[i,["object"]]]),e.children.push(i),e.firstElementChild=e.children[0]},e.outerHTML=()=>t.D.parseElement(e),e}},t.D=typeof document<"u"&&typeof process>"u"?document:t.DocumentMVP,t.setCookie=(n,e="",i={})=>{if(t.verify([[n,["notEmptyString"]],[e,["string","number","boolean"]],[i,["object"]]]),t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}let r=encodeURIComponent(n)+"="+encodeURIComponent(e);i={path:"/",...i},i.expires instanceof Date?i.expires=i.expires.toUTCString():typeof i.expires=="number"&&(i.expires=new Date(i.expires).toUTCString());for(const d in i){r+="; "+d;const w=i[d];w!==!0&&(r+="="+w)}t.D.cookie=r},t.getCookie=n=>{if(t.verify([[n,["notEmptyString"]]]),t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}const e=t.D.cookie.match(RegExp("(?:^|; )"+n.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0},t.deleteCookie=n=>{t.verify([[n,["notEmptyString"]]]),t.setCookie(n,"",{"max-age":0})},t.clearCookies=()=>{if(t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}const n=t.D.cookie.split(";");for(;n.length;){let e=n.pop();for(;e.charAt(0)===" ";)e=e.substring(1);const i=e.split("=")[0];t.deleteCookie(i)}},t.clearLocalStorage=n=>{if(t.verify([[n,["boolean","undefined"]]]),!(typeof localStorage>"u"))if(n)localStorage.clear();else for(let e=localStorage.length-1;e>=0;e--){const i=localStorage.key(e);i.indexOf("oInc-")===-1&&i.indexOf("oTest-")===-1&&localStorage.removeItem(i)}},t.clearSessionStorage=n=>{if(t.verify([[n,["boolean","undefined"]]]),!(typeof sessionStorage>"u"))if(!n)sessionStorage.clear();else for(let e=sessionStorage.length-1;e>=0;e--){const i=sessionStorage.key(e);i&&i.indexOf("oTest-")===0&&sessionStorage.removeItem(i)}},t.clearTestsStorage=()=>{t.clearSessionStorage(1)},t.clearAfterTests=()=>{t.clearCookies(),t.clearLocalStorage(!1),t.clearTestsStorage()},t.ajax=(n,e={})=>{t.verify([[n,["notEmptyString"]],[e,["object"]]]);const i=new URLSearchParams;if(e.data&&typeof e.data=="object"){for(const r in e.data)t.C(e.data,r)&&(typeof e.data[r]=="object"?i.set(r,encodeURIComponent(JSON.stringify(e.data[r]))):i.set(r,e.data[r]));e.method.toLowerCase()==="get"?n+="?"+i.toString():e.body||(e.body=i),delete e.data}return e.headers||(e.headers={"X-Requested-With":"XMLHttpRequest"}),fetch(n,e)},t.get=(n,e={})=>(t.verify([[n,["notEmptyString"]],[e,["object"]]]),t.ajax(n,{...e,method:"GET"})),t.post=(n,e={})=>(t.verify([[n,["notEmptyString"]],[e,["object"]]]),t.ajax(n,{...e,method:"POST"})),t.newLoader=n=>{t.verify([[n,["promise","undefined"]]]);let e=[],i=null,r=!1,d=!1;const w=u=>{r=!1,d=!1,i=null,setTimeout(()=>{u.then(x=>{r=!0,!x.ok&&typeof x.ok<"u"?(d=!0,e.forEach(([v,I,f])=>{f&&v[f](x)})):typeof x.json=="function"?x.json().then(v=>{i=v,e.forEach(([I,f])=>{I[f](i)})}):(i=x,e.forEach(([v,I])=>{v[I](i)}))}).catch(x=>{d=!0,e.forEach(([v,I,f])=>{f&&v[f](x)})})},33)};return n&&w(n),{reload:w,isObjsLoader:!0,listeners:e,isFinished:()=>r,getStore:()=>i,connect:(u,x="render",v)=>{t.verify([[u,["object"]],[x,["notEmptyString"]],[v,["string","undefined"]]]),r?d?v&&u[v]():typeof u[x]=="function"&&u[x](i):e.push([u,x,v])},disconnect:u=>{t.verify([[u,["object"]]]),e=e.filter(([x])=>x!==u)}}},t.getParams=n=>{t.verify([[n,["string","undefined"]]]);const e={},i=new URLSearchParams(window.location.search).entries();for(const r of i)e[r[0]]=r[1];return n?e[n]:e},t.incCache=!0,t.incCacheExp=1e3*60*60*24,t.incTimeout=6e3,t.incSource="",t.incForce=t.F,t.incAsync=!0,t.incCors=t.F,t.incSeparator="?",t.incFns={},t.incSet=[0],t.incReady=[0],t.incN=0,t.incGetHash=n=>n.split(t.incSeparator)[1]||"",t.incCheck=(n=0,e,i=0)=>(t.verify([[n,["number"]],[e,["number","undefined"]],[i,["number"]]]),!i&&n&&e===t.U&&t.incReady[n]?t.incSet[n]===1:t.incReady[n]===t.U||t.incReady[n][e]===t.U?t.F:(t.incReady[n][e].loaded=i,t.incFns[t.incReady[n][e].name]=i,t.incReady[n][0]+=i,n&&t.incReady[n].length===t.incReady[n][0]&&(typeof t.incSet[n]=="function"&&t.incSet[n](n),t.incSet[n]=1),t.incSet[n]===1)),t.incCacheClear=(n=t.F)=>{t.verify([[n,["boolean"]]]);for(const e in t.incFns)t.C(t.incFns,e)&&(localStorage.removeItem("oInc-"+e),localStorage.removeItem("oInc-"+e+"-expires"));return n&&(t.incReady.forEach((e,i)=>{i&&e.forEach((r,d)=>{d&&t("#oInc-"+i+"-"+d).remove()})}),t.incN=0,t.incFns={},t.incSet=[0],t.incReady=[0]),!0},t.inc=(n,e,i)=>{if(t.verify([[n,["object","undefined"]],[e,["function","undefined"]],[i,["function","undefined"]]]),typeof localStorage>"u")return;let r=0,d=0,w="",u=!1;const x="function",v=-1;if(typeof n!="object"||!n)return t.incSet[0];t.incSet[0]++;const I=t.incSet[0];t.incSet[I]=e||0,t.incReady[I]=[];const f=t.incReady[I];f[0]=1;const S={};for(const m in n)if(t.C(n,m)){if(m==="preload"){u=!0;continue}w=t.incGetHash(n[m]),r++,t.incN++;const O=n[m].indexOf(".css")>v?"style":"script";if(n[m]=(t.incSource?t.incSource+"/":"")+n[m],Number.isNaN(Number(m))&&t.C(t.incFns,m)&&t.incFns[m]&&!t.incForce){f[r]={name:m,loaded:1},d++;continue}if(f[r]={name:m,loaded:0},Number.isNaN(Number(m))&&(t.incFns[m]=0),Number.isNaN(Number(m))&&t.incCache&&(n[m].substring(0,4)!=="http"||!t.incCors)&&window.location.protocol!=="file:"&&(n[m].indexOf(".css")>v||n[m].indexOf(".js")>v)){const y=localStorage,C=y.getItem("oInc-"+m),s=y.getItem("oInc-"+m+"-expires"),c=y.getItem("oInc-"+m+"-hash");C&&s&&Date.now()<s&&c===w?(u||t.initState({tag:O,id:"oInc-"+I+"-"+r,innerHTML:C,"data-o-inc":I}).appendInside("head"),f[r].loaded=1,t.incFns[m]=1,d++):(S[m]=r,t.get(n[m],{mode:t.incCors?"cors":"same-origin"}).then(g=>{if(g.status!==200){t.onError&&t.onError({message:t.incSource+n[m]+" was not loaded"});return}g.text().then(a=>{y.setItem("oInc-"+m,a),y.setItem("oInc-"+m+"-expires",Date.now()+t.incCacheExp),y.setItem("oInc-"+m+"-hash",w),u||t.initState({tag:O,id:"oInc-"+I+"-"+S[m],innerHTML:a,"data-o-inc":I}).appendInside("head"),t.incCheck(I,S[m],1)})}))}else{const y={tag:O,id:"oInc-"+I+"-"+r,"data-o-inc":I,async:t.incAsync,onload:"o.incCheck("+I+","+r+",1)"};n[m].indexOf(".css")>v?(y.tag="link",y.rel="stylesheet",y.href=n[m]):(n[m].indexOf(".js")>v||(y.tag="img",y.style="display:none;"),y.src=n[m]),t.initState(y).appendInside(y.style?"body":"head")}}return f[0]+=d,r!==0&&(d===r?typeof e===x&&e(I):setTimeout(m=>{t.incReady[m]&&t.incReady[m].length<t.incReady[m][0]&&(t.incSet[m]=0,typeof i===x&&i(I))},t.incTimeout,I)),t.incSet[0]},t.connectRedux=(n,e,i,r="render")=>{t.verify([[n,["object"]],[e,["function"]],[i,["object"]],[r,["notEmptyString"]]]);const d=()=>{if(typeof i[r]=="function"){const w=e(n.getState());i[r](w!==null&&typeof w=="object"?w:{value:w})}};return d(),n.subscribe(d)},t.connectMobX=(n,e,i,r,d="render")=>(t.verify([[n,["object"]],[e,["object"]],[i,["function"]],[r,["object"]],[d,["notEmptyString"]]]),n.autorun(()=>{if(typeof r[d]=="function"){const w=i(e);r[d](w!==null&&typeof w=="object"?w:{value:w})}})),t.ObjsContext=null,t.withReactContext=(n,e,i,r,d="render")=>function(){const u=n.useContext(e);return n.useEffect(()=>{if(typeof r[d]=="function"){const x=i(u);r[d](x!==null&&typeof x=="object"?x:{value:x})}},[u]),null},t.debug=!1,t.sleep=n=>new Promise(e=>setTimeout(e,n)),t.tLog=[],t.tRes=[],t.tStatus=[],t.tFns=[],t.tShowOk=t.F,t.tStyled=t.F,t.tTime=2e3,t.tests=[],t.tExpectedSteps={},t.tFinalized={},t.tAutolog=t.F,t.tBeforeEach=void 0,t.tAfterEach=void 0,t.addTest=(n,...e)=>{t.verify([[n,["notEmptyString"]],[e,["array"]]]);let i={};e.length&&typeof e[e.length-1]=="object"&&!Array.isArray(e[e.length-1])&&(i=e.pop());const r=t.tests.length;return t.tests[r]={title:n,tests:e,hooks:i},{run:()=>{typeof i.before=="function"&&(t.tBeforeEach=i.before),typeof i.after=="function"&&(t.tAfterEach=i.after),t.runTest(r)},autorun:()=>{typeof i.before=="function"&&(t.tBeforeEach=i.before),typeof i.after=="function"&&(t.tAfterEach=i.after),t.runTest(r,!0)},testId:r}},t.updateLogs=()=>{for(let n=0;n<t.tests.length;n++)t.tLog[n]=t.tLog[testN]=sessionStorage.getItem(`oTest-Log-${testN}`)||"";return t.tLog},t.runTest=(n=0,e,i)=>{if(t.verify([[n,["number"]],[e,["boolean","undefined"]],[i,["boolean","undefined"]]]),!t.tests[n])return;i||(sessionStorage?.removeItem(`oTest-Log-${n}`),sessionStorage?.removeItem(`oTest-Res-${n}`),sessionStorage?.removeItem(`oTest-Status-${n}`)),sessionStorage?.setItem("oTest-Run",n),e?sessionStorage?.setItem("oTest-Autorun",e):sessionStorage?.removeItem("oTest-Autorun");const r=t.tests[n];let d=r.tests.pop();typeof d!="function"&&(r.tests.push(d),d=()=>{}),r.tests.push(w=>{d(w),sessionStorage.setItem("dddd",1),sessionStorage?.removeItem("oTest-Run"),e&&t.runTest(n+1,e)}),t.test(r.title,...r.tests)},t.tPre='<div style="font-family:monospace;text-align:left;">',t.tOk='<span style="background:#cfc;padding: 0 15px;">OK</span> ',t.tXx='<div style="background:#fcc;padding:3px;">',t.tDc="</div>",t.test=(n="",...e)=>{t.verify([[n,["notEmptyString"]],[e,["array"]]]);const i=sessionStorage?.getItem("oTest-Run"),r=i||t.tLog.length;let d=0,w="\u251C OK: ",u="\u251C \u2718 ",x=`
7
+ `,v=`
8
+ `,I="",f=e.length,S=0;const m=(s="",c=!1,g=!1)=>{t.tAutolog&&(c?console.error(s):(t.tShowOk||g)&&console.log(s))};let O={};if(typeof e[f-1]=="function"&&(t.tFns[r]=e[f-1],f--),f>0&&typeof e[f-1]=="object"&&!Array.isArray(e[f-1])&&(e[f-1].sync!==void 0||e[f-1].confirmOnFailure!==void 0)&&(O=e[f-1],f--),i){t.tLog[r]=sessionStorage.getItem(`oTest-Log-${r}`)||"",t.tRes[r]=sessionStorage.getItem(`oTest-Res-${r}`)||!1,t.tStatus[r]=JSON.parse(sessionStorage.getItem(`oTest-Status-${r}`)||"[]");for(let s=0;s<t.tStatus[r].length;s++){const c=t.tStatus[r][s];(c===!0||c===!1)&&S++}}t.tStyled&&(w=t.tPre+t.tOk,u=t.tPre+t.tXx,x=t.tDc,v=x+x),(!i||t.tLog[r].length===0)&&(m("\u2552 "+n+" #"+r,!1,!0),t.tStyled?t.tLog[r]="<div><b>"+n+" #"+r+"</b></div>":t.tLog[r]="\u2552 "+n+" #"+r+`
9
+ `,t.tRes[r]=t.F,t.tStatus[r]=[]),t.tExpectedSteps[r]=f,t.tFinalized[r]=!1;const y=(s,c)=>new Promise(g=>{const a=t.overlay({innerHTML:`<div style="display:flex;flex-direction:column;gap:8px;"><div style="cursor:grab;">Step ${s+1} failed: ${c||"error"}. Continue testing?</div><div style="display:flex;gap:8px;"><button class="o-cf-continue" style="padding:6px 12px;background:#2563eb;color:#fff;border:none;border-radius:6px;cursor:pointer;">Continue</button><button class="o-cf-stop" style="padding:6px 12px;background:#dc2626;color:#fff;border:none;border-radius:6px;cursor:pointer;">Stop</button></div></div>`,timeout:O.confirmOnFailureTimeout||void 0,onClose:L=>g(L||{continue:!1}),excludeDragSelector:".o-cf-continue, .o-cf-stop"});a.first(".o-cf-continue").on("click",()=>{a._overlayCleanup(),g({continue:!0})}),a.first(".o-cf-stop").on("click",()=>{a._overlayCleanup(),g({continue:!1})})}),C=()=>{if(t.tFinalized[r])return;t.tFinalized[r]=!0;const s=t.tStatus[r].some(c=>c===!1);t.tRes[r]=!s&&S===f,I=d?"\u251C ":"\u2558 ",I+="DONE "+S+"/"+f+(d?", waiting: "+d:""),m(I,S+d!==f),d||m(),t.tStyled?t.tLog[r]+=t.tPre+'<div style="color:'+(S+d!==f?"red":"green")+';"><b>DONE '+S+"/"+f+(d?", waiting: "+d:"")+"</b>"+t.tDc+t.tDc:t.tLog[r]+=I+`
10
+ `,i&&(sessionStorage.setItem(`oTest-Log-${r}`,t.tLog[r]),sessionStorage.setItem(`oTest-Res-${r}`,t.tRes[r]),sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]))),!d&&typeof t.tFns[r]=="function"&&t.tFns[r](r)};if(O.sync||O.confirmOnFailure)return(async()=>{for(let s=t.tStatus[r].length;s<f;s++){const c={n:r,i:s,title:e[s][0],tShowOk:t.tShowOk,tStyled:t.tStyled};let g=e[s][1];if(typeof g>"u"){t.tStyled?t.tLog[r]+="<div>"+c.title+"</div>":t.tLog[r]+=c.title+`
11
+ `,m("\u251C "+c.title,!1,!0),t.tStatus[r][s]=!0,S++;continue}if(typeof t.tBeforeEach=="function"&&t.tBeforeEach(c),typeof g=="function")try{g=g(c)}catch(a){g=a.message,t.onError&&t.onError(a)}if(typeof t.tAfterEach=="function"&&t.tAfterEach(c,g),g&&typeof g.then=="function"){try{const a=await g,L=a===!0||a==null||a&&typeof a=="object"&&a.ok===!0,k=a&&a.errors&&a.errors.length?a.errors.join("; "):typeof a=="string"?a:"";if(t.testUpdate(c,L,L?"":k?": "+k:""),S++,!L&&O.confirmOnFailure&&!(await y(s,k)).continue)break}catch(a){if(t.testUpdate(c,!1,a.message||"Promise rejected"),O.confirmOnFailure&&!(await y(s,a.message||"Promise rejected")).continue)break}continue}if(typeof t.tStatus[r][s]>"u")t.tStatus[r][s]=typeof g=="string"?t.F:g;else{sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]));return}if(g===!0)S++,t.tShowOk&&(t.tLog[r]+=w+e[s][0]+x,m("\u251C OK: "+e[s][0]));else if(g!==t.U){if(t.tLog[r]+=u+e[s][0]+(g!==t.F?": "+g:"")+v,m("\u251C \u2718 "+e[s][0]+(g!==t.F?": "+g:""),!0),O.confirmOnFailure&&!(await y(s,typeof g=="string"?g:"")).continue)break}else{d++,setTimeout(a=>{a.title+=" (timeout)",t.testUpdate(a)},t.tTime,c);return}}C()})(),r;for(let s=t.tStatus[r].length;s<f;s++){const c={n:r,i:s,title:e[s][0],tShowOk:t.tShowOk,tStyled:t.tStyled};let g=e[s][1];if(typeof g>"u"){t.tStyled?t.tLog[r]+="<div>"+c.title+"</div>":t.tLog[r]+=c.title+`
12
+ `,m("\u251C "+c.title,!1,!0),t.tStatus[r][s]=!0,S++;continue}if(typeof t.tBeforeEach=="function"&&t.tBeforeEach(c),typeof g=="function")try{g=g(c)}catch(a){g=a.message,t.onError&&t.onError(a)}if(typeof t.tAfterEach=="function"&&t.tAfterEach(c,g),g&&typeof g.then=="function"){d++;const a=setTimeout(()=>{c.title+=" (timeout)",t.testUpdate(c)},t.tTime);g.then(L=>{clearTimeout(a);const k=L===!0||L&&L.ok===!0,p=L&&L.errors&&L.errors.length?L.errors.join("; "):typeof L=="string"?L:"";t.testUpdate(c,k,k?"":p?": "+p:"")}).catch(L=>{clearTimeout(a),t.testUpdate(c,!1,L.message||"Promise rejected")});continue}if(typeof t.tStatus[r][s]>"u")t.tStatus[r][s]=typeof g=="string"?t.F:g;else{sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]));return}g===!0?(S++,t.tShowOk&&(t.tLog[r]+=w+e[s][0]+x,m("\u251C OK: "+e[s][0]))):g!==t.U?(t.tLog[r]+=u+e[s][0]+(g!==t.F?": "+g:"")+v,m("\u251C \u2718 "+e[s][0]+(g!==t.F?": "+g:""),!0)):(d++,setTimeout(a=>{a.title+=" (timeout)",t.testUpdate(a)},t.tTime,c))}return C(),r},t.testUpdate=(n,e=t.F,i="")=>{t.verify([[n,["object"]],[e,["boolean","string"]],[i,["string"]]]);let r="";const d=n.n,w=(u="",x=!1)=>{t.tAutolog&&(x?console.error(u):console.log(u))};if(t.tStatus[d][n.i]===t.U||t.tStatus[d][n.i]===null){t.tStatus[d][n.i]=e===!0,e===!0?n.tShowOk&&(r="\u251C OK: "+n.title+i,w(r),n.tStyled?t.tLog[d]+=t.tPre+t.tOk+n.title+i+t.tDc:t.tLog[d]+=r+`
13
+ `):(t.tRes[d]=t.F,r="\u251C \u2718 "+n.title+(e?": "+e:"")+i,w(r,!0),n.tStyled?t.tLog[d]+=t.tPre+t.tXx+n.title+i+(e?": "+e:"")+t.tDc+t.tDc:t.tLog[d]+=r+`
14
+ `);let u=0,x=0;for(const I of t.tStatus[d]){if(I===t.U||I===null)return;I||u++,x++}const v=t.tests[d]?.tests?.length??t.tExpectedSteps[d]??Number.MAX_SAFE_INTEGER;if(x<v){sessionStorage?.getItem("oTest-Run")===d&&(sessionStorage.setItem(`oTest-Log-${d}`,t.tLog[d]),sessionStorage.setItem(`oTest-Res-${d}`,t.tRes[d]),sessionStorage.setItem(`oTest-Status-${d}`,JSON.stringify(t.tStatus[d])));return}if(t.tFinalized[d])return;t.tFinalized[d]=!0,sessionStorage?.getItem("oTest-Run")===d&&(sessionStorage.setItem(`oTest-Log-${d}`,t.tLog[d]),sessionStorage.setItem(`oTest-Res-${d}`,t.tRes[d]),sessionStorage.setItem(`oTest-Status-${d}`,JSON.stringify(t.tStatus[d]))),t.tRes[d]=!u,r=u?"FAILED "+u+"/"+x:"DONE "+x+"/"+x,w("\u2558 "+r,!!u),w(),n.tStyled?t.tLog[d]+=t.tPre+'<b style="color:'+(u?"red":"green")+';">'+r+"</b>"+t.tDc:t.tLog[d]+="\u2558 "+r+`
15
+ `,typeof t.tFns[d]=="function"&&t.tFns[d](d)}},sessionStorage?.getItem("oTest-Run")&&window?.addEventListener("load",()=>{t.runTest(sessionStorage?.getItem("oTest-Run"),sessionStorage?.getItem("oTest-Autorun")||t.F,!0)},!1),t.measure=n=>{if(!n)return{};const e=n.getBoundingClientRect(),i=window.getComputedStyle(n);return{width:e.width,height:e.height,top:e.top,left:e.left,visible:i.display!=="none"&&i.visibility!=="hidden"&&e.width>0,opacity:i.opacity,zIndex:i.zIndex}},t.assertVisible=n=>!!t.measure(n).visible,t.assertSize=(n,e={})=>{if(!n)return"element is null";const i=t.measure(n);if(e.w!==void 0&&Math.round(i.width)!==e.w)return`width: expected ${e.w}, got ${Math.round(i.width)}`;if(e.h!==void 0&&Math.round(i.height)!==e.h)return`height: expected ${e.h}, got ${Math.round(i.height)}`;const r=d=>{const w=window.getComputedStyle(n).getPropertyValue(d);return w?parseFloat(w):0};return e.padding!==void 0&&r("padding-top")!==e.padding?`padding: expected ${e.padding}, got ${r("padding-top")}`:e.paddingTop!==void 0&&r("padding-top")!==e.paddingTop?`paddingTop: expected ${e.paddingTop}, got ${r("padding-top")}`:e.paddingRight!==void 0&&r("padding-right")!==e.paddingRight?`paddingRight: expected ${e.paddingRight}, got ${r("padding-right")}`:e.paddingBottom!==void 0&&r("padding-bottom")!==e.paddingBottom?`paddingBottom: expected ${e.paddingBottom}, got ${r("padding-bottom")}`:e.paddingLeft!==void 0&&r("padding-left")!==e.paddingLeft?`paddingLeft: expected ${e.paddingLeft}, got ${r("padding-left")}`:e.margin!==void 0&&r("margin-top")!==e.margin?`margin: expected ${e.margin}, got ${r("margin-top")}`:e.marginTop!==void 0&&r("margin-top")!==e.marginTop?`marginTop: expected ${e.marginTop}, got ${r("margin-top")}`:e.marginRight!==void 0&&r("margin-right")!==e.marginRight?`marginRight: expected ${e.marginRight}, got ${r("margin-right")}`:e.marginBottom!==void 0&&r("margin-bottom")!==e.marginBottom?`marginBottom: expected ${e.marginBottom}, got ${r("margin-bottom")}`:e.marginLeft!==void 0&&r("margin-left")!==e.marginLeft?`marginLeft: expected ${e.marginLeft}, got ${r("margin-left")}`:!0},t.recorder={active:!1,actions:[],mocks:{},initialData:{},assertions:[],observeRoot:null,_originalFetch:null,_listeners:[],_observer:null},t.recordingAssertionDebug=!1,t.startRecording=(n,e,i)=>{if(t.recorder.active)return;const r=["click","mouseover","scroll","input","change"],d={click:100,mouseover:50,scroll:30,input:50,change:50},w=e||r,u=Object.assign({},d,i||{}),x={scroll:30,mouseover:50},v=t.recorder;v.active=!0,v.actions=[],v.mocks={},v.stepDelays=u,v.initialData={url:window.location.href,timestamp:Date.now()},v.observeRoot=n||null,v.assertions=[],v.removedElements=[],t.inits.forEach((y,C)=>{y?.store&&(v.initialData["init_"+C]=JSON.parse(JSON.stringify(y.store)))}),v._originalFetch=window.fetch,window.fetch=async(y,C={})=>{const s=(C.method||"GET").toUpperCase();let c;try{c=C.body?JSON.parse(C.body):void 0}catch{c=C.body}const g=await v._originalFetch(y,C),a=g.clone();let L;try{L=await a.json()}catch{L=await a.text().catch(()=>null)}const k=s+":"+y;return v.mocks[k]={url:y,method:s,request:c,response:L,status:g.status},g};const I={"data-o-init":1,"data-o-init-i":1,"data-o-state":1},f=(y,C)=>{if(t.D.querySelectorAll(y).length<=1)return y;let s=C;for(;s&&s!==t.D.body;){let c=s.id?"#"+s.id:null;if(!c&&s.attributes){const g=t.autotag?"data-"+t.autotag:null;if(g){const a=s.getAttribute(g);a!=null&&(c=`[${g}="${a}"]`)}if(!c){for(const a of s.attributes)if(a.name.startsWith("data-")&&!I[a.name]){c=`[${a.name}="${a.value}"]`;break}}}if(c){const g=c+" "+y;if(t.D.querySelectorAll(g).length===1)return g}s=s.parentElement}return y},S=y=>{if(!y||y.nodeType!==1)return"";let C="";if(y.dataset){const s=t.autotag&&y.dataset[t.autotag];s&&(C=f(`[data-${t.autotag}="${s}"]`,y.parentElement))}if(!C&&y.tagName){const s=y.id?"#"+y.id:y.className?y.tagName.toLowerCase()+"."+[...y.classList].join("."):y.tagName.toLowerCase();C=y.id?s:f(s,y.parentElement)}return C},m=n&&t.D.querySelector(n)||t.D.body;v._observer=new MutationObserver(y=>{const C=v.actions.length-1;if(C<0)return;const s=v.actions[C];t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] MutationObserver batch:",{actionIdx:C,lastAction:s?{type:s.type,target:s.target}:null,mutationTypes:y.map(c=>c.type),addedCount:y.reduce((c,g)=>c+(g.addedNodes?.length||0),0),removedCount:y.reduce((c,g)=>c+(g.removedNodes?.length||0),0)}),y.forEach(c=>{const g=(a,L)=>{let k,p;if(a&&m&&m.querySelectorAll(a).length>1){let N=L;for(;N&&N!==m&&N.nodeType===1;){const $=t.autotag&&N.dataset&&N.dataset[t.autotag];if($){const T=`[data-${t.autotag}="${$}"]`,R=m.querySelectorAll(T);if(R.length>1){const U=[...R].indexOf(N);if(U!==-1){k=T,p=U;break}}}N=N.parentElement}}return{listSelector:k,index:p}};if(c.type==="childList"&&(c.addedNodes.forEach(a=>{if(a.nodeType!==1||!a.offsetParent)return;const L=S(a);if(!L||v.assertions.some($=>$.actionIdx===C&&$.selector===L&&$.type==="visible"))return;const k=(a.textContent?.trim()||"").slice(0,80)||void 0,{listSelector:p,index:D}=g(L,a),N={actionIdx:C,type:"visible",selector:L,text:k};p!=null&&(N.listSelector=p),D!=null&&(N.index=D),v.assertions.push(N),t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] +visible assertion:",{actionIdx:C,lastAction:s?.type+" "+s?.target,selector:L,text:(k||"").slice(0,40),index:D,listSelector:p})}),c.removedNodes.forEach(a=>{if(a.nodeType!==1)return;const L=S(a);if(!L)return;const k=(a.textContent?.trim()||"").slice(0,80)||void 0,p=c.target;let D;a.previousSibling?D=Array.from(p.children).indexOf(a.previousSibling)+1:a.nextSibling?D=Array.from(p.children).indexOf(a.nextSibling):D=0;let N;if(t.autotag&&a.dataset?.[t.autotag]){const T=a.dataset[t.autotag];N=`[data-${t.autotag}="${T}"]`}const $={actionIdx:C,type:"removed",selector:L,text:k};N&&($.listSelector=N),$.index=D,v.removedElements.push($),t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] +removed element:",{actionIdx:C,lastAction:s?.type+" "+s?.target,selector:L,text:(k||"").slice(0,40),index:D,listSelector:N})})),c.type==="attributes"){const a=S(c.target);if(!a||v.assertions.some(D=>D.actionIdx===C&&D.selector===a&&D.type==="class"))return;const{listSelector:L,index:k}=g(a,c.target),p={actionIdx:C,type:"class",selector:a,className:c.target.className};L!=null&&(p.listSelector=L),k!=null&&(p.index=k),v.assertions.push(p),t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] +class assertion:",{actionIdx:C,lastAction:s?.type+" "+s?.target,selector:a,className:c.target.className,index:k,listSelector:L})}})}),v._observer.observe(m,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","disabled","aria-expanded","aria-checked"]});const O={};w.forEach(y=>{const C=s=>{const c=s.target;if(n&&m&&c?.nodeType===1&&!m.contains(c))return;let g="";if(c?.dataset){const R=t.autotag&&c.dataset[t.autotag];R&&(g=f(`[data-${t.autotag}="${R}"]`,c.parentElement))}if(!g&&c?.tagName){const R=c.id?"#"+c.id:c.className?c.tagName.toLowerCase()+"."+[...c.classList].join("."):c.tagName.toLowerCase();g=c.id?R:f(R,c.parentElement)}let a,L;if(g&&m&&m.querySelectorAll(g).length>1){let U=c;for(;U&&U!==m&&U.nodeType===1;){const J=t.autotag&&U.dataset&&U.dataset[t.autotag];if(J){const G=`[data-${t.autotag}="${J}"]`,V=m.querySelectorAll(G);if(V.length>1){const X=[...V].indexOf(U);if(X!==-1){a=G,L=X;break}}}U=U.parentElement}}const k=c?.tagName?c.tagName.toLowerCase()+(c.type?":"+c.type:""):void 0,p=y==="scroll"?window.scrollY:void 0,D=y==="input"||y==="change"?c?.value:void 0,N=y==="change"&&(c?.type==="checkbox"||c?.type==="radio")?c?.checked:void 0,$=y==="click"||y==="change"?0:u[y]!==void 0?u[y]:x[y]??0,T=()=>{const R={type:y,target:g,time:Date.now()};k&&(R.targetType=k),p!==void 0&&(R.scrollY=p),D!==void 0&&(R.value=D),N!==void 0&&(R.checked=N),a!=null&&(R.listSelector=a),L!=null&&(R.targetIndex=L),v.actions.push(R)};$===0?T():(clearTimeout(O[y]),O[y]=setTimeout(T,$))};t.D.addEventListener(y,C,!0),v._listeners.push({ev:y,handler:C})})},t.stopRecording=()=>{const n=t.recorder;return n.active=!1,n._originalFetch&&(window.fetch=n._originalFetch,n._originalFetch=null),n._listeners.forEach(({ev:e,handler:i})=>{t.D.removeEventListener(e,i,!0)}),n._listeners=[],n._observer&&(n._observer.disconnect(),n._observer=null),{actions:[...n.actions],mocks:{...n.mocks},initialData:{...n.initialData},stepDelays:{...n.stepDelays},assertions:[...n.assertions||[]],removedElements:[...n.removedElements||[]],observeRoot:n.observeRoot||null}},t.clearRecording=n=>{if(n!==void 0)sessionStorage?.removeItem("oTest-Recording-"+n);else for(let e=sessionStorage?.length-1;e>=0;e--){const i=sessionStorage?.key(e);i&&i.indexOf("oTest-Recording-")===0&&sessionStorage?.removeItem(i)}},t.runRecordingAssertions=(n,e,i,r)=>{const d=r&&r.assertions,w=d??(n.assertions||[]).filter(s=>i==null||s.actionIdx===i);t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[runRecordingAssertions] run:",{actionIdx:i,scope:i==null?"teardown (all)":"per-action",assertionsCount:w.length,assertions:w.map(s=>({actionIdx:s.actionIdx,type:s.type,selector:s.selector,index:s.index,text:(s.text||"").slice(0,40)}))});const u=new Set,x=w.filter(s=>{const c=`${s.selector}|${s.type}|${s.actionIdx}|${s.index??""}`;return u.has(c)?!1:(u.add(c),!0)}),I=(()=>{if(e!=null)return typeof e=="string"?t.D.querySelector(e)||t.D.body:e;const s=n.observeRoot;return s&&t.D.querySelector(s)||t.D.body})(),f=s=>(s||"").trim().replace(/\s+/g," "),S=s=>s?f(s.textContent||""):"",m=r?.removedElements||[],O=s=>{if(!m.length||i==null)return!1;const c=f(s.text||"");for(const g of m)if(!(g.actionIdx>i)&&f(g.text||"")===c&&g.selector===s.selector&&!(s.listSelector!=null&&g.listSelector!==s.listSelector)&&!(s.index!=null&&g.index!==s.index))return!0;return!1};let y=0;const C=[];for(const s of x){if(O(s)){y+=1,t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[runRecordingAssertions] skip (explicit removed):",{actionIdx:s.actionIdx,selector:s.selector,text:(s.text||"").slice(0,40)});continue}let c=null,g=!1;if(s.listSelector!=null&&s.index!=null){const a=I.querySelectorAll(s.listSelector),L=f(s.text||""),k=D=>{const N=a[D];return N?(s.selector!==s.listSelector?N.querySelector(s.selector):N)||(s.selector!==s.listSelector?N:null):null};let p=a[s.index];if(!p&&s.index>0&&(p=a[s.index-1]),p){if(c=k(s.index)||(s.index>0?k(s.index-1):null),!c&&s.selector!==s.listSelector&&(c=p),s.type==="visible"&&L&&c){const D=S(c);if(D.indexOf(L)===-1&&L.indexOf(D)===-1)for(let $=0;$<a.length;$++){const T=k($);if(T&&S(T).indexOf(L)!==-1){c=T,p=a[$];break}}}}else g=!0}else{const a=I.querySelectorAll(s.selector);c=a.length>0?a[0]:t.D.querySelector(s.selector)}if(s.type==="visible"){const a=c&&c.nodeType===1&&(c.offsetParent!==null||c.getBoundingClientRect&&c.getBoundingClientRect().width>0),L=f(s.text||""),k=S(c),p=k,D=!L||k.indexOf(L)!==-1||p.indexOf(L)!==-1||L.length>0&&L.indexOf(k)!==-1;if(a&&D)y+=1;else{const N=g?`index out of bounds (list has ${I.querySelectorAll(s.listSelector||s.selector).length} items, assertion expected index ${s.index})`:c?a?D?"fail":"text mismatch":"not visible":"element not found";C.push({selector:s.selector,message:N}),typeof console<"u"&&console.warn&&console.warn("[runRecordingAssertions] visible failed:",{actionIdx:s.actionIdx,selector:s.selector,listSelector:s.listSelector,index:s.index,expectedText:s.text||"(any)",actualText:k.slice(0,80),message:N})}}else if(s.type==="class"){const a=(s.className||"").trim().split(/\s+/).filter(Boolean);if(c&&(a.length===0||a.every(k=>c.classList?.contains(k))))y+=1;else{const k=g?`index out of bounds (list has ${I.querySelectorAll(s.listSelector).length} items, expected index ${s.index})`:c?`expected class "${s.className}"`:"element not found";C.push({selector:s.selector,message:k}),typeof console<"u"&&console.warn&&console.warn("[runRecordingAssertions] failed:",{type:s.type,selector:s.selector,actionIdx:s.actionIdx,listSelector:s.listSelector,index:s.index,itemsInRoot:s.listSelector?I.querySelectorAll(s.listSelector).length:"-",message:k})}}}return{passed:y,total:x.length,failures:C}},t.exportTest=(n,e={})=>{const i=e.delay!==void 0?e.delay:16,r={actions:n.actions,assertions:n.assertions||[],observeRoot:n.observeRoot||null},d=n.observeRoot?`(o.D.querySelector('${n.observeRoot.replace(/'/g,"\\'")}') || o.D.body)`:"o.D.body",w=f=>{if(f.listSelector!=null&&f.targetIndex!=null){const S=JSON.stringify(f.listSelector),m=f.target===f.listSelector,O=m?S:JSON.stringify(f.target);return` const items = o.D.querySelectorAll(${S});
16
+ const item = items[${f.targetIndex}];
17
+ let el = null;
18
+ if (item) { el = ${m?"item":`item.querySelector(${O}) || item`}; }`}return` const el = o.D.querySelector(${JSON.stringify(f.target)});`},u=i>0?`
19
+ await o.sleep(${i});
20
+ return true;
21
+ `:` return true;
22
+ `,x=i>0?"async () =>":"() =>",v=[];for(let f=0;f<n.actions.length;f++){const S=n.actions[f];let m;S.type==="scroll"?m=` window.scrollTo(0, ${S.scrollY||0});${u}`:S.type==="input"||S.type==="change"?m=(S.value!==void 0?` el.value = ${JSON.stringify(S.value)};
23
+ `:"")+(S.checked!==void 0?` el.checked = ${S.checked};
24
+ `:"")+` el.dispatchEvent(new Event('${S.type}', {bubbles:true}));${u}`:m=S.type==="click"?` el.click();${u}`:` el.dispatchEvent(new MouseEvent('${S.type}', {bubbles:true,cancelable:true}));${u}`,v.push(` ['${S.type} on ${S.target}', ${x} {
25
+ `+w(S)+`
26
+ if (!el && '${S.type}' !== 'scroll') return 'element not found: ${S.target.replace(/'/g,"\\'")}';
27
+ `+m+" }]"),(n.assertions||[]).filter(y=>y.actionIdx===f).length>0&&v.push(` ['assert after ${S.type}', () => {
28
+ const r = o.runRecordingAssertions(recordingData, ${d}, ${f});
29
+ return r.passed === r.total ? true : r.failures.map(f => f.selector + ': ' + f.message).join('; ');
30
+ }]`)}return`// Auto-generated by o.exportTest() \u2014 review and anonymize mocks before committing
31
+ const recordingMocks = ${Object.keys(n.mocks||{}).length?JSON.stringify(n.mocks,null,2):"{}"};
32
+ const recordingData = { actions: ${JSON.stringify(n.actions)}, assertions: ${JSON.stringify(n.assertions||[])}, observeRoot: ${JSON.stringify(n.observeRoot||null)} };
26
33
 
27
34
  o.addTest('Recorded test', [
28
- ${e}
35
+ ${v.join(`,
36
+ `)}
37
+ // Add manual checks: ['Manual: label', () => o.testConfirm('label', ['item1'])],
29
38
  ], () => {
30
39
  // teardown
31
40
  });
32
- `},t.exportPlaywrightTest=(n,e={})=>{const o=e.testName||"Recorded session",r=n.initialData?.url??"/";let c="/";try{c=new URL(r).pathname||"/"}catch{c=r}const w=e.baseUrl||c,a=Object.values(n.mocks).map(l=>{const k=l.url.startsWith("/")?l.url:"/"+l.url,m=JSON.stringify(l.response);return` await page.route('**${k}', async route => {
33
- await route.fulfill({ status: ${l.status||200}, contentType: 'application/json',
41
+ `},t.exportPlaywrightTest=(n,e={})=>{const i=e.testName||"Recorded session",r=n.initialData?.url??"/";let d="/";try{d=new URL(r).pathname||"/"}catch{d=r}const w=e.baseUrl||d,u=Object.values(n.mocks).map(f=>{const S=f.url.startsWith("/")?f.url:"/"+f.url,m=JSON.stringify(f.response);return` await page.route('**${S}', async route => {
42
+ await route.fulfill({ status: ${f.status||200}, contentType: 'application/json',
34
43
  body: JSON.stringify(${m}) });
35
44
  });`}).join(`
36
- `),h=Object.assign({click:100,mouseover:50,scroll:30,input:50,change:50},n.stepDelays||{}),S=n.actions.map((l,k)=>{const m=l.listSelector!=null&&l.targetIndex!=null?l.target!==l.listSelector?`page.locator(${JSON.stringify(l.listSelector)}).nth(${l.targetIndex}).locator(${JSON.stringify(l.target)})`:`page.locator(${JSON.stringify(l.listSelector)}).nth(${l.targetIndex})`:`page.locator(${JSON.stringify(l.target)})`,E=` await page.waitForTimeout(${h[l.type]||50});`;let f;if(l.type==="scroll")f=` await page.evaluate(() => window.scrollTo(0, ${l.scrollY||0}));`;else if(l.type==="mouseover")f=` await ${m}.hover();
45
+ `),x=Object.assign({click:100,mouseover:50,scroll:30,input:50,change:50},n.stepDelays||{}),v=n.actions.map((f,S)=>{const m=f.listSelector!=null&&f.targetIndex!=null?f.target!==f.listSelector?`page.locator(${JSON.stringify(f.listSelector)}).nth(${f.targetIndex}).locator(${JSON.stringify(f.target)})`:`page.locator(${JSON.stringify(f.listSelector)}).nth(${f.targetIndex})`:`page.locator(${JSON.stringify(f.target)})`,O=` await page.waitForTimeout(${x[f.type]||50});`;let y;if(f.type==="scroll")y=` await page.evaluate(() => window.scrollTo(0, ${f.scrollY||0}));`;else if(f.type==="mouseover")y=` await ${m}.hover();
37
46
  // Pure CSS :hover \u2014 no DOM mutation to assert.
38
- // Fix: toggle a class in a mouseover handler, or add a page.screenshot() visual check.`;else if(l.type==="input")f=` await ${m}.fill(${JSON.stringify(l.value||"")});`;else if(l.type==="change"){const u=l.targetType||"";if(u.indexOf(":checkbox")!==-1||u.indexOf(":radio")!==-1){const y=l.checked!==void 0?l.checked:l.value==="true"||l.value==="on";f=` await ${m}.${y?"check":"uncheck"}();`}else u.indexOf("select")!==-1?f=` await ${m}.selectOption(${JSON.stringify(l.value||"")});`:f=` await ${m}.fill(${JSON.stringify(l.value||"")});`}else f=` await ${m}.click();`;const v=(n.assertions||[]).filter(u=>u.actionIdx===k).filter((u,y,x)=>x.findIndex(b=>b.selector===u.selector&&b.type===u.type&&b.index===u.index)===y).map(u=>{const y=u.listSelector!=null&&u.index!=null?u.selector!==u.listSelector?`page.locator(${JSON.stringify(u.listSelector)}).nth(${u.index}).locator(${JSON.stringify(u.selector)})`:`page.locator(${JSON.stringify(u.listSelector)}).nth(${u.index})`:`page.locator(${JSON.stringify(u.selector)})`;if(u.type==="visible"){let x=` await expect(${y}).toBeVisible();`;return u.text&&(x+=`
39
- await expect(${y}).toContainText(${JSON.stringify(u.text)});`),x}return u.type==="class"?` // class on ${u.selector} changed to: "${u.className}"`:""}).filter(Boolean).join(`
40
- `);return f+`
41
- `+E+(v?`
42
- `+v:"")}).join(`
43
- `),C=(n.assertions||[]).length>0;return`// Auto-generated by o.exportPlaywrightTest() \u2014 review and anonymize mocks before committing
47
+ // Fix: toggle a class in a mouseover handler, or add a page.screenshot() visual check.`;else if(f.type==="input")y=` await ${m}.fill(${JSON.stringify(f.value||"")});`;else if(f.type==="change"){const s=f.targetType||"";if(s.indexOf(":checkbox")!==-1||s.indexOf(":radio")!==-1){const c=f.checked!==void 0?f.checked:f.value==="true"||f.value==="on";y=` await ${m}.${c?"check":"uncheck"}();`}else s.indexOf("select")!==-1?y=` await ${m}.selectOption(${JSON.stringify(f.value||"")});`:y=` await ${m}.fill(${JSON.stringify(f.value||"")});`}else y=` await ${m}.click();`;const C=(n.assertions||[]).filter(s=>s.actionIdx===S).filter((s,c,g)=>g.findIndex(a=>a.selector===s.selector&&a.type===s.type&&a.index===s.index)===c).map(s=>{const c=s.listSelector!=null&&s.index!=null?s.selector!==s.listSelector?`page.locator(${JSON.stringify(s.listSelector)}).nth(${s.index}).locator(${JSON.stringify(s.selector)})`:`page.locator(${JSON.stringify(s.listSelector)}).nth(${s.index})`:`page.locator(${JSON.stringify(s.selector)})`;if(s.type==="visible"){let g=` await expect(${c}).toBeVisible();`;return s.text&&(g+=`
48
+ await expect(${c}).toContainText(${JSON.stringify(s.text)});`),g}return s.type==="class"?` // class on ${s.selector} changed to: "${s.className}"`:""}).filter(Boolean).join(`
49
+ `);return y+`
50
+ `+O+(C?`
51
+ `+C:"")}).join(`
52
+ `),I=(n.assertions||[]).length>0;return`// Auto-generated by o.exportPlaywrightTest() \u2014 review and anonymize mocks before committing
44
53
  // Prerequisites: npm install @playwright/test && npx playwright install chromium
45
54
  // Run: npx playwright test recorded.spec.ts
46
55
  import { test, expect } from '@playwright/test';
47
56
 
48
- test(${JSON.stringify(o)}, async ({ page }) => {
49
- `+(a?` // Network mocks \u2014 edit/anonymize before committing
50
- `+a+`
57
+ test(${JSON.stringify(i)}, async ({ page }) => {
58
+ `+(u?` // Network mocks \u2014 edit/anonymize before committing
59
+ `+u+`
51
60
 
52
61
  `:"")+` // Set baseURL in playwright.config.ts: { use: { baseURL: 'https://staging.example.com' } }
53
62
  await page.goto(${JSON.stringify(w)});
54
63
 
55
- `+(S?S+`
64
+ `+(v?v+`
56
65
 
57
- `:"")+(C?` // Auto-generated assertions above \u2014 review for correctness before committing
66
+ `:"")+(I?` // Auto-generated assertions above \u2014 review for correctness before committing
58
67
  `:` // TODO: Add assertions before committing, e.g.:
59
68
  // await expect(page.locator('[data-qa="success-panel"]')).toBeVisible();
60
69
  // await expect(page).toHaveURL(/\\/confirmation/);
61
70
  // await expect(page.locator('[data-qa="error-banner"]')).not.toBeVisible();
62
71
  `)+`});
63
- `},t.playRecording=(n,e={})=>{const o=Object.assign({},n.mocks,e),r=window.fetch;window.fetch=(a,h={})=>{const C=(h.method||"GET").toUpperCase()+":"+a;if(o[C]){const l=o[C],k=typeof l.response=="string"?l.response:JSON.stringify(l.response);return Promise.resolve(new Response(k,{status:l.status||200}))}return r(a,h)};const c=n.actions.map(a=>[`${a.type} on ${a.target}`,()=>{let h=null;if(a.target)if(a.listSelector!=null&&a.targetIndex!=null){const C=t.D.querySelectorAll(a.listSelector)[a.targetIndex];C&&(h=a.target!==a.listSelector?C.querySelector(a.target):C,!h&&a.target!==a.listSelector&&(h=C))}else h=t.D.querySelector(a.target);return!h&&a.type!=="scroll"?`element not found: ${a.target}`:(a.type==="scroll"?window.scrollTo(0,a.scrollY||0):a.type==="input"||a.type==="change"?(a.value!==void 0&&(h.value=a.value),a.checked!==void 0&&(h.checked=a.checked),h.dispatchEvent(new Event(a.type,{bubbles:!0}))):a.type==="click"?h.click():h.dispatchEvent(new MouseEvent(a.type,{bubbles:!0,cancelable:!0})),!0)}]);return t.test("Recorded playback",...c,()=>{window.fetch=r})},t.testOverlay=()=>{const n="o-test-overlay-btn",e="o-test-overlay-panel";if(t("#"+n).el)return;const o=()=>{const l=t("#"+e);if(!l.el)return;const k=t.tRes.length;let E=`<b>Tests: ${t.tRes.filter(Boolean).length}/${k}</b><hr style="margin:4px 0">`;t.tLog.forEach((f,v)=>{const u=t.tRes[v];E+=`<div style="margin:2px 0;padding:2px 4px;border-radius:3px;background:${u?"#d4edda":"#f8d7da"};color:${u?"#155724":"#721c24"};font-size:11px;white-space:pre-wrap">${f||"Test #"+v}</div>`}),E+='<button id="o-test-export" style="margin-top:6px;padding:4px 8px;font-size:11px;cursor:pointer">Export results</button>',l.html(E),t("#o-test-export").on("click",()=>{const f=JSON.stringify({results:t.tRes,logs:t.tLog},null,2),v=new Blob([f],{type:"application/json"}),u=t.D.createElement("a");u.href=URL.createObjectURL(v),u.download="objs-test-results.json",u.click()})},r={position:"fixed",left:"50%",bottom:"50px",transform:"translateX(-50%)","z-index":"999999",width:"fit-content","max-width":"min(90vw, 420px)","font-family":"system-ui,sans-serif",cursor:"grab","user-select":"text"},c=t.initState({tag:"div",id:n,className:"o-test-overlay",style:"position:fixed;left:50%;bottom:50px;transform:translateX(-50%);z-index:999999;width:fit-content;max-width:min(90vw,420px);font-family:system-ui,sans-serif;cursor:grab;user-select:text;",html:`<div class="o-test-overlay-bar" style="display:flex;flex-direction:column;align-items:stretch;padding:10px 14px;background:#1e293b;color:#e2e8f0;border:1px solid #334155;border-radius:8px;font-size:14px;cursor:grab;min-width:200px;"><div style="display:flex;align-items:center;gap:12px;"><span class="o-test-overlay-summary" style="flex:1;font-size:13px;">Tests: 0/0</span><button type="button" class="o-test-overlay-toggle" style="padding:6px 10px;background:#334155;color:#e2e8f0;border:none;border-radius:6px;cursor:pointer;font-size:12px;">List</button><button type="button" class="o-test-overlay-close" style="padding:4px 8px;background:transparent;color:#94a3b8;border:none;border-radius:4px;cursor:pointer;font-size:16px;line-height:1;" title="Close">\xD7</button></div></div><div id="${e}" style="display:none;margin-top:4px;padding:8px;background:#fff;border:1px solid #334155;border-radius:6px;max-height:60vh;overflow-y:auto;box-shadow:0 2px 8px rgba(0,0,0,.15);font-size:11px;user-select:text;cursor:text;"></div>`}).appendInside("body"),w=()=>{c.css(r)};let a=null;const h=l=>{a&&(r.left=a.left+(l.clientX-a.startX)+"px",r.top=a.top+(l.clientY-a.startY)+"px",delete r.bottom,r.transform="none",w())},S=()=>{a&&(r.cursor="grab",w()),a=null};c.on("mousedown",l=>{if(l.target.closest(".o-test-overlay-close")||l.target.closest(".o-test-overlay-toggle")||l.target.closest("#"+e))return;const k=c.el.getBoundingClientRect();a={startX:l.clientX,startY:l.clientY,left:k.left,top:k.top},r.cursor="grabbing",w()}),t.D.addEventListener("mousemove",h),t.D.addEventListener("mouseup",S);const C=()=>{const l=t(".o-test-overlay-summary");l.els.length&&l.innerText(`Tests: ${t.tRes.filter(Boolean).length}/${t.tRes.length}`)};c.first(".o-test-overlay-toggle").on("click",()=>{const l=t("#"+e);if(!l.el)return;const k=l.el.style.display!=="none";l.css({display:k?"none":"block"}),k||o()}),c.first(".o-test-overlay-close").on("click",()=>{t.D.removeEventListener("mousemove",h),t.D.removeEventListener("mouseup",S),c.remove()}),t.testOverlay.showPanel=()=>{const l=t("#"+e);l.el&&(l.css({display:"block"}),o(),C())},t._testOverlayBase||(t._testOverlayBase=t.test),t.test=(...l)=>{const k=t._testOverlayBase(...l),m=t.tFns[k];return t.tFns[k]=E=>{typeof m=="function"&&m(E);const f=t("#"+e);f.el&&f.el.style.display!=="none"&&o(),C()},k}},t.testConfirm=(n,e=[],o={})=>new Promise(r=>{t(".o-tc-overlay").remove();const c=o.confirm||"Continue",w=e.length>0,a=w?"#dc2626":"#2563eb",h=e.map((y,x)=>"o-tc-cb-"+x),C=w?`<style>.o-tc-item-cb{appearance:none;-webkit-appearance:none;width:16px;height:16px;border:2px solid #ef4444;border-radius:3px;background:#fef2f2;flex-shrink:0;cursor:pointer;}.o-tc-item-cb:checked{border-color:#22c55e;background:#22c55e;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");background-size:12px 12px;background-position:center;}</style><ul class="o-tc-list" style="margin:8px 0 0;padding:0;list-style:none;font-size:13px;color:#cbd5e1;">`+e.map((y,x)=>`<li style="margin-bottom:4px;"><label for="${h[x]}" style="display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;"><input type="checkbox" id="${h[x]}" class="o-tc-item-cb"> <span>${y}</span></label></li>`).join("")+"</ul>":"",l=t.initState({tag:"div",className:"o-tc-overlay",style:"position:fixed;left:50%;bottom:50px;transform:translateX(-50%);z-index:999999;width:fit-content;max-width:min(90vw,400px);font-family:system-ui,sans-serif;cursor:grab;user-select:text;",html:`<div class="o-tc-bar" style="display:flex;flex-direction:column;align-items:stretch;padding:10px 14px;background:#1e293b;color:#e2e8f0;border:1px solid #334155;border-radius:8px;font-size:14px;cursor:grab;min-width:280px;"><div style="display:flex;align-items:center;gap:12px;"><span class="o-tc-label" style="flex:1;">${n}: Paused</span><button type="button" class="o-tc-ok" style="padding:6px 14px;background:${a};color:#fff;border:none;border-radius:6px;font-weight:600;cursor:pointer;font-size:13px;flex-shrink:0;">${c}</button></div>`+C+"</div>"}).appendInside("body"),k={padding:"6px 14px",background:w?"#dc2626":"#2563eb",color:"#fff",border:"none","border-radius":"6px","font-weight":"600",cursor:"pointer","font-size":"13px","flex-shrink":"0"};if(w){const y=l.first(".o-tc-ok"),x=t(".o-tc-overlay .o-tc-item-cb"),b=()=>{const D=x.length>0&&x.els.every(I=>I.checked);y.css({...k,background:D?"#16a34a":"#dc2626"})};x.on("change",b)}let m=null;const E={position:"fixed",left:"50%",bottom:"50px",transform:"translateX(-50%)","z-index":"999999",width:"fit-content","max-width":"min(90vw, 400px)","font-family":"system-ui,sans-serif",cursor:"grab","user-select":"text"},f=()=>{l.css(E)},v=y=>{m&&(E.left=m.left+(y.clientX-m.startX)+"px",E.top=m.top+(y.clientY-m.startY)+"px",delete E.bottom,E.transform="none",f())},u=()=>{m&&(E.cursor="grab",f()),m=null};l.on("mousedown",y=>{if(y.target.closest(".o-tc-ok"))return;const x=l.el.getBoundingClientRect();m={startX:y.clientX,startY:y.clientY,left:x.left,top:x.top},E.cursor="grabbing",f()}),t.D.addEventListener("mousemove",v),t.D.addEventListener("mouseup",u),l.first(".o-tc-ok").on("click",()=>{t.D.removeEventListener("mousemove",v),t.D.removeEventListener("mouseup",u);let y=[];w&&t(".o-tc-overlay .o-tc-item-cb").els.forEach((b,D)=>{!b.checked&&e[D]!==void 0&&y.push(e[D])}),l.remove(),y.length===0?r({ok:!0}):r({ok:!1,errors:y})})});
72
+ `},t.playRecording=(n,e={})=>{const i=e&&typeof e=="object"&&(e.runAssertions!==void 0||e.root!==void 0||e.manualChecks!==void 0||e.actionDelay!==void 0),r=i?e.mockOverrides||{}:e,d=i&&e.runAssertions,w=i?e.root:void 0,u=i&&e.manualChecks||[],x=i&&e.actionDelay!==void 0?e.actionDelay:16,v=Object.assign({},n.mocks,r),I=window.fetch;window.fetch=(k,p={})=>{const N=(p.method||"GET").toUpperCase()+":"+k;if(v[N]){const $=v[N],T=typeof $.response=="string"?$.response:JSON.stringify($.response);return Promise.resolve(new Response(T,{status:$.status||200}))}return I(k,p)};const f=()=>{if(w!=null)return typeof w=="string"?t.D.querySelector(w)||t.D.body:w;const k=n.observeRoot;return k&&t.D.querySelector(k)||t.D.body},S=d?f():null,m=w!=null?f():t.D,O=n.actions,y=n.assertions||[],C={};for(const k of y){const p=k.actionIdx;C[p]||(C[p]=[]),C[p].push(k)}if(t.recordingAssertionDebug&&d&&typeof console<"u"&&console.log){const k=O.map((p,D)=>({i:D,action:p.type+" "+(p.target||""),assertions:(C[D]||[]).length,assertionDetails:(C[D]||[]).map(N=>({type:N.type,index:N.index,text:(N.text||"").slice(0,30)}))}));console.log("[playRecording] assertions by action:",k)}const s={};for(const k of u){const p=k.afterAction;s[p]||(s[p]=[]),s[p].push(k)}const c=[];let g={passed:0,total:0,failures:[]};for(let k=0;k<O.length;k++){const p=O[k];c.push([`${p.type} on ${p.target}`,async()=>{let N=null;const $=m;if(p.target)if(p.listSelector!=null&&p.targetIndex!=null){const R=$.querySelectorAll(p.listSelector)[p.targetIndex];R&&(N=p.target!==p.listSelector?R.querySelector(p.target):R,!N&&p.target!==p.listSelector&&(N=R))}else N=$.querySelector(p.target);return!N&&p.type!=="scroll"?`element not found: ${p.target}`:(p.type==="scroll"?window.scrollTo(0,p.scrollY||0):p.type==="input"||p.type==="change"?(p.value!==void 0&&(N.value=p.value),p.checked!==void 0&&(N.checked=p.checked),N.dispatchEvent(new Event(p.type,{bubbles:!0}))):p.type==="click"?N.click():N.dispatchEvent(new MouseEvent(p.type,{bubbles:!0,cancelable:!0})),x>0&&await t.sleep(x),!0)}]);const D=C[k];d&&D&&D.length>0&&c.push([`assert after ${p.type}`,()=>new Promise(N=>{const $=()=>{const T=t.runRecordingAssertions(n,S,k,{assertions:D,removedElements:n.removedElements});g.passed+=T.passed,g.total+=T.total,g.failures.push(...T.failures),N(T.passed===T.total?!0:T.failures.map(R=>R.selector+": "+R.message).join("; "))};requestAnimationFrame(()=>requestAnimationFrame($))})]);for(const N of s[k]||[])c.push([`Manual: ${N.label}`,()=>typeof t.testConfirm=="function"?t.testConfirm(N.label,N.items||[]):{ok:!0}])}for(const k of s.end||[])c.push([`Manual: ${k.label}`,()=>typeof t.testConfirm=="function"?t.testConfirm(k.label,k.items||[]):{ok:!0}]);const a=i&&e.onComplete,L=t.test("Recorded playback",...c,{sync:!0},k=>{window.fetch=I;const p=d&&y.length>0?g:void 0;if(p?.failures?.length>0){t.tRes[k]=!1;const D=p.failures.map($=>`${$.selector}: ${$.message}`).join("; "),N=t.tStyled?t.tPre+t.tXx+"Assertions failed: "+D+t.tDc:`
73
+ \u2718 Assertions failed: `+D;t.tLog[k]=(t.tLog[k]||"")+N}typeof a=="function"&&a(p)});return d?{testId:L}:L},t.testOverlay=()=>{const n="o-test-overlay-btn",e="o-test-overlay-panel";if(t("#"+n).el)return;const i=()=>{const u=t("#"+e);if(!u.el)return;const x=t.tRes.length;let I=`<b>Tests: ${t.tRes.filter(Boolean).length}/${x}</b><hr style="margin:4px 0">`;t.tLog.forEach((f,S)=>{const m=t.tRes[S];I+=`<div style="margin:2px 0;padding:2px 4px;border-radius:3px;background:${m?"#d4edda":"#f8d7da"};color:${m?"#155724":"#721c24"};font-size:11px;white-space:pre-wrap">${f||"Test #"+S}</div>`}),I+='<button id="o-test-export" style="margin-top:6px;padding:4px 8px;font-size:11px;cursor:pointer">Export results</button>',u.html(I),t("#o-test-export").on("click",()=>{const f=JSON.stringify({results:t.tRes,logs:t.tLog},null,2),S=new Blob([f],{type:"application/json"}),m=t.D.createElement("a");m.href=URL.createObjectURL(S),m.download="objs-test-results.json",m.click()})},r=`<div style="display:flex;align-items:center;gap:12px;"><span class="o-test-overlay-summary" style="flex:1;font-size:13px;cursor:grab;">Tests: 0/0</span><button type="button" class="o-test-overlay-toggle" style="padding:6px 10px;background:#334155;color:#e2e8f0;border:none;border-radius:6px;cursor:pointer;font-size:12px;">List</button><button type="button" class="o-test-overlay-close" style="padding:4px 8px;background:transparent;color:#94a3b8;border:none;border-radius:4px;cursor:pointer;font-size:16px;line-height:1;" title="Close">\xD7</button></div><div id="${e}" style="display:none;margin-top:4px;padding:8px;background:#fff;border:1px solid #334155;border-radius:6px;max-height:240px;overflow-y:auto;box-shadow:0 2px 8px rgba(0,0,0,.15);font-size:11px;user-select:text;cursor:text;"></div>`,d=t.overlay({innerHTML:r,removeExisting:!1,className:"o-test-overlay",id:n,excludeDragSelector:".o-test-overlay-close, .o-test-overlay-toggle, #"+e}),w=()=>{const u=t(".o-test-overlay-summary");u.els.length&&u.innerText(`Tests: ${t.tRes.filter(Boolean).length}/${t.tRes.length}`)};d.first(".o-test-overlay-toggle").on("click",()=>{const u=t("#"+e);if(!u.el)return;const x=u.el.style.display!=="none";u.css({display:x?"none":"block"}),x||i()}),d.first(".o-test-overlay-close").on("click",()=>{d._overlayCleanup()}),t.testOverlay.showPanel=()=>{const u=t("#"+e);u.el&&(u.css({display:"block"}),i(),w())},t._testOverlayBase||(t._testOverlayBase=t.test),t.test=(...u)=>{const x=t._testOverlayBase(...u),v=t.tFns[x];return t.tFns[x]=I=>{typeof v=="function"&&v(I);const f=t("#"+e);f.el&&f.el.style.display!=="none"&&i(),w()},x}},t.overlay=(n={})=>{const{innerHTML:e,onClose:i,timeout:r,excludeDragSelector:d,removeExisting:w=!0,className:u="o-overlay-common",id:x}=n;if(w)t("."+u).remove();else if(x&&t("#"+x).el)return t("#"+x);const v={position:"fixed",left:"50%",bottom:"50px",transform:"translateX(-50%)","z-index":"999999",width:"fit-content","max-width":"min(90vw, 420px)","font-family":"system-ui,sans-serif","user-select":"text"},I="o-overlay-countdown",f='<div class="o-overlay-bar" style="display:flex;flex-direction:column;align-items:stretch;padding:10px 14px;background:#1e293b;color:#e2e8f0;border:1px solid #334155;border-radius:8px;font-size:14px;min-width:200px;max-height:90vh;overflow-y:auto;">'+e+(r?`<div id="${I}" style="margin-top:6px;font-size:11px;color:#94a3b8;"></div>`:"")+"</div>",S=t.initState({tag:"div",className:u,id:x||void 0,style:"position:fixed;left:50%;bottom:50px;transform:translateX(-50%);z-index:999999;width:fit-content;max-width:min(90vw,420px);font-family:system-ui,sans-serif;user-select:text;",html:f}).appendInside("body"),m=()=>S.css(v);let O=null;const y=g=>{O&&(v.left=O.left+(g.clientX-O.startX)+"px",v.top=O.top+(g.clientY-O.startY)+"px",delete v.bottom,v.transform="none",m())},C=()=>{O&&(delete v.cursor,m()),O=null};S.on("mousedown",g=>{if(d&&g.target.closest(d))return;const a=S.el.getBoundingClientRect();O={startX:g.clientX,startY:g.clientY,left:a.left,top:a.top},v.cursor="grabbing",m()}),t.D.addEventListener("mousemove",y),t.D.addEventListener("mouseup",C);let s;const c=()=>{t.D.removeEventListener("mousemove",y),t.D.removeEventListener("mouseup",C),s&&clearInterval(s),S.remove()};if(r&&r>0){let g=Math.ceil(r/1e3);const a=t("#"+I);a.el&&(a.el.textContent=g?`Continue in ${g}s`:""),s=setInterval(()=>{g-=1,a.el&&(a.el.textContent=g>0?`Continue in ${g}s`:""),g<=0&&(clearInterval(s),s=null,c(),typeof i=="function"&&i({ok:!1,errors:["timeout"]}))},1e3)}return S._overlayCleanup=c,S._overlayOnClose=i,S},t.testConfirm=(n,e=[],i={})=>new Promise(r=>{const d=i.confirm||"Continue",w=e.length>0,u=w?"#dc2626":"#2563eb",x=e.map((O,y)=>"o-tc-cb-"+y),I=w?`<style>.o-tc-item-cb{appearance:none;-webkit-appearance:none;width:16px;height:16px;border:2px solid #ef4444;border-radius:3px;background:#fef2f2;flex-shrink:0;cursor:pointer;}.o-tc-item-cb:checked{border-color:#22c55e;background:#22c55e;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");background-size:12px 12px;background-position:center;}</style><ul class="o-tc-list" style="margin:8px 0 0;padding:0;list-style:none;font-size:13px;color:#cbd5e1;cursor:grab;">`+e.map((O,y)=>`<li style="margin-bottom:4px;"><label for="${x[y]}" style="display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;"><input type="checkbox" id="${x[y]}" class="o-tc-item-cb"> <span>${O}</span></label></li>`).join("")+"</ul>":"",f=`<div style="display:flex;align-items:center;gap:12px;"><span class="o-tc-label" style="flex:1;cursor:grab;">${n}: Paused</span><button type="button" class="o-tc-ok" style="padding:6px 14px;background:${u};color:#fff;border:none;border-radius:6px;font-weight:600;cursor:pointer;font-size:13px;flex-shrink:0;">${d}</button></div>`+I,S=t.overlay({innerHTML:f,timeout:i.timeout,excludeDragSelector:".o-tc-ok",onClose:O=>r(O||{ok:!0})}),m={padding:"6px 14px",background:w?"#dc2626":"#2563eb",color:"#fff",border:"none","border-radius":"6px","font-weight":"600",cursor:"pointer","font-size":"13px","flex-shrink":"0"};if(w){const O=S.first(".o-tc-ok"),y=t(".o-overlay-common .o-tc-item-cb"),C=()=>{const s=y.length>0&&y.els.every(c=>c.checked);O.css({...m,background:s?"#16a34a":"#dc2626"})};y.on("change",C)}S.first(".o-tc-ok").on("click",()=>{let O=[];if(w){const y=t(".o-overlay-common .o-tc-item-cb");y.els.length&&y.els.forEach((C,s)=>{!C.checked&&e[s]!==void 0&&O.push(e[s])})}S._overlayCleanup(),r(O.length===0?{ok:!0}:{ok:!1,errors:O})})});
64
74
 
65
75
  export { o };
66
76
  export default o;
package/objs.d.ts CHANGED
@@ -179,7 +179,8 @@ export interface ObjsInstance {
179
179
 
180
180
  // Selection
181
181
  reset(query: QueryArg): ObjsInstance;
182
- select(i?: number): ObjsInstance;
182
+ /** Select by index or by event: select(e) selects the element in this instance that contains e.target. */
183
+ select(i?: number | Event): ObjsInstance;
183
184
  all(): ObjsInstance;
184
185
  find(query: string): ObjsInstance;
185
186
  first(query?: string): ObjsInstance;
@@ -197,6 +198,8 @@ export interface ObjsInstance {
197
198
 
198
199
  // DOM manipulation
199
200
  html(html?: string): string | ObjsInstance;
201
+ toString(): string;
202
+ [Symbol.toPrimitive](hint: string): string | number;
200
203
  innerHTML(html?: string): string[] | ObjsInstance;
201
204
  innerText(text: string): ObjsInstance;
202
205
  textContent(content: string): ObjsInstance;
@@ -271,7 +274,7 @@ declare namespace o {
271
274
  // Element selection
272
275
  function first(query: string): ObjsInstance;
273
276
  function take(query: QueryArg): ObjsInstance;
274
-
277
+
275
278
  // State
276
279
  function init(states: StatesMap | StateFunction | string): ObjsInstance;
277
280
  function initState(state: StateObject, props?: Record<string, unknown>): ObjsInstance;
@@ -390,13 +393,25 @@ declare namespace o {
390
393
  function startRecording(observe?: string, events?: string[], timeouts?: Record<string, number>): void;
391
394
  function stopRecording(): Recording;
392
395
  function clearRecording(id?: number): void;
393
- function exportTest(recording: Recording): string;
396
+ function exportTest(recording: Recording, options?: { delay?: number }): string;
397
+ /**
398
+ * Run recording assertions against the current DOM.
399
+ * @param recording Recording with assertions
400
+ * @param root Root element or selector (default: document)
401
+ * @param actionIdx When provided, run only assertions for this action index
402
+ */
403
+ function runRecordingAssertions(
404
+ recording: Recording,
405
+ root?: Element | string,
406
+ actionIdx?: number
407
+ ): { passed: number; total: number; failures: Array<{ selector: string; message: string }> };
394
408
  function exportPlaywrightTest(
395
409
  recording: Recording,
396
410
  options?: { testName?: string; baseUrl?: string }
397
411
  ): string;
398
412
 
399
413
  // Test framework
414
+ function sleep(ms: number): Promise<void>;
400
415
  let tLog: string[];
401
416
  let tRes: boolean[];
402
417
  let tStatus: Array<Array<boolean | undefined>>;
@@ -409,7 +424,16 @@ declare namespace o {
409
424
  let tBeforeEach: ((info: TestInfo) => void) | undefined;
410
425
  let tAfterEach: ((info: TestInfo, result: unknown) => void) | undefined;
411
426
 
412
- function test(title: string, ...cases: Array<TestCase | (() => void)>): number;
427
+ /** Options for o.test when sync or confirmOnFailure is needed */
428
+ interface TestOptions {
429
+ sync?: boolean;
430
+ confirmOnFailure?: boolean;
431
+ confirmOnFailureTimeout?: number;
432
+ }
433
+ function test(
434
+ title: string,
435
+ ...cases: Array<TestCase | TestOptions | (() => void)>
436
+ ): number;
413
437
  function addTest(title: string, ...cases: Array<TestCase | { before?: Function; after?: Function }>): TestHandle;
414
438
  function runTest(testId?: number, autoRun?: boolean, savePrev?: boolean): void;
415
439
  function testUpdate(info: TestInfo, result?: boolean | string, suffix?: string): void;
@@ -438,8 +462,36 @@ declare namespace o {
438
462
  ): boolean | string;
439
463
 
440
464
  // Dev-only replay + overlay (depend on o.test framework)
441
- function playRecording(recording: Recording, mockOverrides?: Recording['mocks']): number;
465
+ /** Manual check inserted after an action or at end of playback */
466
+ interface ManualCheck {
467
+ afterAction: number | 'end';
468
+ label: string;
469
+ items: string[];
470
+ }
471
+ /** Options for o.playRecording when runAssertions is used */
472
+ interface PlayRecordingOptions {
473
+ runAssertions?: boolean;
474
+ root?: string;
475
+ actionDelay?: number;
476
+ manualChecks?: ManualCheck[];
477
+ mockOverrides?: Recording['mocks'];
478
+ onComplete?: (assertionResult?: { passed: number; total: number; failures: Array<{ selector: string; message: string }> }) => void;
479
+ }
480
+ function playRecording(
481
+ recording: Recording,
482
+ opts?: Recording['mocks'] | PlayRecordingOptions
483
+ ): number | { testId: number };
442
484
  function testOverlay(): void;
485
+ /** Common draggable overlay; used by testConfirm, testOverlay, confirmOnFailure */
486
+ function overlay(opts: {
487
+ innerHTML: string;
488
+ onClose?: (result?: { ok?: boolean; errors?: string[]; continue?: boolean }) => void;
489
+ timeout?: number;
490
+ excludeDragSelector?: string;
491
+ removeExisting?: boolean;
492
+ className?: string;
493
+ id?: string;
494
+ }): ObjsInstance;
443
495
  /**
444
496
  * Pause an Objs browser test; shows a draggable bar with "Test title: Paused", optional checklist (labels + checkboxes), and Continue.
445
497
  * Dev-only. Returns ok: true if all items checked; ok: false with errors = list of unchecked item texts.
@@ -447,7 +499,7 @@ declare namespace o {
447
499
  function testConfirm(
448
500
  label: string,
449
501
  items?: string[],
450
- opts?: { confirm?: string }
502
+ opts?: { confirm?: string; timeout?: number }
451
503
  ): Promise<{ ok: boolean; errors?: string[] }>;
452
504
  }
453
505