mirror of https://github.com/veypi/OneAuth.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
93 KiB
JavaScript
1 line
93 KiB
JavaScript
|
2 months ago
|
var t;t=function(){const t=[],e=[];function n(){return`${performance.now().toString(36)}-${Math.random().toString(36).substring(2,5)}`}setInterval((()=>{let n=new Set(e.splice(0)),o=0;for(let e of n)t[e]&&(window.vdev||t[e](),o++);return o}),25),window.$vupdate=e=>{t[e]()};var o=[];const r=Symbol("isProxy"),i=Symbol("DataID"),s=Symbol("bind"),a=Symbol("root"),c=Symbol("root arg");function l(t,e){t[a]=e,Object.keys(e).forEach((e=>{e in t||(t[e]=c)}))}function u(t){return!(!t||"object"!=typeof t||t instanceof Node||t instanceof Date||t instanceof RegExp||t instanceof Event||t.t||t.constructor!==Object&&t.constructor!==Array)}function f(t,e){if(!t||!t[r]||!u(e))return e;let n=t[s];if(!e[r])return Object.keys(t).forEach((n=>{void 0===e[n]&&delete t[n]})),Object.keys(e).forEach((n=>{t[n]?.[r]?t[n]=f(t[n],e[n]):t[n]=e[n]})),t;if(e[i]===t[i])return e;for(let o in n)if(e[s][o]?.indexOf)for(let t of n[o])-1===e[s][o].indexOf(t)&&e[s][o].push(t);else e[s][o]=n[o];for(let o in e)o in t&&t[o]?.[r]&&(e[o]=f(t[o],e[o]));return e}const h={console,window,prompt:prompt.bind(window),alert:alert.bind(window),confirm:confirm.bind(window),RegExp,document,Array,Object,Math,Date,JSON,Symbol,Number,eval,isNaN,parseInt,parseFloat,setTimeout:setTimeout.bind(window),setInterval:setInterval.bind(window),clearTimeout:clearTimeout.bind(window),clearInterval:clearInterval.bind(window),encodeURIComponent,btoa:btoa.bind(window),fetch:fetch.bind(window),TextDecoder,history,requestAnimationFrame:requestAnimationFrame.bind(window)};function d(t,e,n){const o=new Proxy(t,{has:(t,e)=>!0,get(o,r,i){let s;return"$data"===r?s=t:"$env"===r?s=e:r in o?s=Reflect.get(o,r,i):r in e?s=e[r]:n&&r in n?s=n[r]:r in h?s=h[r]:r in window&&(s=window[r]),s},set:(t,e,n,o)=>Reflect.set(t,e,n,o)});return o}const p=Object.getPrototypeOf((async function(){})).constructor;function m(t,e){if(t.startsWith("/"))return t;const n=e.substring(0,e.lastIndexOf("/")).split("/").filter((t=>""!==t)),o=t.split("/").filter((t=>""!==t));for(const r of o)if(".."===r)n.length>0&&n.pop();else{if("."===r)continue;n.push(r)}return"/"+n.join("/")}const w={Wrap:function h(d,p=void 0){const m=n();let w=!1;"[object Array]"==={}.toString.call(d)&&(w=!0),p&&l(d,p),d[i]=m;const y={},b={get(t,e,n){if(e===i)return m;if(e===r)return!0;if(e===s)return y;const l=Reflect.get(t,e,n);if(l===c)return t[a][e];if("symbol"==typeof e)return l;let f=-1;if(o.length>0){let t=e;f=o[o.length-1],w&&(t=""),y.hasOwnProperty(t)?-1==y[t].indexOf(f)&&y[t].push(f):y[t]=[f]}if(window.vdev,u(l)&&!l[r]){let o=h(l,void 0);return Reflect.set(t,e,o,n),o}return l},set(n,i,s,l){const h=Reflect.get(n,i,l);if(h===c)return n[a][i]=s,!0;if(h===s)return!0;let d=!0;if(Array.isArray(s)&&Array.isArray(h)?(h.length=0,h.push(...s)):h&&h[r]&&u(s)?(s=f(h,s),d=Reflect.set(n,i,s,l)):d=Reflect.set(n,i,s,l),d&&0===o.length){let n=i;if(w&&(n=""),y[n]){let o=0;for(;o<y[n].length;){let r=y[n][o];t[r]?(o++,e.push(r),window.vdev):y[n].splice(o,1)}}}return d},deleteProperty(n,r){window.vdev;const i=Reflect.deleteProperty(n,r);if(i&&0===o.length){let n=r;if(w&&(n=""),y[n]){let o=0;for(;o<y[n].length;){let r=y[n][o];t[r]?(o++,e.push(r),window.vdev):y[n].splice(o,1)}}}return i}};return new Proxy(d,b)},Watch:function(e,n){let r,i=t.length;o.push(i),"function"==typeof n?t.push((()=>{n(e())})):t.push(e);try{r=e()}catch(b){}finally{o.pop()}return"function"==typeof n&&n(r),i},Cancel:function(e){e>=0&&e<t.length&&(t[e]=null)},ForceUpdate:function(){for(let e of t)e&&e()},SetDataRoot:l,DataID:i,GenUniqueID:n,Run:function(t,e,n,o){let r,i=t.trim();-1===i.indexOf("\n")&&(i="return "+i),i=`\nwith (sandbox) {\n${i}\n}`;try{r=Function("sandbox",i)(d(e,n,o))}catch(s){}return r},AsyncRun:async function(t,e,n,o){let r=t.trim();-1===r.indexOf("\n")&&(r="return "+r),r=`\nwith (sandbox) {\n${r}\n}`;const i=new p("sandbox",r);return await i(d(e,n,o))},ParseImport:async function(t,e,n,o){e=e||{};let r,i=n.root||"",s=t;o=o.startsWith("http")?o:i+o;const a=/await import\(['"]([^'"]+)['"]\)/gm;for(;null!==(r=a.exec(t));){let t=r[1];t.startsWith("http")||(t=m(t,o),t=window.location.orig
|