@galacean/effects-plugin-downgrade 2.7.2 → 2.7.4

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/alipay.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/alipay"),i=require("@galacean/appx-adapter/alipay");function n(e){if(e&&e.__esModule)return e;var i=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),i.default=e,Object.freeze(i)}var t=n(e);function o(e,i,n,t,o,r,h){try{var s=e[r](h),d=s.value}catch(e){return void n(e)}s.done?i(d):Promise.resolve(d).then(t,o)}function r(e,i){return r=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},r(e,i)}function h(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=s(0),h.throw=s(1),h.return=s(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function s(s){return function(d){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,s[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,t=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=i.call(e,r)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}function s(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function d(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return s(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var a,l={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},c={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},u={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},v={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};exports.DeviceLevel=void 0,(a=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",a.Medium="medium",a.Low="low",a.Unknown="unknown";var m=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var n=e.prototype;return n.getDeviceInfo=function(){return this.device},n.isIOS=function(){return"iOS"===this.device.platform},n.isAndroid=function(){return"Android"===this.device.platform},n.isHarmony=function(){return"Harmony"===this.device.platform},n.isWindows=function(){return"Windows"===this.device.platform},n.isMacintosh=function(){return"Macintosh"===this.device.platform},n.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},n.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var s,a=d(t);!(s=a()).done;){var l=s.value,c=l.name,u=l.comment;if(null==c?void 0:c.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},n.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},n.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?exports.DeviceLevel.Low:e<16?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?exports.DeviceLevel.Low:i<12?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}return exports.DeviceLevel.High},n.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.getIPhoneModel=function(){var e,n=i.window.screen.width*i.window.devicePixelRatio,t=i.window.screen.height*i.window.devicePixelRatio,o=l.iPhone.find((function(e){return e.width===n&&e.height===t}));return null!=(e=null==o?void 0:o.model)?e:"iPhone"},n.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=d(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var s,a=t[t.length-1].trim(),c=d(l.vender);!(s=c()).done;){var u=s.value;if(a.startsWith(u))return a.substring(u.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var v=t.length;if("wv"===t[v-1].trim())return t[v-2].trim()}},n.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.testIPhone=function(e){return e.includes("iPhone")},n.testIPad=function(e){return e.includes("iPad")},n.testAndroid=function(e){return e.includes("Android")},n.testMacintosh=function(e){return e.includes("Macintosh")},n.testWindows=function(e){return e.includes("Windows")},e}(),f=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:exports.DeviceLevel.High,medium:exports.DeviceLevel.Medium,middle:exports.DeviceLevel.Medium,low:exports.DeviceLevel.Low}[e]||exports.DeviceLevel.Unknown},e}(),P=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=v.wechat[e.model])?t:e.model,h=d(l.iPhone);!(o=h()).done;){var s=o.value;if(s.name===r){e.model=s.model;break}}if("iOS"===this.device.platform){var a=e.model.match(/^(.*?)<(.*?)>$/);a?(this.device.model=a[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=exports.DeviceLevel.Unknown:e.benchmarkLevel<=10?this.device.level=exports.DeviceLevel.Low:e.benchmarkLevel<=20?this.device.level=exports.DeviceLevel.Medium:this.device.level=exports.DeviceLevel.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),p=function(){function i(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=i.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?c.iPhone:c.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?u.iOS:u.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===exports.DeviceLevel.High)return e.spec.RenderLevel.S;if(this.device.level===exports.DeviceLevel.Medium)return e.spec.RenderLevel.A;if(this.device.level===exports.DeviceLevel.Low)return e.spec.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var i=+RegExp.$1;return i<=9?e.spec.RenderLevel.B:i<10?e.spec.RenderLevel.A:e.spec.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?e.spec.RenderLevel.B:this.device.memoryMB<6e3?e.spec.RenderLevel.A:e.spec.RenderLevel.S:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},i}(),g=Symbol("@@_inter_pause"),w=!1;function y(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function L(i){i.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[g]=!0)})))}function S(i){i.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[g]&&(e.resume(),e[g]=!1)})))}var M=function(i){function n(){return i.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&r(e,i)}(n,i),n.processRawJSON=function(i,n){return void 0===n&&(n={}),(t=function(){var i,t,o;return h(this,(function(r){if(t=null==(i=n.pluginData)?void 0:i.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:y()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(n,r){var h=t.apply(e,i);function s(e){o(h,n,r,s,d,"next",e)}function d(e){o(h,n,r,s,d,"throw",e)}s(void 0)}))})();var t},n}(e.AbstractPlugin),D="2.7.2";e.registerPlugin("downgrade",M,e.VFXItem),e.logger.info("Plugin downgrade version: 2.7.2."),D!==t.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),exports.AlipayMiniprogramParser=f,exports.UADecoder=m,exports.WechatMiniprogramParser=P,exports.getDefaultRenderLevel=y,exports.getDowngradeResult=function(n){void 0===n&&(n={}),w||(!function(n){var t=n.autoPause;i.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",L),document.addEventListener("resume",S))}(n),w=!0);var t,o=n.mockDowngrade;if(void 0!==o)return{downgrade:o,level:null!=(t=n.level)?t:e.spec.RenderLevel.S,reason:"mock"};var r=function(i){var n=i.queryDeviceInMiniApp,t=i.deviceInfo;if(t)return t;if(n){if(e.isAlipayMiniApp()){if(my.canIUse("getSystemInfo")){var o=my.getSystemInfo();return new f(o).getDeviceInfo()}e.logger.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(e.isWechatMiniApp()){if(wx.canIUse("getDeviceInfo")){var r=wx.getDeviceInfo();return new P(r).getDeviceInfo()}e.logger.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else e.logger.error("Non-mini program environment and try to get device info from user agent.")}return(new m).getDeviceInfo()}(n);return new p(n,r).getDowngradeResult()},exports.version=D;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/alipay"),i=require("@galacean/appx-adapter/alipay");function n(e){if(e&&e.__esModule)return e;var i=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),i.default=e,Object.freeze(i)}var t=n(e);function o(e,i,n,t,o,r,h){try{var s=e[r](h),d=s.value}catch(e){return void n(e)}s.done?i(d):Promise.resolve(d).then(t,o)}function r(e,i){return r=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},r(e,i)}function h(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=s(0),h.throw=s(1),h.return=s(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function s(s){return function(d){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,s[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,t=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=i.call(e,r)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}function s(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function d(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return s(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var a,l={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},c={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},u={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},v={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};exports.DeviceLevel=void 0,(a=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",a.Medium="medium",a.Low="low",a.Unknown="unknown";var m=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var n=e.prototype;return n.getDeviceInfo=function(){return this.device},n.isIOS=function(){return"iOS"===this.device.platform},n.isAndroid=function(){return"Android"===this.device.platform},n.isHarmony=function(){return"Harmony"===this.device.platform},n.isWindows=function(){return"Windows"===this.device.platform},n.isMacintosh=function(){return"Macintosh"===this.device.platform},n.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},n.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var s,a=d(t);!(s=a()).done;){var l=s.value,c=l.name,u=l.comment;if(null==c?void 0:c.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},n.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},n.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?exports.DeviceLevel.Low:e<16?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?exports.DeviceLevel.Low:i<12?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}return exports.DeviceLevel.High},n.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.getIPhoneModel=function(){var e,n=i.window.screen.width*i.window.devicePixelRatio,t=i.window.screen.height*i.window.devicePixelRatio,o=l.iPhone.find((function(e){return e.width===n&&e.height===t}));return null!=(e=null==o?void 0:o.model)?e:"iPhone"},n.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=d(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var s,a=t[t.length-1].trim(),c=d(l.vender);!(s=c()).done;){var u=s.value;if(a.startsWith(u))return a.substring(u.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var v=t.length;if("wv"===t[v-1].trim())return t[v-2].trim()}},n.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.testIPhone=function(e){return e.includes("iPhone")},n.testIPad=function(e){return e.includes("iPad")},n.testAndroid=function(e){return e.includes("Android")},n.testMacintosh=function(e){return e.includes("Macintosh")},n.testWindows=function(e){return e.includes("Windows")},e}(),f=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:exports.DeviceLevel.High,medium:exports.DeviceLevel.Medium,middle:exports.DeviceLevel.Medium,low:exports.DeviceLevel.Low}[e]||exports.DeviceLevel.Unknown},e}(),P=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=v.wechat[e.model])?t:e.model,h=d(l.iPhone);!(o=h()).done;){var s=o.value;if(s.name===r){e.model=s.model;break}}if("iOS"===this.device.platform){var a=e.model.match(/^(.*?)<(.*?)>$/);a?(this.device.model=a[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=exports.DeviceLevel.Unknown:e.benchmarkLevel<=10?this.device.level=exports.DeviceLevel.Low:e.benchmarkLevel<=20?this.device.level=exports.DeviceLevel.Medium:this.device.level=exports.DeviceLevel.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),p=function(){function i(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=i.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?c.iPhone:c.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?u.iOS:u.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===exports.DeviceLevel.High)return e.spec.RenderLevel.S;if(this.device.level===exports.DeviceLevel.Medium)return e.spec.RenderLevel.A;if(this.device.level===exports.DeviceLevel.Low)return e.spec.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var i=+RegExp.$1;return i<=9?e.spec.RenderLevel.B:i<10?e.spec.RenderLevel.A:e.spec.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?e.spec.RenderLevel.B:this.device.memoryMB<6e3?e.spec.RenderLevel.A:e.spec.RenderLevel.S:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},i}(),g=Symbol("@@_inter_pause"),w=!1;function y(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function L(i){i.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[g]=!0)})))}function S(i){i.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[g]&&(e.resume(),e[g]=!1)})))}var M=function(i){function n(){return i.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&r(e,i)}(n,i),n.processRawJSON=function(i,n){return void 0===n&&(n={}),(t=function(){var i,t,o;return h(this,(function(r){if(t=null==(i=n.pluginData)?void 0:i.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:y()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(n,r){var h=t.apply(e,i);function s(e){o(h,n,r,s,d,"next",e)}function d(e){o(h,n,r,s,d,"throw",e)}s(void 0)}))})();var t},n}(e.AbstractPlugin),D="2.7.4";e.registerPlugin("downgrade",M,e.VFXItem),e.logger.info("Plugin downgrade version: 2.7.4."),D!==t.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),exports.AlipayMiniprogramParser=f,exports.UADecoder=m,exports.WechatMiniprogramParser=P,exports.getDefaultRenderLevel=y,exports.getDowngradeResult=function(n){void 0===n&&(n={}),w||(!function(n){var t=n.autoPause;i.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",L),document.addEventListener("resume",S))}(n),w=!0);var t,o=n.mockDowngrade;if(void 0!==o)return{downgrade:o,level:null!=(t=n.level)?t:e.spec.RenderLevel.S,reason:"mock"};var r=function(i){var n=i.queryDeviceInMiniApp,t=i.deviceInfo;if(t)return t;if(n){if(e.isAlipayMiniApp()){if(my.canIUse("getSystemInfo")){var o=my.getSystemInfo();return new f(o).getDeviceInfo()}e.logger.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(e.isWechatMiniApp()){if(wx.canIUse("getDeviceInfo")){var r=wx.getDeviceInfo();return new P(r).getDeviceInfo()}e.logger.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else e.logger.error("Non-mini program environment and try to get device info from user agent.")}return(new m).getDeviceInfo()}(n);return new p(n,r).getDowngradeResult()},exports.version=D;
2
2
  //# sourceMappingURL=alipay.js.map
package/dist/alipay.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import*as e from"@galacean/effects/alipay";import{spec as i,getActivePlayers as n,isAlipayMiniApp as t,logger as o,isWechatMiniApp as r,isIOS as h,AbstractPlugin as d,registerPlugin as a,VFXItem as s}from"@galacean/effects/alipay";import{window as l}from"@galacean/appx-adapter/alipay";function u(e,i,n,t,o,r,h){try{var d=e[r](h),a=d.value}catch(e){return void n(e)}d.done?i(a):Promise.resolve(a).then(t,o)}function c(e,i){return c=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},c(e,i)}function v(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=d(0),h.throw=d(1),h.return=d(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function d(d){return function(a){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,d[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&d[0]?t.return:d[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,d[1])).done)return o;switch(t=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,t=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==d[0]&&2!==d[0])){r=0;continue}if(3===d[0]&&(!o||d[1]>o[0]&&d[1]<o[3])){r.label=d[1];break}if(6===d[0]&&r.label<o[1]){r.label=o[1],o=d;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(d);break}o[2]&&r.ops.pop(),r.trys.pop();continue}d=i.call(e,r)}catch(e){d=[6,e],t=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([d,a])}}}function m(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function f(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return m(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var P,g={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},p={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},w={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},y={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};!function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(P||(P={}));var S=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.isIOS=function(){return"iOS"===this.device.platform},i.isAndroid=function(){return"Android"===this.device.platform},i.isHarmony=function(){return"Harmony"===this.device.platform},i.isWindows=function(){return"Windows"===this.device.platform},i.isMacintosh=function(){return"Macintosh"===this.device.platform},i.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},i.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var d,a=f(t);!(d=a()).done;){var s=d.value,l=s.name,u=s.comment;if(null==l?void 0:l.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},i.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},i.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?P.Low:e<16?P.Medium:P.High}return P.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?P.Low:i<12?P.Medium:P.High}return P.Low}return P.High},i.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.getIPhoneModel=function(){var e,i=l.screen.width*l.devicePixelRatio,n=l.screen.height*l.devicePixelRatio,t=g.iPhone.find((function(e){return e.width===i&&e.height===n}));return null!=(e=null==t?void 0:t.model)?e:"iPhone"},i.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=f(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var d,a=t[t.length-1].trim(),s=f(g.vender);!(d=s()).done;){var l=d.value;if(a.startsWith(l))return a.substring(l.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var u=t.length;if("wv"===t[u-1].trim())return t[u-2].trim()}},i.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.testIPhone=function(e){return e.includes("iPhone")},i.testIPad=function(e){return e.includes("iPad")},i.testAndroid=function(e){return e.includes("Android")},i.testMacintosh=function(e){return e.includes("Macintosh")},i.testWindows=function(e){return e.includes("Windows")},e}(),M=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:P.High,medium:P.Medium,middle:P.Medium,low:P.Low}[e]||P.Unknown},e}(),b=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=y.wechat[e.model])?t:e.model,h=f(g.iPhone);!(o=h()).done;){var d=o.value;if(d.name===r){e.model=d.model;break}}if("iOS"===this.device.platform){var a=e.model.match(/^(.*?)<(.*?)>$/);a?(this.device.model=a[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=P.Unknown:e.benchmarkLevel<=10?this.device.level=P.Low:e.benchmarkLevel<=20?this.device.level=P.Medium:this.device.level=P.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),I=function(){function e(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=e.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?p.iPhone:p.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?w.iOS:w.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===P.High)return i.RenderLevel.S;if(this.device.level===P.Medium)return i.RenderLevel.A;if(this.device.level===P.Low)return i.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var e=+RegExp.$1;return e<=9?i.RenderLevel.B:e<10?i.RenderLevel.A:i.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?i.RenderLevel.B:this.device.memoryMB<6e3?i.RenderLevel.A:i.RenderLevel.S:this.isIOS?i.RenderLevel.S:i.RenderLevel.B},e}(),A=Symbol("@@_inter_pause"),L=!1;function O(e){void 0===e&&(e={}),L||(!function(e){var i=e.autoPause;l.addEventListener("unload",(function(){n().forEach((function(e){return e.dispose()}))})),i&&(document.addEventListener("pause",R),document.addEventListener("resume",V))}(e),L=!0);var h,d=e.mockDowngrade;if(void 0!==d)return{downgrade:d,level:null!=(h=e.level)?h:i.RenderLevel.S,reason:"mock"};var a=function(e){var i=e.queryDeviceInMiniApp,n=e.deviceInfo;if(n)return n;if(i){if(t()){if(my.canIUse("getSystemInfo")){var h=my.getSystemInfo();return new M(h).getDeviceInfo()}o.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(r()){if(wx.canIUse("getDeviceInfo")){var d=wx.getDeviceInfo();return new b(d).getDeviceInfo()}o.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else o.error("Non-mini program environment and try to get device info from user agent.")}return(new S).getDeviceInfo()}(e);return new I(e,a).getDowngradeResult()}function D(){return h()?i.RenderLevel.S:i.RenderLevel.B}function R(e){e.target===document&&(o.info("Auto pause all players with data offloaded."),n().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[A]=!0)})))}function V(e){e.target===document&&(o.info("Auto resume all players."),n().forEach((function(e){e[A]&&(e.resume(),e[A]=!1)})))}var x=function(e){function i(){return e.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&c(e,i)}(i,e),i.processRawJSON=function(e,i){return void 0===i&&(i={}),(n=function(){var e,n,t;return v(this,(function(r){if(n=null==(e=i.pluginData)?void 0:e.downgrade){if(n.downgrade)throw new Error("Downgraded, reason: "+n.reason)}else o.warn("No downgrade result in pluginData of SceneLoadOptions.");return i.renderLevel||(i.renderLevel=null!=(t=null==n?void 0:n.level)?t:D()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(t,o){var r=n.apply(e,i);function h(e){u(r,t,o,h,d,"next",e)}function d(e){u(r,t,o,h,d,"throw",e)}h(void 0)}))})();var n},i}(d),k="2.7.2";a("downgrade",x,s),o.info("Plugin downgrade version: 2.7.2."),k!==e.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");export{M as AlipayMiniprogramParser,P as DeviceLevel,S as UADecoder,b as WechatMiniprogramParser,D as getDefaultRenderLevel,O as getDowngradeResult,k as version};
1
+ import*as e from"@galacean/effects/alipay";import{spec as i,getActivePlayers as n,isAlipayMiniApp as t,logger as o,isWechatMiniApp as r,isIOS as h,AbstractPlugin as d,registerPlugin as a,VFXItem as s}from"@galacean/effects/alipay";import{window as l}from"@galacean/appx-adapter/alipay";function u(e,i,n,t,o,r,h){try{var d=e[r](h),a=d.value}catch(e){return void n(e)}d.done?i(a):Promise.resolve(a).then(t,o)}function c(e,i){return c=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},c(e,i)}function v(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=d(0),h.throw=d(1),h.return=d(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function d(d){return function(a){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,d[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&d[0]?t.return:d[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,d[1])).done)return o;switch(t=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,t=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==d[0]&&2!==d[0])){r=0;continue}if(3===d[0]&&(!o||d[1]>o[0]&&d[1]<o[3])){r.label=d[1];break}if(6===d[0]&&r.label<o[1]){r.label=o[1],o=d;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(d);break}o[2]&&r.ops.pop(),r.trys.pop();continue}d=i.call(e,r)}catch(e){d=[6,e],t=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([d,a])}}}function m(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function f(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return m(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var P,g={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},p={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},w={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},y={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};!function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(P||(P={}));var S=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.isIOS=function(){return"iOS"===this.device.platform},i.isAndroid=function(){return"Android"===this.device.platform},i.isHarmony=function(){return"Harmony"===this.device.platform},i.isWindows=function(){return"Windows"===this.device.platform},i.isMacintosh=function(){return"Macintosh"===this.device.platform},i.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},i.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var d,a=f(t);!(d=a()).done;){var s=d.value,l=s.name,u=s.comment;if(null==l?void 0:l.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},i.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},i.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?P.Low:e<16?P.Medium:P.High}return P.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?P.Low:i<12?P.Medium:P.High}return P.Low}return P.High},i.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.getIPhoneModel=function(){var e,i=l.screen.width*l.devicePixelRatio,n=l.screen.height*l.devicePixelRatio,t=g.iPhone.find((function(e){return e.width===i&&e.height===n}));return null!=(e=null==t?void 0:t.model)?e:"iPhone"},i.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=f(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var d,a=t[t.length-1].trim(),s=f(g.vender);!(d=s()).done;){var l=d.value;if(a.startsWith(l))return a.substring(l.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var u=t.length;if("wv"===t[u-1].trim())return t[u-2].trim()}},i.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.testIPhone=function(e){return e.includes("iPhone")},i.testIPad=function(e){return e.includes("iPad")},i.testAndroid=function(e){return e.includes("Android")},i.testMacintosh=function(e){return e.includes("Macintosh")},i.testWindows=function(e){return e.includes("Windows")},e}(),M=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:P.High,medium:P.Medium,middle:P.Medium,low:P.Low}[e]||P.Unknown},e}(),b=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=y.wechat[e.model])?t:e.model,h=f(g.iPhone);!(o=h()).done;){var d=o.value;if(d.name===r){e.model=d.model;break}}if("iOS"===this.device.platform){var a=e.model.match(/^(.*?)<(.*?)>$/);a?(this.device.model=a[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=P.Unknown:e.benchmarkLevel<=10?this.device.level=P.Low:e.benchmarkLevel<=20?this.device.level=P.Medium:this.device.level=P.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),I=function(){function e(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=e.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?p.iPhone:p.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?w.iOS:w.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===P.High)return i.RenderLevel.S;if(this.device.level===P.Medium)return i.RenderLevel.A;if(this.device.level===P.Low)return i.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var e=+RegExp.$1;return e<=9?i.RenderLevel.B:e<10?i.RenderLevel.A:i.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?i.RenderLevel.B:this.device.memoryMB<6e3?i.RenderLevel.A:i.RenderLevel.S:this.isIOS?i.RenderLevel.S:i.RenderLevel.B},e}(),A=Symbol("@@_inter_pause"),L=!1;function O(e){void 0===e&&(e={}),L||(!function(e){var i=e.autoPause;l.addEventListener("unload",(function(){n().forEach((function(e){return e.dispose()}))})),i&&(document.addEventListener("pause",R),document.addEventListener("resume",V))}(e),L=!0);var h,d=e.mockDowngrade;if(void 0!==d)return{downgrade:d,level:null!=(h=e.level)?h:i.RenderLevel.S,reason:"mock"};var a=function(e){var i=e.queryDeviceInMiniApp,n=e.deviceInfo;if(n)return n;if(i){if(t()){if(my.canIUse("getSystemInfo")){var h=my.getSystemInfo();return new M(h).getDeviceInfo()}o.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(r()){if(wx.canIUse("getDeviceInfo")){var d=wx.getDeviceInfo();return new b(d).getDeviceInfo()}o.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else o.error("Non-mini program environment and try to get device info from user agent.")}return(new S).getDeviceInfo()}(e);return new I(e,a).getDowngradeResult()}function D(){return h()?i.RenderLevel.S:i.RenderLevel.B}function R(e){e.target===document&&(o.info("Auto pause all players with data offloaded."),n().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[A]=!0)})))}function V(e){e.target===document&&(o.info("Auto resume all players."),n().forEach((function(e){e[A]&&(e.resume(),e[A]=!1)})))}var x=function(e){function i(){return e.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&c(e,i)}(i,e),i.processRawJSON=function(e,i){return void 0===i&&(i={}),(n=function(){var e,n,t;return v(this,(function(r){if(n=null==(e=i.pluginData)?void 0:e.downgrade){if(n.downgrade)throw new Error("Downgraded, reason: "+n.reason)}else o.warn("No downgrade result in pluginData of SceneLoadOptions.");return i.renderLevel||(i.renderLevel=null!=(t=null==n?void 0:n.level)?t:D()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(t,o){var r=n.apply(e,i);function h(e){u(r,t,o,h,d,"next",e)}function d(e){u(r,t,o,h,d,"throw",e)}h(void 0)}))})();var n},i}(d),k="2.7.4";a("downgrade",x,s),o.info("Plugin downgrade version: 2.7.4."),k!==e.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");export{M as AlipayMiniprogramParser,P as DeviceLevel,S as UADecoder,b as WechatMiniprogramParser,D as getDefaultRenderLevel,O as getDowngradeResult,k as version};
2
2
  //# sourceMappingURL=alipay.mjs.map
package/dist/douyin.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/douyin"),i=require("@galacean/appx-adapter/douyin");function n(e){if(e&&e.__esModule)return e;var i=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),i.default=e,Object.freeze(i)}var t=n(e);function o(e,i,n,t,o,r,h){try{var s=e[r](h),d=s.value}catch(e){return void n(e)}s.done?i(d):Promise.resolve(d).then(t,o)}function r(e,i){return r=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},r(e,i)}function h(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=s(0),h.throw=s(1),h.return=s(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function s(s){return function(d){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,s[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,t=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=i.call(e,r)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}function s(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function d(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return s(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var a,l={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},c={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},u={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},v={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};exports.DeviceLevel=void 0,(a=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",a.Medium="medium",a.Low="low",a.Unknown="unknown";var m=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var n=e.prototype;return n.getDeviceInfo=function(){return this.device},n.isIOS=function(){return"iOS"===this.device.platform},n.isAndroid=function(){return"Android"===this.device.platform},n.isHarmony=function(){return"Harmony"===this.device.platform},n.isWindows=function(){return"Windows"===this.device.platform},n.isMacintosh=function(){return"Macintosh"===this.device.platform},n.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},n.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var s,a=d(t);!(s=a()).done;){var l=s.value,c=l.name,u=l.comment;if(null==c?void 0:c.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},n.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},n.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?exports.DeviceLevel.Low:e<16?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?exports.DeviceLevel.Low:i<12?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}return exports.DeviceLevel.High},n.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.getIPhoneModel=function(){var e,n=i.window.screen.width*i.window.devicePixelRatio,t=i.window.screen.height*i.window.devicePixelRatio,o=l.iPhone.find((function(e){return e.width===n&&e.height===t}));return null!=(e=null==o?void 0:o.model)?e:"iPhone"},n.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=d(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var s,a=t[t.length-1].trim(),c=d(l.vender);!(s=c()).done;){var u=s.value;if(a.startsWith(u))return a.substring(u.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var v=t.length;if("wv"===t[v-1].trim())return t[v-2].trim()}},n.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.testIPhone=function(e){return e.includes("iPhone")},n.testIPad=function(e){return e.includes("iPad")},n.testAndroid=function(e){return e.includes("Android")},n.testMacintosh=function(e){return e.includes("Macintosh")},n.testWindows=function(e){return e.includes("Windows")},e}(),f=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:exports.DeviceLevel.High,medium:exports.DeviceLevel.Medium,middle:exports.DeviceLevel.Medium,low:exports.DeviceLevel.Low}[e]||exports.DeviceLevel.Unknown},e}(),P=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=v.wechat[e.model])?t:e.model,h=d(l.iPhone);!(o=h()).done;){var s=o.value;if(s.name===r){e.model=s.model;break}}if("iOS"===this.device.platform){var a=e.model.match(/^(.*?)<(.*?)>$/);a?(this.device.model=a[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=exports.DeviceLevel.Unknown:e.benchmarkLevel<=10?this.device.level=exports.DeviceLevel.Low:e.benchmarkLevel<=20?this.device.level=exports.DeviceLevel.Medium:this.device.level=exports.DeviceLevel.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),p=function(){function i(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=i.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?c.iPhone:c.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?u.iOS:u.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===exports.DeviceLevel.High)return e.spec.RenderLevel.S;if(this.device.level===exports.DeviceLevel.Medium)return e.spec.RenderLevel.A;if(this.device.level===exports.DeviceLevel.Low)return e.spec.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var i=+RegExp.$1;return i<=9?e.spec.RenderLevel.B:i<10?e.spec.RenderLevel.A:e.spec.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?e.spec.RenderLevel.B:this.device.memoryMB<6e3?e.spec.RenderLevel.A:e.spec.RenderLevel.S:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},i}(),g=Symbol("@@_inter_pause"),w=!1;function y(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function L(i){i.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[g]=!0)})))}function S(i){i.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[g]&&(e.resume(),e[g]=!1)})))}var M=function(i){function n(){return i.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&r(e,i)}(n,i),n.processRawJSON=function(i,n){return void 0===n&&(n={}),(t=function(){var i,t,o;return h(this,(function(r){if(t=null==(i=n.pluginData)?void 0:i.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:y()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(n,r){var h=t.apply(e,i);function s(e){o(h,n,r,s,d,"next",e)}function d(e){o(h,n,r,s,d,"throw",e)}s(void 0)}))})();var t},n}(e.AbstractPlugin),D="2.7.2";e.registerPlugin("downgrade",M,e.VFXItem),e.logger.info("Plugin downgrade version: 2.7.2."),D!==t.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),exports.AlipayMiniprogramParser=f,exports.UADecoder=m,exports.WechatMiniprogramParser=P,exports.getDefaultRenderLevel=y,exports.getDowngradeResult=function(n){void 0===n&&(n={}),w||(!function(n){var t=n.autoPause;i.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",L),document.addEventListener("resume",S))}(n),w=!0);var t,o=n.mockDowngrade;if(void 0!==o)return{downgrade:o,level:null!=(t=n.level)?t:e.spec.RenderLevel.S,reason:"mock"};var r=function(i){var n=i.queryDeviceInMiniApp,t=i.deviceInfo;if(t)return t;if(n){if(e.isAlipayMiniApp()){if(my.canIUse("getSystemInfo")){var o=my.getSystemInfo();return new f(o).getDeviceInfo()}e.logger.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(e.isWechatMiniApp()){if(wx.canIUse("getDeviceInfo")){var r=wx.getDeviceInfo();return new P(r).getDeviceInfo()}e.logger.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else e.logger.error("Non-mini program environment and try to get device info from user agent.")}return(new m).getDeviceInfo()}(n);return new p(n,r).getDowngradeResult()},exports.version=D;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/douyin"),i=require("@galacean/appx-adapter/douyin");function n(e){if(e&&e.__esModule)return e;var i=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),i.default=e,Object.freeze(i)}var t=n(e);function o(e,i,n,t,o,r,h){try{var s=e[r](h),d=s.value}catch(e){return void n(e)}s.done?i(d):Promise.resolve(d).then(t,o)}function r(e,i){return r=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},r(e,i)}function h(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=s(0),h.throw=s(1),h.return=s(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function s(s){return function(d){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,s[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,t=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=i.call(e,r)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}function s(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function d(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return s(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var a,l={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},c={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},u={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},v={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};exports.DeviceLevel=void 0,(a=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",a.Medium="medium",a.Low="low",a.Unknown="unknown";var m=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var n=e.prototype;return n.getDeviceInfo=function(){return this.device},n.isIOS=function(){return"iOS"===this.device.platform},n.isAndroid=function(){return"Android"===this.device.platform},n.isHarmony=function(){return"Harmony"===this.device.platform},n.isWindows=function(){return"Windows"===this.device.platform},n.isMacintosh=function(){return"Macintosh"===this.device.platform},n.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},n.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var s,a=d(t);!(s=a()).done;){var l=s.value,c=l.name,u=l.comment;if(null==c?void 0:c.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},n.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},n.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?exports.DeviceLevel.Low:e<16?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?exports.DeviceLevel.Low:i<12?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}return exports.DeviceLevel.High},n.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.getIPhoneModel=function(){var e,n=i.window.screen.width*i.window.devicePixelRatio,t=i.window.screen.height*i.window.devicePixelRatio,o=l.iPhone.find((function(e){return e.width===n&&e.height===t}));return null!=(e=null==o?void 0:o.model)?e:"iPhone"},n.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=d(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var s,a=t[t.length-1].trim(),c=d(l.vender);!(s=c()).done;){var u=s.value;if(a.startsWith(u))return a.substring(u.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var v=t.length;if("wv"===t[v-1].trim())return t[v-2].trim()}},n.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.testIPhone=function(e){return e.includes("iPhone")},n.testIPad=function(e){return e.includes("iPad")},n.testAndroid=function(e){return e.includes("Android")},n.testMacintosh=function(e){return e.includes("Macintosh")},n.testWindows=function(e){return e.includes("Windows")},e}(),f=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:exports.DeviceLevel.High,medium:exports.DeviceLevel.Medium,middle:exports.DeviceLevel.Medium,low:exports.DeviceLevel.Low}[e]||exports.DeviceLevel.Unknown},e}(),P=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=v.wechat[e.model])?t:e.model,h=d(l.iPhone);!(o=h()).done;){var s=o.value;if(s.name===r){e.model=s.model;break}}if("iOS"===this.device.platform){var a=e.model.match(/^(.*?)<(.*?)>$/);a?(this.device.model=a[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=exports.DeviceLevel.Unknown:e.benchmarkLevel<=10?this.device.level=exports.DeviceLevel.Low:e.benchmarkLevel<=20?this.device.level=exports.DeviceLevel.Medium:this.device.level=exports.DeviceLevel.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),p=function(){function i(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=i.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?c.iPhone:c.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?u.iOS:u.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===exports.DeviceLevel.High)return e.spec.RenderLevel.S;if(this.device.level===exports.DeviceLevel.Medium)return e.spec.RenderLevel.A;if(this.device.level===exports.DeviceLevel.Low)return e.spec.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var i=+RegExp.$1;return i<=9?e.spec.RenderLevel.B:i<10?e.spec.RenderLevel.A:e.spec.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?e.spec.RenderLevel.B:this.device.memoryMB<6e3?e.spec.RenderLevel.A:e.spec.RenderLevel.S:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},i}(),g=Symbol("@@_inter_pause"),w=!1;function y(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function L(i){i.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[g]=!0)})))}function S(i){i.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[g]&&(e.resume(),e[g]=!1)})))}var M=function(i){function n(){return i.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&r(e,i)}(n,i),n.processRawJSON=function(i,n){return void 0===n&&(n={}),(t=function(){var i,t,o;return h(this,(function(r){if(t=null==(i=n.pluginData)?void 0:i.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:y()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(n,r){var h=t.apply(e,i);function s(e){o(h,n,r,s,d,"next",e)}function d(e){o(h,n,r,s,d,"throw",e)}s(void 0)}))})();var t},n}(e.AbstractPlugin),D="2.7.4";e.registerPlugin("downgrade",M,e.VFXItem),e.logger.info("Plugin downgrade version: 2.7.4."),D!==t.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),exports.AlipayMiniprogramParser=f,exports.UADecoder=m,exports.WechatMiniprogramParser=P,exports.getDefaultRenderLevel=y,exports.getDowngradeResult=function(n){void 0===n&&(n={}),w||(!function(n){var t=n.autoPause;i.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",L),document.addEventListener("resume",S))}(n),w=!0);var t,o=n.mockDowngrade;if(void 0!==o)return{downgrade:o,level:null!=(t=n.level)?t:e.spec.RenderLevel.S,reason:"mock"};var r=function(i){var n=i.queryDeviceInMiniApp,t=i.deviceInfo;if(t)return t;if(n){if(e.isAlipayMiniApp()){if(my.canIUse("getSystemInfo")){var o=my.getSystemInfo();return new f(o).getDeviceInfo()}e.logger.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(e.isWechatMiniApp()){if(wx.canIUse("getDeviceInfo")){var r=wx.getDeviceInfo();return new P(r).getDeviceInfo()}e.logger.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else e.logger.error("Non-mini program environment and try to get device info from user agent.")}return(new m).getDeviceInfo()}(n);return new p(n,r).getDowngradeResult()},exports.version=D;
2
2
  //# sourceMappingURL=douyin.js.map
package/dist/douyin.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import*as e from"@galacean/effects/douyin";import{spec as i,getActivePlayers as n,isAlipayMiniApp as t,logger as o,isWechatMiniApp as r,isIOS as h,AbstractPlugin as d,registerPlugin as s,VFXItem as a}from"@galacean/effects/douyin";import{window as l}from"@galacean/appx-adapter/douyin";function u(e,i,n,t,o,r,h){try{var d=e[r](h),s=d.value}catch(e){return void n(e)}d.done?i(s):Promise.resolve(s).then(t,o)}function c(e,i){return c=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},c(e,i)}function v(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=d(0),h.throw=d(1),h.return=d(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function d(d){return function(s){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,d[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&d[0]?t.return:d[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,d[1])).done)return o;switch(t=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,t=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==d[0]&&2!==d[0])){r=0;continue}if(3===d[0]&&(!o||d[1]>o[0]&&d[1]<o[3])){r.label=d[1];break}if(6===d[0]&&r.label<o[1]){r.label=o[1],o=d;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(d);break}o[2]&&r.ops.pop(),r.trys.pop();continue}d=i.call(e,r)}catch(e){d=[6,e],t=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([d,s])}}}function m(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function f(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return m(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var P,g={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},p={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},w={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},y={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};!function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(P||(P={}));var S=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.isIOS=function(){return"iOS"===this.device.platform},i.isAndroid=function(){return"Android"===this.device.platform},i.isHarmony=function(){return"Harmony"===this.device.platform},i.isWindows=function(){return"Windows"===this.device.platform},i.isMacintosh=function(){return"Macintosh"===this.device.platform},i.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},i.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var d,s=f(t);!(d=s()).done;){var a=d.value,l=a.name,u=a.comment;if(null==l?void 0:l.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},i.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},i.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?P.Low:e<16?P.Medium:P.High}return P.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?P.Low:i<12?P.Medium:P.High}return P.Low}return P.High},i.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.getIPhoneModel=function(){var e,i=l.screen.width*l.devicePixelRatio,n=l.screen.height*l.devicePixelRatio,t=g.iPhone.find((function(e){return e.width===i&&e.height===n}));return null!=(e=null==t?void 0:t.model)?e:"iPhone"},i.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=f(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var d,s=t[t.length-1].trim(),a=f(g.vender);!(d=a()).done;){var l=d.value;if(s.startsWith(l))return s.substring(l.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var u=t.length;if("wv"===t[u-1].trim())return t[u-2].trim()}},i.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.testIPhone=function(e){return e.includes("iPhone")},i.testIPad=function(e){return e.includes("iPad")},i.testAndroid=function(e){return e.includes("Android")},i.testMacintosh=function(e){return e.includes("Macintosh")},i.testWindows=function(e){return e.includes("Windows")},e}(),M=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:P.High,medium:P.Medium,middle:P.Medium,low:P.Low}[e]||P.Unknown},e}(),b=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=y.wechat[e.model])?t:e.model,h=f(g.iPhone);!(o=h()).done;){var d=o.value;if(d.name===r){e.model=d.model;break}}if("iOS"===this.device.platform){var s=e.model.match(/^(.*?)<(.*?)>$/);s?(this.device.model=s[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=P.Unknown:e.benchmarkLevel<=10?this.device.level=P.Low:e.benchmarkLevel<=20?this.device.level=P.Medium:this.device.level=P.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),I=function(){function e(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=e.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?p.iPhone:p.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?w.iOS:w.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===P.High)return i.RenderLevel.S;if(this.device.level===P.Medium)return i.RenderLevel.A;if(this.device.level===P.Low)return i.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var e=+RegExp.$1;return e<=9?i.RenderLevel.B:e<10?i.RenderLevel.A:i.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?i.RenderLevel.B:this.device.memoryMB<6e3?i.RenderLevel.A:i.RenderLevel.S:this.isIOS?i.RenderLevel.S:i.RenderLevel.B},e}(),A=Symbol("@@_inter_pause"),L=!1;function O(e){void 0===e&&(e={}),L||(!function(e){var i=e.autoPause;l.addEventListener("unload",(function(){n().forEach((function(e){return e.dispose()}))})),i&&(document.addEventListener("pause",R),document.addEventListener("resume",V))}(e),L=!0);var h,d=e.mockDowngrade;if(void 0!==d)return{downgrade:d,level:null!=(h=e.level)?h:i.RenderLevel.S,reason:"mock"};var s=function(e){var i=e.queryDeviceInMiniApp,n=e.deviceInfo;if(n)return n;if(i){if(t()){if(my.canIUse("getSystemInfo")){var h=my.getSystemInfo();return new M(h).getDeviceInfo()}o.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(r()){if(wx.canIUse("getDeviceInfo")){var d=wx.getDeviceInfo();return new b(d).getDeviceInfo()}o.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else o.error("Non-mini program environment and try to get device info from user agent.")}return(new S).getDeviceInfo()}(e);return new I(e,s).getDowngradeResult()}function D(){return h()?i.RenderLevel.S:i.RenderLevel.B}function R(e){e.target===document&&(o.info("Auto pause all players with data offloaded."),n().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[A]=!0)})))}function V(e){e.target===document&&(o.info("Auto resume all players."),n().forEach((function(e){e[A]&&(e.resume(),e[A]=!1)})))}var x=function(e){function i(){return e.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&c(e,i)}(i,e),i.processRawJSON=function(e,i){return void 0===i&&(i={}),(n=function(){var e,n,t;return v(this,(function(r){if(n=null==(e=i.pluginData)?void 0:e.downgrade){if(n.downgrade)throw new Error("Downgraded, reason: "+n.reason)}else o.warn("No downgrade result in pluginData of SceneLoadOptions.");return i.renderLevel||(i.renderLevel=null!=(t=null==n?void 0:n.level)?t:D()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(t,o){var r=n.apply(e,i);function h(e){u(r,t,o,h,d,"next",e)}function d(e){u(r,t,o,h,d,"throw",e)}h(void 0)}))})();var n},i}(d),k="2.7.2";s("downgrade",x,a),o.info("Plugin downgrade version: 2.7.2."),k!==e.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");export{M as AlipayMiniprogramParser,P as DeviceLevel,S as UADecoder,b as WechatMiniprogramParser,D as getDefaultRenderLevel,O as getDowngradeResult,k as version};
1
+ import*as e from"@galacean/effects/douyin";import{spec as i,getActivePlayers as n,isAlipayMiniApp as t,logger as o,isWechatMiniApp as r,isIOS as h,AbstractPlugin as d,registerPlugin as s,VFXItem as a}from"@galacean/effects/douyin";import{window as l}from"@galacean/appx-adapter/douyin";function u(e,i,n,t,o,r,h){try{var d=e[r](h),s=d.value}catch(e){return void n(e)}d.done?i(s):Promise.resolve(s).then(t,o)}function c(e,i){return c=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},c(e,i)}function v(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=d(0),h.throw=d(1),h.return=d(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function d(d){return function(s){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,d[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&d[0]?t.return:d[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,d[1])).done)return o;switch(t=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,t=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==d[0]&&2!==d[0])){r=0;continue}if(3===d[0]&&(!o||d[1]>o[0]&&d[1]<o[3])){r.label=d[1];break}if(6===d[0]&&r.label<o[1]){r.label=o[1],o=d;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(d);break}o[2]&&r.ops.pop(),r.trys.pop();continue}d=i.call(e,r)}catch(e){d=[6,e],t=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([d,s])}}}function m(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function f(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return m(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var P,g={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},p={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},w={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},y={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};!function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(P||(P={}));var S=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.isIOS=function(){return"iOS"===this.device.platform},i.isAndroid=function(){return"Android"===this.device.platform},i.isHarmony=function(){return"Harmony"===this.device.platform},i.isWindows=function(){return"Windows"===this.device.platform},i.isMacintosh=function(){return"Macintosh"===this.device.platform},i.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},i.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var d,s=f(t);!(d=s()).done;){var a=d.value,l=a.name,u=a.comment;if(null==l?void 0:l.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},i.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},i.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?P.Low:e<16?P.Medium:P.High}return P.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?P.Low:i<12?P.Medium:P.High}return P.Low}return P.High},i.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.getIPhoneModel=function(){var e,i=l.screen.width*l.devicePixelRatio,n=l.screen.height*l.devicePixelRatio,t=g.iPhone.find((function(e){return e.width===i&&e.height===n}));return null!=(e=null==t?void 0:t.model)?e:"iPhone"},i.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=f(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var d,s=t[t.length-1].trim(),a=f(g.vender);!(d=a()).done;){var l=d.value;if(s.startsWith(l))return s.substring(l.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var u=t.length;if("wv"===t[u-1].trim())return t[u-2].trim()}},i.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.testIPhone=function(e){return e.includes("iPhone")},i.testIPad=function(e){return e.includes("iPad")},i.testAndroid=function(e){return e.includes("Android")},i.testMacintosh=function(e){return e.includes("Macintosh")},i.testWindows=function(e){return e.includes("Windows")},e}(),M=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:P.High,medium:P.Medium,middle:P.Medium,low:P.Low}[e]||P.Unknown},e}(),b=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=y.wechat[e.model])?t:e.model,h=f(g.iPhone);!(o=h()).done;){var d=o.value;if(d.name===r){e.model=d.model;break}}if("iOS"===this.device.platform){var s=e.model.match(/^(.*?)<(.*?)>$/);s?(this.device.model=s[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=P.Unknown:e.benchmarkLevel<=10?this.device.level=P.Low:e.benchmarkLevel<=20?this.device.level=P.Medium:this.device.level=P.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),I=function(){function e(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=e.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?p.iPhone:p.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?w.iOS:w.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===P.High)return i.RenderLevel.S;if(this.device.level===P.Medium)return i.RenderLevel.A;if(this.device.level===P.Low)return i.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var e=+RegExp.$1;return e<=9?i.RenderLevel.B:e<10?i.RenderLevel.A:i.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?i.RenderLevel.B:this.device.memoryMB<6e3?i.RenderLevel.A:i.RenderLevel.S:this.isIOS?i.RenderLevel.S:i.RenderLevel.B},e}(),A=Symbol("@@_inter_pause"),L=!1;function O(e){void 0===e&&(e={}),L||(!function(e){var i=e.autoPause;l.addEventListener("unload",(function(){n().forEach((function(e){return e.dispose()}))})),i&&(document.addEventListener("pause",R),document.addEventListener("resume",V))}(e),L=!0);var h,d=e.mockDowngrade;if(void 0!==d)return{downgrade:d,level:null!=(h=e.level)?h:i.RenderLevel.S,reason:"mock"};var s=function(e){var i=e.queryDeviceInMiniApp,n=e.deviceInfo;if(n)return n;if(i){if(t()){if(my.canIUse("getSystemInfo")){var h=my.getSystemInfo();return new M(h).getDeviceInfo()}o.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(r()){if(wx.canIUse("getDeviceInfo")){var d=wx.getDeviceInfo();return new b(d).getDeviceInfo()}o.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else o.error("Non-mini program environment and try to get device info from user agent.")}return(new S).getDeviceInfo()}(e);return new I(e,s).getDowngradeResult()}function D(){return h()?i.RenderLevel.S:i.RenderLevel.B}function R(e){e.target===document&&(o.info("Auto pause all players with data offloaded."),n().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[A]=!0)})))}function V(e){e.target===document&&(o.info("Auto resume all players."),n().forEach((function(e){e[A]&&(e.resume(),e[A]=!1)})))}var x=function(e){function i(){return e.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&c(e,i)}(i,e),i.processRawJSON=function(e,i){return void 0===i&&(i={}),(n=function(){var e,n,t;return v(this,(function(r){if(n=null==(e=i.pluginData)?void 0:e.downgrade){if(n.downgrade)throw new Error("Downgraded, reason: "+n.reason)}else o.warn("No downgrade result in pluginData of SceneLoadOptions.");return i.renderLevel||(i.renderLevel=null!=(t=null==n?void 0:n.level)?t:D()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(t,o){var r=n.apply(e,i);function h(e){u(r,t,o,h,d,"next",e)}function d(e){u(r,t,o,h,d,"throw",e)}h(void 0)}))})();var n},i}(d),k="2.7.4";s("downgrade",x,a),o.info("Plugin downgrade version: 2.7.4."),k!==e.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");export{M as AlipayMiniprogramParser,P as DeviceLevel,S as UADecoder,b as WechatMiniprogramParser,D as getDefaultRenderLevel,O as getDowngradeResult,k as version};
2
2
  //# sourceMappingURL=douyin.mjs.map
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player downgrade plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 飂兮
6
- * Version: v2.7.2
6
+ * Version: v2.7.4
7
7
  */
8
8
 
9
9
  'use strict';
@@ -1144,7 +1144,7 @@ function resumePausedPlayers(e) {
1144
1144
 
1145
1145
  /**
1146
1146
  * 插件版本号
1147
- */ var version = "2.7.2";
1147
+ */ var version = "2.7.4";
1148
1148
  EFFECTS.registerPlugin("downgrade", DowngradePlugin, EFFECTS.VFXItem);
1149
1149
  EFFECTS.logger.info("Plugin downgrade version: " + version + ".");
1150
1150
  if (version !== EFFECTS__namespace.version) {
package/dist/index.min.js CHANGED
@@ -3,6 +3,6 @@
3
3
  * Description: Galacean Effects player downgrade plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 飂兮
6
- * Version: v2.7.2
7
- */function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],i):i(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.downgradePlugin={}),e.ge)}(this,function(e,i){"use strict";var n,t=function(e){if(e&&e.__esModule)return e;var i=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}}),i.default=e,Object.freeze(i)}(i);function o(e,i,n,t,o,r,h){try{var s=e[r](h),d=s.value}catch(e){n(e);return}s.done?i(d):Promise.resolve(d).then(t,o)}function r(e,i){return(r=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e})(e,i)}function h(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=Array(i);n<i;n++)t[n]=e[n];return t}function s(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return h(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h(e,void 0)}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var d={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},l={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},a={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},c={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};e.DeviceLevel=void 0,(n=e.DeviceLevel||(e.DeviceLevel={})).High="high",n.Medium="medium",n.Low="low",n.Unknown="unknown";var u=function(){function i(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var n=i.prototype;return n.getDeviceInfo=function(){return this.device},n.isIOS=function(){return"iOS"===this.device.platform},n.isAndroid=function(){return"Android"===this.device.platform},n.isHarmony=function(){return"Harmony"===this.device.platform},n.isWindows=function(){return"Windows"===this.device.platform},n.isMacintosh=function(){return"Macintosh"===this.device.platform},n.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},n.parse=function(e){for(var i=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,n=[];null!==(t=i.exec(e));){var t,o,r=t[1],h=null==(o=t[2])?void 0:o.trim();n.push({name:r,comment:h})}for(var d,l=s(n);!(d=l()).done;){var a=d.value,c=a.name,u=a.comment;if(null==c?void 0:c.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},n.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},n.estimateDeviceLevel=function(){if(this.isIOS()){if(!this.device.osVersion)return e.DeviceLevel.Low;var i=parseInt(this.device.osVersion.split(".")[0]);return i<12?e.DeviceLevel.Low:i<16?e.DeviceLevel.Medium:e.DeviceLevel.High}if(this.isAndroid()){if(!this.device.osVersion)return e.DeviceLevel.Low;var n=parseInt(this.device.osVersion.split(".")[0]);if(n<10)return e.DeviceLevel.Low;if(n<12)return e.DeviceLevel.Medium}return e.DeviceLevel.High},n.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.getIPhoneModel=function(){var e,i=window.screen.width*window.devicePixelRatio,n=window.screen.height*window.devicePixelRatio,t=d.iPhone.find(function(e){return e.width===i&&e.height===n});return null!=(e=null==t?void 0:t.model)?e:"iPhone"},n.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=s(t);!(n=o()).done;){var r=n.value,h=/(.+?) Build/,l=r.match(h);if(l&&l.length>=2)return l[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var a,c=t[t.length-1].trim(),u=s(d.vender);!(a=u()).done;){var v=a.value;if(c.startsWith(v))return c.substring(v.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var f=t.length;if("wv"===t[f-1].trim())return t[f-2].trim()}},n.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.testIPhone=function(e){return e.includes("iPhone")},n.testIPad=function(e){return e.includes("iPad")},n.testAndroid=function(e){return e.includes("Android")},n.testMacintosh=function(e){return e.includes("Macintosh")},n.testWindows=function(e){return e.includes("Windows")},i}(),v=function(){function i(e){this.device={},this.parse(e)}var n=i.prototype;return n.getDeviceInfo=function(){return this.device},n.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},n.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find(function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())});if(i)return null==e?void 0:e.substring(i.length).trim()}return e},n.getDeviceLevel=function(i){return void 0===i&&(i=""),({high:e.DeviceLevel.High,medium:e.DeviceLevel.Medium,middle:e.DeviceLevel.Medium,low:e.DeviceLevel.Low})[i]||e.DeviceLevel.Unknown},i}(),f=function(){function i(e){this.device={},this.parse(e)}var n=i.prototype;return n.getDeviceInfo=function(){return this.device},n.parse=function(i){var n=i.system.match(/\w+/);n&&(this.device.platform=n[0].trim());var t=i.system.match(/[\d.]+/);if(t&&(this.device.osVersion=t[0].trim()),"devtools"===i.platform)for(var o,r,h=null!=(o=c.wechat[i.model])?o:i.model,l=s(d.iPhone);!(r=l()).done;){var a=r.value;if(a.name===h){i.model=a.model;break}}if("iOS"===this.device.platform){var u=i.model.match(/^(.*?)<(.*?)>$/);u?(this.device.model=u[2].trim(),this.device.originalModel=i.model):this.device.model=i.model}else this.device.model=i.model;i.benchmarkLevel<=0?this.device.level=e.DeviceLevel.Unknown:i.benchmarkLevel<=10?this.device.level=e.DeviceLevel.Low:i.benchmarkLevel<=20?this.device.level=e.DeviceLevel.Medium:this.device.level=e.DeviceLevel.High,this.device.memoryMB=i.memorySize,this.device.sourceData=i},i}(),m=function(){function n(e,i){this.options=e,this.device=i,this.isIOS=!1}var t=n.prototype;return t.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?l.iPhone:l.android).find(function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)}))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?a.iOS:a.android).find(function(i){return i===e.device.osVersion})?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},t.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===e.DeviceLevel.High)return i.spec.RenderLevel.S;if(this.device.level===e.DeviceLevel.Medium)return i.spec.RenderLevel.A;if(this.device.level===e.DeviceLevel.Low)return i.spec.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var n=+RegExp.$1;return n<=9?i.spec.RenderLevel.B:n<10?i.spec.RenderLevel.A:i.spec.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?i.spec.RenderLevel.B:this.device.memoryMB<6e3?i.spec.RenderLevel.A:i.spec.RenderLevel.S:this.isIOS?i.spec.RenderLevel.S:i.spec.RenderLevel.B},n}(),P=Symbol("@@_inter_pause"),g=!1;function p(){return i.isIOS()?i.spec.RenderLevel.S:i.spec.RenderLevel.B}function w(e){e.target===document&&(i.logger.info("Auto pause all players with data offloaded."),i.getActivePlayers().forEach(function(e){e.paused||(e.pause({offloadTexture:!0}),e[P]=!0)}))}function y(e){e.target===document&&(i.logger.info("Auto resume all players."),i.getActivePlayers().forEach(function(e){e[P]&&(e.resume(),e[P]=!1)}))}var L=function(e){function n(){return e.apply(this,arguments)}return!function(e,i){if("function"!=typeof i&&null!==i)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&r(e,i)}(n,e),n.processRawJSON=function(e,n){var t;return void 0===n&&(n={}),(t=function(){var e,t,o;return function(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=s(0),h.throw=s(1),h.return=s(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function s(s){return function(d){return function(s){if(n)throw TypeError("Generator is already executing.");for(;h&&(h=0,s[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,t=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=(o=r.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=i.call(e,r)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}(this,function(r){if(t=null==(e=n.pluginData)?void 0:e.downgrade){if(t.downgrade)throw Error("Downgraded, reason: "+t.reason)}else i.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:p()),[2]})},function(){var e=this,i=arguments;return new Promise(function(n,r){var h=t.apply(e,i);function s(e){o(h,n,r,s,d,"next",e)}function d(e){o(h,n,r,s,d,"throw",e)}s(void 0)})})()},n}(i.AbstractPlugin),S="2.7.2";i.registerPlugin("downgrade",L,i.VFXItem),i.logger.info("Plugin downgrade version: "+S+"."),S!==t.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),e.AlipayMiniprogramParser=v,e.UADecoder=u,e.WechatMiniprogramParser=f,e.getDefaultRenderLevel=p,e.getDowngradeResult=function(e){void 0===e&&(e={}),g||(n=e.autoPause,window.addEventListener("unload",function(){i.getActivePlayers().forEach(function(e){return e.dispose()})}),n&&(document.addEventListener("pause",w),document.addEventListener("resume",y)),g=!0);var n,t,o=e.mockDowngrade;if(void 0!==o)return{downgrade:o,level:null!=(t=e.level)?t:i.spec.RenderLevel.S,reason:"mock"};var r=function(e){var n=e.queryDeviceInMiniApp,t=e.deviceInfo;if(t)return t;if(n){if(i.isAlipayMiniApp()){if(my.canIUse("getSystemInfo"))return new v(my.getSystemInfo()).getDeviceInfo();i.logger.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(i.isWechatMiniApp()){if(wx.canIUse("getDeviceInfo"))return new f(wx.getDeviceInfo()).getDeviceInfo();i.logger.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else i.logger.error("Non-mini program environment and try to get device info from user agent.")}return new u().getDeviceInfo()}(e);return new m(e,r).getDowngradeResult()},e.version=S,Object.defineProperty(e,"__esModule",{value:!0})});
6
+ * Version: v2.7.4
7
+ */function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],i):i(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.downgradePlugin={}),e.ge)}(this,function(e,i){"use strict";var n,t=function(e){if(e&&e.__esModule)return e;var i=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}}),i.default=e,Object.freeze(i)}(i);function o(e,i,n,t,o,r,h){try{var s=e[r](h),d=s.value}catch(e){n(e);return}s.done?i(d):Promise.resolve(d).then(t,o)}function r(e,i){return(r=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e})(e,i)}function h(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=Array(i);n<i;n++)t[n]=e[n];return t}function s(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return h(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h(e,void 0)}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var d={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},l={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},a={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},c={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};e.DeviceLevel=void 0,(n=e.DeviceLevel||(e.DeviceLevel={})).High="high",n.Medium="medium",n.Low="low",n.Unknown="unknown";var u=function(){function i(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var n=i.prototype;return n.getDeviceInfo=function(){return this.device},n.isIOS=function(){return"iOS"===this.device.platform},n.isAndroid=function(){return"Android"===this.device.platform},n.isHarmony=function(){return"Harmony"===this.device.platform},n.isWindows=function(){return"Windows"===this.device.platform},n.isMacintosh=function(){return"Macintosh"===this.device.platform},n.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},n.parse=function(e){for(var i=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,n=[];null!==(t=i.exec(e));){var t,o,r=t[1],h=null==(o=t[2])?void 0:o.trim();n.push({name:r,comment:h})}for(var d,l=s(n);!(d=l()).done;){var a=d.value,c=a.name,u=a.comment;if(null==c?void 0:c.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},n.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},n.estimateDeviceLevel=function(){if(this.isIOS()){if(!this.device.osVersion)return e.DeviceLevel.Low;var i=parseInt(this.device.osVersion.split(".")[0]);return i<12?e.DeviceLevel.Low:i<16?e.DeviceLevel.Medium:e.DeviceLevel.High}if(this.isAndroid()){if(!this.device.osVersion)return e.DeviceLevel.Low;var n=parseInt(this.device.osVersion.split(".")[0]);if(n<10)return e.DeviceLevel.Low;if(n<12)return e.DeviceLevel.Medium}return e.DeviceLevel.High},n.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.getIPhoneModel=function(){var e,i=window.screen.width*window.devicePixelRatio,n=window.screen.height*window.devicePixelRatio,t=d.iPhone.find(function(e){return e.width===i&&e.height===n});return null!=(e=null==t?void 0:t.model)?e:"iPhone"},n.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=s(t);!(n=o()).done;){var r=n.value,h=/(.+?) Build/,l=r.match(h);if(l&&l.length>=2)return l[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var a,c=t[t.length-1].trim(),u=s(d.vender);!(a=u()).done;){var v=a.value;if(c.startsWith(v))return c.substring(v.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var f=t.length;if("wv"===t[f-1].trim())return t[f-2].trim()}},n.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.testIPhone=function(e){return e.includes("iPhone")},n.testIPad=function(e){return e.includes("iPad")},n.testAndroid=function(e){return e.includes("Android")},n.testMacintosh=function(e){return e.includes("Macintosh")},n.testWindows=function(e){return e.includes("Windows")},i}(),v=function(){function i(e){this.device={},this.parse(e)}var n=i.prototype;return n.getDeviceInfo=function(){return this.device},n.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},n.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find(function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())});if(i)return null==e?void 0:e.substring(i.length).trim()}return e},n.getDeviceLevel=function(i){return void 0===i&&(i=""),({high:e.DeviceLevel.High,medium:e.DeviceLevel.Medium,middle:e.DeviceLevel.Medium,low:e.DeviceLevel.Low})[i]||e.DeviceLevel.Unknown},i}(),f=function(){function i(e){this.device={},this.parse(e)}var n=i.prototype;return n.getDeviceInfo=function(){return this.device},n.parse=function(i){var n=i.system.match(/\w+/);n&&(this.device.platform=n[0].trim());var t=i.system.match(/[\d.]+/);if(t&&(this.device.osVersion=t[0].trim()),"devtools"===i.platform)for(var o,r,h=null!=(o=c.wechat[i.model])?o:i.model,l=s(d.iPhone);!(r=l()).done;){var a=r.value;if(a.name===h){i.model=a.model;break}}if("iOS"===this.device.platform){var u=i.model.match(/^(.*?)<(.*?)>$/);u?(this.device.model=u[2].trim(),this.device.originalModel=i.model):this.device.model=i.model}else this.device.model=i.model;i.benchmarkLevel<=0?this.device.level=e.DeviceLevel.Unknown:i.benchmarkLevel<=10?this.device.level=e.DeviceLevel.Low:i.benchmarkLevel<=20?this.device.level=e.DeviceLevel.Medium:this.device.level=e.DeviceLevel.High,this.device.memoryMB=i.memorySize,this.device.sourceData=i},i}(),m=function(){function n(e,i){this.options=e,this.device=i,this.isIOS=!1}var t=n.prototype;return t.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?l.iPhone:l.android).find(function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)}))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?a.iOS:a.android).find(function(i){return i===e.device.osVersion})?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},t.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===e.DeviceLevel.High)return i.spec.RenderLevel.S;if(this.device.level===e.DeviceLevel.Medium)return i.spec.RenderLevel.A;if(this.device.level===e.DeviceLevel.Low)return i.spec.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var n=+RegExp.$1;return n<=9?i.spec.RenderLevel.B:n<10?i.spec.RenderLevel.A:i.spec.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?i.spec.RenderLevel.B:this.device.memoryMB<6e3?i.spec.RenderLevel.A:i.spec.RenderLevel.S:this.isIOS?i.spec.RenderLevel.S:i.spec.RenderLevel.B},n}(),P=Symbol("@@_inter_pause"),g=!1;function p(){return i.isIOS()?i.spec.RenderLevel.S:i.spec.RenderLevel.B}function w(e){e.target===document&&(i.logger.info("Auto pause all players with data offloaded."),i.getActivePlayers().forEach(function(e){e.paused||(e.pause({offloadTexture:!0}),e[P]=!0)}))}function y(e){e.target===document&&(i.logger.info("Auto resume all players."),i.getActivePlayers().forEach(function(e){e[P]&&(e.resume(),e[P]=!1)}))}var L=function(e){function n(){return e.apply(this,arguments)}return!function(e,i){if("function"!=typeof i&&null!==i)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&r(e,i)}(n,e),n.processRawJSON=function(e,n){var t;return void 0===n&&(n={}),(t=function(){var e,t,o;return function(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=s(0),h.throw=s(1),h.return=s(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function s(s){return function(d){return function(s){if(n)throw TypeError("Generator is already executing.");for(;h&&(h=0,s[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,t=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=(o=r.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=i.call(e,r)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}(this,function(r){if(t=null==(e=n.pluginData)?void 0:e.downgrade){if(t.downgrade)throw Error("Downgraded, reason: "+t.reason)}else i.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:p()),[2]})},function(){var e=this,i=arguments;return new Promise(function(n,r){var h=t.apply(e,i);function s(e){o(h,n,r,s,d,"next",e)}function d(e){o(h,n,r,s,d,"throw",e)}s(void 0)})})()},n}(i.AbstractPlugin),S="2.7.4";i.registerPlugin("downgrade",L,i.VFXItem),i.logger.info("Plugin downgrade version: "+S+"."),S!==t.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),e.AlipayMiniprogramParser=v,e.UADecoder=u,e.WechatMiniprogramParser=f,e.getDefaultRenderLevel=p,e.getDowngradeResult=function(e){void 0===e&&(e={}),g||(n=e.autoPause,window.addEventListener("unload",function(){i.getActivePlayers().forEach(function(e){return e.dispose()})}),n&&(document.addEventListener("pause",w),document.addEventListener("resume",y)),g=!0);var n,t,o=e.mockDowngrade;if(void 0!==o)return{downgrade:o,level:null!=(t=e.level)?t:i.spec.RenderLevel.S,reason:"mock"};var r=function(e){var n=e.queryDeviceInMiniApp,t=e.deviceInfo;if(t)return t;if(n){if(i.isAlipayMiniApp()){if(my.canIUse("getSystemInfo"))return new v(my.getSystemInfo()).getDeviceInfo();i.logger.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(i.isWechatMiniApp()){if(wx.canIUse("getDeviceInfo"))return new f(wx.getDeviceInfo()).getDeviceInfo();i.logger.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else i.logger.error("Non-mini program environment and try to get device info from user agent.")}return new u().getDeviceInfo()}(e);return new m(e,r).getDowngradeResult()},e.version=S,Object.defineProperty(e,"__esModule",{value:!0})});
8
8
  //# sourceMappingURL=index.min.js.map
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player downgrade plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 飂兮
6
- * Version: v2.7.2
6
+ * Version: v2.7.4
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
@@ -1121,7 +1121,7 @@ function resumePausedPlayers(e) {
1121
1121
 
1122
1122
  /**
1123
1123
  * 插件版本号
1124
- */ var version = "2.7.2";
1124
+ */ var version = "2.7.4";
1125
1125
  registerPlugin("downgrade", DowngradePlugin, VFXItem);
1126
1126
  logger.info("Plugin downgrade version: " + version + ".");
1127
1127
  if (version !== EFFECTS.version) {
package/dist/weapp.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/weapp"),i=require("@galacean/appx-adapter/weapp");function n(e){if(e&&e.__esModule)return e;var i=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),i.default=e,Object.freeze(i)}var t=n(e);function o(e,i,n,t,o,r,h){try{var s=e[r](h),d=s.value}catch(e){return void n(e)}s.done?i(d):Promise.resolve(d).then(t,o)}function r(e,i){return r=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},r(e,i)}function h(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=s(0),h.throw=s(1),h.return=s(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function s(s){return function(d){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,s[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,t=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=i.call(e,r)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}function s(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function d(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return s(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var a,l={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},c={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},u={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},v={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};exports.DeviceLevel=void 0,(a=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",a.Medium="medium",a.Low="low",a.Unknown="unknown";var m=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var n=e.prototype;return n.getDeviceInfo=function(){return this.device},n.isIOS=function(){return"iOS"===this.device.platform},n.isAndroid=function(){return"Android"===this.device.platform},n.isHarmony=function(){return"Harmony"===this.device.platform},n.isWindows=function(){return"Windows"===this.device.platform},n.isMacintosh=function(){return"Macintosh"===this.device.platform},n.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},n.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var s,a=d(t);!(s=a()).done;){var l=s.value,c=l.name,u=l.comment;if(null==c?void 0:c.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},n.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},n.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?exports.DeviceLevel.Low:e<16?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?exports.DeviceLevel.Low:i<12?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}return exports.DeviceLevel.High},n.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.getIPhoneModel=function(){var e,n=i.window.screen.width*i.window.devicePixelRatio,t=i.window.screen.height*i.window.devicePixelRatio,o=l.iPhone.find((function(e){return e.width===n&&e.height===t}));return null!=(e=null==o?void 0:o.model)?e:"iPhone"},n.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=d(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var s,a=t[t.length-1].trim(),c=d(l.vender);!(s=c()).done;){var u=s.value;if(a.startsWith(u))return a.substring(u.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var v=t.length;if("wv"===t[v-1].trim())return t[v-2].trim()}},n.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.testIPhone=function(e){return e.includes("iPhone")},n.testIPad=function(e){return e.includes("iPad")},n.testAndroid=function(e){return e.includes("Android")},n.testMacintosh=function(e){return e.includes("Macintosh")},n.testWindows=function(e){return e.includes("Windows")},e}(),f=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:exports.DeviceLevel.High,medium:exports.DeviceLevel.Medium,middle:exports.DeviceLevel.Medium,low:exports.DeviceLevel.Low}[e]||exports.DeviceLevel.Unknown},e}(),p=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=v.wechat[e.model])?t:e.model,h=d(l.iPhone);!(o=h()).done;){var s=o.value;if(s.name===r){e.model=s.model;break}}if("iOS"===this.device.platform){var a=e.model.match(/^(.*?)<(.*?)>$/);a?(this.device.model=a[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=exports.DeviceLevel.Unknown:e.benchmarkLevel<=10?this.device.level=exports.DeviceLevel.Low:e.benchmarkLevel<=20?this.device.level=exports.DeviceLevel.Medium:this.device.level=exports.DeviceLevel.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),P=function(){function i(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=i.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?c.iPhone:c.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?u.iOS:u.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===exports.DeviceLevel.High)return e.spec.RenderLevel.S;if(this.device.level===exports.DeviceLevel.Medium)return e.spec.RenderLevel.A;if(this.device.level===exports.DeviceLevel.Low)return e.spec.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var i=+RegExp.$1;return i<=9?e.spec.RenderLevel.B:i<10?e.spec.RenderLevel.A:e.spec.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?e.spec.RenderLevel.B:this.device.memoryMB<6e3?e.spec.RenderLevel.A:e.spec.RenderLevel.S:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},i}(),g=Symbol("@@_inter_pause"),w=!1;function y(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function L(i){i.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[g]=!0)})))}function S(i){i.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[g]&&(e.resume(),e[g]=!1)})))}var M=function(i){function n(){return i.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&r(e,i)}(n,i),n.processRawJSON=function(i,n){return void 0===n&&(n={}),(t=function(){var i,t,o;return h(this,(function(r){if(t=null==(i=n.pluginData)?void 0:i.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:y()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(n,r){var h=t.apply(e,i);function s(e){o(h,n,r,s,d,"next",e)}function d(e){o(h,n,r,s,d,"throw",e)}s(void 0)}))})();var t},n}(e.AbstractPlugin),D="2.7.2";e.registerPlugin("downgrade",M,e.VFXItem),e.logger.info("Plugin downgrade version: 2.7.2."),D!==t.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),exports.AlipayMiniprogramParser=f,exports.UADecoder=m,exports.WechatMiniprogramParser=p,exports.getDefaultRenderLevel=y,exports.getDowngradeResult=function(n){void 0===n&&(n={}),w||(!function(n){var t=n.autoPause;i.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",L),document.addEventListener("resume",S))}(n),w=!0);var t,o=n.mockDowngrade;if(void 0!==o)return{downgrade:o,level:null!=(t=n.level)?t:e.spec.RenderLevel.S,reason:"mock"};var r=function(i){var n=i.queryDeviceInMiniApp,t=i.deviceInfo;if(t)return t;if(n){if(e.isAlipayMiniApp()){if(my.canIUse("getSystemInfo")){var o=my.getSystemInfo();return new f(o).getDeviceInfo()}e.logger.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(e.isWechatMiniApp()){if(wx.canIUse("getDeviceInfo")){var r=wx.getDeviceInfo();return new p(r).getDeviceInfo()}e.logger.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else e.logger.error("Non-mini program environment and try to get device info from user agent.")}return(new m).getDeviceInfo()}(n);return new P(n,r).getDowngradeResult()},exports.version=D;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/weapp"),i=require("@galacean/appx-adapter/weapp");function n(e){if(e&&e.__esModule)return e;var i=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),i.default=e,Object.freeze(i)}var t=n(e);function o(e,i,n,t,o,r,h){try{var s=e[r](h),d=s.value}catch(e){return void n(e)}s.done?i(d):Promise.resolve(d).then(t,o)}function r(e,i){return r=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},r(e,i)}function h(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=s(0),h.throw=s(1),h.return=s(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function s(s){return function(d){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,s[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,t=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=i.call(e,r)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}function s(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function d(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return s(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var a,l={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},c={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},u={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},v={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};exports.DeviceLevel=void 0,(a=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",a.Medium="medium",a.Low="low",a.Unknown="unknown";var m=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var n=e.prototype;return n.getDeviceInfo=function(){return this.device},n.isIOS=function(){return"iOS"===this.device.platform},n.isAndroid=function(){return"Android"===this.device.platform},n.isHarmony=function(){return"Harmony"===this.device.platform},n.isWindows=function(){return"Windows"===this.device.platform},n.isMacintosh=function(){return"Macintosh"===this.device.platform},n.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},n.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var s,a=d(t);!(s=a()).done;){var l=s.value,c=l.name,u=l.comment;if(null==c?void 0:c.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},n.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},n.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?exports.DeviceLevel.Low:e<16?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?exports.DeviceLevel.Low:i<12?exports.DeviceLevel.Medium:exports.DeviceLevel.High}return exports.DeviceLevel.Low}return exports.DeviceLevel.High},n.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.getIPhoneModel=function(){var e,n=i.window.screen.width*i.window.devicePixelRatio,t=i.window.screen.height*i.window.devicePixelRatio,o=l.iPhone.find((function(e){return e.width===n&&e.height===t}));return null!=(e=null==o?void 0:o.model)?e:"iPhone"},n.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=d(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var s,a=t[t.length-1].trim(),c=d(l.vender);!(s=c()).done;){var u=s.value;if(a.startsWith(u))return a.substring(u.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var v=t.length;if("wv"===t[v-1].trim())return t[v-2].trim()}},n.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},n.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},n.testIPhone=function(e){return e.includes("iPhone")},n.testIPad=function(e){return e.includes("iPad")},n.testAndroid=function(e){return e.includes("Android")},n.testMacintosh=function(e){return e.includes("Macintosh")},n.testWindows=function(e){return e.includes("Windows")},e}(),f=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:exports.DeviceLevel.High,medium:exports.DeviceLevel.Medium,middle:exports.DeviceLevel.Medium,low:exports.DeviceLevel.Low}[e]||exports.DeviceLevel.Unknown},e}(),p=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=v.wechat[e.model])?t:e.model,h=d(l.iPhone);!(o=h()).done;){var s=o.value;if(s.name===r){e.model=s.model;break}}if("iOS"===this.device.platform){var a=e.model.match(/^(.*?)<(.*?)>$/);a?(this.device.model=a[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=exports.DeviceLevel.Unknown:e.benchmarkLevel<=10?this.device.level=exports.DeviceLevel.Low:e.benchmarkLevel<=20?this.device.level=exports.DeviceLevel.Medium:this.device.level=exports.DeviceLevel.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),P=function(){function i(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=i.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?c.iPhone:c.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?u.iOS:u.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===exports.DeviceLevel.High)return e.spec.RenderLevel.S;if(this.device.level===exports.DeviceLevel.Medium)return e.spec.RenderLevel.A;if(this.device.level===exports.DeviceLevel.Low)return e.spec.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var i=+RegExp.$1;return i<=9?e.spec.RenderLevel.B:i<10?e.spec.RenderLevel.A:e.spec.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?e.spec.RenderLevel.B:this.device.memoryMB<6e3?e.spec.RenderLevel.A:e.spec.RenderLevel.S:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},i}(),g=Symbol("@@_inter_pause"),w=!1;function y(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function L(i){i.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[g]=!0)})))}function S(i){i.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[g]&&(e.resume(),e[g]=!1)})))}var M=function(i){function n(){return i.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&r(e,i)}(n,i),n.processRawJSON=function(i,n){return void 0===n&&(n={}),(t=function(){var i,t,o;return h(this,(function(r){if(t=null==(i=n.pluginData)?void 0:i.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:y()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(n,r){var h=t.apply(e,i);function s(e){o(h,n,r,s,d,"next",e)}function d(e){o(h,n,r,s,d,"throw",e)}s(void 0)}))})();var t},n}(e.AbstractPlugin),D="2.7.4";e.registerPlugin("downgrade",M,e.VFXItem),e.logger.info("Plugin downgrade version: 2.7.4."),D!==t.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),exports.AlipayMiniprogramParser=f,exports.UADecoder=m,exports.WechatMiniprogramParser=p,exports.getDefaultRenderLevel=y,exports.getDowngradeResult=function(n){void 0===n&&(n={}),w||(!function(n){var t=n.autoPause;i.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",L),document.addEventListener("resume",S))}(n),w=!0);var t,o=n.mockDowngrade;if(void 0!==o)return{downgrade:o,level:null!=(t=n.level)?t:e.spec.RenderLevel.S,reason:"mock"};var r=function(i){var n=i.queryDeviceInMiniApp,t=i.deviceInfo;if(t)return t;if(n){if(e.isAlipayMiniApp()){if(my.canIUse("getSystemInfo")){var o=my.getSystemInfo();return new f(o).getDeviceInfo()}e.logger.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(e.isWechatMiniApp()){if(wx.canIUse("getDeviceInfo")){var r=wx.getDeviceInfo();return new p(r).getDeviceInfo()}e.logger.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else e.logger.error("Non-mini program environment and try to get device info from user agent.")}return(new m).getDeviceInfo()}(n);return new P(n,r).getDowngradeResult()},exports.version=D;
2
2
  //# sourceMappingURL=weapp.js.map
package/dist/weapp.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import*as e from"@galacean/effects/weapp";import{spec as i,getActivePlayers as n,isAlipayMiniApp as t,logger as o,isWechatMiniApp as r,isIOS as h,AbstractPlugin as d,registerPlugin as s,VFXItem as a}from"@galacean/effects/weapp";import{window as l}from"@galacean/appx-adapter/weapp";function u(e,i,n,t,o,r,h){try{var d=e[r](h),s=d.value}catch(e){return void n(e)}d.done?i(s):Promise.resolve(s).then(t,o)}function c(e,i){return c=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},c(e,i)}function v(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=d(0),h.throw=d(1),h.return=d(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function d(d){return function(s){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,d[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&d[0]?t.return:d[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,d[1])).done)return o;switch(t=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,t=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==d[0]&&2!==d[0])){r=0;continue}if(3===d[0]&&(!o||d[1]>o[0]&&d[1]<o[3])){r.label=d[1];break}if(6===d[0]&&r.label<o[1]){r.label=o[1],o=d;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(d);break}o[2]&&r.ops.pop(),r.trys.pop();continue}d=i.call(e,r)}catch(e){d=[6,e],t=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([d,s])}}}function m(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function f(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return m(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var P,g={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},p={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},w={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},y={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};!function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(P||(P={}));var S=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.isIOS=function(){return"iOS"===this.device.platform},i.isAndroid=function(){return"Android"===this.device.platform},i.isHarmony=function(){return"Harmony"===this.device.platform},i.isWindows=function(){return"Windows"===this.device.platform},i.isMacintosh=function(){return"Macintosh"===this.device.platform},i.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},i.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var d,s=f(t);!(d=s()).done;){var a=d.value,l=a.name,u=a.comment;if(null==l?void 0:l.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},i.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},i.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?P.Low:e<16?P.Medium:P.High}return P.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?P.Low:i<12?P.Medium:P.High}return P.Low}return P.High},i.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.getIPhoneModel=function(){var e,i=l.screen.width*l.devicePixelRatio,n=l.screen.height*l.devicePixelRatio,t=g.iPhone.find((function(e){return e.width===i&&e.height===n}));return null!=(e=null==t?void 0:t.model)?e:"iPhone"},i.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=f(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var d,s=t[t.length-1].trim(),a=f(g.vender);!(d=a()).done;){var l=d.value;if(s.startsWith(l))return s.substring(l.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var u=t.length;if("wv"===t[u-1].trim())return t[u-2].trim()}},i.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.testIPhone=function(e){return e.includes("iPhone")},i.testIPad=function(e){return e.includes("iPad")},i.testAndroid=function(e){return e.includes("Android")},i.testMacintosh=function(e){return e.includes("Macintosh")},i.testWindows=function(e){return e.includes("Windows")},e}(),M=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:P.High,medium:P.Medium,middle:P.Medium,low:P.Low}[e]||P.Unknown},e}(),b=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=y.wechat[e.model])?t:e.model,h=f(g.iPhone);!(o=h()).done;){var d=o.value;if(d.name===r){e.model=d.model;break}}if("iOS"===this.device.platform){var s=e.model.match(/^(.*?)<(.*?)>$/);s?(this.device.model=s[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=P.Unknown:e.benchmarkLevel<=10?this.device.level=P.Low:e.benchmarkLevel<=20?this.device.level=P.Medium:this.device.level=P.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),I=function(){function e(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=e.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?p.iPhone:p.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?w.iOS:w.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===P.High)return i.RenderLevel.S;if(this.device.level===P.Medium)return i.RenderLevel.A;if(this.device.level===P.Low)return i.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var e=+RegExp.$1;return e<=9?i.RenderLevel.B:e<10?i.RenderLevel.A:i.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?i.RenderLevel.B:this.device.memoryMB<6e3?i.RenderLevel.A:i.RenderLevel.S:this.isIOS?i.RenderLevel.S:i.RenderLevel.B},e}(),A=Symbol("@@_inter_pause"),L=!1;function O(e){void 0===e&&(e={}),L||(!function(e){var i=e.autoPause;l.addEventListener("unload",(function(){n().forEach((function(e){return e.dispose()}))})),i&&(document.addEventListener("pause",R),document.addEventListener("resume",V))}(e),L=!0);var h,d=e.mockDowngrade;if(void 0!==d)return{downgrade:d,level:null!=(h=e.level)?h:i.RenderLevel.S,reason:"mock"};var s=function(e){var i=e.queryDeviceInMiniApp,n=e.deviceInfo;if(n)return n;if(i){if(t()){if(my.canIUse("getSystemInfo")){var h=my.getSystemInfo();return new M(h).getDeviceInfo()}o.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(r()){if(wx.canIUse("getDeviceInfo")){var d=wx.getDeviceInfo();return new b(d).getDeviceInfo()}o.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else o.error("Non-mini program environment and try to get device info from user agent.")}return(new S).getDeviceInfo()}(e);return new I(e,s).getDowngradeResult()}function D(){return h()?i.RenderLevel.S:i.RenderLevel.B}function R(e){e.target===document&&(o.info("Auto pause all players with data offloaded."),n().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[A]=!0)})))}function V(e){e.target===document&&(o.info("Auto resume all players."),n().forEach((function(e){e[A]&&(e.resume(),e[A]=!1)})))}var x=function(e){function i(){return e.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&c(e,i)}(i,e),i.processRawJSON=function(e,i){return void 0===i&&(i={}),(n=function(){var e,n,t;return v(this,(function(r){if(n=null==(e=i.pluginData)?void 0:e.downgrade){if(n.downgrade)throw new Error("Downgraded, reason: "+n.reason)}else o.warn("No downgrade result in pluginData of SceneLoadOptions.");return i.renderLevel||(i.renderLevel=null!=(t=null==n?void 0:n.level)?t:D()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(t,o){var r=n.apply(e,i);function h(e){u(r,t,o,h,d,"next",e)}function d(e){u(r,t,o,h,d,"throw",e)}h(void 0)}))})();var n},i}(d),k="2.7.2";s("downgrade",x,a),o.info("Plugin downgrade version: 2.7.2."),k!==e.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");export{M as AlipayMiniprogramParser,P as DeviceLevel,S as UADecoder,b as WechatMiniprogramParser,D as getDefaultRenderLevel,O as getDowngradeResult,k as version};
1
+ import*as e from"@galacean/effects/weapp";import{spec as i,getActivePlayers as n,isAlipayMiniApp as t,logger as o,isWechatMiniApp as r,isIOS as h,AbstractPlugin as d,registerPlugin as s,VFXItem as a}from"@galacean/effects/weapp";import{window as l}from"@galacean/appx-adapter/weapp";function u(e,i,n,t,o,r,h){try{var d=e[r](h),s=d.value}catch(e){return void n(e)}d.done?i(s):Promise.resolve(s).then(t,o)}function c(e,i){return c=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},c(e,i)}function v(e,i){var n,t,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=d(0),h.throw=d(1),h.return=d(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function d(d){return function(s){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,d[0]&&(r=0)),r;)try{if(n=1,t&&(o=2&d[0]?t.return:d[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,d[1])).done)return o;switch(t=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,t=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==d[0]&&2!==d[0])){r=0;continue}if(3===d[0]&&(!o||d[1]>o[0]&&d[1]<o[3])){r.label=d[1];break}if(6===d[0]&&r.label<o[1]){r.label=o[1],o=d;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(d);break}o[2]&&r.ops.pop(),r.trys.pop();continue}d=i.call(e,r)}catch(e){d=[6,e],t=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([d,s])}}}function m(e,i){(null==i||i>e.length)&&(i=e.length);for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function f(e,i){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,i){if(e){if("string"==typeof e)return m(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,i):void 0}}(e))||i&&e&&"number"==typeof e.length){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var P,g={vender:["SAMSUNG"],iPhone:[{name:"iPhone 15 Pro Max",model:"iPhone16,2",width:1290,height:2796},{name:"iPhone 15 Pro",model:"iPhone16,1",width:1179,height:2556},{name:"iPhone 15 Plus",model:"iPhone15,5",width:1290,height:2796},{name:"iPhone 15",model:"iPhone15,4",width:1179,height:2556},{name:"iPhone 14 Pro Max",model:"iPhone15,3",width:1290,height:2796},{name:"iPhone 14 Pro",model:"iPhone15,2",width:1179,height:2556},{name:"iPhone 14 Plus",model:"iPhone14,8",width:1284,height:2778},{name:"iPhone 14",model:"iPhone14,7",width:1170,height:2532},{name:"iPhone 13 Pro Max",model:"iPhone14,3",width:1284,height:2778},{name:"iPhone 13 Pro",model:"iPhone14,2",width:1170,height:2532},{name:"iPhone 13",model:"iPhone14,5",width:1170,height:2532},{name:"iPhone 13 mini",model:"iPhone14,4",width:1080,height:2340},{name:"iPhone SE (3rd gen)",model:"iPhone14,6",width:750,height:1334},{name:"iPhone 12 Pro Max",model:"iPhone13,4",width:1284,height:2778},{name:"iPhone 12 Pro",model:"iPhone13,3",width:1170,height:2532},{name:"iPhone 12",model:"iPhone13,2",width:1170,height:2532},{name:"iPhone 12 mini",model:"iPhone13,1",width:1080,height:2340},{name:"iPhone 11 Pro Max",model:"iPhone12,5",width:1242,height:2688},{name:"iPhone 11 Pro",model:"iPhone12,3",width:1125,height:2436},{name:"iPhone 11",model:"iPhone12,1",width:828,height:1792},{name:"iPhone SE (2nd gen)",model:"iPhone12,8",width:750,height:1334},{name:"iPhone XR",model:"iPhone11,8",width:828,height:1792},{name:"iPhone XS Max",model:"iPhone11,6",width:1242,height:2688},{name:"iPhone XS",model:"iPhone11,2",width:1125,height:2436},{name:"iPhone X",model:"iPhone10,3",width:1125,height:2436},{name:"iPhone 8 Plus",model:"iPhone10,2",width:1080,height:1920},{name:"iPhone 8",model:"iPhone10,1",width:750,height:1334},{name:"iPhone 7 Plus",model:"iPhone9,2",width:1080,height:1920},{name:"iPhone 7",model:"iPhone9,1",width:750,height:1334},{name:"iPhone 6s Plus",model:"iPhone8,2",width:1080,height:1920},{name:"iPhone 6s",model:"iPhone8,1",width:750,height:1334},{name:"iPhone SE (1st gen)",model:"iPhone8,4",width:640,height:1136},{name:"iPhone 6 Plus",model:"iPhone7,1",width:1080,height:1920},{name:"iPhone 6",model:"iPhone7,2",width:750,height:1334},{name:"iPhone 5C",model:"iPhone5,3",width:640,height:1136},{name:"iPhone 5S",model:"iPhone6,1",width:640,height:1136},{name:"iPhone 5",model:"iPhone5,1",width:640,height:1136},{name:"iPhone 4S",model:"iPhone4,1",width:640,height:960},{name:"iPhone 4",model:"iPhone3,1",width:640,height:960},{name:"iPhone 3GS",model:"iPhone2,1",width:320,height:480},{name:"iPhone 3G",model:"iPhone1,2",width:320,height:480},{name:"iPhone 1st gen",model:"iPhone1,1",width:320,height:480}]},p={android:["OPPO R9s Plus","GM1910","V1824A","V1916A","SM-G9650","V1936A","MI9 PRO 5G","REDMI K20","V1914A","GM1900","RMX1971","SM-A6060","SM-G9600","V1922A","PBAM00","PCAM10","PACT00","PBBM00","PCEM00","V1818A","vivo X6A","vivo X6Plus A"],iPhone:["iPhone8,4","iPhone8,2","iPhone8,1","iPhone7,2","iPhone7,1","iPhone6,2","iPhone6,1","iPhone5,4","iPhone5,3","iPhone5,2","iPhone5,1","iPhone4,3","iPhone4,2","iPhone4,1","iPhone3,3","iPhone3,2","iPhone3,1","iPhone2,1","iPhone1,2","iPhone1,1"]},w={android:[],iOS:["16.7","16.7.1","16.7.2","16.7.3","16.7.4","16.7.5","16.7.6"]},y={wechat:{"iPhone 6/7/8":"iPhone 8","iPhone 6/7/8 Plus":"iPhone 8 Plus","iPhone 12/13 mini":"iPhone 13 mini","iPhone 12/13 (Pro)":"iPhone 13 Pro","iPhone 12/13 Pro Max":"iPhone 13 Pro Max"}};!function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(P||(P={}));var S=function(){function e(e){this.device={},this.parse(null!=e?e:navigator.userAgent)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.isIOS=function(){return"iOS"===this.device.platform},i.isAndroid=function(){return"Android"===this.device.platform},i.isHarmony=function(){return"Harmony"===this.device.platform},i.isWindows=function(){return"Windows"===this.device.platform},i.isMacintosh=function(){return"Macintosh"===this.device.platform},i.isMobile=function(){return this.isIOS()||this.isAndroid()||this.isHarmony()},i.parse=function(e){for(var i,n=/(\w+\/[\w.]+)(\s+\([^)]+\))?/g,t=[];null!==(i=n.exec(e));){var o,r=i[1],h=null==(o=i[2])?void 0:o.trim();t.push({name:r,comment:h})}for(var d,s=f(t);!(d=s()).done;){var a=d.value,l=a.name,u=a.comment;if(null==l?void 0:l.startsWith("Mozilla/")){u&&this.parseData(u);break}}this.device.level=this.estimateDeviceLevel(),this.device.sourceData=e},i.parseData=function(e){e.length&&"("===e[0]&&(e=e.substring(1)),e.length&&")"==e[e.length-1]&&(e=e.substring(0,e.length-1)),this.testIPhone(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model=this.getIPhoneModel()):this.testIPad(e)?(this.device.platform="iOS",this.device.osVersion=this.parseIOSVersion(e),this.device.model="iPad"):this.testMacintosh(e)?(this.device.platform="Mac OS",this.device.osVersion=this.parseMacOSVersion(e)):this.testAndroid(e)?(this.device.platform="Android",this.device.osVersion=this.parseAndroidVersion(e),this.device.model=this.parseAndroidModel(e)):this.testWindows(e)?(this.device.platform="Windows",this.device.osVersion=this.parseWindowsVersion(e)):console.error("Unknown info: "+e+".")},i.estimateDeviceLevel=function(){if(this.isIOS()){if(this.device.osVersion){var e=parseInt(this.device.osVersion.split(".")[0]);return e<12?P.Low:e<16?P.Medium:P.High}return P.Low}if(this.isAndroid()){if(this.device.osVersion){var i=parseInt(this.device.osVersion.split(".")[0]);return i<10?P.Low:i<12?P.Medium:P.High}return P.Low}return P.High},i.parseIOSVersion=function(e){var i=e.match(/OS (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.getIPhoneModel=function(){var e,i=l.screen.width*l.devicePixelRatio,n=l.screen.height*l.devicePixelRatio,t=g.iPhone.find((function(e){return e.width===i&&e.height===n}));return null!=(e=null==t?void 0:t.model)?e:"iPhone"},i.parseAndroidVersion=function(e){var i=e.match(/Android ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseAndroidModel=function(e){for(var i,n,t=e.split(";"),o=f(t);!(n=o()).done;){var r=n.value,h=r.match(/(.+?) Build/);if(h&&h.length>=2)return h[1].trim();if(r.includes("HMSCore")&&i)return i.trim();i=r}if(t.length>0)for(var d,s=t[t.length-1].trim(),a=f(g.vender);!(d=a()).done;){var l=d.value;if(s.startsWith(l))return s.substring(l.length).trim()}if(3==t.length)return t[t.length-1].trim();if(4===t.length){var u=t.length;if("wv"===t[u-1].trim())return t[u-2].trim()}},i.parseWindowsVersion=function(e){var i=e.match(/Windows NT ([\d.]+);/);if(i&&i.length>=2)return i[1]},i.parseMacOSVersion=function(e){var i=e.match(/OS X (\d+)(?:_(\d+))?_(\d+)/);if(i){for(var n=[],t=1;t<=3;t++)i[t]&&n.push(i[t]);return n.join(".")}},i.testIPhone=function(e){return e.includes("iPhone")},i.testIPad=function(e){return e.includes("iPad")},i.testAndroid=function(e){return e.includes("Android")},i.testMacintosh=function(e){return e.includes("Macintosh")},i.testWindows=function(e){return e.includes("Windows")},e}(),M=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){this.device.platform=e.platform,this.device.osVersion=e.system,this.device.originalModel=e.model,this.device.model=this.getDeviceModel(e.model),this.device.level=this.getDeviceLevel(e.performance),this.device.sourceData=e},i.getDeviceModel=function(e){if(e){var i=["Huawei","Xiaomi","samsung","vivo","OPPO"].find((function(i){return(null!=e?e:"").toLowerCase().startsWith(i.toLowerCase())}));if(i)return null==e?void 0:e.substring(i.length).trim()}return e},i.getDeviceLevel=function(e){return void 0===e&&(e=""),{high:P.High,medium:P.Medium,middle:P.Medium,low:P.Low}[e]||P.Unknown},e}(),b=function(){function e(e){this.device={},this.parse(e)}var i=e.prototype;return i.getDeviceInfo=function(){return this.device},i.parse=function(e){var i=e.system.match(/\w+/);i&&(this.device.platform=i[0].trim());var n=e.system.match(/[\d.]+/);if(n&&(this.device.osVersion=n[0].trim()),"devtools"===e.platform)for(var t,o,r=null!=(t=y.wechat[e.model])?t:e.model,h=f(g.iPhone);!(o=h()).done;){var d=o.value;if(d.name===r){e.model=d.model;break}}if("iOS"===this.device.platform){var s=e.model.match(/^(.*?)<(.*?)>$/);s?(this.device.model=s[2].trim(),this.device.originalModel=e.model):this.device.model=e.model}else this.device.model=e.model;e.benchmarkLevel<=0?this.device.level=P.Unknown:e.benchmarkLevel<=10?this.device.level=P.Low:e.benchmarkLevel<=20?this.device.level=P.Medium:this.device.level=P.High,this.device.memoryMB=e.memorySize,this.device.sourceData=e},e}(),I=function(){function e(e,i){this.options=e,this.device=i,this.isIOS=!1}var n=e.prototype;return n.getDowngradeResult=function(){var e=this,i=this.options.downgradeCallback;if(i){var n=i(this.device);if(n)return n.reason||(n.reason="downgradeCallback"),n}if(this.isIOS="iOS"===this.device.platform,this.level=this.getRenderLevel(),this.device.model){var t=this.device.model.toLowerCase();if(void 0!==(this.isIOS?p.iPhone:p.android).find((function(i){var n=i.toLowerCase();return e.isIOS?n===t:n.includes(t)||t.includes(n)})))return{downgrade:!0,level:this.level,reason:"Downgrade by model list",deviceInfo:this.device}}return void 0!==(this.isIOS?w.iOS:w.android).find((function(i){return i===e.device.osVersion}))?{downgrade:!0,level:this.level,reason:"Downgrade by OS version list",deviceInfo:this.device}:{downgrade:!1,level:this.level,reason:"",deviceInfo:this.device}},n.getRenderLevel=function(){if(this.options.level)return this.options.level;if(this.device.level){if(this.device.level===P.High)return i.RenderLevel.S;if(this.device.level===P.Medium)return i.RenderLevel.A;if(this.device.level===P.Low)return i.RenderLevel.B}if(this.isIOS&&this.device.model&&/iPhone(\d+),/.test(this.device.model)){var e=+RegExp.$1;return e<=9?i.RenderLevel.B:e<10?i.RenderLevel.A:i.RenderLevel.S}return this.device.memoryMB?this.device.memoryMB<4e3?i.RenderLevel.B:this.device.memoryMB<6e3?i.RenderLevel.A:i.RenderLevel.S:this.isIOS?i.RenderLevel.S:i.RenderLevel.B},e}(),A=Symbol("@@_inter_pause"),L=!1;function O(e){void 0===e&&(e={}),L||(!function(e){var i=e.autoPause;l.addEventListener("unload",(function(){n().forEach((function(e){return e.dispose()}))})),i&&(document.addEventListener("pause",R),document.addEventListener("resume",V))}(e),L=!0);var h,d=e.mockDowngrade;if(void 0!==d)return{downgrade:d,level:null!=(h=e.level)?h:i.RenderLevel.S,reason:"mock"};var s=function(e){var i=e.queryDeviceInMiniApp,n=e.deviceInfo;if(n)return n;if(i){if(t()){if(my.canIUse("getSystemInfo")){var h=my.getSystemInfo();return new M(h).getDeviceInfo()}o.error("Can't use getSystemInfo in Alipay MiniProgram.")}if(r()){if(wx.canIUse("getDeviceInfo")){var d=wx.getDeviceInfo();return new b(d).getDeviceInfo()}o.error("Can't use getDeviceInfo in WeChat MiniProgram.")}else o.error("Non-mini program environment and try to get device info from user agent.")}return(new S).getDeviceInfo()}(e);return new I(e,s).getDowngradeResult()}function D(){return h()?i.RenderLevel.S:i.RenderLevel.B}function R(e){e.target===document&&(o.info("Auto pause all players with data offloaded."),n().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[A]=!0)})))}function V(e){e.target===document&&(o.info("Auto resume all players."),n().forEach((function(e){e[A]&&(e.resume(),e[A]=!1)})))}var x=function(e){function i(){return e.apply(this,arguments)}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&c(e,i)}(i,e),i.processRawJSON=function(e,i){return void 0===i&&(i={}),(n=function(){var e,n,t;return v(this,(function(r){if(n=null==(e=i.pluginData)?void 0:e.downgrade){if(n.downgrade)throw new Error("Downgraded, reason: "+n.reason)}else o.warn("No downgrade result in pluginData of SceneLoadOptions.");return i.renderLevel||(i.renderLevel=null!=(t=null==n?void 0:n.level)?t:D()),[2]}))},function(){var e=this,i=arguments;return new Promise((function(t,o){var r=n.apply(e,i);function h(e){u(r,t,o,h,d,"next",e)}function d(e){u(r,t,o,h,d,"throw",e)}h(void 0)}))})();var n},i}(d),k="2.7.4";s("downgrade",x,a),o.info("Plugin downgrade version: 2.7.4."),k!==e.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");export{M as AlipayMiniprogramParser,P as DeviceLevel,S as UADecoder,b as WechatMiniprogramParser,D as getDefaultRenderLevel,O as getDowngradeResult,k as version};
2
2
  //# sourceMappingURL=weapp.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-plugin-downgrade",
3
- "version": "2.7.2",
3
+ "version": "2.7.4",
4
4
  "description": "Galacean Effects player downgrade plugin",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "registry": "https://registry.npmjs.org"
44
44
  },
45
45
  "devDependencies": {
46
- "@galacean/effects": "2.7.2"
46
+ "@galacean/effects": "2.7.4"
47
47
  },
48
48
  "scripts": {
49
49
  "dev": "vite",