Socket
Socket
Sign inDemoInstall

@satumjs/async-override

Package Overview
Dependencies
5
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3-beta.2 to 0.1.3-rc.0

2

lib/index.es.js

@@ -1,1 +0,1 @@

import{PluginEvent as e,pluginPrefix as t,MidwareName as r,FileType as n}from"@satumjs/types";import{getGlobalWindow as i,getFileExt as o,multipleRun as u,printWarn as l,noopPromise as a,getInlineFileName as c,printLog as f,toArray as s,toPromise as p}from"@satumjs/utils";function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){g(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e,t){return y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},y(e,t)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function b(e,t,r){return b=h()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&y(i,r.prototype),i},b.apply(null,arguments)}function m(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var S=i(),x=S.document;function A(){return arguments.length<=0?void 0:arguments[0]}function C(e){if(!e)return{};var t;if("system"in e){var r=e.system.microApps||[];return e.appName&&(t=r.find((function(t){return t.name===e.appName}))),{system:e.system,app:t}}return{app:e}}function P(e,t,r){if(f("hit cache success",t),r)return e;var n=new Blob([e]);return new Response(n)}function j(e,t,r){if(s(e).some((function(e){return"string"==typeof e?t.includes(e):"function"==typeof e?e(t,null==r?void 0:r.name):e&&e.test(t)}))){var n=new Blob([""]);return Promise.resolve(new Response(n))}}function w(e,t){var r=e,n="string"==typeof r?r.match(/\/\/\s*#\s+sourceMappingURL\s*\=\s*((?!(\.map)).)+\.map/g):null,i=t.replace(/[^\/]+$/,"");return n&&n.forEach((function(e){var t=e.split("=");t.splice.apply(t,[1,0].concat(m(i?["=",i]:[""]))),r=r.replace(e,t.join(""))})),r}function R(i,c){if(S.fetch||c){var f=c||S.fetch.bind(S),s=C(i),p=s.system,d=s.app,v=(null==p?void 0:p.microApps)||[];return function(i,l){var a,c="string"==typeof i?i:i.url,s=d||v.find((function(e){return e.requests.includes(c)})),g=(null==s?void 0:s.getAppRealUrl(c))||(null==p?void 0:p.getRealUrl(c))||c,y=(null===(a=s||p)||void 0===a?void 0:a.trigger)||A;return((null==s?void 0:s.getAppCacheByUrl(g))||(null==p?void 0:p.getCacheByUrl(g))||Promise.resolve()).then((function(a){if(a)return P(a,g);var c=(null==s?void 0:s.getConfig("ignoreFileRule"))||(null==p?void 0:p.getConfig("ignoreFileRule"));if(c){var d=j(c,g,s);if(d)return d}if(null==s||!s.inDebugOrProxy){var v={file:g};y(e.fileLoadStart,v),y(t+e.fileLoadStart,v)}return f(i,l).then((function(i){var l=i.headers,a=i.status,c=i.statusText,f=l?l.get("Content-Type"):null;return i.text().then((function(i){var d=f?{type:f}:void 0,v=(null==s?void 0:s.fileExtNameMap[g])||(null==p?void 0:p.fileExtName(g))||o(g),h=(null==s?void 0:s.getConfig(r.code))||(null==p?void 0:p.getConfig(r.code)),b=i;if(s&&!s.fileExtNameMap[g]&&(s.fileExtNameMap[g]=v),null==s||!s.inDebugOrProxy){var m={file:g,source:b,ext:v};y(e.fileOriginSource,m),y(t+e.fileOriginSource,m)}if(h&&h.length)return b=v===n.JS||v===n.CSS?w(i,g):i,u(h,b,g).then((function(r){if(null==s||!s.inDebugOrProxy){var n={file:g,microSource:r,ext:v};y(e.fileMicroSource,n),y(t+e.fileMicroSource,n)}var i=new Blob([r],d);return new Response(i,{status:a,statusText:c,headers:l})}));var O=new Blob([b],d);return new Response(O,{status:a,statusText:c,headers:l})}))}))}))}}return l("`fetch` is required when the script runs, polyfill such as `whatwg-fetch` can be used."),a}function N(i,a){var c=C(i),f=c.system,s=c.app,d=(null==f?void 0:f.microApps)||[],v=S.XMLHttpRequest||S.ActiveXObject;return a||v||l("`XMLHttpRequest` is required when the script runs"),function(){for(var i=a||v||A,l=arguments.length,c=new Array(l),g=0;g<l;g++)c[g]=arguments[g];var y,h,m=b(i,c),O=m.open.bind(m);function S(){if(m.readyState===m.DONE||4==m.readyState&&200==m.status||304==m.status){var i,l=m.responseURL,a=s||d.find((function(e){return e.requests.includes(l)})),c=(null===(i=a||f)||void 0===i?void 0:i.trigger)||A,p=(null==a?void 0:a.getAppRealUrl(l))||(null==f?void 0:f.getRealUrl(l))||l,v=(null==a?void 0:a.fileExtNameMap[p])||(null==f?void 0:f.fileExtName(p))||o(p),g=m.response||m.responseText,y=(null==a?void 0:a.getConfig(r.code))||(null==f?void 0:f.getConfig(r.code)),h=g;a&&!a.fileExtNameMap[p]&&(a.fileExtNameMap[p]=v);var b=!!j((null==a?void 0:a.getConfig("ignoreFileRule"))||(null==f?void 0:f.getConfig("ignoreFileRule")),p,a)||(null==a?void 0:a.inDebugOrProxy);if(!b){var O={file:p,source:h,ext:v};c(e.fileOriginSource,O),c(t+e.fileOriginSource,O)}if(y&&y.length)return h=v===n.JS||v===n.CSS?w(g,p):g,u(y,h,p).then((function(r){if(!b){var n={file:p,microSource:r,ext:v};c(e.fileMicroSource,n),c(t+e.fileMicroSource,n)}Object.defineProperty(m,"response",{value:r}),Object.defineProperty(m,"responseText",{value:r})}));Object.defineProperty(m,"response",{value:h}),Object.defineProperty(m,"responseText",{value:h})}}function x(e,t){(y||h)&&(Object.defineProperties(m,{responseURL:{value:t},readyState:{value:XMLHttpRequest.DONE},status:{value:200},response:{value:e},responseText:{value:e}}),y&&y(),h&&h())}return m.onreadystatechange=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];y&&p(S()).then((function(){return y.apply(void 0,t)}))},m.onload=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];h&&p(S()).then((function(){return h.apply(void 0,t)}))},Object.defineProperties(m,{open:{value:function(){var r=arguments.length<=1?void 0:arguments[1];if(r){var n,i=s||d.find((function(e){return e.requests.includes(r)})),o=(null===(n=i||f)||void 0===n?void 0:n.trigger)||A,u=(null==i?void 0:i.getAppRealUrl(r))||(null==f?void 0:f.getRealUrl(r))||r,l=(null==i?void 0:i.getAppCacheByUrl(u))||(null==f?void 0:f.getCacheByUrl(u))||Promise.resolve(void 0);l.then((function(r){if(void 0!==r)return P(r,u,!0),x(r,u),void m.abort();if(!!j((null==i?void 0:i.getConfig("ignoreFileRule"))||(null==f?void 0:f.getConfig("ignoreFileRule")),u,i))return x("",u),void m.abort();if(null==i||!i.inDebugOrProxy){var n={file:u};o(e.fileLoadStart,n),o(t+e.fileLoadStart,n)}}))}return O.apply(void 0,arguments)}},onreadystatechange:{set:function(e){y=e}},onload:{set:function(e){h=e}}}),m}}function E(e,t){return"file://fake-path/".concat(t||"__UNKNOWNMICROAPPNAME__","/").concat(e||"__UNKNOWNFILENAME__")}function M(i,o,s){if(x&&(x.createElement||o)){var p,d=R(i),g=o||x.createElement.bind(x),y=C(i),h=y.system,b=y.app,m=(null===(p=b||h)||void 0===p?void 0:p.trigger)||A;return function(i,o){var l=g(i,o);if("script"===i){var p=l;return Object.defineProperties(p,{src:{get:function(){return p.getAttribute("data-src")||p.getAttribute("src")},set:function(e){var t=(null==b?void 0:b.getAppRealUrl(e))||e,r=b?b.getAppCorsUrl(e,b.inDebugOrProxy):((null==h?void 0:h.getCorsUrl)||a)(e);b&&(b.fileExtNameMap[t]=n.JS),p.setAttribute("data-src",t),r.then((function(e){e&&d(e).then((function(e){return e.text()})).then((function(e){p.text=s?"with(window['".concat(s,"']){\n").concat(e,"\n}"):e;var t=new Event("load");t.state=1,p.dispatchEvent(t)}))}))}}}),l}if("link"===i){var y=l;return Object.defineProperties(y,{href:{get:function(){return y.getAttribute("data-src")||y.getAttribute("href")},set:function(e){if("text/css"===y.getAttribute("type")){var t=(null==b?void 0:b.getAppRealUrl(e))||e,r=b?b.getAppCorsUrl(e,b.inDebugOrProxy):((null==h?void 0:h.getCorsUrl)||a)(e);b&&(b.fileExtNameMap[t]=n.CSS),y.setAttribute("data-src",t),r.then((function(e){e&&d(e).then((function(e){return e.text()})).then((function(e){var t=URL.createObjectURL(new Blob([e],{type:"text/css"}));y.setAttribute("href",t)}))}))}else y.setAttribute("href",e)}}}),y}if("style"===i){var O=g(i,o),S=O.styleSheet;O.setAttribute("data-type","fake-style");var A=l;A.setAttribute("type","text/css");var C=A.appendChild.bind(A),P=(null==b?void 0:b.getConfig(r.code))||(null==h?void 0:h.getConfig(r.code));return Object.defineProperties(O,{innerHTML:{get:function(){return A.innerHTML},set:function(e){A.appendChild(null==x?void 0:x.createTextNode(e))}},appendChild:{value:function(r){var i="string"==typeof r?r:r.nodeValue||"",o=c(i,n.CSS),l=E(o,null==b?void 0:b.name);return b&&(b.fileExtNameMap[l]=n.CSS),A.id=o,O.setAttribute("data-for",o),setTimeout((function(){var e=A.parentNode;if(e){var t=null==e?void 0:e.removeChild.bind(e);try{Object.defineProperty(e,"removeChild",{value:function(e){if("STYLE"===e.tagName){var r=e.getAttribute("data-for");if(r){var n=e.previousElementSibling;if(n&&n.id===r)t(n);else{var i=x.querySelector("#".concat(r));try{C(i)}catch(e){}}}}t(e)}})}catch(e){}}}),100),((null==b?void 0:b.getAppCacheByUrl(l))||(null==h?void 0:h.getCacheByUrl(l))||Promise.resolve()).then((function(r){var o=O.parentNode;if(o){if(r)return f("hit cache success",l),o.insertBefore(A,O),void C(null==x?void 0:x.createTextNode(r));if(null==b||!b.inDebugOrProxy){var a={file:l};m(e.fileLoadStart,a),m(t+e.fileLoadStart,a),m(e.fileOriginSource,v(v({},a),{},{source:i,ext:n.CSS})),m(t+e.fileOriginSource,v(v({},a),{},{source:i,ext:n.CSS}))}P&&P.length?u(P,i,l).then((function(r){if(o.insertBefore(A,O),C(null==x?void 0:x.createTextNode(r)),null==b||!b.inDebugOrProxy){var i={file:l,microSource:r,ext:n.CSS};m(e.fileMicroSource,i),m(t+e.fileMicroSource,i)}})):(o.insertBefore(A,O),C(null==x?void 0:x.createTextNode(i)))}})),r}}}),S&&Object.defineProperties(S,{cssText:{get:function(){return A.innerHTML},set:function(e){O.innerHTML=e}}}),O}return l}}return l("`document.createElement` is required when the script runs"),function(){return null}}export{E as getFileFakeUrl,N as satumMicroAjaxFactory,M as satumMicroCreateElementFactory,R as satumMicroFetchFactory};
import{PluginEvent as e,pluginPrefix as t,FileType as r,MidwareName as n}from"@satumjs/types";import{printLog as i,multipleRun as o,noop as u,getGlobalWindow as l,getFileExt as a,printWarn as c,noopPromise as f,getInlineFileName as s,toArray as p,toPromise as d}from"@satumjs/utils";function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){y(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e,t){return h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},h(e,t)}function b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function m(e,t,r){return m=b()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&h(i,r.prototype),i},m.apply(null,arguments)}function O(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var x=l(),A=x.document;function C(){return arguments.length<=0?void 0:arguments[0]}function P(e){if(!e)return{};var t;if("system"in e){var r=e.system.microApps||[];return e.appName&&(t=r.find((function(t){return t.name===e.appName}))),{system:e.system,app:t}}return{app:e}}function w(e,t,r){if(i("hit cache success",t),r)return e;var n=new Blob([e]);return new Response(n)}function j(e,t,r){if(p(e).some((function(e){return"string"==typeof e?t.includes(e):"function"==typeof e?e(t,null==r?void 0:r.name):e&&e.test(t)}))){var n=new Blob([""]);return Promise.resolve(new Response(n))}}function R(e,t){var r=e,n="string"==typeof r?r.match(/\/\/\s*#\s+sourceMappingURL\s*\=\s*((?!(\.map)).)+\.map/g):null,i=t.replace(/[^\/]+$/,"");return n&&n.forEach((function(e){var t=e.split("=");t.splice.apply(t,[1,0].concat(O(i?["=",i]:[""]))),r=r.replace(e,t.join(""))})),r}function N(i,u){if(x.fetch||u){var l=u||x.fetch.bind(x),s=P(i),p=s.system,d=s.app,v=(null==p?void 0:p.microApps)||[];return function(i,u){var c,f="string"==typeof i?i:i.url,s=d||v.find((function(e){return e.requests.includes(f)})),g=(null==s?void 0:s.getAppRealUrl(f))||(null==p?void 0:p.getRealUrl(f))||f,y=(null===(c=s||p)||void 0===c?void 0:c.trigger)||C;return((null==s?void 0:s.getAppCacheByUrl(g))||(null==p?void 0:p.getCacheByUrl(g))||Promise.resolve()).then((function(c){if(c)return w(c,g);var f=(null==s?void 0:s.getConfig("ignoreFileRule"))||(null==p?void 0:p.getConfig("ignoreFileRule"));if(f){var d=j(f,g,s);if(d)return d}if(null==s||!s.inDebugOrProxy){var v={file:g};y(e.fileLoadStart,v),y(t+e.fileLoadStart,v)}return l(i,u).then((function(i){var u=i.headers,l=i.status,c=i.statusText,f=u?u.get("Content-Type"):null;return i.text().then((function(i){var d=f?{type:f}:void 0,v=(null==s?void 0:s.fileExtNameMap[g])||(null==p?void 0:p.fileExtName(g))||a(g),h=(null==s?void 0:s.getConfig(n.code))||(null==p?void 0:p.getConfig(n.code)),b=i;if(s&&!s.fileExtNameMap[g]&&(s.fileExtNameMap[g]=v),null==s||!s.inDebugOrProxy){var m={file:g,source:b,ext:v};y(e.fileOriginSource,m),y(t+e.fileOriginSource,m)}if(h&&h.length)return b=v===r.JS||v===r.CSS?R(i,g):i,o(h,b,g).then((function(r){if(null==s||!s.inDebugOrProxy){var n={file:g,microSource:r,ext:v};y(e.fileMicroSource,n),y(t+e.fileMicroSource,n)}var i=new Blob([r],d);return new Response(i,{status:l,statusText:c,headers:u})}));var O=new Blob([b],d);return new Response(O,{status:l,statusText:c,headers:u})}))}))}))}}return c("`fetch` is required when the script runs, polyfill such as `whatwg-fetch` can be used."),f}function M(i,u){var l=P(i),f=l.system,s=l.app,p=(null==f?void 0:f.microApps)||[],v=x.XMLHttpRequest||x.ActiveXObject;return u||v||c("`XMLHttpRequest` is required when the script runs"),function(){for(var i=u||v||C,l=arguments.length,c=new Array(l),g=0;g<l;g++)c[g]=arguments[g];var y,h,b=m(i,c),O=b.open.bind(b);function S(){if(b.readyState===b.DONE||4==b.readyState&&200==b.status||304==b.status){var i,u=b.responseURL,l=s||p.find((function(e){return e.requests.includes(u)})),c=(null===(i=l||f)||void 0===i?void 0:i.trigger)||C,d=(null==l?void 0:l.getAppRealUrl(u))||(null==f?void 0:f.getRealUrl(u))||u,v=(null==l?void 0:l.fileExtNameMap[d])||(null==f?void 0:f.fileExtName(d))||a(d),g=b.response||b.responseText,y=(null==l?void 0:l.getConfig(n.code))||(null==f?void 0:f.getConfig(n.code)),h=g;l&&!l.fileExtNameMap[d]&&(l.fileExtNameMap[d]=v);var m=!!j((null==l?void 0:l.getConfig("ignoreFileRule"))||(null==f?void 0:f.getConfig("ignoreFileRule")),d,l)||(null==l?void 0:l.inDebugOrProxy);if(!m){var O={file:d,source:h,ext:v};c(e.fileOriginSource,O),c(t+e.fileOriginSource,O)}if(y&&y.length)return h=v===r.JS||v===r.CSS?R(g,d):g,o(y,h,d).then((function(r){if(!m){var n={file:d,microSource:r,ext:v};c(e.fileMicroSource,n),c(t+e.fileMicroSource,n)}Object.defineProperty(b,"response",{value:r}),Object.defineProperty(b,"responseText",{value:r})}));Object.defineProperty(b,"response",{value:h}),Object.defineProperty(b,"responseText",{value:h})}}function x(e,t){(y||h)&&(Object.defineProperties(b,{responseURL:{value:t},readyState:{value:XMLHttpRequest.DONE},status:{value:200},response:{value:e},responseText:{value:e}}),y&&y(),h&&h())}return b.onreadystatechange=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];y&&d(S()).then((function(){return y.apply(void 0,t)}))},b.onload=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];h&&d(S()).then((function(){return h.apply(void 0,t)}))},Object.defineProperties(b,{open:{value:function(){var r=arguments.length<=1?void 0:arguments[1];if(r){var n,i=s||p.find((function(e){return e.requests.includes(r)})),o=(null===(n=i||f)||void 0===n?void 0:n.trigger)||C,u=(null==i?void 0:i.getAppRealUrl(r))||(null==f?void 0:f.getRealUrl(r))||r,l=(null==i?void 0:i.getAppCacheByUrl(u))||(null==f?void 0:f.getCacheByUrl(u))||Promise.resolve(void 0);l.then((function(r){if(void 0!==r)return w(r,u,!0),x(r,u),void b.abort();if(!!j((null==i?void 0:i.getConfig("ignoreFileRule"))||(null==f?void 0:f.getConfig("ignoreFileRule")),u,i))return x("",u),void b.abort();if(null==i||!i.inDebugOrProxy){var n={file:u};o(e.fileLoadStart,n),o(t+e.fileLoadStart,n)}}))}return O.apply(void 0,arguments)}},onreadystatechange:{set:function(e){y=e}},onload:{set:function(e){h=e}}}),b}}function E(e,t){return"file://fake-path/".concat(t||"__UNKNOWNMICROAPPNAME__","/").concat(e||"__UNKNOWNFILENAME__")}function U(l,a,p){if(A&&(A.createElement||a)){var d=N(l),v=a||A.createElement.bind(A),y=P(l),h=y.system,b=y.app;return function(l,a){var c=v(l,a);if("script"===l){var y=c;return Object.defineProperties(y,{src:{get:function(){return y.getAttribute("data-src")||y.getAttribute("src")},set:function(e){var t=(null==b?void 0:b.getAppRealUrl(e))||e,n=b?b.getAppCorsUrl(e,b.inDebugOrProxy):((null==h?void 0:h.getCorsUrl)||f)(e);b&&(b.fileExtNameMap[t]=r.JS),y.setAttribute("data-src",t),n.then((function(e){e&&d(e).then((function(e){return e.text()})).then((function(e){y.text=p?"with(window['".concat(p,"']){\n").concat(e,"\n}"):e;var t=new Event("load");t.state=1,y.dispatchEvent(t)}))}))}}}),c}if("link"===l){var m=c;return Object.defineProperties(m,{href:{get:function(){return m.getAttribute("data-src")||m.getAttribute("href")},set:function(e){if("text/css"===m.getAttribute("type")){var t=(null==b?void 0:b.getAppRealUrl(e))||e,n=b?b.getAppCorsUrl(e,b.inDebugOrProxy):((null==h?void 0:h.getCorsUrl)||f)(e);b&&(b.fileExtNameMap[t]=r.CSS),m.setAttribute("data-src",t),n.then((function(e){e&&d(e).then((function(e){return e.text()})).then((function(e){var t=URL.createObjectURL(new Blob([e],{type:"text/css"}));m.setAttribute("href",t)}))}))}else m.setAttribute("href",e)}}}),m}if("style"===l){var O=c;O.setAttribute("type","text/css");var S=O.appendChild.bind(O),x=(null==b?void 0:b.getConfig(n.code))||(null==h?void 0:h.getConfig(n.code)),C=v(l,a),P=C.styleSheet;return C.setAttribute("data-type","fake-style"),Object.defineProperties(C,{innerHTML:{get:function(){return O.innerHTML},set:function(e){O.appendChild(null==A?void 0:A.createTextNode(e))}},appendChild:{value:function(n){var l="string"==typeof n?n:n.nodeValue||"",a=s(l,r.CSS),c=E(a,null==b?void 0:b.name);return b&&(b.fileExtNameMap[c]=r.CSS),function(n,l,a,c,f,s,p){var d,v="string"==typeof n?n:n.nodeValue||"",y=(null===(d=a||l)||void 0===d?void 0:d.trigger)||u;return a&&(a.fileExtNameMap[f]=r.CSS),((null==a?void 0:a.getAppCacheByUrl(f))||(null==l?void 0:l.getCacheByUrl(f))||Promise.resolve()).then((function(n){if(n)return i("hit cache success",f),void c(null==p?void 0:p.createTextNode(n));if(null==a||!a.inDebugOrProxy){var u={file:f};y(e.fileLoadStart,u),y(t+e.fileLoadStart,u),y(e.fileOriginSource,g(g({},u),{},{source:v,ext:r.CSS})),y(t+e.fileOriginSource,g(g({},u),{},{source:v,ext:r.CSS}))}if(s&&s.length)return o(s,v,f).then((function(n){if(c(null==p?void 0:p.createTextNode(n)),null==a||!a.inDebugOrProxy){var i={file:f,microSource:n,ext:r.CSS};y(e.fileMicroSource,i),y(t+e.fileMicroSource,i)}}));c(null==p?void 0:p.createTextNode(v))}))}(n,h,b,S,c,x,A).then((function(){var e=C.parentNode;if(e){O.id=a,C.setAttribute("data-for",a),e.insertBefore(O,C);try{var t=e.removeChild.bind(e);Object.defineProperty(e,"removeChild",{value:function(r){!function(e,t,r,n){if("style"===e.tagName.toLocaleLowerCase()){var i=e.getAttribute("data-for");if(i){var o=e.previousElementSibling;if(o&&o.id===i)r(o);else{var u=n.querySelector("#".concat(i));u&&u.parentNode===t&&r(u)}}}}(r,e,t,e),t(r)}})}catch(e){}}})),n}}}),P&&Object.defineProperties(P,{cssText:{get:function(){return O.innerHTML},set:function(e){C.innerHTML=e}}}),C}return c}}return c("`document.createElement` is required when the script runs"),function(){return null}}export{E as getFileFakeUrl,M as satumMicroAjaxFactory,U as satumMicroCreateElementFactory,N as satumMicroFetchFactory};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).satumAsyncOverride={})}(this,(function(e){"use strict";function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,r){return u=i()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&o(i,r.prototype),i},u.apply(null,arguments)}function a(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var c,f,s,p,d,v,g,y,h,m,b,S="satum-micro",O="satum-micro".replace("-","").toLocaleUpperCase(),x="".concat(O,"_DEBUGGER"),A="custom#";!function(e){e.NOT_ACTIVED="NOT_ACTIVED",e.ACTIVING="ACTIVING",e.ACTIVED="ACTIVED",e.NOT_RENDERED="NOT_RENDERED",e.RENDERING="RENDERING",e.RENDERED="RENDERED"}(c||(c={})),function(e){e.BROWSER="browser",e.HASH="hash",e.MEMORY="memory",e.MPA="mpa"}(f||(f={})),function(e){e.HTML="html",e.CSS="css",e.JS="js",e.JSON="json"}(s||(s={})),function(e){e.DEV="DEV",e.TEST="TEST",e.PRE="PRE",e.PROD="PROD"}(p||(p={})),function(e){e.PC="pc",e.H5="h5",e.NONE="none"}(d||(d={})),function(e){e.loading="file_loading",e.loaded="file_loaded"}(v||(v={})),function(e){e.fileLoadStart="file_load_start",e.fileOriginSource="file_origin_source",e.fileMicroSource="file_micro_source",e.fileCacheInfo="file_cache_info",e.currentAppChains="current_app_chains",e.currentAppRequests="current_app_requests",e.sandboxRouteHistory="sandbox_route_history"}(g||(g={})),function(e){e.microApp="processRemoteDataToValidMicroApp",e.statusChange="statusChange",e.domChange="domChange",e.url="processUrlToValidUrl",e.code="processCodeToMicroCode",e.cache="saveCodeToCache",e.root="getMountNodeForMicroApp",e.route="routeInterceptor",e.Sandbox="Sandbox",e.Store="Store",e.urlOption="processUrlOption",e.proxyEntry="proxyEntry",e.start="start"}(y||(y={})),function(e){e.afterCreatedSandbox="afterCreatedSandbox"}(h||(h={})),function(e){e.layout="[layout]",e.block="[block]"}(m||(m={})),function(e){e.OA="old_actor",e.OAWNL="old_actor_with_new_layout",e.NA="new_actor",e.NAWOS="new_actor_with_old_sandbox",e.NAWOSANL="new_actor_with_old_sandbox_and_new_layout",e.NAWOM="new_actor_with_old_microapp"}(b||(b={}));var C={},E=Object.prototype.hasOwnProperty;function w(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function N(e){try{return encodeURIComponent(e)}catch(e){return null}}function R(){return Promise.resolve()}function _(e){return e instanceof Promise?e:Promise.resolve(e)}function P(e){for(var t=e.length,r=2166136261,n=0;n<t;n++)r^=e.charCodeAt(n),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24);return r>>>0}function j(e,t){var r=function(e){var t=e;return(t=((t=(t=t.replace("??","Ω")).split(function(e){var t=e.indexOf("?"),r=e.indexOf("#");return-1!==t&&-1===r?"?":-1===t&&-1!==r?"#":t<r?"?":t>r?"#":"?"}(t))[0])||"").replace("Ω","??")).split("/").pop()}(e),n=t||s.JSON;if(!r)return n;var o=function(e){return e===s.CSS||e===s.JS||e===s.JSON||e===s.HTML};if(o(r))return r;var i=(r.match(/\[?\.([^\.]+)\]?$/g)||[]).map((function(e){return e.replace(/\[|\.|\]/g,"")}))[0];return i=/^x?html?$/i.test(i)?s.HTML:i,o(i=["ejs","es","ts","mjs","jsx","tsx","vue"].includes(i)?s.JS:i)?i:n}function M(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(!e.length)return _(r[0]);var o,i=e.currentIndex=e.currentIndex||0,u=e[i];try{o=u.apply(void 0,r)}catch(t){return delete e.currentIndex,Promise.reject(t)}return _(o).then((function(t){return e.currentIndex++,t&&(r[0]=t),e.currentIndex<e.length?M.apply(void 0,[e].concat(r)):(delete e.currentIndex,r[0])})).catch((function(t){return delete e.currentIndex,t}))}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function D(e,t){var r,n=t.length>1?t.shift():e;(r=console)[e].apply(r,["[".concat(S,"] ").concat(n).concat(t.length?":":"")].concat(function(e){return function(e){if(Array.isArray(e))return T(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return T(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?T(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t)))}function U(){var e="undefined"!=typeof localStorage?localStorage.getItem(x):"true";if("1"===e||"true"===e){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];D("log",r)}}function I(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];D("warn",t)}C.stringify=function(e,t){t=t||"";var r,n,o=[];for(n in"string"!=typeof t&&(t="?"),e)if(E.call(e,n)){if((r=e[n])||null!=r&&!isNaN(r)||(r=""),n=N(n),r=N(r),null===n||null===r)continue;o.push(n+"="+r)}return o.length?t+o.join("&"):""},C.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var o=w(t[1]),i=w(t[2]);null===o||null===i||o in n||(n[o]=i)}return n};var L=function e(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:(void 0===e.fakeWindow&&(e.fakeWindow=Object.create(null)),e.fakeWindow)}(),B=L.document;function F(){return arguments.length<=0?void 0:arguments[0]}function H(e){if(!e)return{};var t;if("system"in e){var r=e.system.microApps||[];return e.appName&&(t=r.find((function(t){return t.name===e.appName}))),{system:e.system,app:t}}return{app:e}}function q(e,t,r){if(U("hit cache success",t),r)return e;var n=new Blob([e]);return new Response(n)}function V(e,t,r){var n=function(e){return e?Array.isArray(e)?e:[e]:[]}(e).some((function(e){return"string"==typeof e?t.includes(e):"function"==typeof e?e(t,null==r?void 0:r.name):e&&e.test(t)}));if(n){var o=new Blob([""]);return Promise.resolve(new Response(o))}}function W(e,t){var r=e,n="string"==typeof r?r.match(/\/\/\s*#\s+sourceMappingURL\s*\=\s*((?!(\.map)).)+\.map/g):null,o=t.replace(/[^\/]+$/,"");return n&&n.forEach((function(e){var t=e.split("=");t.splice.apply(t,[1,0].concat(a(o?["=",o]:[""]))),r=r.replace(e,t.join(""))})),r}function k(e,t){if(L.fetch||t){var r=t||L.fetch.bind(L),n=H(e),o=n.system,i=n.app,u=(null==o?void 0:o.microApps)||[];return function(e,t){var n,a="string"==typeof e?e:e.url,l=i||u.find((function(e){return e.requests.includes(a)})),c=(null==l?void 0:l.getAppRealUrl(a))||(null==o?void 0:o.getRealUrl(a))||a,f=(null===(n=l||o)||void 0===n?void 0:n.trigger)||F;return((null==l?void 0:l.getAppCacheByUrl(c))||(null==o?void 0:o.getCacheByUrl(c))||Promise.resolve()).then((function(n){if(n)return q(n,c);var i=(null==l?void 0:l.getConfig("ignoreFileRule"))||(null==o?void 0:o.getConfig("ignoreFileRule"));if(i){var u=V(i,c,l);if(u)return u}if(null==l||!l.inDebugOrProxy){var a={file:c};f(g.fileLoadStart,a),f(A+g.fileLoadStart,a)}return r(e,t).then((function(e){var t=e.headers,r=e.status,n=e.statusText,i=t?t.get("Content-Type"):null;return e.text().then((function(e){var u=i?{type:i}:void 0,a=(null==l?void 0:l.fileExtNameMap[c])||(null==o?void 0:o.fileExtName(c))||j(c),p=(null==l?void 0:l.getConfig(y.code))||(null==o?void 0:o.getConfig(y.code)),d=e;if(l&&!l.fileExtNameMap[c]&&(l.fileExtNameMap[c]=a),null==l||!l.inDebugOrProxy){var v={file:c,source:d,ext:a};f(g.fileOriginSource,v),f(A+g.fileOriginSource,v)}if(p&&p.length)return M(p,d=a===s.JS||a===s.CSS?W(e,c):e,c).then((function(e){if(null==l||!l.inDebugOrProxy){var o={file:c,microSource:e,ext:a};f(g.fileMicroSource,o),f(A+g.fileMicroSource,o)}var i=new Blob([e],u);return new Response(i,{status:r,statusText:n,headers:t})}));var h=new Blob([d],u);return new Response(h,{status:r,statusText:n,headers:t})}))}))}))}}return I("`fetch` is required when the script runs, polyfill such as `whatwg-fetch` can be used."),R}function J(e,t){return"file://fake-path/".concat(t||"__UNKNOWNMICROAPPNAME__","/").concat(e||"__UNKNOWNFILENAME__")}e.getFileFakeUrl=J,e.satumMicroAjaxFactory=function(e,t){var r=H(e),n=r.system,o=r.app,i=(null==n?void 0:n.microApps)||[],a=L.XMLHttpRequest||L.ActiveXObject;return t||a||I("`XMLHttpRequest` is required when the script runs"),function(){for(var e=t||a||F,r=arguments.length,l=new Array(r),c=0;c<r;c++)l[c]=arguments[c];var f,p,d=u(e,l),v=d.open.bind(d);function h(){if(d.readyState===d.DONE||4==d.readyState&&200==d.status||304==d.status){var e,t=d.responseURL,r=o||i.find((function(e){return e.requests.includes(t)})),u=(null===(e=r||n)||void 0===e?void 0:e.trigger)||F,a=(null==r?void 0:r.getAppRealUrl(t))||(null==n?void 0:n.getRealUrl(t))||t,l=(null==r?void 0:r.fileExtNameMap[a])||(null==n?void 0:n.fileExtName(a))||j(a),c=d.response||d.responseText,f=(null==r?void 0:r.getConfig(y.code))||(null==n?void 0:n.getConfig(y.code)),p=c;r&&!r.fileExtNameMap[a]&&(r.fileExtNameMap[a]=l);var v=!!V((null==r?void 0:r.getConfig("ignoreFileRule"))||(null==n?void 0:n.getConfig("ignoreFileRule")),a,r)||(null==r?void 0:r.inDebugOrProxy);if(!v){var h={file:a,source:p,ext:l};u(g.fileOriginSource,h),u(A+g.fileOriginSource,h)}if(f&&f.length)return M(f,p=l===s.JS||l===s.CSS?W(c,a):c,a).then((function(e){if(!v){var t={file:a,microSource:e,ext:l};u(g.fileMicroSource,t),u(A+g.fileMicroSource,t)}Object.defineProperty(d,"response",{value:e}),Object.defineProperty(d,"responseText",{value:e})}));Object.defineProperty(d,"response",{value:p}),Object.defineProperty(d,"responseText",{value:p})}}function m(e,t){(f||p)&&(Object.defineProperties(d,{responseURL:{value:t},readyState:{value:XMLHttpRequest.DONE},status:{value:200},response:{value:e},responseText:{value:e}}),f&&f(),p&&p())}return d.onreadystatechange=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];f&&_(h()).then((function(){return f.apply(void 0,t)}))},d.onload=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];p&&_(h()).then((function(){return p.apply(void 0,t)}))},Object.defineProperties(d,{open:{value:function(){var e=arguments.length<=1?void 0:arguments[1];if(e){var t,r=o||i.find((function(t){return t.requests.includes(e)})),u=(null===(t=r||n)||void 0===t?void 0:t.trigger)||F,a=(null==r?void 0:r.getAppRealUrl(e))||(null==n?void 0:n.getRealUrl(e))||e,l=(null==r?void 0:r.getAppCacheByUrl(a))||(null==n?void 0:n.getCacheByUrl(a))||Promise.resolve(void 0);l.then((function(e){if(void 0!==e)return q(e,a,!0),m(e,a),void d.abort();if(!!V((null==r?void 0:r.getConfig("ignoreFileRule"))||(null==n?void 0:n.getConfig("ignoreFileRule")),a,r))return m("",a),void d.abort();if(null==r||!r.inDebugOrProxy){var t={file:a};u(g.fileLoadStart,t),u(A+g.fileLoadStart,t)}}))}return v.apply(void 0,arguments)}},onreadystatechange:{set:function(e){f=e}},onload:{set:function(e){p=e}}}),d}},e.satumMicroCreateElementFactory=function(e,t,n){if(B&&(B.createElement||t)){var o,i=k(e),u=t||B.createElement.bind(B),a=H(e),l=a.system,c=a.app,f=(null===(o=c||l)||void 0===o?void 0:o.trigger)||F;return function(e,t){var o=u(e,t);if("script"===e){var a=o;return Object.defineProperties(a,{src:{get:function(){return a.getAttribute("data-src")||a.getAttribute("src")},set:function(e){var t=(null==c?void 0:c.getAppRealUrl(e))||e,r=c?c.getAppCorsUrl(e,c.inDebugOrProxy):((null==l?void 0:l.getCorsUrl)||R)(e);c&&(c.fileExtNameMap[t]=s.JS),a.setAttribute("data-src",t),r.then((function(e){e&&i(e).then((function(e){return e.text()})).then((function(e){a.text=n?"with(window['".concat(n,"']){\n").concat(e,"\n}"):e;var t=new Event("load");t.state=1,a.dispatchEvent(t)}))}))}}}),o}if("link"===e){var p=o;return Object.defineProperties(p,{href:{get:function(){return p.getAttribute("data-src")||p.getAttribute("href")},set:function(e){if("text/css"===p.getAttribute("type")){var t=(null==c?void 0:c.getAppRealUrl(e))||e,r=c?c.getAppCorsUrl(e,c.inDebugOrProxy):((null==l?void 0:l.getCorsUrl)||R)(e);c&&(c.fileExtNameMap[t]=s.CSS),p.setAttribute("data-src",t),r.then((function(e){e&&i(e).then((function(e){return e.text()})).then((function(e){var t=URL.createObjectURL(new Blob([e],{type:"text/css"}));p.setAttribute("href",t)}))}))}else p.setAttribute("href",e)}}}),p}if("style"===e){var d=u(e,t),v=d.styleSheet;d.setAttribute("data-type","fake-style");var h=o;h.setAttribute("type","text/css");var m=h.appendChild.bind(h),b=(null==c?void 0:c.getConfig(y.code))||(null==l?void 0:l.getConfig(y.code));return Object.defineProperties(d,{innerHTML:{get:function(){return h.innerHTML},set:function(e){h.appendChild(null==B?void 0:B.createTextNode(e))}},appendChild:{value:function(e){var t="string"==typeof e?e:e.nodeValue||"",n=function(e,t){var r="".concat(S.replace("-",""),"inline"),n=new RegExp("@\\{(".concat(r,"[^\\}]+)\\}"));if(n.test(e))return(e.match(n)||[])[1];if(P)return"".concat(r,"-").concat(P(e),".").concat(t);var o=e.length;return"".concat(r,"-").concat((o>300?e.slice(o/2-150,o/2+150):e).replace(/\W|\_/g,""),".").concat(t)}(t,s.CSS),o=J(n,null==c?void 0:c.name);return c&&(c.fileExtNameMap[o]=s.CSS),h.id=n,d.setAttribute("data-for",n),setTimeout((function(){var e=h.parentNode;if(e){var t=null==e?void 0:e.removeChild.bind(e);try{Object.defineProperty(e,"removeChild",{value:function(e){if("STYLE"===e.tagName){var r=e.getAttribute("data-for");if(r){var n=e.previousElementSibling;if(n&&n.id===r)t(n);else{var o=B.querySelector("#".concat(r));try{m(o)}catch(e){}}}}t(e)}})}catch(e){}}}),100),((null==c?void 0:c.getAppCacheByUrl(o))||(null==l?void 0:l.getCacheByUrl(o))||Promise.resolve()).then((function(e){var n=d.parentNode;if(n){if(e)return U("hit cache success",o),n.insertBefore(h,d),void m(null==B?void 0:B.createTextNode(e));if(null==c||!c.inDebugOrProxy){var i={file:o};f(g.fileLoadStart,i),f(A+g.fileLoadStart,i),f(g.fileOriginSource,r(r({},i),{},{source:t,ext:s.CSS})),f(A+g.fileOriginSource,r(r({},i),{},{source:t,ext:s.CSS}))}b&&b.length?M(b,t,o).then((function(e){if(n.insertBefore(h,d),m(null==B?void 0:B.createTextNode(e)),null==c||!c.inDebugOrProxy){var t={file:o,microSource:e,ext:s.CSS};f(g.fileMicroSource,t),f(A+g.fileMicroSource,t)}})):(n.insertBefore(h,d),m(null==B?void 0:B.createTextNode(t)))}})),e}}}),v&&Object.defineProperties(v,{cssText:{get:function(){return h.innerHTML},set:function(e){d.innerHTML=e}}}),d}return o}}return I("`document.createElement` is required when the script runs"),function(){return null}},e.satumMicroFetchFactory=k,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).satumAsyncOverride={})}(this,(function(e){"use strict";function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,r){return u=i()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&o(i,r.prototype),i},u.apply(null,arguments)}function a(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var c,f,s,p,d,v,g,y,h,m,b,S="satum-micro",O="satum-micro".replace("-","").toLocaleUpperCase(),x="".concat(O,"_DEBUGGER"),A="custom#";!function(e){e.NOT_ACTIVED="NOT_ACTIVED",e.ACTIVING="ACTIVING",e.ACTIVED="ACTIVED",e.NOT_RENDERED="NOT_RENDERED",e.RENDERING="RENDERING",e.RENDERED="RENDERED"}(c||(c={})),function(e){e.BROWSER="browser",e.HASH="hash",e.MEMORY="memory",e.MPA="mpa"}(f||(f={})),function(e){e.HTML="html",e.CSS="css",e.JS="js",e.JSON="json"}(s||(s={})),function(e){e.DEV="DEV",e.TEST="TEST",e.PRE="PRE",e.PROD="PROD"}(p||(p={})),function(e){e.PC="pc",e.H5="h5",e.NONE="none"}(d||(d={})),function(e){e.loading="file_loading",e.loaded="file_loaded"}(v||(v={})),function(e){e.fileLoadStart="file_load_start",e.fileOriginSource="file_origin_source",e.fileMicroSource="file_micro_source",e.fileCacheInfo="file_cache_info",e.currentAppChains="current_app_chains",e.currentAppRequests="current_app_requests",e.sandboxRouteHistory="sandbox_route_history"}(g||(g={})),function(e){e.microApp="processRemoteDataToValidMicroApp",e.statusChange="statusChange",e.domChange="domChange",e.url="processUrlToValidUrl",e.code="processCodeToMicroCode",e.cache="saveCodeToCache",e.root="getMountNodeForMicroApp",e.route="routeInterceptor",e.Sandbox="Sandbox",e.Store="Store",e.urlOption="processUrlOption",e.proxyEntry="proxyEntry",e.start="start"}(y||(y={})),function(e){e.afterCreatedSandbox="afterCreatedSandbox"}(h||(h={})),function(e){e.layout="[layout]",e.block="[block]"}(m||(m={})),function(e){e.OA="old_actor",e.OAWNL="old_actor_with_new_layout",e.NA="new_actor",e.NAWOS="new_actor_with_old_sandbox",e.NAWOSANL="new_actor_with_old_sandbox_and_new_layout",e.NAWOM="new_actor_with_old_microapp"}(b||(b={}));var C={},E=Object.prototype.hasOwnProperty;function w(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function N(e){try{return encodeURIComponent(e)}catch(e){return null}}function R(){}function _(){return Promise.resolve()}function P(e){return e instanceof Promise?e:Promise.resolve(e)}function j(e){for(var t=e.length,r=2166136261,n=0;n<t;n++)r^=e.charCodeAt(n),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24);return r>>>0}function M(e,t){var r=function(e){var t=e;return(t=((t=(t=t.replace("??","Ω")).split(function(e){var t=e.indexOf("?"),r=e.indexOf("#");return-1!==t&&-1===r?"?":-1===t&&-1!==r?"#":t<r?"?":t>r?"#":"?"}(t))[0])||"").replace("Ω","??")).split("/").pop()}(e),n=t||s.JSON;if(!r)return n;var o=function(e){return e===s.CSS||e===s.JS||e===s.JSON||e===s.HTML};if(o(r))return r;var i=(r.match(/\[?\.([^\.]+)\]?$/g)||[]).map((function(e){return e.replace(/\[|\.|\]/g,"")}))[0];return i=/^x?html?$/i.test(i)?s.HTML:i,o(i=["ejs","es","ts","mjs","jsx","tsx","vue"].includes(i)?s.JS:i)?i:n}function T(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(!e.length)return P(r[0]);var o,i=e.currentIndex=e.currentIndex||0,u=e[i];try{o=u.apply(void 0,r)}catch(t){return delete e.currentIndex,Promise.reject(t)}return P(o).then((function(t){return e.currentIndex++,t&&(r[0]=t),e.currentIndex<e.length?T.apply(void 0,[e].concat(r)):(delete e.currentIndex,r[0])})).catch((function(t){return delete e.currentIndex,t}))}function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function U(e,t){var r,n=t.length>1?t.shift():e;(r=console)[e].apply(r,["[".concat(S,"] ").concat(n).concat(t.length?":":"")].concat(function(e){return function(e){if(Array.isArray(e))return D(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return D(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?D(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t)))}function I(){var e="undefined"!=typeof localStorage?localStorage.getItem(x):"true";if("1"===e||"true"===e){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];U("log",r)}}function L(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];U("warn",t)}C.stringify=function(e,t){t=t||"";var r,n,o=[];for(n in"string"!=typeof t&&(t="?"),e)if(E.call(e,n)){if((r=e[n])||null!=r&&!isNaN(r)||(r=""),n=N(n),r=N(r),null===n||null===r)continue;o.push(n+"="+r)}return o.length?t+o.join("&"):""},C.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var o=w(t[1]),i=w(t[2]);null===o||null===i||o in n||(n[o]=i)}return n};var B=function e(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:(void 0===e.fakeWindow&&(e.fakeWindow=Object.create(null)),e.fakeWindow)}(),F=B.document;function H(){return arguments.length<=0?void 0:arguments[0]}function q(e){if(!e)return{};var t;if("system"in e){var r=e.system.microApps||[];return e.appName&&(t=r.find((function(t){return t.name===e.appName}))),{system:e.system,app:t}}return{app:e}}function V(e,t,r){if(I("hit cache success",t),r)return e;var n=new Blob([e]);return new Response(n)}function W(e,t,r){var n=function(e){return e?Array.isArray(e)?e:[e]:[]}(e).some((function(e){return"string"==typeof e?t.includes(e):"function"==typeof e?e(t,null==r?void 0:r.name):e&&e.test(t)}));if(n){var o=new Blob([""]);return Promise.resolve(new Response(o))}}function k(e,t){var r=e,n="string"==typeof r?r.match(/\/\/\s*#\s+sourceMappingURL\s*\=\s*((?!(\.map)).)+\.map/g):null,o=t.replace(/[^\/]+$/,"");return n&&n.forEach((function(e){var t=e.split("=");t.splice.apply(t,[1,0].concat(a(o?["=",o]:[""]))),r=r.replace(e,t.join(""))})),r}function J(e,t){if(B.fetch||t){var r=t||B.fetch.bind(B),n=q(e),o=n.system,i=n.app,u=(null==o?void 0:o.microApps)||[];return function(e,t){var n,a="string"==typeof e?e:e.url,l=i||u.find((function(e){return e.requests.includes(a)})),c=(null==l?void 0:l.getAppRealUrl(a))||(null==o?void 0:o.getRealUrl(a))||a,f=(null===(n=l||o)||void 0===n?void 0:n.trigger)||H;return((null==l?void 0:l.getAppCacheByUrl(c))||(null==o?void 0:o.getCacheByUrl(c))||Promise.resolve()).then((function(n){if(n)return V(n,c);var i=(null==l?void 0:l.getConfig("ignoreFileRule"))||(null==o?void 0:o.getConfig("ignoreFileRule"));if(i){var u=W(i,c,l);if(u)return u}if(null==l||!l.inDebugOrProxy){var a={file:c};f(g.fileLoadStart,a),f(A+g.fileLoadStart,a)}return r(e,t).then((function(e){var t=e.headers,r=e.status,n=e.statusText,i=t?t.get("Content-Type"):null;return e.text().then((function(e){var u=i?{type:i}:void 0,a=(null==l?void 0:l.fileExtNameMap[c])||(null==o?void 0:o.fileExtName(c))||M(c),p=(null==l?void 0:l.getConfig(y.code))||(null==o?void 0:o.getConfig(y.code)),d=e;if(l&&!l.fileExtNameMap[c]&&(l.fileExtNameMap[c]=a),null==l||!l.inDebugOrProxy){var v={file:c,source:d,ext:a};f(g.fileOriginSource,v),f(A+g.fileOriginSource,v)}if(p&&p.length)return T(p,d=a===s.JS||a===s.CSS?k(e,c):e,c).then((function(e){if(null==l||!l.inDebugOrProxy){var o={file:c,microSource:e,ext:a};f(g.fileMicroSource,o),f(A+g.fileMicroSource,o)}var i=new Blob([e],u);return new Response(i,{status:r,statusText:n,headers:t})}));var h=new Blob([d],u);return new Response(h,{status:r,statusText:n,headers:t})}))}))}))}}return L("`fetch` is required when the script runs, polyfill such as `whatwg-fetch` can be used."),_}function G(e,t){return"file://fake-path/".concat(t||"__UNKNOWNMICROAPPNAME__","/").concat(e||"__UNKNOWNFILENAME__")}e.getFileFakeUrl=G,e.satumMicroAjaxFactory=function(e,t){var r=q(e),n=r.system,o=r.app,i=(null==n?void 0:n.microApps)||[],a=B.XMLHttpRequest||B.ActiveXObject;return t||a||L("`XMLHttpRequest` is required when the script runs"),function(){for(var e=t||a||H,r=arguments.length,l=new Array(r),c=0;c<r;c++)l[c]=arguments[c];var f,p,d=u(e,l),v=d.open.bind(d);function h(){if(d.readyState===d.DONE||4==d.readyState&&200==d.status||304==d.status){var e,t=d.responseURL,r=o||i.find((function(e){return e.requests.includes(t)})),u=(null===(e=r||n)||void 0===e?void 0:e.trigger)||H,a=(null==r?void 0:r.getAppRealUrl(t))||(null==n?void 0:n.getRealUrl(t))||t,l=(null==r?void 0:r.fileExtNameMap[a])||(null==n?void 0:n.fileExtName(a))||M(a),c=d.response||d.responseText,f=(null==r?void 0:r.getConfig(y.code))||(null==n?void 0:n.getConfig(y.code)),p=c;r&&!r.fileExtNameMap[a]&&(r.fileExtNameMap[a]=l);var v=!!W((null==r?void 0:r.getConfig("ignoreFileRule"))||(null==n?void 0:n.getConfig("ignoreFileRule")),a,r)||(null==r?void 0:r.inDebugOrProxy);if(!v){var h={file:a,source:p,ext:l};u(g.fileOriginSource,h),u(A+g.fileOriginSource,h)}if(f&&f.length)return T(f,p=l===s.JS||l===s.CSS?k(c,a):c,a).then((function(e){if(!v){var t={file:a,microSource:e,ext:l};u(g.fileMicroSource,t),u(A+g.fileMicroSource,t)}Object.defineProperty(d,"response",{value:e}),Object.defineProperty(d,"responseText",{value:e})}));Object.defineProperty(d,"response",{value:p}),Object.defineProperty(d,"responseText",{value:p})}}function m(e,t){(f||p)&&(Object.defineProperties(d,{responseURL:{value:t},readyState:{value:XMLHttpRequest.DONE},status:{value:200},response:{value:e},responseText:{value:e}}),f&&f(),p&&p())}return d.onreadystatechange=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];f&&P(h()).then((function(){return f.apply(void 0,t)}))},d.onload=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];p&&P(h()).then((function(){return p.apply(void 0,t)}))},Object.defineProperties(d,{open:{value:function(){var e=arguments.length<=1?void 0:arguments[1];if(e){var t,r=o||i.find((function(t){return t.requests.includes(e)})),u=(null===(t=r||n)||void 0===t?void 0:t.trigger)||H,a=(null==r?void 0:r.getAppRealUrl(e))||(null==n?void 0:n.getRealUrl(e))||e,l=(null==r?void 0:r.getAppCacheByUrl(a))||(null==n?void 0:n.getCacheByUrl(a))||Promise.resolve(void 0);l.then((function(e){if(void 0!==e)return V(e,a,!0),m(e,a),void d.abort();if(!!W((null==r?void 0:r.getConfig("ignoreFileRule"))||(null==n?void 0:n.getConfig("ignoreFileRule")),a,r))return m("",a),void d.abort();if(null==r||!r.inDebugOrProxy){var t={file:a};u(g.fileLoadStart,t),u(A+g.fileLoadStart,t)}}))}return v.apply(void 0,arguments)}},onreadystatechange:{set:function(e){f=e}},onload:{set:function(e){p=e}}}),d}},e.satumMicroCreateElementFactory=function(e,t,n){if(F&&(F.createElement||t)){var o=J(e),i=t||F.createElement.bind(F),u=q(e),a=u.system,l=u.app;return function(e,t){var u=i(e,t);if("script"===e){var c=u;return Object.defineProperties(c,{src:{get:function(){return c.getAttribute("data-src")||c.getAttribute("src")},set:function(e){var t=(null==l?void 0:l.getAppRealUrl(e))||e,r=l?l.getAppCorsUrl(e,l.inDebugOrProxy):((null==a?void 0:a.getCorsUrl)||_)(e);l&&(l.fileExtNameMap[t]=s.JS),c.setAttribute("data-src",t),r.then((function(e){e&&o(e).then((function(e){return e.text()})).then((function(e){c.text=n?"with(window['".concat(n,"']){\n").concat(e,"\n}"):e;var t=new Event("load");t.state=1,c.dispatchEvent(t)}))}))}}}),u}if("link"===e){var f=u;return Object.defineProperties(f,{href:{get:function(){return f.getAttribute("data-src")||f.getAttribute("href")},set:function(e){if("text/css"===f.getAttribute("type")){var t=(null==l?void 0:l.getAppRealUrl(e))||e,r=l?l.getAppCorsUrl(e,l.inDebugOrProxy):((null==a?void 0:a.getCorsUrl)||_)(e);l&&(l.fileExtNameMap[t]=s.CSS),f.setAttribute("data-src",t),r.then((function(e){e&&o(e).then((function(e){return e.text()})).then((function(e){var t=URL.createObjectURL(new Blob([e],{type:"text/css"}));f.setAttribute("href",t)}))}))}else f.setAttribute("href",e)}}}),f}if("style"===e){var p=u;p.setAttribute("type","text/css");var d=p.appendChild.bind(p),v=(null==l?void 0:l.getConfig(y.code))||(null==a?void 0:a.getConfig(y.code)),h=i(e,t),m=h.styleSheet;return h.setAttribute("data-type","fake-style"),Object.defineProperties(h,{innerHTML:{get:function(){return p.innerHTML},set:function(e){p.appendChild(null==F?void 0:F.createTextNode(e))}},appendChild:{value:function(e){var t=function(e,t){var r="".concat(S.replace("-",""),"inline"),n=new RegExp("@\\{(".concat(r,"[^\\}]+)\\}"));if(n.test(e))return(e.match(n)||[])[1];if(j)return"".concat(r,"-").concat(j(e),".").concat(t);var o=e.length;return"".concat(r,"-").concat((o>300?e.slice(o/2-150,o/2+150):e).replace(/\W|\_/g,""),".").concat(t)}("string"==typeof e?e:e.nodeValue||"",s.CSS),n=G(t,null==l?void 0:l.name);return l&&(l.fileExtNameMap[n]=s.CSS),function(e,t,n,o,i,u,a){var l,c="string"==typeof e?e:e.nodeValue||"",f=(null===(l=n||t)||void 0===l?void 0:l.trigger)||R;return n&&(n.fileExtNameMap[i]=s.CSS),((null==n?void 0:n.getAppCacheByUrl(i))||(null==t?void 0:t.getCacheByUrl(i))||Promise.resolve()).then((function(e){if(e)return I("hit cache success",i),void o(null==a?void 0:a.createTextNode(e));if(null==n||!n.inDebugOrProxy){var t={file:i};f(g.fileLoadStart,t),f(A+g.fileLoadStart,t),f(g.fileOriginSource,r(r({},t),{},{source:c,ext:s.CSS})),f(A+g.fileOriginSource,r(r({},t),{},{source:c,ext:s.CSS}))}if(u&&u.length)return T(u,c,i).then((function(e){if(o(null==a?void 0:a.createTextNode(e)),null==n||!n.inDebugOrProxy){var t={file:i,microSource:e,ext:s.CSS};f(g.fileMicroSource,t),f(A+g.fileMicroSource,t)}}));o(null==a?void 0:a.createTextNode(c))}))}(e,a,l,d,n,v,F).then((function(){var e=h.parentNode;if(e){p.id=t,h.setAttribute("data-for",t),e.insertBefore(p,h);try{var r=e.removeChild.bind(e);Object.defineProperty(e,"removeChild",{value:function(t){!function(e,t,r,n){if("style"===e.tagName.toLocaleLowerCase()){var o=e.getAttribute("data-for");if(o){var i=e.previousElementSibling;if(i&&i.id===o)r(i);else{var u=n.querySelector("#".concat(o));u&&u.parentNode===t&&r(u)}}}}(t,e,r,e),r(t)}})}catch(e){}}})),e}}}),m&&Object.defineProperties(m,{cssText:{get:function(){return p.innerHTML},set:function(e){h.innerHTML=e}}}),h}return u}}return L("`document.createElement` is required when the script runs"),function(){return null}},e.satumMicroFetchFactory=J,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@satumjs/async-override",
"version": "0.1.3-beta.2",
"version": "0.1.3-rc.0",
"description": "override async for sandbox",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc