@alicloud/console-os-browser-vm 1.4.34 → 1.4.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/es/Window.js +2 -2
- package/lib/Window.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.aliOSBrowserVM=e():t.aliOSBrowserVM=e()}(window,function(){return n=[function(t,e,n){n=n(2)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,e,n){t.exports=n(4)},function(P,t,e){var k=e(3).default;function n(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */P.exports=function(){return a},P.exports.__esModule=!0,P.exports.default=P.exports;var u,a={},t=Object.prototype,s=t.hasOwnProperty,l=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o,i,a,c,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),r=new j(r||[]);return l(e,"_invoke",{value:(o=t,i=n,a=r,c=p,function(t,e){if(c===h)throw Error("Generator is already running");if(c===y){if("throw"===t)throw e;return{value:u,done:!0}}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,o=e.iterator[r];if(o===u)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=u,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=f(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=u),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}(n,a);if(n){if(n===m)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===p)throw c=y,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=h;n=f(o,i,a);if("normal"===n.type){if(c=a.done?y:d,n.arg===m)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(c=y,a.method="throw",a.arg=n.arg)}})}),e}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",m={};function v(){}function w(){}function b(){}var e={},g=(i(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(L([]))),x=(g&&g!==t&&s.call(g,r)&&(e=g),b.prototype=v.prototype=Object.create(e));function O(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function _(a,c){var e;l(this,"_invoke",{value:function(n,r){function t(){return new c(function(t,e){!function e(t,n,r,o){var i,t=f(a[t],a,n);if("throw"!==t.type)return i=t.arg,n=i.value,n&&"object"==k(n)&&s.call(n,"__await")?c.resolve(n.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):c.resolve(n).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)});o(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function L(e){if(e||""===e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,t=function t(){for(;++n<e.length;)if(s.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=u,t.done=!0,t},t.next=t}throw new TypeError(k(e)+" is not iterable")}return w.prototype=b,l(x,"constructor",{value:b,configurable:!0}),l(b,"constructor",{value:w,configurable:!0}),w.displayName=i(b,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,i(t,o,"GeneratorFunction")),t.prototype=Object.create(x),t},a.awrap=function(t){return{__await:t}},O(_.prototype),i(_.prototype,n,function(){return this}),a.AsyncIterator=_,a.async=function(t,e,n,r,o){void 0===o&&(o=Promise);var i=new _(c(t,e,n,r),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(x),i(x,o,"Generator"),i(x,r,function(){return this}),i(x,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=L,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return i.type="throw",i.arg=n,r.next=t,e&&(r.method="next",r.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,o=this.tryEntries[e];if(o.tryLoc===t)return n=o.completion,"throw"===n.type&&(r=n.arg,E(o)),r}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),m}},a}P.exports=n,P.exports.__esModule=!0,P.exports.default=P.exports},function(e,t){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(R,t,e){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t){t=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if(n=n.call(t,e||"default"),"object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==r(t)?t:t+""}function a(t,e,n){e=o(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}function u(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function i(c){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=c.apply(t,a);function o(t){u(r,e,n,o,i,"next",t)}function i(t){u(r,e,n,o,i,"throw",t)}o(void 0)})}}e.r(t),e.d(t,"createContext",function(){return W}),e.d(t,"removeContext",function(){return U}),e.d(t,"evalScripts",function(){return V});var t=e(0),c=e.n(t);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function d(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var n;if(t)return"string"==typeof t?s(t,e):(n=Object.prototype.toString.call(t).slice(8,-1),"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0)}(t)||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(t){var e;try{e=new URL(t)}catch(t){return}return t=e.searchParams,t?t.get("callback")||t.get("cb"):null}function n(){return"undefined"==typeof document}var f=function(t){setTimeout(function(){var e,n;t.src&&(e=t.ownerContext.window,n=l(t.src),n)&&"function"==typeof e[n]&&(window[n]=function(){var t=e[n].apply(e,arguments);return window[n]=null,t})},0)};if(!n()&&"function"==typeof window.Element)for(var p=0,h=["appendChild","insertBefore","append"];p<h.length;p++){var y=h[p],m=window.Element.prototype[y];window.Element.prototype[y]=function(i,a){return function(n){var e=n&&n.ownerContext&&-1===n.ownerContext.allowResources.indexOf(n.src)&&"*"!==n.ownerContext.allowResources;if(n&&n._evalScriptInSandbox&&n.ownerContext&&"SCRIPT"===n.nodeName&&n.src&&e&&!l(n.src))return n.ownerContext.loadScripts(n.src).then(function(){var t=n._listenerMap.get("load"),t=(t&&t.forEach(function(t){t()}),new Event("load"));n.onload&&n.onload(t)}).catch(function(e){console.error(e,n.src);var t=n._listenerMap.get("error");t&&t.forEach(function(t){t(e)}),n.onerror&&n.onerror(e)});n&&"SCRIPT"===n.nodeName&&n.ownerContext&&f(n),n&&n.scriptText&&n.ownerContext.evalScript(n.scriptText);for(var t=arguments.length,r=new Array(1<t?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e=("append"===a&&void 0===n?[]:[n]).concat(r);try{return i.call.apply(i,[this].concat(d(e)))}catch(t){return i.apply(this,e)}}}(m,y)}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function b(t,e,n){return e&&w(t.prototype,e),n&&w(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var g=n()?function(){}:window.addEventListener,x=n()?function(){}:window.removeEventListener,O=["webkitmouseforcedown","webkitmouseforcewillbegin","visibilitychange","error","mousemove","mousedown","mouseup","touchcancel","touchend","touchstart","auxclick","dblclick","pointercancel","pointerdown","pointerup","dragend","dragstart","drop","compositionend","compositionstart","keydown","keypress","keyup","input","textInput","close","cancel","copy","cut","paste","click","change","contextmenu","reset","submit","resize","scroll","foucs","blur"];function _(t){t=t.prototype&&t.prototype.constructor===t&&1<Object.getOwnPropertyNames(t.prototype).length||/^class\b/.test(t.toString());return t}function S(t){t=0===t.name.indexOf("bound ")&&!t.hasOwnProperty("prototype");return t}var E=["setTimeout","setInterval","clearInterval","clearTimeout"],j=["location","history"],L=["requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","msRequestAnimationFrame","cancelAnimationFrame","webkitCancelAnimationFrame","mozCancelAnimationFrame","oCancelAnimationFrame","msCancelAnimationFrame","matchMedia","getSelection","open"];function P(e){var o,i,a,c;e._listenerMap=new Map,e.addEventListener=(o=e,i=e.addEventListener,function(t,e,n){var r=o._listenerMap.get(t)||[];return o._listenerMap.set(t,[].concat(d(r),[e])),i.apply(o,[t,e,n])}),e.removeEventListener=(a=e,c=e.removeEventListener,function(t,e,n){var r=a._listenerMap.get(t);return r&&r.length&&-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),c.apply(a,[t,e,n])}),e._evalScriptInSandbox||(A.forEach(function(t){Object.defineProperty(e,t,{get:function(){return this.scriptText||""},set:function(t){this.scriptText=t,e.parentNode&&this.ownerContext.evalScript&&e.ownerContext.evalScript(t.toString())},enumerable:!1})}),e._evalScriptInSandbox=!0)}var e=b(function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},l=1<arguments.length?arguments[1]:void 0,n=2<arguments.length?arguments[2]:void 0,f=(v(this,t),[].concat(L,d(e.externals||[]))),p={};return E.forEach(function(t){f.includes(t)||(p[t]=n.contentWindow[t].bind(n.contentWindow))}),j.forEach(function(t){f.includes(t)&&(p[t]=window[t])}),new Proxy(n.contentWindow,{set:function(t,e,n){return t[e]=n,p[e]=n,!0},get:function(t,e){if(f.includes(e)){var n=window[e];if("function"!=typeof n||S(n)||_(n))return n;var r,o=n.bind(window);for(r in n)o[r]=n[r];return o}switch(e){case"window":return c=l,s=Object.getOwnPropertyDescriptor(c,"window"),s&&(s.configurable=!0,u=Object.prototype.hasOwnProperty.call(s,"get"),u||(s.writable=!0)),c.window;case"document":return l.document;case"location":return l.location;case"history":return l.history;case"__CONSOLE_OS_GLOBAL_VARS_":return p;case"addEventListener":return a=l,function(t,e,n){var r=a._listenerMap.get(t)||[];return a._listenerMap.set(t,[].concat(d(r),[e])),-1===O.indexOf(t)?a.baseFrame.addEventListener.apply(a.baseFrame.contentWindow,[t,e,n]):g.apply(window,[t,e,n])};case"removeEventListener":return i=l,function(t,e,n){var r=i._listenerMap.get(t);return r&&r.length&&-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),-1===O.indexOf(t)?i.baseFrame.removeEventListener.apply(i.baseFrame.contentWindow,[t,e,n]):x.apply(window,[t,e,n])}}var i,a,c,u,s;return p[e]||(e=t[e],"function"!=typeof e||S(e)||_(e)?e:e.bind&&e.bind(t))}})}),k=e,A=["innerHTML","text","innerText"],t=b(function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,o=(v(this,t),[]);return new Proxy(document,{set:function(t,e,n){return"cookie"===e?document.cookie=n:t[e]=n,!0},get:function(r,t){switch(t){case"body":return n.body;case"location":return n.location;case"defaultView":return n.window;case"write":case"writeln":return function(){};case"createElement":return function(){var t=(t=document).createElement.apply(t,arguments);return t.ownerContext=n,t.appId=e.id,"SCRIPT"!==t.tagName||e.enableScriptEscape||P(t),t};case"addEventListener":return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return o.push(e),r.addEventListener.apply(r,e)};case"removeEventListeners":return function(){for(var t=0,e=o;t<e.length;t++){var n=e[t];r.removeEventListener.apply(r,d(n))}}}return"function"==typeof r[t]?r[t].bind&&r[t].bind(r):r[t]}})}),I=t;function C(t){return t&&"about:blank"===t.href}var e=b(function t(r){return v(this,t),new Proxy({},{set:function(t,e,n){return"href"!==e&&(r[e]=n),!0},get:function(t,e){switch(e){case"reload":return function(){return window.location.reload()};case"replace":return function(){};case"toString":return function(){try{return(C(r)?window.location:r).toString()}catch(t){return(C(r)?window.location:r).href}}}return"function"==typeof r[e]?r[e].bind&&r[e].bind(t):(C(r)?window.location:r)[e]}})}),G=e,t=b(function t(e,o){if(v(this,t),!e)return o.history;function i(){o.postMessage({type:"".concat(e,":history-change"),data:JSON.parse(JSON.stringify(o.location))},"*")}try{var a=o.history.pushState,c=o.history.replaceState;return o.history.pushState=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=a.apply(o.history,[].concat(e));return i(),r},o.history.replaceState=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=c.apply(o.history,[].concat(e));return i(),r},o.history}catch(t){}}),B=t;function D(t){return t.includes("console.aliyun.com")||t.includes("console.alibabacloud.com")||function(t,e){try{var n=new URL(t);return n.origin===e}catch(t){}try{var r=new URL(t,e);return r.origin===e}catch(t){}}(t,location&&location.origin)?"include":"omit"}function T(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var e=function(){function o(t,e){v(this,o),this.location=new G(e.contentWindow.location),this.history=new B(t.id,e.contentWindow),this.window=new k(t,this,e,location),this.allowResources=t.allowResources||[];var n=t.body,r=t.disableBody;r?n=document.body:n||(n=document.createElement("body"),document.documentElement.appendChild(n)),this.body=n,this.document=new I(F({enableScriptEscape:!0},t),this,e,location),this.baseFrame=e,this._listenerMap=new Map,this.window.__IS_CONSOLE_OS_CONTEXT__=!0}var e,n;return b(o,[{key:"loadScripts",value:(n=i(c.a.mark(function t(e){var n;return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e,{credentials:D(e)});case 2:return n=t.sent,t.next=5,n.text();case 5:n=t.sent,this.evalScript(n,e);case 7:case"end":return t.stop()}},t,this)})),function(t){return n.apply(this,arguments)})},{key:"evalScript",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=this.document.createElement("script"),t=(n.src=e,new Function('\n return function ({window, location, history, document, __os_current_script__}){\n var document = new Proxy(document, {\n get: function get(target, prop) {\n if (prop === "currentScript" && __os_current_script__) {\n return __os_current_script__;\n }\n return target[prop];\n }\n });\n var window = new Proxy(window, {\n get: function get(target, prop) {\n if (prop === "document") return document;\n return target[prop];\n }\n })\n var globalThis = window;\n with(window.__CONSOLE_OS_GLOBAL_VARS_) {\n try {\n '.concat(t,"\n } catch(e) {\n console.log(e)\n }\n }\n }//# sourceMappingURL=").concat(e)));t().call(this.window,F(F({},this),{},{__os_current_script__:n}))}},{key:"updateBody",value:function(t){!t&&this.body||(this.body=t)}},{key:"remove",value:function(){this.document.removeEventListeners(),this.baseFrame&&(this.baseFrame.parentNode?this.baseFrame.parentNode.removeChild(this.baseFrame):this.baseFrame.setAttribute("src","about:blank"))}}],[{key:"create",value:function(r){var o=this;return new Promise(function(t){var e=document.createElement("iframe"),n=(e.setAttribute("src",r.url||"/api.json"),e.style.cssText="position: absolute; top: -20000px; width: 1px; height: 1px;",r.id&&e.setAttribute("data-id",r.id),(null==(n=document.documentElement)?void 0:n.getElementsByTagName("body")[0])||document.body);if(n.appendChild(e),"about:blank"===r.url)return t(new o(r,e));e.onload=function(){t(new o(r,e))}})}},{key:"remove",value:(e=i(c.a.mark(function t(e){return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e.remove&&e.remove();case 1:case"end":return t.stop()}},t)})),function(t){return e.apply(this,arguments)})}]),o}(),M=e;function N(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}var W=function(){var t=i(c.a.mark(function t(){var e,n=arguments;return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=0<n.length&&void 0!==n[0]?n[0]:{},t.next=3,M.create(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),U=function(){var e=i(c.a.mark(function t(e){return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,M.remove(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}(),V=function(){var e=i(c.a.mark(function t(e){var n,r,o,i=arguments;return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=1<i.length&&void 0!==i[1]?i[1]:{},t.next=3,M.create(n);case 3:return r=t.sent,o=new Function("\n return function({window, location, history, document}){ \n with(window.__CONSOLE_OS_GLOBAL_VARS_) { \n ".concat(e,"\n }\n }//@sourceURL=").concat(n.name)),t.abrupt("return",o(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},r)));case 6:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}()}],r={},o.m=n,o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/",o(o.s=1);function o(t){var e;return(r[t]||(e=r[t]={i:t,l:!1,exports:{}},n[t].call(e.exports,e,e.exports,o),e.l=!0,e)).exports}var n,r});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.aliOSBrowserVM=e():t.aliOSBrowserVM=e()}(window,function(){return n=[function(t,e,n){n=n(2)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,e,n){t.exports=n(4)},function(P,t,e){var k=e(3).default;function n(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */P.exports=function(){return a},P.exports.__esModule=!0,P.exports.default=P.exports;var u,a={},t=Object.prototype,s=t.hasOwnProperty,l=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o,i,a,c,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),r=new L(r||[]);return l(e,"_invoke",{value:(o=t,i=n,a=r,c=p,function(t,e){if(c===h)throw Error("Generator is already running");if(c===y){if("throw"===t)throw e;return{value:u,done:!0}}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,o=e.iterator[r];if(o===u)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=u,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=f(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=u),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}(n,a);if(n){if(n===m)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===p)throw c=y,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=h;n=f(o,i,a);if("normal"===n.type){if(c=a.done?y:d,n.arg===m)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(c=y,a.method="throw",a.arg=n.arg)}})}),e}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",m={};function v(){}function w(){}function b(){}var e={},g=(i(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(j([]))),x=(g&&g!==t&&s.call(g,r)&&(e=g),b.prototype=v.prototype=Object.create(e));function O(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function _(a,c){var e;l(this,"_invoke",{value:function(n,r){function t(){return new c(function(t,e){!function e(t,n,r,o){var i,t=f(a[t],a,n);if("throw"!==t.type)return i=t.arg,n=i.value,n&&"object"==k(n)&&s.call(n,"__await")?c.resolve(n.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):c.resolve(n).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)});o(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function j(e){if(e||""===e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,t=function t(){for(;++n<e.length;)if(s.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=u,t.done=!0,t},t.next=t}throw new TypeError(k(e)+" is not iterable")}return w.prototype=b,l(x,"constructor",{value:b,configurable:!0}),l(b,"constructor",{value:w,configurable:!0}),w.displayName=i(b,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,i(t,o,"GeneratorFunction")),t.prototype=Object.create(x),t},a.awrap=function(t){return{__await:t}},O(_.prototype),i(_.prototype,n,function(){return this}),a.AsyncIterator=_,a.async=function(t,e,n,r,o){void 0===o&&(o=Promise);var i=new _(c(t,e,n,r),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(x),i(x,o,"Generator"),i(x,r,function(){return this}),i(x,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=j,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return i.type="throw",i.arg=n,r.next=t,e&&(r.method="next",r.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,o=this.tryEntries[e];if(o.tryLoc===t)return n=o.completion,"throw"===n.type&&(r=n.arg,E(o)),r}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:j(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),m}},a}P.exports=n,P.exports.__esModule=!0,P.exports.default=P.exports},function(e,t){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(R,t,e){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t){t=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if(n=n.call(t,e||"default"),"object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==r(t)?t:t+""}function a(t,e,n){e=o(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}function u(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function i(c){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=c.apply(t,a);function o(t){u(r,e,n,o,i,"next",t)}function i(t){u(r,e,n,o,i,"throw",t)}o(void 0)})}}e.r(t),e.d(t,"createContext",function(){return W}),e.d(t,"removeContext",function(){return U}),e.d(t,"evalScripts",function(){return V});var t=e(0),c=e.n(t);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function l(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var n;if(t)return"string"==typeof t?s(t,e):(n=Object.prototype.toString.call(t).slice(8,-1),"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0)}(t)||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 f(t){var e;try{e=new URL(t)}catch(t){return}return t=e.searchParams,t?t.get("callback")||t.get("cb"):null}function n(){return"undefined"==typeof document}var p=function(t){setTimeout(function(){var e,n;t.src&&(e=t.ownerContext.window,n=f(t.src),n)&&"function"==typeof e[n]&&(window[n]=function(){var t=e[n].apply(e,arguments);return window[n]=null,t})},0)};if(!n()&&"function"==typeof window.Element)for(var d=0,h=["appendChild","insertBefore","append"];d<h.length;d++){var y=h[d],m=window.Element.prototype[y];window.Element.prototype[y]=function(i,a){return function(n){var e=n&&n.ownerContext&&-1===n.ownerContext.allowResources.indexOf(n.src)&&"*"!==n.ownerContext.allowResources;if(n&&n._evalScriptInSandbox&&n.ownerContext&&"SCRIPT"===n.nodeName&&n.src&&e&&!f(n.src))return n.ownerContext.loadScripts(n.src).then(function(){var t=n._listenerMap.get("load"),t=(t&&t.forEach(function(t){t()}),new Event("load"));n.onload&&n.onload(t)}).catch(function(e){console.error(e,n.src);var t=n._listenerMap.get("error");t&&t.forEach(function(t){t(e)}),n.onerror&&n.onerror(e)});n&&"SCRIPT"===n.nodeName&&n.ownerContext&&p(n),n&&n.scriptText&&n.ownerContext.evalScript(n.scriptText);for(var t=arguments.length,r=new Array(1<t?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e=("append"===a&&void 0===n?[]:[n]).concat(r);try{return i.call.apply(i,[this].concat(l(e)))}catch(t){return i.apply(this,e)}}}(m,y)}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function b(t,e,n){return e&&w(t.prototype,e),n&&w(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var g=n()?function(){}:window.addEventListener,x=n()?function(){}:window.removeEventListener,O=["webkitmouseforcedown","webkitmouseforcewillbegin","visibilitychange","error","mousemove","mousedown","mouseup","touchcancel","touchend","touchstart","auxclick","dblclick","pointercancel","pointerdown","pointerup","dragend","dragstart","drop","compositionend","compositionstart","keydown","keypress","keyup","input","textInput","close","cancel","copy","cut","paste","click","change","contextmenu","reset","submit","resize","scroll","foucs","blur"];function _(t){t=t.prototype&&t.prototype.constructor===t&&1<Object.getOwnPropertyNames(t.prototype).length||/^class\b/.test(t.toString());return t}function S(t){t=0===t.name.indexOf("bound ")&&!t.hasOwnProperty("prototype");return t}var E=["setTimeout","setInterval","clearInterval","clearTimeout"],L=["location","history"],j=["requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","msRequestAnimationFrame","cancelAnimationFrame","webkitCancelAnimationFrame","mozCancelAnimationFrame","oCancelAnimationFrame","msCancelAnimationFrame","matchMedia","getSelection","open"];function P(e){var o,i,a,c;e._listenerMap=new Map,e.addEventListener=(o=e,i=e.addEventListener,function(t,e,n){var r=o._listenerMap.get(t)||[];return o._listenerMap.set(t,[].concat(l(r),[e])),i.apply(o,[t,e,n])}),e.removeEventListener=(a=e,c=e.removeEventListener,function(t,e,n){var r=a._listenerMap.get(t);return r&&r.length&&-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),c.apply(a,[t,e,n])}),e._evalScriptInSandbox||(A.forEach(function(t){Object.defineProperty(e,t,{get:function(){return this.scriptText||""},set:function(t){this.scriptText=t,e.parentNode&&this.ownerContext.evalScript&&e.ownerContext.evalScript(t.toString())},enumerable:!1})}),e._evalScriptInSandbox=!0)}var e=b(function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=1<arguments.length?arguments[1]:void 0,n=2<arguments.length?arguments[2]:void 0,u=(v(this,t),[].concat(j,l(e.externals||[]))),s={};return E.forEach(function(t){u.includes(t)||(s[t]=n.contentWindow[t].bind(n.contentWindow))}),L.forEach(function(t){u.includes(t)&&(s[t]=window[t])}),new Proxy(n.contentWindow,{set:function(t,e,n){return t[e]=n,s[e]=n,!0},get:function(t,e){if(u.includes(e)){var n=window[e];if("function"!=typeof n||S(n)||_(n))return n;var r,o=n.bind(window);for(r in n)o[r]=n[r];return o}switch(e){case"document":return c.document;case"location":return c.location;case"history":return c.history;case"__CONSOLE_OS_GLOBAL_VARS_":return s;case"addEventListener":return a=c,function(t,e,n){var r=a._listenerMap.get(t)||[];return a._listenerMap.set(t,[].concat(l(r),[e])),-1===O.indexOf(t)?a.baseFrame.addEventListener.apply(a.baseFrame.contentWindow,[t,e,n]):g.apply(window,[t,e,n])};case"removeEventListener":return i=c,function(t,e,n){var r=i._listenerMap.get(t);return r&&r.length&&-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),-1===O.indexOf(t)?i.baseFrame.removeEventListener.apply(i.baseFrame.contentWindow,[t,e,n]):x.apply(window,[t,e,n])}}var i,a;return s[e]||(e=t[e],"function"!=typeof e||S(e)||_(e)?e:e.bind&&e.bind(t))}})}),k=e,A=["innerHTML","text","innerText"],t=b(function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,o=(v(this,t),[]);return new Proxy(document,{set:function(t,e,n){return"cookie"===e?document.cookie=n:t[e]=n,!0},get:function(r,t){switch(t){case"body":return n.body;case"location":return n.location;case"defaultView":return n.window;case"write":case"writeln":return function(){};case"createElement":return function(){var t=(t=document).createElement.apply(t,arguments);return t.ownerContext=n,t.appId=e.id,"SCRIPT"!==t.tagName||e.enableScriptEscape||P(t),t};case"addEventListener":return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return o.push(e),r.addEventListener.apply(r,e)};case"removeEventListeners":return function(){for(var t=0,e=o;t<e.length;t++){var n=e[t];r.removeEventListener.apply(r,l(n))}}}return"function"==typeof r[t]?r[t].bind&&r[t].bind(r):r[t]}})}),I=t;function C(t){return t&&"about:blank"===t.href}var e=b(function t(r){return v(this,t),new Proxy({},{set:function(t,e,n){return"href"!==e&&(r[e]=n),!0},get:function(t,e){switch(e){case"reload":return function(){return window.location.reload()};case"replace":return function(){};case"toString":return function(){try{return(C(r)?window.location:r).toString()}catch(t){return(C(r)?window.location:r).href}}}return"function"==typeof r[e]?r[e].bind&&r[e].bind(t):(C(r)?window.location:r)[e]}})}),G=e,t=b(function t(e,o){if(v(this,t),!e)return o.history;function i(){o.postMessage({type:"".concat(e,":history-change"),data:JSON.parse(JSON.stringify(o.location))},"*")}try{var a=o.history.pushState,c=o.history.replaceState;return o.history.pushState=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=a.apply(o.history,[].concat(e));return i(),r},o.history.replaceState=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=c.apply(o.history,[].concat(e));return i(),r},o.history}catch(t){}}),B=t;function D(t){return t.includes("console.aliyun.com")||t.includes("console.alibabacloud.com")||function(t,e){try{var n=new URL(t);return n.origin===e}catch(t){}try{var r=new URL(t,e);return r.origin===e}catch(t){}}(t,location&&location.origin)?"include":"omit"}function T(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var e=function(){function o(t,e){v(this,o),this.location=new G(e.contentWindow.location),this.history=new B(t.id,e.contentWindow),this.window=new k(t,this,e,location),this.allowResources=t.allowResources||[];var n=t.body,r=t.disableBody;r?n=document.body:n||(n=document.createElement("body"),document.documentElement.appendChild(n)),this.body=n,this.document=new I(F({enableScriptEscape:!0},t),this,e,location),this.baseFrame=e,this._listenerMap=new Map,this.window.__IS_CONSOLE_OS_CONTEXT__=!0}var e,n;return b(o,[{key:"loadScripts",value:(n=i(c.a.mark(function t(e){var n;return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e,{credentials:D(e)});case 2:return n=t.sent,t.next=5,n.text();case 5:n=t.sent,this.evalScript(n,e);case 7:case"end":return t.stop()}},t,this)})),function(t){return n.apply(this,arguments)})},{key:"evalScript",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=this.document.createElement("script"),t=(n.src=e,new Function('\n return function ({window, location, history, document, __os_current_script__}){\n var document = new Proxy(document, {\n get: function get(target, prop) {\n if (prop === "currentScript" && __os_current_script__) {\n return __os_current_script__;\n }\n return target[prop];\n }\n });\n var window = new Proxy(window, {\n get: function get(target, prop) {\n if (prop === "document") return document;\n return target[prop];\n }\n })\n var globalThis = window;\n with(window.__CONSOLE_OS_GLOBAL_VARS_) {\n try {\n '.concat(t,"\n } catch(e) {\n console.log(e)\n }\n }\n }//# sourceMappingURL=").concat(e)));t().call(this.window,F(F({},this),{},{__os_current_script__:n}))}},{key:"updateBody",value:function(t){!t&&this.body||(this.body=t)}},{key:"remove",value:function(){this.document.removeEventListeners(),this.baseFrame&&(this.baseFrame.parentNode?this.baseFrame.parentNode.removeChild(this.baseFrame):this.baseFrame.setAttribute("src","about:blank"))}}],[{key:"create",value:function(r){var o=this;return new Promise(function(t){var e=document.createElement("iframe"),n=(e.setAttribute("src",r.url||"/api.json"),e.style.cssText="position: absolute; top: -20000px; width: 1px; height: 1px;",r.id&&e.setAttribute("data-id",r.id),(null==(n=document.documentElement)?void 0:n.getElementsByTagName("body")[0])||document.body);if(n.appendChild(e),"about:blank"===r.url)return t(new o(r,e));e.onload=function(){t(new o(r,e))}})}},{key:"remove",value:(e=i(c.a.mark(function t(e){return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e.remove&&e.remove();case 1:case"end":return t.stop()}},t)})),function(t){return e.apply(this,arguments)})}]),o}(),M=e;function N(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}var W=function(){var t=i(c.a.mark(function t(){var e,n=arguments;return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=0<n.length&&void 0!==n[0]?n[0]:{},t.next=3,M.create(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),U=function(){var e=i(c.a.mark(function t(e){return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,M.remove(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}(),V=function(){var e=i(c.a.mark(function t(e){var n,r,o,i=arguments;return c.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=1<i.length&&void 0!==i[1]?i[1]:{},t.next=3,M.create(n);case 3:return r=t.sent,o=new Function("\n return function({window, location, history, document}){ \n with(window.__CONSOLE_OS_GLOBAL_VARS_) { \n ".concat(e,"\n }\n }//@sourceURL=").concat(n.name)),t.abrupt("return",o(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},r)));case 6:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}()}],r={},o.m=n,o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/",o(o.s=1);function o(t){var e;return(r[t]||(e=r[t]={i:t,l:!1,exports:{}},n[t].call(e.exports,e,e.exports,o),e.l=!0,e)).exports}var n,r});
|
package/es/Window.js
CHANGED
|
@@ -62,8 +62,8 @@ var Window = /*#__PURE__*/_createClass(function Window() {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
switch (name) {
|
|
65
|
-
case 'window':
|
|
66
|
-
|
|
65
|
+
// case 'window':
|
|
66
|
+
// return getContextWindow(context);
|
|
67
67
|
case 'document':
|
|
68
68
|
return context.document;
|
|
69
69
|
case 'location':
|
package/lib/Window.js
CHANGED
|
@@ -70,8 +70,8 @@ var Window = /*#__PURE__*/(0, _createClass2.default)(function Window() {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
switch (name) {
|
|
73
|
-
case 'window':
|
|
74
|
-
|
|
73
|
+
// case 'window':
|
|
74
|
+
// return getContextWindow(context);
|
|
75
75
|
case 'document':
|
|
76
76
|
return context.document;
|
|
77
77
|
case 'location':
|