diff --git a/ofa.js/app-config.js b/ofa.js/app-config.js new file mode 100644 index 0000000..fae5a18 --- /dev/null +++ b/ofa.js/app-config.js @@ -0,0 +1,45 @@ +export const home = "./pages/home.html"; + +export const loading = () => { + const loadingEl = $({ + tag: "div", + css: { + width: "100%", + height: "100%", + position: "absolute", + zIndex: 1000, + left: 0, + top: 0, + }, + html: ` +
+ `, + }); + + setTimeout(() => (loadingEl[0].style.width = "98%")); + + loadingEl.remove = () => { + loadingEl[0].style["transition-duration"] = "0.1s"; + loadingEl[0].style.width = "100%"; + setTimeout(() => { + $.fn.remove.call(loadingEl); + }, 200); + }; + + return loadingEl; +}; + +export const pageAnime = { + current: { + opacity: 1, + transform: "translate(0, 0)", + }, + next: { + opacity: 0, + transform: "translate(30px, 0)", + }, + previous: { + opacity: 0, + transform: "translate(-30px, 0)", + }, +}; diff --git a/ofa.js/images/logo.svg b/ofa.js/images/logo.svg new file mode 100644 index 0000000..7b419f6 --- /dev/null +++ b/ofa.js/images/logo.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + diff --git a/ofa.js/index.html b/ofa.js/index.html new file mode 100644 index 0000000..19cef5c --- /dev/null +++ b/ofa.js/index.html @@ -0,0 +1,25 @@ + + + + + + ofa.js app + + + + + + + + + + diff --git a/ofa.js/ofa.4.3.20.min.js b/ofa.js/ofa.4.3.20.min.js new file mode 100644 index 0000000..bc44d39 --- /dev/null +++ b/ofa.js/ofa.4.3.20.min.js @@ -0,0 +1,3 @@ +//! ofa.js - v4.3.20 https://github.com/kirakiray/ofa.js (c) 2018-2023 YAO +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).$=t()}(this,(function(){"use strict";const e=()=>Math.random().toString(32).slice(2),t=Object.prototype.toString,r=e=>t.call(e).toLowerCase().replace(/(\[object )|(])/g,""),n=e=>{const t=r(e);return"array"===t||"object"===t};let s,i=0;const a=new Set;function o(t){const r=`t-${e()}`;return clearTimeout(s),s=setTimeout((()=>{i=0})),a.add(r),Promise.resolve().then((()=>{if(i++,i>5e4){a.clear();const e="nextTick exceeds thread limit";throw console.error({desc:e,lastCall:t}),new Error(e)}a.has(r)&&(t(),a.delete(r))})),r}const l=(e,t,r={})=>([...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)].forEach((n=>{const s=Object.getOwnPropertyDescriptor(t,n),{configurable:i,enumerable:a,writable:o,get:l,set:c,value:h}=s;"value"in s?e.hasOwnProperty(n)?e[n]=h:Object.defineProperty(e,n,{enumerable:a,configurable:i,writable:o,...r,value:h}):Object.defineProperty(e,n,{enumerable:a,configurable:i,...r,get:l,set:c})})),e);function c(e){try{e.xid}catch(e){return h(e)}return!1}function h(e){const t=e.stack.split(/\\n/)[0].toLowerCase();return!(!t.includes("proxy")||!t.includes("revoked"))}const d=e=>r(e).includes("function"),u=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase()));const f=e=>e.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})),p=(e,t)=>{const r=document.createElement("template");return r.content.append(e.cloneNode()),!!r.content.querySelector(t)};const m=(e,t)=>{const r=e.indexOf(t);r>-1&&e.splice(r,1)},g=(e,t)=>e instanceof HTMLTemplateElement?Array.from(e.content.querySelectorAll(t)):Array.from(e.querySelectorAll(t));const{assign:_,freeze:y}=Object;class w{constructor(e){_(this,e),y(this)}hasModified(e){if("array"===this.type)return this.path.includes(this.currentTarget.get(e));const t=e.split(".");if(this.currentTarget===this.target&&this.name===t[0])return!0;const r=b(this,t).indexOf(this.target);if(r>-1){const e=t.slice(r+1);return!e.length||this.name===e[0]}return this.path.includes(this.currentTarget[e])}hasReplaced(e){if("set"!==this.type)return!1;const t=e.split(".");if(this.target===this.currentTarget&&this.name===t[0])return!0;const r=b(this,t).indexOf(this.target);if(r>-1){return t.slice(r+1)[0]===this.name}return!1}}const b=(e,t)=>{const r=[],n=t.slice();let s=e.currentTarget;for(;n.length;){const e=n.shift();s&&(s=s[e]),r.push(s)}return r};class v extends Array{constructor(e){super(...e)}hasModified(e){return this.some((t=>t.hasModified(e)))}hasReplaced(e){return this.some((t=>t.hasReplaced(e)))}}const k=({type:e,currentTarget:t,target:r,name:n,value:s,oldValue:i,args:a,path:o=[]})=>{if(o&&o.includes(t))return void console.warn("Circular references appear");let l={type:e,target:r,name:n,oldValue:i,value:s};if("array"===e&&(delete l.value,l.args=a),t._hasWatchs){const e=new w({currentTarget:t,...l,path:[...o]});t[N].forEach((t=>{t(e)}))}t._update&&t.owner.forEach((e=>{k({currentTarget:e,...l,path:[t,...o]})}))};var E={watch(t){const r="w-"+e();return this[N].set(r,t),r},unwatch(e){return this[N].delete(e)},watchTick(e,t){return this.watch(function(e,t=0){let r=null,n=[];return function(...s){n.push(...s),t>0?(clearTimeout(r),r=setTimeout((()=>{e.call(this,n),n=[],r=null}),t)):null===r&&(r=1,o((()=>{e.call(this,n),n=[],r=null})))}}((t=>{c(this)||(t=t.filter((e=>{try{e.path.forEach((e=>e.xid))}catch(e){return!1}return!0})),e(new v(t)))}),t||0))},refresh(e){const t={...e,type:"refresh",target:this,currentTarget:this};k(t)}};const x=Symbol("placeholder");const T={},A=Array.prototype;["push","pop","shift","unshift","splice","reverse","sort","fill","copyWithin"].forEach((e=>{A[e]&&(T[e]=function(...t){const r=Array.from(this),s=A[e].apply(this[j],t),{deletedItems:i,addedItems:a}=function(e,t){const r=Array.from(t),n=Array.from(e),s=[],i=new Map,a=e.length;for(let t=0;t-1?r[i]=x:s.push(n)}const o=t.length;for(let e=0;e-1?n[s]=x:i.set(e,r)}return{deletedItems:s,addedItems:i}}(r,this);for(let[e,t]of a)C(t)?t._owner.push(this):n(t)&&(this.__unupdate=1,this[e]=t,delete this.__unupdate);for(let e of i)I(e,this);return k({type:"array",currentTarget:this,target:this,args:t,name:e,oldValue:r}),s===this[j]?this[M]:s})}));const{defineProperties:O,getOwnPropertyDescriptor:S,entries:L}=Object,j=Symbol("self"),M=Symbol("proxy"),N=Symbol("watchs"),R=Symbol("isxdata"),C=e=>e&&!!e[R];function P(t,r=F){let n,{proxy:s,revoke:i}=Proxy.revocable(this,r);return s._update=1,O(this,{xid:{value:t.xid||e()},_owner:{value:[]},owner:{configurable:!0,get(){return new Set(this._owner)}},[R]:{value:!0},[j]:{configurable:!0,get:()=>this},[M]:{configurable:!0,get:()=>s},[N]:{get:()=>n||(n=new Map)},_hasWatchs:{get:()=>!!n},_revoke:{value:i}}),Object.keys(t).forEach((e=>{const r=S(t,e);let{value:n,get:i,set:a}=r;i||a?O(this,{[e]:r}):s[e]=n})),s}class H extends Array{constructor(e){return super(),P.call(this,e)}revoke(){const e=this[j];e._onrevokes&&(e._onrevokes.forEach((e=>e())),e._onrevokes.length=0),e.__unupdate=1,e[N].clear(),L(this).forEach((([e,t])=>{C(t)&&(this[e]=null)})),e._owner.forEach((e=>{L(e).forEach((([t,r])=>{r===this&&(e[t]=null)}))})),delete e[j],delete e[M],e._revoke()}toJSON(){let e={},t=!0,r=-1;Object.keys(this).forEach((n=>{let s=this[n];/\D/.test(n)?t=!1:(n=parseInt(n))>r&&(r=n),C(s)&&(s=s.toJSON()),e[n]=s})),t&&(e.length=r+1,e=Array.from(e));const n=this.xid;return O(e,{xid:{get:()=>n}}),e}toString(){return JSON.stringify(this.toJSON())}extend(e,t){return l(this,e,t)}get(e){if(/\./.test(e)){const t=e.split(".");let r=this;for(let e=0,n=t.length;e{const o=s[t];let l=r;if(C(l)){if(o===r)return!0;l._owner.push(s)}else if(n(r)){const n=Object.getOwnPropertyDescriptor(e,t);n&&!n.hasOwnProperty("value")||(l=new H(r),l._owner.push(s))}const c=o===r;!c&&C(o)&&I(o,s);const h=a(l);return!c&&!e.__unupdate&&k({type:i||"set",target:s,currentTarget:s,name:t,value:r,oldValue:o}),h},I=(e,t)=>{if(C(e)){const r=e._owner.indexOf(t);r>-1?e._owner.splice(r,1):console.error({desc:"This data is wrong, the owner has no boarding object at the time of deletion",target:t,mismatch:e})}},F={set(e,t,r,n){if("symbol"==typeof t)return Reflect.set(e,t,r,n);if(/^_/.test(t))return e.hasOwnProperty(t)?Reflect.set(e,t,r,n):U(e,{[t]:{writable:!0,configurable:!0,value:r}}),!0;try{return D({target:e,key:t,value:r,receiver:n,succeed:r=>Reflect.set(e,t,r,n)})}catch(e){const s=new Error(`failed to set ${t} \n ${e.stack}`);throw Object.assign(s,{key:t,value:r,target:n,error:e}),s}},deleteProperty:(e,t)=>/^_/.test(t)||"symbol"==typeof t?Reflect.deleteProperty(e,t):D({target:e,key:t,value:void 0,receiver:e[M],type:"delete",succeed:()=>Reflect.deleteProperty(e,t)})};document.createElement("template");const q={set:(e,t,r,n)=>/\D/.test(String(t))?"html"===t?Reflect.set(e,t,r,n):F.set(e,t,r,n):Reflect.set(e,t,r,n),get:(e,t,r)=>/\D/.test(String(t))?Reflect.get(e,t,r):Re(e.ele.children[t]),ownKeys(e){let t=Reflect.ownKeys(e),r=e.ele.children.length;for(let e=0;e"string"!=typeof t||/\D/.test(t)?Reflect.getOwnPropertyDescriptor(e,t):{enumerable:!0,configurable:!0}},B={beforeRender(){},render(){}},W=e=>e.__revokes||(e.__revokes=[]),V=(e,t)=>W(e).push(t),J=(e,t,r)=>{const n=`\nconst isRevokedErr = ${h.toString()}\nconst [$event] = $args;\nconst {data, errCall} = this;\ntry{\n with(data){\n return ${e};\n }\n}catch(error){\n if(isRevokedErr(error)){\n return;\n }\n if(data.ele && !data.ele.isConnected){\n return;\n }\n if(errCall){\n const result = errCall(error);\n if(result !== false){\n console.error(error);\n }\n }else{\n console.error(error);\n }\n}\n`;return new Function("...$args",n).bind({data:t,...r})};function z({data:e,target:t,template:r,temps:n,isRenderSelf:s,...i}){const a=r&&r.innerHTML;a&&(t.innerHTML=a),B.beforeRender({target:t});const o=g(t,"xtext"),l=[],c=W(t);o.forEach((t=>{const r=document.createTextNode(""),{parentNode:n}=t;n.insertBefore(r,t),n.removeChild(t);const s=J(t.getAttribute("expr"),e),i=()=>{r.textContent=s()};l.push(i);const a=()=>{m(c,a),m(l,i),m(W(r),a)};c.push(a),V(r,a)}));const h=g(t,"[x-bind-data]");if(s&&p(t,"[x-bind-data]")&&h.unshift(t),h.forEach((r=>{const n=JSON.parse(r.getAttribute("x-bind-data")),s=Re(r);for(let[i,a]of Object.entries(n))a.forEach((n=>{try{const{always:a}=s[i];let o,h=[];const d=()=>{const[r,a]=n,o=J(a,e,{errCall:e=>{const r=`Rendering of target element failed: ${s.ele.outerHTML} \n ${e.stack}`;return console.error(r),console.error({stack:r,element:s.ele,target:t,error:e}),!1}});h=[r,o];const l=s[i](...h,{actionName:i,target:s,data:e,beforeArgs:n,args:h});return B.render({step:"refresh",args:n,name:i,target:s}),l};let u=()=>{const{revoke:t}=s[i];t&&t({actionName:i,target:s,data:e,beforeArgs:n,args:h,result:o}),m(c,u),m(W(r),u),m(l,d),u=null};a?l.push(d):o=d(),c.push(u),r!==t&&V(r,u)}catch(e){const t=new Error(`Execution of the ${i} method reports an error: ${i}:${n[0]}="${n[1]}" \n ${e.stack}`);throw t.error=e,t}}));r.removeAttribute("x-bind-data"),r._bindingRendered=!0,r.dispatchEvent(new Event("binding-rendered"))})),t.__render_temps||function(e){if(!e)return!1;for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(n)||(t.__render_temps=n),l.length){if(t.__render_data&&t.__render_data!==e){const r=new Error("An old listener already exists and the rendering of this element may be wrong");throw Object.assign(r,{element:t,old:t.__render_data,new:e}),r}t.__render_data=e,l.forEach((e=>e()));const r=e.watchTick((t=>{l.length?l.forEach((e=>e())):e.unwatch(r)}))}B.render({step:"init",target:t})}const K=e=>{const{tagName:t}=e;if("TEMPLATE"!==t){if(t){const t={};Array.from(e.attributes).forEach((r=>{const n=/(.*):(.+)/.exec(r.name);if(!n)return;let[,s,i]=n;s||(s="prop");(t[s]||(t[s]=[])).push([i,r.value]),e.removeAttribute(r.name)}));Object.keys(t).length&&e.setAttribute("x-bind-data",JSON.stringify(t))}Array.from(e.children).forEach(K)}},G=(e,t,r)=>{const n=Array.from(e.content.querySelectorAll(t));return r&&n.forEach(r),n};let X;const Y=t=>{let r={};const n={};G(t,"code",(t=>{const r=e();t.setAttribute("code-id",r),n[r]=t.innerHTML,t.innerHTML=""})),t.innerHTML=t.innerHTML.replace(/{{(.+?)}}/g,((e,t)=>``));const s=t.getAttribute("name");if(s){const e=t.content.children;if(e.length>1){X||(console.warn("Only one child element can be contained within a template element. If multiple child elements appear, the child elements will be rewrapped within a
element"),X=1);const r=`wrapper-${s}`;t.innerHTML=`
${t.innerHTML}
`,console.warn(`The template "${s}" contains ${e.length} child elements that have been wrapped in a div element with attribute "${r}".`)}else if(0===e.length)throw new Error(`The template "${s}" needs to have at least one child element`);r[s]=t,t.remove()}G(t,"x-fill:not([name])",(t=>{if(t.querySelector("x-fill:not([name])"))throw`Don't fill unnamed x-fills with unnamed x-fill elements!!!\n${t.outerHTML}`;const r=`t${e()}`;t.setAttribute("name",r);const n=document.createElement("template");n.setAttribute("name",r),n.innerHTML=t.innerHTML,t.innerHTML="",t.appendChild(n)})),G(t,"x-if,x-else-if,x-else",(e=>{const t=e.children[0];t&&"TEMPLATE"===t.tagName||(e.innerHTML=``)})),G(t,"template",(e=>{const t=Y(e);Object.keys(t).forEach((e=>{if(r[e])throw new Error(`Template "${e}" already exists`)})),r={...r,...t}})),Array.from(t.content.children).forEach((e=>K(e)));for(let[e,r]of Object.entries(n))G(t,`[code-id="${e}"]`,(e=>{e.removeAttribute("code-id"),e.innerHTML=r}));return r},Z=e=>d(e)?e():e,Q={prop(...e){let[t,r]=e;if(1===e.length)return this[t];r=Z(r),t=u(t),this.set(t,r)},attr(...e){let[t,r]=e;if(1===e.length)return this.ele.getAttribute(t);r=Z(r),null===r?this.ele.removeAttribute(t):this.ele.setAttribute(t,r)},class(...e){let[t,r]=e;if(1===e.length)return this.ele.classList.contains(t);r=Z(r),r?this.ele.classList.add(t):this.ele.classList.remove(t)}};Q.prop.always=!0,Q.attr.always=!0,Q.class.always=!0,Q.prop.revoke=({target:e,args:t,$ele:r,data:n})=>{const s=t[0];e.set(s,null)};const ee={sync(e,t,r){if(!r)throw"Sync is only allowed within the renderer";[e,t]=r.beforeArgs;const{data:n}=r;if(n.get(t)instanceof Object){const e=`Object values cannot be synchronized using the sync function : ${t}`;throw console.log(e,n),new Error(e)}this[e]=n.get(t);const s=this.watch((r=>{if(r.hasModified(e))try{const r=this.get(e);n.set(t,r)}catch(e){}})),i=n.watch((r=>{if(r.hasModified(t))try{const r=n.get(t);this.set(e,r)}catch(e){}}));return()=>{this.unwatch(s),n.unwatch(i)}}};ee.sync.revoke=e=>{e.result()};const te={on(e,t,r){let n;if(r){const s=r.beforeArgs[1];/[^\d\w_\$\.]/.test(s)||(t=r.data.get(s).bind(r.data)),n=()=>this.ele.removeEventListener(e,t)}return this.ele.addEventListener(e,t),n||this},one(e,t,r){const n=r=>{this.off(e,n),t(r)};return this.on(e,n,r),this},off(e,t){return this.ele.removeEventListener(e,t),this},emit(e,t){const r={...t};let n,s;return r.hasOwnProperty("data")&&(n=r.data,delete r.data),e instanceof Event?s=e:e&&(s=new Event(e,{bubbles:!0,...r})),n&&(s.data=n),this.ele.dispatchEvent(s),this}};te.on.revoke=e=>{e.result()};const re=(e,t,r,...n)=>{const{children:s}=e;t<0&&(t+=e.children.length),void 0===r&&(r=e.children.length-t);const i=[];for(let e=t,n=t+r;ee&&e.remove())),n.length){const r=document.createDocumentFragment();n.forEach((e=>r.append(Pe(e).ele)));const i=s[t];i?e.insertBefore(r,i):e.appendChild(r)}return i},ne=["push","pop","shift","unshift","splice","reverse","sort","fill","copyWithin"],se={push(...e){const{ele:t}=this;return re(t,t.children.length,0,...e),k({type:"array",currentTarget:this,target:this,args:e,name:"push"}),t.children.length},pop(...e){const{ele:t}=this,r=re(t,t.children.length-1,1,...e);return k({type:"array",currentTarget:this,target:this,args:e,name:"pop"}),Re(r[0])},shift(...e){const{ele:t}=this,r=re(t,0,1,...e);return k({type:"array",currentTarget:this,target:this,args:e,name:"shift"}),Re(r[0])},unshift(...e){const{ele:t}=this;return re(t,0,0,...e),k({type:"array",currentTarget:this,target:this,args:e,name:"unshift"}),t.children.length},splice(...e){const t=re(this.ele,...e);return k({type:"array",currentTarget:this,target:this,args:e,name:"splice"}),t.map(Re)},reverse(...e){const t=Array.from(this.ele.childNodes);ie.reverse.call(t,...e);const r=document.createDocumentFragment();return t.forEach((e=>{e.__internal=1,r.append(e)})),this.ele.append(r),t.forEach((e=>{delete e.__internal})),k({type:"array",currentTarget:this,target:this,args:e,name:"reverse"}),this},sort(...e){const t=Array.from(this.ele.children).map(Re);ie.sort.call(t,...e);const r=document.createDocumentFragment();return t.forEach((e=>{e.ele.__internal=1,r.append(e.ele)})),this.ele.append(r),t.forEach((e=>{delete e.ele.__internal})),k({type:"array",currentTarget:this,target:this,args:e,name:"sort"}),this}},ie=Array.prototype;Object.keys(Object.getOwnPropertyDescriptors(ie)).forEach((e=>{if("constructor"===e||"length"===e||ne.includes(e))return;const t=ie[e];d(t)&&(se[e]=function(...e){return t.apply(Array.from(this.ele.children).map(Re),e)})}));class ae{}for(let[e,t]of Object.entries(se))Object.defineProperty(ae.prototype,e,{value:t});const oe=e=>new H(e);Object.assign(oe,{is:C});const{defineProperty:le,assign:ce}=Object,he=(e,t)=>{const{ele:r}=t;e.forEach((e=>{if(e in r){let n=!1;le(t,e,{enumerable:!0,get:()=>{let t=r[e];return n&&(/\D/.test(t)?n=!1:t=Number(t)),t},set:t=>{n="number"==typeof t,r[e]=t}})}}))},de=new Set(["input","textarea","select","option","button","label","fieldset","legend","form"]),ue=(e,t={})=>{const{name:r,type:n}=t,{ele:s}=e;let i=s[r];e.on(n,(()=>{k({type:"set",target:e,currentTarget:e,name:r,value:s[r],oldValue:i}),i=s[r]}))},fe=e=>{switch(e.attr("type")){case"file":he(["multiple","files"],e),ue(e,{name:"files",type:"change"});break;case"checkbox":he(["checked","multiple","value"],e),ue(e,{name:"checked",type:"change"});break;case"radio":he(["checked","value"],e),ue(e,{name:"checked",type:"change"});break;default:he(["placeholder","value"],e),ue(e,{name:"value",type:"input"})}},pe=(e,t)=>{const r={};return e.all(t).forEach((e=>{const{name:t,tag:n,ele:s}=e;if("input"===n)switch(e.type){case"checkbox":t in r||(r[t]=[]),s.checked&&r[t].push(s.value);break;case"radio":s.checked&&(r[t]=s.value);break;case"file":r[t]=s.files;break;default:r[t]=s.value}else if("textarea"===n)r[t]=s.value;else if("select"===n){const e=g(s,"option:checked");if(s.multiple)r[t]=e.map((e=>e.value||e.textContent));else{const[n]=e;r[t]=n.value||n.textContent}}else r[t]=e.value})),r};var me={formData(e,t={wait:200}){const r=oe({});ce(r,pe(this,e||"input,select,textarea"));const n=this.watchTick((t=>{const n=pe(this,e||"input,select,textarea");!function(e,t){for(let r of Object.keys(e))t.hasOwnProperty(r)||delete e[r];for(let[r,n]of Object.entries(t))e[r]=n}(r,n)}),t.wait),s=r.watchTick((t=>{!function(e,t,r){const n=e.all(t);Object.keys(r).forEach((e=>{const t=n.filter((t=>t.attr("name")===e));if(0===t.length)return;const s=r[e],i=t[0],a=i.attr("type");if(1===t.length){let e=!0;if("input"!==i.tag||"radio"!==a&&"checkbox"!==a||(e=!1),e)return void(i.value!==s&&(i.value=s))}t.forEach((e=>{switch(e.attr("type")){case"radio":e.value===s?e.checked=!0:e.checked=!1;break;case"checkbox":e.checked=s.includes(e.value)}}))}))}(this,e||"input,select,textarea",r)})),i=this,a=r.revoke;return r.extend({revoke(){i.unwatch(n),r.unwatch(s),a.call(this)}}),r}};const ge={set:(e,t,r,n)=>(e._ele.style[t]=r,Reflect.set(e,t,r,n),!0),get(e,t,r){if("length"===t)return 0;const{style:n}=e._ele;return Array.from(n).includes(t)?n[t]:getComputedStyle(e._ele)[t]}};class _e{constructor(e){const t={};Object.defineProperty(t,"_ele",{enumerable:!1,get:()=>e.ele});const{style:r}=e.ele;return Array.from(r).forEach((e=>{t[e]=r[e]})),e._css=new Proxy(t,ge)}}var ye={get css(){return new _e(this)},set css(e){if("string"==r(e))return void(this.ele.style=e);let{style:t}=this,n=Object.keys(e);Array.from(t).forEach((e=>{n.includes(e)||(t[e]="")})),Object.assign(t,e)}};const we={},be=({defaults:e,ele:t,template:r,temps:n})=>{let s;try{const i={...Ee(e.data),...e.attrs};s=Re(t),e.proto&&s.extend(e.proto,{enumerable:!1});for(let[e,t]of Object.entries(i))s.hasOwnProperty(e)||(s[e]=t);if(e.temp){const e=t.attachShadow({mode:"open"});e.innerHTML=r.innerHTML,z({target:e,data:s,temps:n})}e.ready&&e.ready.call(s)}catch(e){const r=new Error(`Render element error: ${t.tagName} \n ${e.stack}`);throw r.error=e,r}if(e.watch){const t=Object.entries(e.watch);s.watchTick((e=>{for(let[r,n]of t)e.hasModified(r)&&n.call(s,s[r],{watchers:e})}));for(let[e,r]of t)r.call(s,s[e],{})}},ve=(e={})=>{const t={tag:"",temp:"",data:{},proto:{},...e};let r,n,s;try{if(function(e){if("-"===e.charAt(0)||"-"===e.charAt(e.length-1))throw new Error(`The string "${e}" cannot start or end with "-"`);for(let t=0;t{let t;return t=e instanceof Array?[...e]:Object.keys(e),t},o=we[s]=class extends HTMLElement{constructor(...e){super(...e);const s=Re(this);if(t.created&&t.created.call(s),t.attrs){const e=a(t.attrs);s.watchTick((t=>{e.forEach((e=>{if(t.hasModified(e)){const t=s[e],r=f(e);null==t?this.removeAttribute(r):this.setAttribute(r,t)}}))}))}be({defaults:t,ele:this,template:r,temps:n})}connectedCallback(){ke(this)||t.attached&&t.attached.call(Re(this))}disconnectedCallback(){ke(this)||t.detached&&t.detached.call(Re(this))}attributeChangedCallback(e,t,r){const n=Re(this);/[^\d.]/.test(r)||"number"!=typeof n[e]||(r=Number(r)),n[u(e)]=r}static get observedAttributes(){return a(t.attrs||{}).map((e=>f(e)))}};if("loading"!==document.readyState)customElements.define(t.tag,o);else{const e="readystatechange";let r;document.addEventListener(e,r=()=>{customElements.define(t.tag,o),document.removeEventListener(e,r)})}};function ke(e){let t=e;for(;t;){if(t.__internal)return!0;if(t=t.parentNode||t.host,!t||t.tagName&&"BODY"===t.tagName)break}return!1}function Ee(e){if(e instanceof Set||e instanceof Map)throw"The data of the registered component should contain only regular data types such as String, Number, Object and Array. for other data types, please set them after ready.";if(e instanceof Function)throw"Please write the function in the 'proto' property object.";if("object"!=typeof e||null===e)return e;const t=Array.isArray(e)?[]:{};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=Ee(e[r]));return t}class xe extends Comment{constructor(e){const t="Fake Node"+(e?": "+e:"");super(` ${t} --end `),this._mark=e,this._inited=!1;const r=new Comment(` ${t} --start `);r.__fake_end=this,Object.defineProperty(this,"_start",{value:r})}init(){this._inited||(this.parentNode.insertBefore(this._start,this),this._inited=!0)}querySelector(e){return this.__searchEl(e,"find")}querySelectorAll(e){return this.__searchEl(e)}__searchEl(e,t="filter"){const r=this.parentNode;if(!r)return[];const n=this.children;return Array.from(r.querySelectorAll(e))[t]((e=>{let t=e;for(;;){if(n.includes(t))return!0;if(t=t.parentNode,!t)break}}))}insertBefore(e,t){const{parentNode:r}=this;Array.from(r.children).includes(t)?r.insertBefore(e,t):r.insertBefore(e,this)}appendChild(e){this.parentNode.insertBefore(e,this)}get children(){const e=[];let t=this;for(;;){if(t=t.previousSibling,!t)throw"This is an unclosed FakeNode";if(t instanceof HTMLElement)e.unshift(t);else if(t===this._start)break}return e}get childNodes(){const e=[];let t=this;for(;;){if(t=t.previousSibling,!t)throw"This is an unclosed FakeNode";if(t===this._start)break;e.unshift(t)}return e}set innerHTML(e){this.childNodes.forEach((e=>{e.remove()}));const t=document.createElement("template");t.innerHTML=e,Array.from(t.content.childNodes).forEach((e=>{this.appendChild(e)}))}get innerHTML(){const{children:e}=this;let t="";return e.forEach((e=>{t+=e.outerHTML+"\n"})),t}get nextElementSibling(){let e=this.nextSibling;return e?e.__fake_end?e.__fake_end:(!e||e instanceof Element||(e=e.nextElementSibling),e):null}get previousElementSibling(){const{_start:e}=this;let t=e.previousSibling;return t?t instanceof xe?t:e.previousElementSibling:null}}const $e=e=>{if(e.parentNode){const t=e.parentNode;Array.from(e.content.children).forEach((r=>{t.insertBefore(r,e)})),e.remove()}};if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent))B.beforeRender=({target:e})=>{let t=[];for(;t=Array.from(e.querySelectorAll('template[is="replace-temp"]')),t.length;)t.forEach((e=>{$e(e)}))};else{class e extends HTMLTemplateElement{constructor(){super(),this.init()}init(){$e(this)}connectedCallback(){this.init()}}customElements.define("replace-temp",e,{extends:"template"})}const Te={data:{value:null,__rendered:!1},watch:{value(){this._bindend&&this.refreshValue()}},proto:{refreshValue(){clearTimeout(this._timer),this._timer=setTimeout((()=>{const e=[this,...this._others];let t=!1;e.forEach((e=>{t?e._clearContent():e.value||"x-else"===e.tag?(t=!0,e._renderContent()):e._clearContent()})),Re(this._fake.parentNode).refresh()}),0)},_renderContent(){if(this.__rendered)return;this.__rendered=!0;const e=Ae(this._fake);if(!e)return;const{target:t,data:r,temps:n}=e;c(r)||(this._fake.innerHTML=this.__originHTML,z({target:t,data:r,temps:n}))},_clearContent(){this.__rendered=!1,He(this._fake),this._fake.innerHTML=""},init(){if(this._bindend)return;this._bindend=!0;const e=this._fake=new xe(this.tag);if(this.before(e),e.init(),this.remove(),"x-if"===this.tag){const t=this._others=[];let r=e;for(;r=r.nextElementSibling,r;)switch(r.tagName){case"X-ELSE":{const e=Re(r);return e.init?e.init():e._if_ready=1,void t.push(e)}case"X-ELSE-IF":{const e=Re(r);e._xif=this,t.push(e);break}}}}},created(){this.__originHTML=this.$("template[condition]").html,this.html=""},ready(){this.ele._bindingRendered?this.init():this.one("binding-rendered",(()=>this.init()))}};ve({tag:"x-if",...Te}),ve({tag:"x-else-if",...Te,watch:{value(){this._bindend&&this._xif&&this._xif.refreshValue()}}}),ve({tag:"x-else",...Te,watch:{},ready(){this._if_ready&&this.init()}});const Ae=e=>{for(;e&&!e.__render_data;)e=e.parentNode;return e?{target:e,data:e.__render_data,temps:e.__render_temps}:null};ve({tag:"x-fill",data:{value:null},watch:{value(){this.refreshValue()}},proto:{refreshValue(){const e=this.value;if(!this._bindend)return;const t=this._fake.children;if(!e)return t.forEach((e=>He(e))),void(this._fake.innerHTML="");if(!(e instanceof Array))return console.warn(`The value of x-fill component must be of type Array, and the type of the current value is ${getType(e)}`),void(t&&t.forEach((e=>{He(e),e.remove()})));const r=Ae(this._fake);if(!r)return;const n=t.map((e=>e._data_xid||e)),{data:s,temps:i}=r,a=i[this._name],o=e.length;let l;for(let r=0;r-1){if(c===r){l=t[r];continue}const e=t[c];Re(e).__item.$index=r,e.__internal=1,0===r?this._fake.insertBefore(e,t[0]):this._fake.insertBefore(e,l.nextElementSibling),l=e,delete e.__internal;continue}const h=Oe(o,i,a,s.$host||s,r);l?this._fake.insertBefore(h.ele,l.nextSibling):t.length?this._fake.insertBefore(h.ele,t[0]):this._fake.appendChild(h.ele),l=h.ele}const c=this._fake.children;o{e.remove(),He(e)})),Re(this._fake.parentNode).refresh()},init(){if(this._bindend)return;this._bindend=!0;const e=this._fake=new xe("x-fill");this.before(e),e.init(),this.remove(),this.refreshValue()}},ready(){this._name=this.attr("name"),this.ele._bindingRendered?this.init():this.one("binding-rendered",(()=>this.init()))}});const Oe=(e,t,r,n,s)=>{const i=Pe(r.innerHTML),a=new H({$data:e,$ele:i,$host:n,$index:s});z({target:i.ele,data:a,temps:t,$host:n,isRenderSelf:!0});const o=i.ele.__revokes,l=()=>{m(o,l),a.revoke()};return o.push(l),i.__item=a,i.ele._data_xid=e.xid||e,i},{defineProperties:Se}=Object,Le=({_this:e,ele:t,proxySelf:r})=>{const n={owner:{get(){const{parentNode:r}=t,{_owner:n}=e,s=r?[Re(r),...n]:[...n];return new Set(s)}},ele:{get:()=>t}},s=t.tagName&&t.tagName.toLowerCase();s&&(n.tag={enumerable:!0,value:s}),Se(e,n),(e=>{const{tag:t}=e;if(de.has(t))switch(he(["type","name","disabled"],e),t){case"input":fe(e);break;case"textarea":he(["value"],e),ue(e,{name:"value",type:"input"});break;case"option":he(["selected","value"],e);break;case"select":{const{ele:t}=e;e.watch((()=>{t.value=e.value})),e.on("change",(()=>{e.value=t.value}))}}})(r)};class je extends ae{constructor({ele:e}){super();const t=P.call(this,{},q);return Le({_this:this,ele:e,proxySelf:t}),e.__xhear__=t,t}get length(){return this.ele&&this.ele.children.length}$(e){let{ele:t}=this;t instanceof HTMLTemplateElement&&(t=t.content);const r=t.querySelector(e);return r?Re(r):null}all(e){return g(this.ele,e).map(Re)}extend(e,t){return l(this,e,t)}get text(){return this.ele.textContent}set text(e){this.ele.textContent=e}get html(){return this.ele.innerHTML}set html(e){this.ele.innerHTML=e}get classList(){return this.ele.classList}get data(){return this.ele.dataset}get shadow(){return Re(this.ele.shadowRoot)}get root(){const e=this.ele.getRootNode();return e?Re(e):null}get host(){let e=this.ele.getRootNode(),{host:t}=e;return t instanceof Node?Re(t):null}get parent(){let{parentNode:e}=this.ele;return e&&e!==document?Re(e):null}get parents(){const e=[];let t=this;for(;t.parent;)t=t.parent,e.push(t);return e}get next(){const e=this.ele.nextElementSibling;return e?Re(e):null}after(e){const{next:t}=this;t?t.before(e):this.parent.push(e)}get nexts(){const{parent:e}=this,t=this.index;return e.filter(((e,r)=>r>t))}get prev(){const e=this.ele.previousElementSibling;return e?Re(e):null}before(e){const t=Pe(e);this.parent.ele.insertBefore(t.ele,this.ele)}get prevs(){const{parent:e}=this,t=this.index;return e.filter(((e,r)=>re!==this))}get index(){let{parentNode:e}=this.ele;return e?Array.prototype.indexOf.call(e.children,this.ele):null}get style(){return this.ele.style}get width(){return parseInt(getComputedStyle(this.ele).width)||0}get height(){return parseInt(getComputedStyle(this.ele).height)||0}get clientWidth(){return this.ele.clientWidth}get clientHeight(){return this.ele.clientHeight}get offsetWidth(){return this.ele.offsetWidth}get offsetHeight(){return this.ele.offsetHeight}get outerWidth(){let e=getComputedStyle(this.ele);return this.ele.offsetWidth+parseInt(e["margin-left"])+parseInt(e["margin-right"])}get outerHeight(){let e=getComputedStyle(this.ele);return this.ele.offsetHeight+parseInt(e["margin-top"])+parseInt(e["margin-bottom"])}is(e){return p(this.ele,e)}remove(){const{parent:e}=this;e.splice(e.indexOf(this),1)}clone(e=!0){return Re(this.ele.cloneNode(e))}wrap(e){const t=Pe(e),{ele:r}=this;if(!r.parentNode)throw"The target has a sibling element, so you can't use unwrap";return r.parentNode.insertBefore(t.ele,r),r.__internal=1,t.ele.appendChild(r),delete r.__internal,this}unwrap(){const{ele:e}=this,t=e.parentNode;if(t.children.length>1)throw"The element itself must have a parent";return e.__internal=1,t.parentNode.insertBefore(e,t),t.remove(),delete e.__internal,this}}const Me=H.prototype,Ne=je.prototype;Ne.extend({get:Me.get,set:Me.set,toJSON:Me.toJSON,toString:Me.toString,...E,...te,...Q,...ee,...me},{enumerable:!1}),Ne.extend(ye);const Re=e=>e?e.__xhear__?e.__xhear__:new je({ele:e}):null,Ce=document.createElement("template"),Pe=(e,t)=>{if(e instanceof je)return e;if(e instanceof Node||e===window)return Re(e);switch(r(e)){case"object":return(e=>{const t={...e};if(!e.tag)return null;const r=document.createElement(e.tag);delete t.tag;const n=Re(r);return Object.assign(n,t),n})(e);case"string":return(e=>{Ce.innerHTML=e;const t=Ce.content.children[0]||Ce.content.childNodes[0];return Ce.innerHTML="",Re(t)})(e)}},He=e=>{e.__revokes&&Array.from(e.__revokes).forEach((e=>e&&e())),e.childNodes&&Array.from(e.childNodes).forEach((e=>{He(e)}));const t=e?.shadowRoot?.__revokes;t&&[...t].forEach((e=>e()))};function Ue(e){if("string"===r(e)&&!/<.+>/.test(e)){const t=document.querySelector(e);return Re(t)}return Pe(e)}function De(e,t,r,n){let s=e.host.root.$(`[inject-host="${t}"]`);if(s)return s.ele.__items.add(n),void(n.__host_link=s);s=r(),s.attr("inject-host",t),s.ele.__items=new Set([n]),n.__host_link=s;const{root:i}=e.host;i.ele===document?document.head.appendChild(s.ele):i.root.push(s)}function Ie(e){if(e.__inited&&e.__host_link){const t=e.__host_link.ele.__items;t.delete(e),t.size||e.__host_link.remove(),delete e.__inited}}Object.defineProperties(Ue,{extensions:{value:{}}}),Object.assign(Ue,{stanz:oe,render:z,convert:Y,register:ve,fn:je.prototype,all:e=>g(document,e).map(Re)}),Ue.register({tag:"inject-host",temp:"",data:{},proto:{init(){this.ele.isConnected&&this.forEach((e=>this._init(e)))},_init(e){if(!e.ele.__inited)switch(e.tag){case"link":this._initLink(e);break;case"style":this._initStyle(e);break;case"x-if":case"x-else-if":case"x-else":case"x-fill":break;default:console.log("This element will be invalidated within the inject-host",e)}},_initLink(e){const t=e.attr("href"),r=e.attr("rel");if("stylesheet"!==r&&"host"!==r)throw'The "rel" attribute of the "link" tag within "inject-host" can only use "stylesheet" as its value.';let{ele:n}=e;"host"!==r&&(e.attr("rel","host"),e.attr("href",t)),n.__inited=!0,n._revoke=()=>{Ie(n),n._revoke=null},De(this,t,(()=>{const t=e.clone();return t.attr("rel","stylesheet"),t}),n)},async _initStyle(e){const t=new Comment(e.html);t.__inited=!0,t._revoke=()=>{Ie(e.ele),delete t.__inited,delete e.ele.__inited,t._revoke=null,e.ele._revoke=null},e.html="",e.push(t),e.ele.__inited=!0,e.ele._revoke=t._revoke;De(this,function(e){let t=0,r=e.length;for(let n=0;n>>19,t=7*t-3*t}return t.toString(36)+"--"+r}(t.data),(()=>Ue(``)),e.ele)}},attached(){(this._obs=new MutationObserver((e=>{for(let t of e)if("attributes"===t.type){if("x-bind-data"===t.attributeName)continue;const{target:e}=t;e.__inited&&(e._revoke(),this._init(Re(e)))}else"childList"===t.type&&(t.removedNodes.forEach((e=>{e.__inited&&e._revoke()})),t.addedNodes.forEach((e=>{if(!e.__inited){if(e instanceof Text&&"STYLE"===e.parentElement.tagName&&this.init(e.parentNode),e.__inited)return;if(e instanceof Text||e instanceof Comment)return;this._init(Re(e))}})))}))).observe(this.ele,{attributes:!0,childList:!0,subtree:!0}),this.init()},detached(){this.forEach((e=>Ie(e.ele))),this._obs.disconnect()}});class Fe{constructor(){this._middlewares=new Map}use(e){const t=Math.random().toString(32).slice(2);return this._middlewares.set(t,e),t}unuse(e){return this._middlewares.delete(e)}async run(e){let t=-1;const r=Array.from(this._middlewares.values()),n=async()=>{t++,t{(qe[e]||(qe[e]=new Fe)).use(t)},We=(e,t)=>{e instanceof Function&&(t=e,e=["js","mjs"]),e instanceof Array?e.forEach((e=>{Be(e,t)})):Be(e,t)};We(["mjs","js"],(async(e,t)=>{if(!e.result){const{url:t,params:r}=e,n=new URL(t),s=/^blob:/.test(t)||/^data:/.test(t);try{s||r.includes("-direct")?e.result=await import(t):e.result=await import(`${n.origin}${n.pathname}`)}catch(r){const n=Ve(`Failed to load module ${e.realUrl||t}`,r);throw s&&console.log("Failed to load module:",e),n}}await t()})),We(["txt","html","htm"],(async(e,t)=>{if(!e.result){const{url:t}=e;let r;try{r=await fetch(t)}catch(e){throw Ve(`Load ${t} failed`,e)}if(!/^2.{2}$/.test(r.status))throw new Error(`Load ${t} failed: status code ${r.status}`);e.result=await r.text()}await t()})),We("json",(async(e,t)=>{if(!e.result){const{url:t}=e;e.result=await fetch(t).then((e=>e.json()))}await t()})),We("wasm",(async(e,t)=>{if(!e.result){const{url:t}=e,r=await fetch(t).then((e=>e.arrayBuffer())),n=await WebAssembly.compile(r),s=new WebAssembly.Instance(n);e.result=s.exports}await t()})),We("css",(async(e,t)=>{if(!e.result){const{url:t,element:r}=e;if(r){const e=document.createElement("link");e.rel="stylesheet",e.href=t;const n=r.getRootNode();let s;n===document?n.head.append(e):n.appendChild(e),r.addEventListener("disconnected",s=t=>{e.remove(),r.removeEventListener("disconnected",s)})}else e.result=await fetch(t).then((e=>e.text()))}await t()}));const Ve=(e,t)=>{const r=new Error(`${e} \n ${t.toString()}`);return r.error=t,r},Je=Symbol("loaded"),ze=async(e,t)=>{const r=new URL(e),{pathname:n}=r;let s,i=null;t.params&&t.params.forEach((e=>{/^\..+/.test(e)?s=e.replace(/^\.(.+)/,"$1"):/^\-\-real/.test(e)&&(i=e.replace(/^\-\-real\:/,""))})),s||(s=n.slice(2+(n.lastIndexOf(".")-1>>>0)));const a={url:e,result:null,realUrl:i,...t},o=qe[s];if(o?await o.run(a):a.result=fetch(e),t&&t.element){const{element:e}=t;e[Je]=!0;const r=new Event("load");e.dispatchEvent(r)}return t.params&&t.params.includes("-ctx")?a:a.result};function Ke(e){return(e=>(e||(e={url:document.location.href}),t=>{let r="";const[n,...s]=t.split(" ");if(e.resolve)r=e.resolve(n);else{const t=new URL(e.url);r=new URL(n,t).href}return ze(r,{params:s})}))(e)}Object.assign(Ke,{use:We});class Ge extends HTMLElement{constructor(...e){super(...e),this[Je]=!1,Object.defineProperties(this,{loaded:{get:()=>this[Je]}}),this._init()}_init(){if(this.__initSrc||this.attributes.hasOwnProperty("pause"))return;let e=this.getAttribute("src");if(!e)return;this.__initSrc=e,e=new URL(e,location.href).href,Object.defineProperties(this,{src:{configurable:!0,value:e}});const[t,...r]=e.split(" ");ze(t,{element:this,params:r})}connectedCallback(){const e=new CustomEvent("connected");e.root=this._root=this.getRootNode(),this.dispatchEvent(e)}disconnectedCallback(){const e=new CustomEvent("disconnected");e.root=this._root,delete this._root,this.dispatchEvent(e)}attributeChangedCallback(e,t,r){"src"===e?r&&null===t?this._init():this.__initSrc&&t&&r!==this.__initSrc&&(console.warn(`${this.tagName.toLowerCase()} change src is invalid, only the first change will be loaded`),this.setAttribute("src",this.__initSrc)):"pause"===e&&null===r&&this._init()}static get observedAttributes(){return["src","pause"]}}class Xe extends Ge{constructor(...e){super(...e)}}const Ye=()=>{customElements.define("load-module",Ge),customElements.define("l-m",Xe),window.removeEventListener("load",Ye)};function Ze(e,t){const[r,...n]=e.split(" "),s=t?new URL(t,location.href):location.href;if(r.startsWith("http://")||r.startsWith("https://"))return r;const i=new URL(r,s);return n.length?`${i.href} ${n.join(" ")}`:i.href}function Qe(e,t){g(e,"[href],[src]").forEach((e=>{["href","src"].forEach((r=>{const n=e.getAttribute(r);/^#/.test(n)||n&&!/^(https?:)?\/\/\S+/.test(n)&&e.setAttribute(r,Ze(n,t))}))}))}function et(e,t){const r=document.createElement("template");return r.innerHTML=e,Qe(r.content,t),g(r.content,"style").forEach((e=>{const r=e.innerHTML;e.innerHTML=r.replace(/url\((.+)\)/g,((e,r)=>`url(${Ze(r,t)})`))})),r.innerHTML}"complete"===document.readyState?Ye():window.addEventListener("load",Ye),window.lm=Ke;const tt=Symbol("loadError"),rt=async e=>{const t=lm({url:e}),r=[];let n,s,i,a=e;for(;;){try{let e=a;const[r]=a.split(" "),s=new URL(r);/\/$/.test(s.pathname)&&(e+=" .html"),n=await t(e)}catch(e){let t;t=s?new Error(`${s} request to parent page(${a}) fails; \n ${e.stack}`):new Error(`Request for ${a} page failed; \n ${e.stack}`),t.error=e,i=t,console.error(i)}if(i){r.unshift({src:e,ISERROR:tt,error:i});break}if(r.unshift({src:a,defaults:n}),!n.parent)break;s=a,a=new URL(n.parent,a).href}return r},nt=(e,t)=>{const r=document.createElement("div");r.innerHTML=``;const n=$(r.children[0]);return n._pause_init=1,o((()=>{n._renderDefault(t),delete n._pause_init})),n},st=B.render;B.render=e=>{st&&st(e);const{step:t,name:r,target:n}=e,{link:s}=Ue.extensions;if("init"===t)n.host&&s&&Ue(n).all("a").forEach((e=>s(e)));else if("attr"===r&&"refresh"===t&&""===n.attr("olink")){const e=n.parents.pop()||n;if(e.__fixLinkTimer)return;e.__fixLinkTimer=o((()=>{const{host:t}=n;t&&"o-page"===t.tag&&Qe(e.ele,t.src),s&&Ue(e).all("a").forEach((e=>s(e))),delete e.__fixLinkTimer}))}};const it=e=>{const t=Ue(e);t.on("click",(e=>{if(e.__processed)return;const r=Ue(e.target);let n=[r,...r.parents].find((e=>"a"===e.tag));if(n&&(n=n.ele),n&&n.attributes.hasOwnProperty("olink"))if(t.app){if(e.metaKey||e.shiftKey)return;if(e.defaultPrevented)return;e.preventDefault();let r=!1;if(e.preventDefault=()=>{r=!0},e.__processed=!0,"A"===n.tagName){const e=n.getAttribute("origin-href");setTimeout((()=>{const s=e||n.href;s&&!r&&t.app.goto(s)}))}}else console.warn("olink is only allowed within o-apps")}))},at=async(e,t,r=!0)=>{const n=new File([e],"genfile",{type:"js"===t?"text/javascript":"application/json"});if(!r)return URL.createObjectURL(n);return await new Promise((e=>{const t=new FileReader;t.onload=t=>{e(t.target.result)},t.readAsDataURL(n)}))},ot=new Map;async function lt(e,t,r=!0){let n=ot.get(t);if(n)return n;let s=!0;$.hasOwnProperty("debugMode")&&(s=$.debugMode);const i=$("");i.html=e;const a=i.$("title"),o=i.$(`template[${r?"page":"component"}]`),l=o.$("script");l&&l.remove();let c="";!!o.html.replace(/\<\!\-\-[\s\S]*?\-\-\>/g,"").trim()&&(c=o.html.replace(/\s+$/,"").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"));const h=`\n export const type = ${r?"$.PAGE":"$.COMP"};\n export const PATH = '${t}';\n ${r&&a?`export const title = '${a.text}';`:""}\n export const temp = \`${c}\`;`;let d="";l&&(l.html.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"").replace(/(import [\s\S]+?from .+);?/g,(e=>e.replace(/([\s\S]+?from )([\s\S]+);?/,((t,r,n)=>{if((!/`/.test(n)||/\$\{.*\}/.test(n))&&!/['"]/.test(n))throw new Error(`Unable to parse addresses of strings with variables: ${e}`)})))),d=l.html.replace(/([\s\S]+?from )['"](.+?)['"]/g,((e,r,n)=>`${r}"${Ze(n,t)}";`)));const u=`${h};\n${d}`;let f="";s&&(f=`//# sourceMappingURL=${await(async(e,t,r)=>{const n=t.split("\n");let s="";for(let e=0;e<=r;e++)s+=";";const i=n.findIndex((e=>" + diff --git a/ofa.js/pages/syntax/text.html b/ofa.js/pages/syntax/text.html new file mode 100644 index 0000000..42f742b --- /dev/null +++ b/ofa.js/pages/syntax/text.html @@ -0,0 +1,22 @@ + diff --git a/ofa.js/router.4.3.20.min.js b/ofa.js/router.4.3.20.min.js new file mode 100644 index 0000000..87732f8 --- /dev/null +++ b/ofa.js/router.4.3.20.min.js @@ -0,0 +1,3 @@ +//! ofa.js - v4.3.20 https://github.com/kirakiray/ofa.js (c) 2018-2023 YAO +!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";new Set;const t=`f-${Math.random().toString(32).slice(2)}`;$.register({tag:"o-router",temp:"",attrs:{fixBody:null},watch:{fixBody(e){if(null!==e){const e=document.createElement("style");e.setAttribute(t,""),e.innerHTML="html,body{margin:0;padding:0;width:100%;height:100%;}",document.head.append(e)}else{const e=document.head.querySelector(t);e&&e.remove()}}},attached(){const t=this.$("o-app");!history.state&&window.location.hash&&(t.$("o-page")?.remove(),t.goto(location.hash.replace("#",""))),this._popstateFunc=function({app:t,getStateUrl:e,fixStateUrl:o}){let r,n,s,i,a;return history.state&&history.state.routerMode&&(t.routers=history.state.routers),t.on("router-change",(o=>{let a="pushState";const{name:c,delta:h,src:l}=o.data||{};switch(c){case"replace":a="replaceState";case"goto":const{routers:o}=t,{pathname:c,search:u}=new URL(l,location.href);if(n)return void(n=null);const d=e?e(c,u,a):`#${c}${u}`;i&&(a="replaceState",i=null),history[a]({routerMode:1,routers:o.map((t=>({src:t.src})))},"",d);break;case"back":if(s)return void(s=null);r=1,history.go(-h)}})),window.addEventListener("popstate",a=e=>{const{state:a}=e;if(r)return void(r=null);if(!a){if(o){const e=o();if(e)return i=1,void t.goto(e);if(!1===e)return}return s=1,void t.back(t.routers.length-1)}if(!a.routerMode||a.ignore)return;const{routers:c}=a,{routers:h}=t;if(c.lengthh.length){const e=c.slice(),o=e.pop();if(e.length>h.length){const o=e.slice(t._history.length);t._history.push(...o)}n=1,t.goto(o.src)}else JSON.stringify(c)!==JSON.stringify(h)&&console.error("o-router error occurred")}),a}({app:t,fixStateUrl(){const t=new URL(location.href);if(t.hash)return t.hash.replace("#","")}})},detached(){this._popstateFunc&&window.removeEventListener("popstate",this._popstateFunc)}}),$.extensions.link=t=>{if(""===t.attr("olink")){const e=t.attr("href");let o;try{o=new URL(e)}catch(t){return}if(!/^#\//.test(o.hash)){t.attr("origin-href",e);const o=new URL(e);t.attr("href",`${location.origin}${location.pathname}#${o.pathname}`)}}}})); +//# sourceMappingURL=router.min.js.map