1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
(window["webpackJsonp-ae-fe/cosmos-1"]=window["webpackJsonp-ae-fe/cosmos-1"]||[]).push([[9],{100:function(e,t,n){var r=n(144);e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},103:function(e,t,n){e.exports=n(195)()},1204:function(e,t,n){"use strict";n.r(t),n.d(t,"renderModuleAndBindMessage",(function(){return b})),n.d(t,"linkModule",(function(){return _}));var r=n(4),i=n.n(r),o=n(0),a=n.n(o),s=n(2),u=n.n(s),c=n(499),p=n(37),l=n.n(p),d=n(69),f=n.n(d),m=n(502),v=function(){var e=this;this.moduleInfo={js:"",css:"",name:""},this.loadPromise=Promise.resolve(!0),this.registerModule=function(t,n,r){var i,o,a=n||t.replace(".js",".css"),s=null!==(i=null===(o=t.match(/@ali\/gmod-(poplayer|pop)(-[a-z]+)+/))||void 0===o?void 0:o[0])&&void 0!==i?i:"";e.moduleInfo={js:t,css:a,name:r||s},e.loadPromise=Promise.all([e.loadCss(),e.loadJs()])},this.renderModule=function(){var t=a()(u.a.mark((function t(n,r,i){var o,a,s;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!window[e.moduleInfo.name]){t.next=2;break}return t.abrupt("return",e.renderDom(n,r,i));case 2:return t.next=4,e.loadPromise;case 4:if(o=t.sent,a=o[0],s=o[1],!a||!s){t.next=9;break}return t.abrupt("return",e.renderDom(n,r,i));case 9:return t.abrupt("return",null);case 10:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),this.loadCss=function(){return new Promise((function(t){var n,r;if(e.moduleInfo.css){var i=document.createElement("link");i.rel="stylesheet",i.href=e.moduleInfo.css,i.onerror=function(){t(!0)},i.onload=function(){t(!0)},null===(n=document.getElementsByTagName("head"))||void 0===n||null===(r=n[0])||void 0===r||r.appendChild(i)}else t(!1)}))},this.loadJs=function(){return new Promise((function(t){var n,r;if(e.moduleInfo.js){var i=document.createElement("script");i.src=e.moduleInfo.js,i.onerror=function(){t(!1)},i.onload=function(){t(!0)},null===(n=document.getElementsByTagName("head"))||void 0===n||null===(r=n[0])||void 0===r||r.appendChild(i)}else t(!1)}))},this.renderDom=function(t,n,r){var i=Object(m.a)(),o=document.createElement("div");document.body.appendChild(o);try{var a=l.a.createElement(window[e.moduleInfo.name],{popInfo:n,positionSign:t,parentSpmB:document.body.getAttribute("data-spm")||"0",uuid:r,isSupportWebp:i});a&&f.a.render(a,o)}catch(e){console.log(e)}return o}},y=n(351),h=function(e){return e.floatNotice="smallImage",e.snackBar="snackbar",e.poplayer="image",e}(h||{});function g(e,t,n){return w.apply(this,arguments)}function w(){return(w=a()(u.a.mark((function e(t,n,r){var i,o,a;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(o=new v).registerModule(null==n||null===(i=n.params)||void 0===i?void 0:i.jsComboUrl),e.next=4,o.renderModule(t,n,r);case 4:return a=e.sent,e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(e,t){return x.apply(this,arguments)}function x(){return(x=a()(u.a.mark((function e(t,n){var r,i,o,a,s,p,l,d,f,m,v,y,h,w;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.positionSign,o=void 0===i?"":i,a=t.popInfo,s=void 0===a?{}:a,p=t.track,l=void 0===p?null==s||null===(r=s.params)||void 0===r?void 0:r.track:p,d=t.parentSpmB,f=void 0===d?document.body.getAttribute("data-spm")||"0":d,m=s.activityUuid,v=void 0===m?"":m,y=s.uuid,h=void 0===y?"":y,e.t0=n,e.t0){e.next=7;break}return e.next=6,g(o,s,v);case 6:e.t0=e.sent;case 7:w=e.t0,!0,w&&Object(c.d)(v,w,l,window.location.href,o,f,!0,h),Object(c.e)({positionSign:o,uuid:v});case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e,t){return k.apply(this,arguments)}function k(){return(k=a()(u.a.mark((function e(t,n){var r,o,s,c,p,l,d,f,m,g,w,x,_,k;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=n.positionSign,s=void 0===o?"":o,c=n.popInfo,p=void 0===c?{}:c,l=t.jsComboUrl,d=t.interactionType,f=void 0===d?"floatNotice":d,m=t.params,g=void 0===m?{}:m,(w=new v).registerModule(l),x=function(){try{var e=i()({},p);return e.globalExtension.interactionType=f,e.params=i()({},p.params,g,{jsComboUrl:l}),e.uuid=(null==p?void 0:p.uuid)+"_link_"+f,e.activityUuid=(null==p?void 0:p.activityUuid)+"_link_"+f,e.times=999,e.type=h[f]||"smallImage",e}catch(e){return p}}(),_=Object(y.c)(),Object(y.a)({type:"add",payload:i()({},_,Object(y.b)((r={},r[null==x?void 0:x.uuid]=x,r)))}),k=function(){var e=a()(u.a.mark((function e(){var t;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w.renderModule(s,x,null==x?void 0:x.activityUuid);case 2:(t=e.sent)&&b(i()({},n,{popInfo:x}),t);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.abrupt("return",k);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},144:function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,n(t,r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},195:function(e,t,n){"use strict";var r=n(196);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},196:function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},239:function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return a}));var r=n(5),i="poplayer-web-container-cachetimes",o={pre:"https://pre-fn.aliexpress.com/fetch/dd-render/index?dida_url=https://www.aliexpress.com/p/poplayer-app-upr/index.html",prod:"https://www.aliexpress.com/p/poplayer-app-upr/index.html"},a=function(){var e={};if(!r.isSSR){var t=location.href.substring(0,location.href.indexOf("#")<0?location.href.length:location.href.indexOf("#")),n=t.substr(t.indexOf("?"));n&&n.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),(function(t,n,r,i){return e[n]=decodeURIComponent(i),""}))}return e}()},240:function(e,t,n){"use strict";function r(e){throw e}n.d(t,"a",(function(){return r}))},300:function(e,t){},351:function(e,t,n){"use strict";n.d(t,"d",(function(){return u})),n.d(t,"b",(function(){return c})),n.d(t,"c",(function(){return l}));var r=n(4),i=n.n(r),o=n(239),a=n(240);var s={};function u(){var e=localStorage.getItem(o.a)||"";try{e&&(s=JSON.parse(e)||{})}catch(e){s={}}}function c(e){return Object.keys(e).reduce((function(t,n){var r,o,a,u,c,p=e[n];return i()({},t,((a={})[p.uuid]=i()({times:p.times,type:p.type,priority:p.priority},(u=p.times,c=null===(r=s[p.uuid])||void 0===r?void 0:r.showTimes,void 0===(null===(o=s[p.uuid])||void 0===o?void 0:o.startTime)&&0,{showTimes:0===u?-1:c||0})),a))}),{})}var p,l=function(){return s},d=(p={reducer:function(e){switch(void 0===e&&(e={}),e.type){case"add":return e.payload;case"reduceTime":return t=e.payload.key,(r=s[t]).times-r.showTimes>0?i()({},s,((n={})[t]=i()({},r,{showTimes:r.showTimes+1}),n)):s;case"addTime":return function(e,t){var n,r=s[e];return i()({},s,((n={})[e]=i()({},r,{showTimes:r.showTimes-t}),n))}(e.payload.key,e.payload.times);default:Object(a.a)("action should has type property")}var t,n,r},afterProcess:[function(e){s=e,localStorage.setItem(o.a,JSON.stringify(s))}]},function(e){var t;void 0===e&&(e={});var n=p.reducer(e);null==p||null===(t=p.afterProcess)||void 0===t||t.forEach((function(e){e(n)}))});t.a=d},499:function(e,t,n){"use strict";function r(e,t){return Object.keys(t).reduce((function(e,n){return function(e,t,n){var r=e.indexOf("?");return r>=0&&(r<e.indexOf("#")||e.indexOf("#")<0)?e.replace(/\?/,"?"+t+"="+encodeURIComponent(n)+"&"):e.indexOf("#")>=0?e.replace("#","?"+t+"="+encodeURIComponent(n)+"#"):e+"?"+t+"="+encodeURIComponent(n)}(e,n,t[n])}),e)}n.d(t,"h",(function(){return k})),n.d(t,"f",(function(){return O})),n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return P})),n.d(t,"e",(function(){return C})),n.d(t,"a",(function(){return E})),n.d(t,"i",(function(){return T})),n.d(t,"g",(function(){return s}));var i=function(e){return e?0===e.indexOf("http")?e:""+location.protocol+e:""},o=n(4),a=n.n(o);function s(){return!!window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|iPad|ios|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)}var u=n(5),c=["https://campaign.aliexpress.com","http://campaign.aliexpress.com","https://pre-wormhole.aliexpress.com","http://pre-wormhole.aliexpress.com"],p=function(){if(!u.isSSR){var e="postMessage"in window;return t.prototype.send=e?function(e){this.target.postMessage(this.prefix+"|"+this.name+"__Messenger__"+e,"*")}:function(e){var t=window.navigator[this.prefix+this.name];if("function"!=typeof t)throw new Error("target callback function is not defined");t(this.prefix+e,window)},n.prototype.addTarget=function(e,n){var r=new t(e,n,this.prefix);this.targets[n]=r},n.prototype.initListen=function(){var t=this,n=function(e){if((-1!==c.indexOf(e.origin)||e.origin===window.location.origin)&&"object"==typeof e&&e.data&&e.data.indexOf&&e.data.indexOf("__Messenger__")>=0)for(var n=(e=e.data).split("__Messenger__"),r=(e=n[1],n[0].split("|")),i=r[0],o=r[1],a=0;a<t.listenFunc.length;a++)i+o===t.prefix+t.name&&t.listenFunc[a](e)};e?"addEventListener"in document?window.addEventListener("message",n,!1):"attachEvent"in document&&window.attachEvent("onmessage",n):window.navigator[this.prefix+this.name]=n},n.prototype.listen=function(e){for(var t=0,n=this.listenFunc.length,r=!1;t<n;t++)if(this.listenFunc[t]==e){r=!0;break}r||this.listenFunc.push(e)},n.prototype.clear=function(){this.listenFunc=[]},n.prototype.send=function(e){var t,n=this.targets;for(t in n)n.hasOwnProperty(t)&&n[t].send(e)},n}function t(e,t,n){var r="";if(arguments.length<2?r="target error - target and name are both required":"object"!=typeof e?r="target error - target itself must be window object":"string"!=typeof t&&(r="target error - target name must be string type"),r)throw new Error(r);this.target=e,this.name=t,this.prefix=n}function n(e,t){this.targets={},this.name=e,this.listenFunc=[],this.prefix=t||"[PROJECT_NAME]",this.initListen()}}(),l=n(17),d=n.n(l),f=n(0),m=n.n(f),v=n(2),y=n.n(v),h=n(13);function g(e){var t=Object.keys(e.params).map((function(t){return t+"="+e.params[t]})).join("&");window.goldlog&&window.goldlog.record(e.path,e.event,"st_page_id=".concat(window.dmtrack_pageid,"&").concat(t),"POST")}function w(e){try{window.goldlog?e():(window.goldlog_queue||(window.goldlog_queue=[])).push({action:"goldlog.aplus_pubsub.subscribe",arguments:["goldlogReady",function(){e()}]})}catch(e){}}function b(e){w((function(){g({path:"/ae.pc_click.statweb_ae_click",event:"CLK",params:e})}))}function x(e){w((function(){g({path:"/ae.pc_ctr.statweb_ae_ctr",event:"EXP",params:e})}))}var _=["type"];function k(e){return S.apply(this,arguments)}function S(){return(S=m()(y.a.mark((function e(t){var n,r,i,o;return y.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{r=t.type,i=d()(t,_),Object.keys(i||{}).reduce((function(e,n){var r=i[n];return t[n]=r,r?e+"&"+n+"="+r:e}),""),o=[""+t.log_key,"click"===r?"CLK":"EXP"],"poplayer","click"===r?t.ae_page_type="poplayer":t.exp_type="poplayer",t["spm-cnt"]=null!==(n=null==t?void 0:t["spm-cnt"])&&void 0!==n?n:"a2g0n.poplayer",t.sdkVersion="1.1.9","CLK"===o[1]?b(t):x(t)}catch(e){console.log("poplayer 打点上报出错:"+e,"src/util/log.ts")}case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var O=function(){var e,t,n="__poplayer_debug";if("true"===(Object(h.a)(n)||(null===(e=Object(h.b)(window.location.search))||void 0===e?void 0:e[n]))){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];(t=console).log.apply(t,["【 poplayer web container sdk 】"].concat(i))}},T=function(e){var t=e;return"object"==typeof e&&(t=JSON.stringify(e)),encodeURIComponent(t)},A=n(239),I=n(351),j=n(240);function M(e){return"number"==typeof e||/^\d+$/.test(""+e)?e+"px":e}function P(e,t,n,r,i,o,u,c){void 0===u&&(u=!1);var l=s()?"a2g0n":"a2g0o",d=s()?"msite":"pc",f=Date.now(),m=new p(e+"parent",void 0);m.addTarget(t.contentWindow||window,e),m.listen((function(e){var s,p,m,v,y,h,g,w,b,x,_,S,O,P,C;try{C=JSON.parse(e)}catch(e){Object(j.a)("parse message error")}switch(null===(s=C)||void 0===s?void 0:s.type){case"load":k(((v={log_key:"/ae.pc_ctr.statweb_ae_ctr"})["spm-cnt"]=l+"."+o+".poplayer.loadsuccess",v.type="expose",v.exp_page=r,v.positionSign=i,v.exp_type="poplayer",v.houyiTrack=T(n),v.isNewModule=u,v.clientType=d,v.extend=JSON.stringify(null!==(p=null===(m=C)||void 0===m?void 0:m.extend)&&void 0!==p?p:{}),v));break;case"resizeWidthPosition":C.payload&&C.payload.width&&(t.style.width=M(C.payload.width)),C.payload&&C.payload.height&&(t.style.height=M(C.payload.height)),C.payload&&C.payload.top&&(t.style.top=M(C.payload.top)),C.payload&&C.payload.bottom&&(t.style.bottom=M(C.payload.bottom)),C.payload&&C.payload.left&&(t.style.left=M(C.payload.left)),C.payload&&C.payload.right&&(t.style.right=M(C.payload.right));break;case"show":k(((h={log_key:"/ae.pc_ctr.statweb_ae_ctr"})["spm-cnt"]=l+"."+o+".poplayer.display",h.type="expose",h.positionSign=i,h.exp_page=r,h.exp_type="poplayer",h.houyiTrack=T(n),h.clientType=d,h.isNewModule=u,h.timeToShow=""+(Date.now()-f),h.extend=JSON.stringify(null!==(y=C)&&void 0!==y&&y.extend?a()({m_page_id:window.dmtrack_pageid||"","spm-url":A.b.spm||""},C.extend):{}),h)),t.style.display="block",t.style.zIndex="1000000",t.style.transform="translate3d(0, 0, 10000)",Object(I.a)({type:"reduceTime",payload:{key:c}});break;case"addTime":Object(I.a)({type:"addTime",payload:{key:c,times:C.payload}});break;case"link":k(((b={log_key:"/ae.pc_click.statweb_ae_click"})["spm-cnt"]=l+"."+o+".poplayer.jump",b.type="click",b.positionSign=i,b.exp_page=r,b.exp_type="poplayer",b.houyiTrack=T(n),b.clientType=d,b.isNewModule=u,b.extend=JSON.stringify(null!==(g=null===(w=C)||void 0===w?void 0:w.extend)&&void 0!==g?g:{}),b));var E=C.payload;E=E.replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'"),window.location.href=E;break;case"close":document.body.removeChild(t),k(((_={log_key:"/ae.pc_click.statweb_ae_click"})["spm-cnt"]=l+"."+o+".poplayer.close",_.type="click",_.positionSign=i,_.exp_page=r,_.exp_type="poplayer",_.houyiTrack=T(n),_.clientType=d,_.isNewModule=u,_.extend=JSON.stringify(null!==(x=C)&&void 0!==x&&x.extend?{m_page_id:window.dmtrack_pageid||"","spm-url":A.b.spm||""}:{}),_));break;case"failed":document.body.removeChild(t),k(((P={log_key:"/ae.pc_ctr.statweb_ae_ctr"})["spm-cnt"]=l+"."+o+".poplayer.hidden",P.type="expose",P.positionSign=i,P.exp_page=r,P.houyiTrack=T(n),P.isNewModule=u,P.exp_type="poplayer",P.clientType=d,P.extend=JSON.stringify(null!==(S=null===(O=C)||void 0===O?void 0:O.extend)&&void 0!==S?S:{}),P));break;default:document.body.removeChild(t),Object(j.a)("never unknown message happen, auto close poplayer")}}))}function C(e){var t=e.positionSign,n=e.uuid,r="autoCollectPopCoupon-"+t,i=localStorage.getItem(r)||"";if(i)try{var o=(i?JSON.parse(i):{})||{},a=(o.positionSign,o.uuid),s=o.timestamp,u=void 0===s?0:s,c=+new Date;a&&(a!==n||c-u>=3e5)&&localStorage.removeItem(r)}catch(e){}}var E=function(){function e(e,t){this.ruleMapArr=[],this.activityTimes={},this.activityTimes=e,this.ruleMapArr=Object.keys(t).map((function(e){return{activityUuid:e,value:t[e]}}))}var t=e.prototype;return t.getRuleMapArr=function(){return this.ruleMapArr},t.getPopIds=function(){return this.ruleMapArr.map((function(e){return e.activityUuid}))},t.fatigue=function(){var e=this,t=Object.keys(this.activityTimes).map((function(t){return a()({},e.activityTimes[t],{activityUuid:t})})).filter((function(e){var t=(null==e?void 0:e.times)>(null==e?void 0:e.showTimes);return O("fatigue",{times:null==e?void 0:e.times,showTimes:null==e?void 0:e.showTimes,filtered:t}),t})).map((function(e){return e.activityUuid}));return this.ruleMapArr=this.ruleMapArr.filter((function(e){return t.includes(e.value.uuid)})),this},t.priority=function(){return this.ruleMapArr.sort((function(e,t){var n,r;return(null==t||null===(n=t.value)||void 0===n?void 0:n.priority)-(null==e||null===(r=e.value)||void 0===r?void 0:r.priority)})),O("priority",this.getPopIds()),this},t.popType=function(){var e={smallImage:!1,snackbar:!1,other:!1};return this.ruleMapArr=this.ruleMapArr.filter((function(t){var n,r=(null!==(n=null==t?void 0:t.value)&&void 0!==n?n:{}).type;if(["smallImage","snackbar"].includes(r)){if(!e[r])return e[r]=!0,!0}else if(!e.other)return e.other=!0,!0;return!1})),O("popType",this.getPopIds()),this},t.layer=function(){return this.ruleMapArr.sort((function(e,t){var n=function(e){var t,n,r={smallImage:0,snackbar:1,other:2};return null!==(t=null==r?void 0:r[null==e||null===(n=e.value)||void 0===n?void 0:n.type])&&void 0!==t?t:r.other};return n(e)-n(t)})),O("layer",this.getPopIds()),this},t.urlWhiteList=function(){var e=this;return this.ruleMapArr=this.ruleMapArr.filter((function(t){var n,r,i=(null!==(n=null==t?void 0:t.value)&&void 0!==n?n:{}).paramContains,o=void 0===i?"":i;if(!o)return!0;var a=null===(r=o.match(/@(.*)@/))||void 0===r?void 0:r[1];if(!a)return!0;var s=new RegExp(a).test(window.location.href);return O("urlWhiteList",o,s,e.getPopIds()),s})),this},e}();window.lib&&window.lib.mtop||(!0,n(74))},502:function(e,t,n){"use strict";n.d(t,"a",(function(){return w}));var r,i=n(4),o=n.n(i),a=n(17),s=n.n(a),u=n(100),c=n.n(u),p=n(37),l=n.n(p),d=n(103),f=n.n(d),m=n(5),v=n(79),y={ie:999,edge:18,firefox:65,opera:18,chrome:32},h=function(e){if(!e)return null;var t,n=function(e){var t,n,r=e.toLowerCase();try{if(n=r.match(/rv:([\d.]+)\) like gecko/)){var i=0,a=n[1],s=a.match(/(\d+)\./);s&&(i=parseInt(s[1])),t={type:"ie",versionStr:a,version:i}}else if(n=r.match(/msie ([\d\.]+)/)){var u=0,c=n[1],p=c.match(/(\d+)\./);p&&(u=parseInt(p[1])),t={type:"ie",versionStr:c,version:u}}else if(n=r.match(/edg?e\/([\d\.]+)/)){var l=0,d=n[1],f=d.match(/(\d+)\./);f&&(l=parseInt(f[1])),t={type:"edge",versionStr:d,version:l}}else if(n=r.match(/firefox\/([\d\.]+)/)){var m=0,v=n[1],y=v.match(/(\d+)\./);y&&(m=parseInt(y[1])),t={type:"firefox",versionStr:v,version:m}}else if(n=r.match(/(?:opera|opr).([\d\.]+)/)){var h=0,g=n[1],w=g.match(/(\d+)\./);w&&(h=parseInt(w[1])),t={type:"opera",versionStr:g,version:h}}else if(n=r.match(/chrome\/([\d\.]+)/)){var b=0,x=n[1],_=x.match(/(\d+)\./);_&&(b=parseInt(_[1])),t={type:"chrome",versionStr:x,version:b}}else if(n=r.match(/version\/([\d\.]+).*safari/)){var k=0,S=n[1],O=S.match(/(\d+)\./);O&&(k=parseInt(O[1])),t={type:"safari",versionStr:S,version:k}}}catch(e){console.error(e)}return t=o()({},t,{ua:r})}(e);return n&&n.version&&n.type?(t="safari"===n.type?n.ua.match(/(iPhone|iPad)/)?(null==n?void 0:n.version)>=14:n.version>=14:n.version>=y[n.type],o()({},n,{supportWebp:t})):null},g=!m.isSSR&&null;function w(){if(m.isSSR){var e=h(Object(v.a)());return Boolean(null==e?void 0:e.supportWebp)}if(null===g)try{var t,n;g=0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")||"1"===(null===(t=window)||void 0===t||null===(n=t.localStorage)||void 0===n?void 0:n.getItem("ae_u_webp"))}catch(e){g=!1}return g}function b(e){return/^.+_\.webp$/.test(e)}function x(){return w()}function _(e){var t=/(\.jpg|\.jpeg|\.png)/;return!!t.test(e)&&e.match(t)[0]}function k(e){var t;if(!m.isSSR&&!0!==(null===(t=window)||void 0===t?void 0:t._ae_pic_a1_on_))return e;return"string"==typeof e?e.replace(/ae0(1|2|3|4).alicdn.com/,"ae-pic-a1.aliexpress-media.com"):e}function S(e,t){var n=b(e),r=function(e){return/(\.((jp(e)?g)|png)).+\1/.test(e)||b(e)}(e),i=!(/(ae0(1|2|3|4).alicdn.com\/kf)/.test(e)||/(ae-pic-a1.aliexpress-media.com)/.test(e)),o=_(e),a=t.compressedHeight,s=t.compressedWidth,u=t.clipAsSquare,c=void 0!==u&&u,p=t.compressQuality,l=void 0!==p&&p,d=t.quality,f=void 0===d?90:d,m=t.relativeQuality,v=void 0!==m&&m,y=t.useWebp,h=void 0===y||y,g={compressedHeight:a,compressedWidth:s,clipAsSquare:c},w={compressQuality:l,quality:f,relativeQuality:v};if(i||!o)return e;if(r)return k(h&&!n?function(e){var t=b(e);return x()&&!t?e+"_.webp":e}(e):e);var S=k(e),O="";(a||s)&&(a||(g.compressedHeight=s),s||(g.compressedWidth=a),O=function(e,t){var n=e.compressedHeight,r=e.compressedWidth,i=e.clipAsSquare,o=n+"x"+r;return void 0==={"960x10000":1,"640x10000":1,"220x10000":1,"960x960":1,"720x720":1,"640x640":1,"480x480":1,"350x350":1,"300x300":1,"250x250":1,"220x220":1,"200x200":1,"140x140":1,"120x120":1,"100x100":1,"80x80":1,"50x50":1}[o]&&(o="480x480"),i?o+"xz":o}(g));/(\.jpg|\.jpeg)/.test(e)&&l&&(O=function(e,t){var n=e.compressQuality,r=e.quality,i=e.relativeQuality;return t+=n?i?"q"+r:"Q"+r:""}(w,O));var T=_(e);if(h&&x()&&!n)S=O?S+"_"+O+T+"_.webp":S+"_.webp";else{if(!O)return e;S=S+"_"+O+T}return S}m.isSSR||((r=new Image).onload=function(){var e,t;g=r.width>0&&r.height>0,null===(e=window)||void 0===e||null===(t=e.localStorage)||void 0===t||t.setItem("ae_u_webp","1")},r.onerror=function(){var e,t;g=!1,null===(e=window)||void 0===e||null===(t=e.localStorage)||void 0===t||t.removeItem("ae_u_webp")},r.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"),n(300);var O=["src","compressedHeight","compressedWidth","clipAsSquare","compressQuality","quality","relativeQuality","useWebp"],T=function(e){function t(){return e.apply(this,arguments)||this}return c()(t,e),t.prototype.render=function(){var e=this.props,t=e.src,n=e.compressedHeight,r=e.compressedWidth,i=e.clipAsSquare,a=e.compressQuality,u=e.quality,c=e.relativeQuality,p=e.useWebp,d=s()(e,O),f=S(t,{compressedHeight:n,compressedWidth:r,clipAsSquare:i,compressQuality:a,quality:u,relativeQuality:c,useWebp:p});return l.a.createElement("img",o()({src:f},d))},t}(l.a.PureComponent);T.propTypes={src:f.a.string,className:f.a.string,compressedHeight:f.a.number,compressedWidth:f.a.number,clipAsSquare:f.a.bool,compressQuality:f.a.bool,quality:f.a.number,relativeQuality:f.a.bool,useWebp:f.a.bool},T.defaultProps={compressQuality:!1,clipAsSquare:!1,quality:90,relativeQuality:!1,useWebp:!0};t.b=T}}]); |