(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";function shouldInsert(){return!(0,_dom.$)(injectionSelector+" ."+btnContainer)}function injectBtns(){(0,_dom.$$)(injectionSelector).forEach(function(e){var n=createInjectionBtn();e.appendChild(n)})}function dispose(){removeAll(),clearTimeout(watchInterval)}function removeAll(){(0,_dom.$$)("."+btnContainer).forEach(_dom.removeNodeFromParent)}function createInjectionBtn(){var e=document.createElement("p");return e.classList.add(btnContainer),e.innerHTML='<a href="'+QN_LINK+'" target="_blank" style="'+containerStyle+'" >\n            <span class="uc-nexus-retailer-mode-icon-download-qn" style="'+iconStyle+'"></span>\n            <span>'+chrome.i18n.getMessage("retailer_download_QN")+'</span>\n            <span class="'+closeBtnClass+' close"></span>\n        </a>',e}var _message=require(7),_retailerMode=require(6),_dom=require(4),_domStyle=require(3),btnContainer="nexus-QN-injection",injectionSelector="[class^=buyer-mod__buyer]",navSelector="pagination",closeBtnClass="uc-nexus-retailer-close-qn-injection",QN_LINK="https://www.taobao.com/market/work/portal/pc.php?from=uc",watchInterval=void 0;(0,_message.sendMessageAsync)(_retailerMode.MSG_EVENT_SHOULD_INJECT_QN_BTN,null).then(function(e){var n=e.disabled,t=e.installed;n||t||(injectBtns(),document.body.addEventListener("click",function(e){e.path.some(function(e){return e.classList&&e.classList.contains(navSelector)})?watchInterval=setInterval(function(){shouldInsert()&&(injectBtns(),clearInterval(watchInterval))},1e3):e.target.classList.contains(closeBtnClass)&&((0,_message.sendMessageAsync)(_retailerMode.MSG_EVENT_DISABLE_QN_INJECTION,{},{noReply:!0}),dispose(),e.preventDefault())}))}),(0,_message.registerMsgHandler)(_retailerMode.MSG_EVENT_DISABLE_QN_INJECTION,dispose);var iconStyle=(0,_domStyle.flatStyle)({display:"inline-block",marginRight:"4px",marginTop:"-1px",verticalAlign:"top"}),containerStyle=(0,_domStyle.flatStyle)({color:"#3eac13",lineHeight:"17px"});


},{"3":3,"4":4,"6":6,"7":7}],2:[function(require,module,exports){
"use strict";function defer(){var e=void 0,r=void 0,n=new Promise(function(n,o){e=n,r=o});return{resolve:function(r){e(r)},reject:function(e){r(e)},promise:n}}exports.defer=defer;


},{}],3:[function(require,module,exports){
"use strict";function flatStyle(t){var r=[];return(0,_utils.forEach)(t,function(t,e){return r.push(e.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})+":"+t)}),r.join(";")}exports.flatStyle=flatStyle;var _utils=require(5);


},{"5":5}],4:[function(require,module,exports){
"use strict";function $(e,o){return e instanceof HTMLElement?e:(o||document).querySelector(e)}function _$(e,o){return(o||document).shadowRoot.querySelector(e)}function _$$(e,o){return slice.call((o||document).shadowRoot.querySelectorAll(e))}function $$(e,o){return slice.call((o||document).querySelectorAll(e))}function toggleClass(e,o,t){var r=2==arguments.length?e.classList.contains(o):!t;e.classList[r?"remove":"add"](o)}function removeNodeFromParent(e){return e&&e.parentNode?(e.parentNode.removeChild(e),!0):!1}exports.$=$,exports._$=_$,exports._$$=_$$,exports.$$=$$,exports.toggleClass=toggleClass,exports.removeNodeFromParent=removeNodeFromParent;var slice=Array.prototype.slice;


},{}],5:[function(require,module,exports){
"use strict";function forEach(r,t,n){if(isObj(r))if(void 0===n&&(n=r),r instanceof Array||r.hasOwnProperty("length"))for(var e=0,o=r.length;o>e;e++)t.call(n,r[e],e);else for(var i in r)r.hasOwnProperty(i)&&t.call(n,r[i],i);return r}function arrAdd(r,t,n){return-1==r.indexOf(t)?(r[n?"unshift":"push"](t),!0):void 0}function arrFind(r,t){var n=0,e=!0,o=!1,i=void 0;try{for(var a,s=r[Symbol.iterator]();!(e=(a=s.next()).done);e=!0){var f=a.value;if(t(f,n++))return f}}catch(u){o=!0,i=u}finally{try{!e&&s["return"]&&s["return"]()}finally{if(o)throw i}}}function arrFirst(r,t){var n=0,e=!0,o=!1,i=void 0;try{for(var a,s=r[Symbol.iterator]();!(e=(a=s.next()).done);e=!0){var f=a.value,u=t(f,n++);if(u)return u}}catch(c){o=!0,i=c}finally{try{!e&&s["return"]&&s["return"]()}finally{if(o)throw i}}}function arrRemove(r,t){var n=r.indexOf(t);return n>-1&&r.splice(n,1),-1!=n}function arrFilterMappedResult(r,t,n){var e=[],o=void 0;return forEach(r,function(r,n){(o=t.call(this,r,n))&&e.push(o)},n),e}function isFunc(r){return"function"==typeof r}function isObj(r){return r&&"object"==typeof r}function isStr(r){return"string"==typeof r}function noop(){}exports.forEach=forEach,exports.arrAdd=arrAdd,exports.arrFind=arrFind,exports.arrFirst=arrFirst,exports.arrRemove=arrRemove,exports.arrFilterMappedResult=arrFilterMappedResult,exports.isFunc=isFunc,exports.isObj=isObj,exports.isStr=isStr,exports.noop=noop;


},{}],6:[function(require,module,exports){
"use strict";var MSG_EVENT_SHOULD_INJECT_QN_BTN=exports.MSG_EVENT_SHOULD_INJECT_QN_BTN="inject-QNBTN?",MSG_EVENT_DISABLE_QN_INJECTION=exports.MSG_EVENT_DISABLE_QN_INJECTION="disable-QNBTN",STORAGE_KEY_USER_DISABLE_QN_INJECTION=exports.STORAGE_KEY_USER_DISABLE_QN_INJECTION="QN_Injection_Disabled",MSG_EVENT_QUERY_RETAILER_AUTOCOMPLETE_INFO=exports.MSG_EVENT_QUERY_RETAILER_AUTOCOMPLETE_INFO="query-retailer-autocomplete-info",MSG_EVENT_SAVE_RETAILER_AUTOCOMPLETE_INFO=exports.MSG_EVENT_SAVE_RETAILER_AUTOCOMPLETE_INFO="save-retailer-autocomplete-info",MSG_EVENT_CAN_OPEN_NEW_RETAILER_WINDOW=exports.MSG_EVENT_CAN_OPEN_NEW_RETAILER_WINDOW="can-open-new-retailer-window",MSG_EVENT_OPEN_NEW_RETAILER_WINDOW=exports.MSG_EVENT_OPEN_NEW_RETAILER_WINDOW="open-new-retailer-window";


},{}],7:[function(require,module,exports){
"use strict";function sendMessageAsync(e,r){var t=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=t.noReply,o=t.extId,s={type:e,data:r,sync:!1,noReply:n,d:"req"};if(n)return sendMsg(o,s),Promise.resolve();var c=guid(),d=(0,_defer.defer)();return s.guid=c,deferCache[c]=d,sendMsg(o,s),d.promise["catch"](noop)}function initPort(){deferCache=Object.create(null);try{extPort=chrome.runtime.connect({name:"page:connect"}),extPort.onMessage.addListener(onMsg),extPort.onDisconnect.addListener(function(){disposePort(),setTimeout(initPort,0)})}catch(e){console.log(e)}}function disposePort(){for(var e in deferCache){var r=deferCache[e];r&&r.reject&&r.reject("disconnect")}deferCache=Object.create(null),extPort=null}function onMsg(e){var r=e.guid,t=e.d,n=deferCache[r];if("postTab"===t){var o=bkMsgHandlers[e.type];o&&o(e.data)}else n&&"res"===t&&(e.success?n.resolve(e.data):n.reject(e.error),delete deferCache[r])}function registerMsgHandler(e,r){"function"==typeof r&&(bkMsgHandlers[e]=r)}function sendMsg(e,r){if(e&&r)throw Error("not support external");r&&(extPort?extPort.postMessage(r):chrome.runtime.sendMessage(r))}function noop(){}function guid(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+Date.now()}exports.sendMessageAsync=sendMessageAsync,exports.registerMsgHandler=registerMsgHandler;var _defer=require(2),deferCache=void 0,bkMsgHandlers=Object.create(null),extPort=void 0;"object"==typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener(onMsg),window.addEventListener("unload",function(){extPort.disconnect(),disposePort()}),initPort();


},{"2":2}]},{},[1]);
