{"version":3,"sources":["webpack:///../node_modules/dom-scroll-into-view/index.js","webpack:///../node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js","webpack:///../node_modules/dom-scroll-into-view/lib/util.js","webpack:///../node_modules/react-autocomplete/build/lib/Autocomplete.js"],"names":[],"mappings":";;;;;;;;;AAAA,iBAAiB,mBAAO,CAAC,oGAA4B;;;;;;;;;;;;ACArD,WAAW,mBAAO,CAAC,gEAAQ;;AAE3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;;;ACzHA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,UAAU;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,kBAAkB;AAC/B;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;;;;;;;;;;;;AC9aA,8CAAa;;AAEb,mDAAmD,gBAAgB,sBAAsB,OAAO,2BAA2B,0BAA0B,yDAAyD,2BAA2B,EAAE,EAAE,EAAE,eAAe;;AAE9P,gCAAgC,2CAA2C,gBAAgB,kBAAkB,OAAO,2BAA2B,wDAAwD,gCAAgC,uDAAuD,2DAA2D,EAAE,EAAE,yDAAyD,qEAAqE,6DAA6D,oBAAoB,GAAG,EAAE;;AAEjjB,iDAAiD,0CAA0C,0DAA0D,EAAE;;AAEvJ,iDAAiD,aAAa,uFAAuF,EAAE,uFAAuF;;AAE9O,0CAA0C,+DAA+D,qGAAqG,EAAE,yEAAyE,eAAe,yEAAyE,EAAE,EAAE,uHAAuH;;AAE5e,YAAY,mBAAO,CAAC,6CAAO;AAC3B,gBAAgB,mBAAO,CAAC,uDAAY;;AAEpC,eAAe,mBAAO,CAAC,qDAAW;AAClC;;AAEA,qBAAqB,mBAAO,CAAC,2EAAsB;;AAEnD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,sEAAsE,2BAA2B;AACjG;AACA;AACA,GAAG;AACH;AACA;AACA,6GAA6G;AAC7G;AACA;AACA,SAAS;AACT;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,kBAAkB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,cAAc;AACd;AACA,GAAG;AACH;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA,qBAAqB,0BAA0B;AAC/C;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA,8FAA8F,oBAAoB;AAClH;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,qBAAqB,eAAe;AACpC;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,kEAAkE,eAAe;AACjF;AACA,GAAG;AACH;AACA;AACA;AACA,oBAAoB;AACpB,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;AACA,kBAAkB,mBAAmB,4BAA4B;AACjE,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,WAAW,SAAS,kBAAkB,EAAE;AACxC;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,wBAAwB;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,GAAG;AACH,gBAAgB;AAChB;AACA;AACA,GAAG;AACH,kCAAkC;AAClC,kCAAkC;AAClC;AACA;AACA,GAAG;AACH;AACA,uCAAuC,mBAAmB,2CAA2C;AACrG,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;;;AAGA,8B","file":"vendors~faq-autocomplete.js","sourcesContent":["module.exports = require('./lib/dom-scroll-into-view');\n","var util = require('./util');\n\nfunction scrollIntoView(elem, container, config) {\n config = config || {};\n // document 归一化到 window\n if (container.nodeType === 9) {\n container = util.getWindow(container);\n }\n\n var allowHorizontalScroll = config.allowHorizontalScroll;\n var onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n var alignWithTop = config.alignWithTop;\n var alignWithLeft = config.alignWithLeft;\n\n allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n var isWin = util.isWindow(container);\n var elemOffset = util.offset(elem);\n var eh = util.outerHeight(elem);\n var ew = util.outerWidth(elem);\n var containerOffset, ch, cw, containerScroll,\n diffTop, diffBottom, win,\n winScroll, ww, wh;\n\n if (isWin) {\n win = container;\n wh = util.height(win);\n ww = util.width(win);\n winScroll = {\n left: util.scrollLeft(win),\n top: util.scrollTop(win)\n };\n // elem 相对 container å¯è§†è§†çª—çš„è·ç¦»\n diffTop = {\n left: elemOffset.left - winScroll.left,\n top: elemOffset.top - winScroll.top\n };\n diffBottom = {\n left: elemOffset.left + ew - (winScroll.left + ww),\n top: elemOffset.top + eh - (winScroll.top + wh)\n };\n containerScroll = winScroll;\n } else {\n containerOffset = util.offset(container);\n ch = container.clientHeight;\n cw = container.clientWidth;\n containerScroll = {\n left: container.scrollLeft,\n top: container.scrollTop\n };\n // elem 相对 container å¯è§†è§†çª—çš„è·ç¦»\n // 注æ„边框, offset æ˜¯è¾¹æ¡†åˆ°æ ¹èŠ‚ç‚¹\n diffTop = {\n left: elemOffset.left - (containerOffset.left +\n (parseFloat(util.css(container, 'borderLeftWidth')) || 0)),\n top: elemOffset.top - (containerOffset.top +\n (parseFloat(util.css(container, 'borderTopWidth')) || 0))\n };\n diffBottom = {\n left: elemOffset.left + ew -\n (containerOffset.left + cw +\n (parseFloat(util.css(container, 'borderRightWidth')) || 0)),\n top: elemOffset.top + eh -\n (containerOffset.top + ch +\n (parseFloat(util.css(container, 'borderBottomWidth')) || 0))\n };\n }\n\n if (diffTop.top < 0 || diffBottom.top > 0) {\n // 强制å‘上\n if (alignWithTop === true) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else if (alignWithTop === false) {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n } else {\n // 自动调整\n if (diffTop.top < 0) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n if (alignWithTop) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n }\n\n if (allowHorizontalScroll) {\n if (diffTop.left < 0 || diffBottom.left > 0) {\n // 强制å‘上\n if (alignWithLeft === true) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else if (alignWithLeft === false) {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n } else {\n // 自动调整\n if (diffTop.left < 0) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n if (alignWithLeft) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n }\n }\n}\n\nmodule.exports = scrollIntoView;\n","var RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n var box, x, y;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement;\n // æ ¹æ® GBS 最新数æ®ï¼ŒA-Grade Browsers éƒ½å·²æ”¯æŒ getBoundingClientRect 方法,ä¸ç”¨å†è€ƒè™‘ä¼ ç»Ÿçš„å®žçŽ°æ–¹å¼\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑å‡åŽ» docElem.clientLeft/clientTop\n // 但测试å‘çŽ°ï¼Œè¿™æ ·å而会导致当 html å’Œ body 有边è·/è¾¹æ¡†æ ·å¼æ—¶ï¼ŒèŽ·å–的值ä¸æ£ç¡®\n // æ¤å¤–,ie6 会忽略 html çš„ margin 值,幸è¿åœ°æ˜¯æ²¡æœ‰è°ä¼šåŽ»è®¾ç½® html çš„ margin\n\n x = box.left;\n y = box.top;\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该å‡åŽ»çª—å£çš„边框å§ï¼Œæ¯•ç«Ÿé»˜è®¤ absolute 都是相对窗å£å®šä½çš„\n // 窗å£è¾¹æ¡†æ ‡å‡†æ˜¯è®¾ documentElement ,quirks 时设置 body\n // 最好ç¦æ¢åœ¨ body å’Œ html 上边框 ,但 ie < 9 html 默认有 2px ,å‡åŽ»\n // ä½†æ˜¯éž ie ä¸å¯èƒ½è®¾ç½®çª—å£è¾¹æ¡†ï¼Œbody html 也ä¸æ˜¯çª—å£ ,ie å¯ä»¥é€šè¿‡ html,body 设置\n // æ ‡å‡† ie 下 docElem.clientTop 就是 border-top\n // ie7 html å³çª—å£è¾¹æ¡†æ”¹å˜ä¸äº†ã€‚永远为 2\n // ä½†æ ‡å‡† firefox/chrome/ie9 下 docElem.clientTop 是窗å£è¾¹æ¡†ï¼Œå³ä½¿è®¾äº† border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {left: x, top: y};\n}\n\nfunction getScroll(w, top) {\n var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];\n var method = 'scroll' + (top ? 'Top' : 'Left');\n if (typeof ret !== 'number') {\n var d = w.document;\n //ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n //quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle) {\n var val = '';\n var d = elem.ownerDocument;\n\n // https://github.com/kissyteam/kissy/issues/61\n if ((computedStyle = (computedStyle || d.defaultView.getComputedStyle(elem, null)))) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');\nvar RE_POS = /^(top|right|bottom|left)$/,\n CURRENT_STYLE = 'currentStyle',\n RUNTIME_STYLE = 'runtimeStyle',\n LEFT = 'left',\n PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft æ–¹å¼è½¬æ¢çš„ width/height 值\n // 一开始就处ç†äº†! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下ä¸å¯¹ï¼Œéœ€è¦ç›´æŽ¥ç”¨ offset æ–¹å¼\n // borderWidth ç‰å€¼ä¹Ÿæœ‰é—®é¢˜ï¼Œä½†è€ƒè™‘到 borderWidth 设为百分比的概率很å°ï¼Œè¿™é‡Œå°±ä¸è€ƒè™‘了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style,\n left = style[LEFT],\n rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : (ret || 0);\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nvar getComputedStyleX;\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\n// 设置 elem 相对 elem.ownerDocument çš„åæ ‡\nfunction setOffset(elem, offset) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var old = getOffset(elem),\n ret = {},\n current, key;\n\n for (key in offset) {\n current = parseFloat(css(elem, key)) || 0;\n ret[key] = current + offset[key] - old[key];\n }\n css(elem, ret);\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'],\n CONTENT_INDEX = -1,\n PADDING_INDEX = 2,\n BORDER_INDEX = 1,\n MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {},\n style = elem.style,\n name;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n old[name] = style[name];\n style[name] = options[name];\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n style[name] = old[name];\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0, prop, j, i;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp;\n if (prop === 'border') {\n cssProp = prop + which[i] + 'Width';\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /*jshint eqeqeq:false*/\n return obj != null && obj == obj.window;\n}\n\nvar domUtils = {};\n\neach(['Width', 'Height'], function (name) {\n domUtils['doc' + name] = function (refWin) {\n var d = refWin.document;\n return Math.max(\n //firefox chrome documentElement.scrollHeight< body.scrollHeight\n //ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement['scroll' + name],\n //quirks : documentElement.scrollHeight 最大ç‰äºŽå¯è§†çª—å£å¤šä¸€ç‚¹ï¼Ÿ\n d.body['scroll' + name],\n domUtils['viewport' + name](d));\n };\n\n domUtils['viewport' + name] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = 'client' + name,\n doc = win.document,\n body = doc.body,\n documentElement = doc.documentElement,\n documentElementProp = documentElement[prop];\n // æ ‡å‡†æ¨¡å¼å– documentElement\n // backcompat å– body\n return doc.compatMode === 'CSS1Compat' && documentElementProp ||\n body && body[prop] || documentElementProp;\n };\n});\n\n/*\n å¾—åˆ°å…ƒç´ çš„å¤§å°ä¿¡æ¯\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'],\n borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem, computedStyle);\n var cssBoxValue = 0;\n if (borderBoxValue == null || borderBoxValue <= 0) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (cssBoxValue == null || (Number(cssBoxValue)) < 0) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'],\n which, computedStyle);\n } else {\n return cssBoxValue;\n }\n } else if (borderBoxValueOrIsBorderBox) {\n return val + (extra === BORDER_INDEX ? 0 :\n (extra === PADDING_INDEX ?\n -getPBMWidth(elem, ['border'], which, computedStyle) :\n getPBMWidth(elem, ['margin'], which, computedStyle)));\n } else {\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra),\n which, computedStyle);\n }\n}\n\nvar cssShow = {position: 'absolute', visibility: 'hidden', display: 'block'};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n var val, args = arguments;\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils['outer' + first] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, val) {\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n }\n return css(elem, name, val);\n }\n return;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\nfunction css(el, name, value) {\n if (typeof name === 'object') {\n for (var i in name) {\n css(el, i, name[i]);\n }\n return;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value = value + 'px';\n }\n el.style[name] = value;\n } else {\n return getComputedStyleX(el, name);\n }\n}\n\nfunction mix(to, from) {\n for (var i in from) {\n to[i] = from[i];\n }\n return to;\n}\n\nvar utils = module.exports = {\n getWindow: function (node) {\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n offset: function (el, value) {\n if (typeof value !== 'undefined') {\n setOffset(el, value);\n } else {\n return getOffset(el);\n }\n },\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function (obj) {\n var ret = {};\n for (var i in obj) {\n ret[i] = obj[i];\n }\n var overflow = obj.overflow;\n if (overflow) {\n for (i in obj) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n return ret;\n },\n mix: mix,\n scrollLeft: function (w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollLeft(w);\n } else {\n window.scrollTo(v, getScrollTop(w));\n }\n } else {\n if (v === undefined) {\n return w.scrollLeft;\n } else {\n w.scrollLeft = v;\n }\n }\n },\n scrollTop: function (w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollTop(w);\n } else {\n window.scrollTo(getScrollLeft(w), v);\n }\n } else {\n if (v === undefined) {\n return w.scrollTop;\n } else {\n w.scrollTop = v;\n }\n }\n },\n merge: function () {\n var ret = {};\n for (var i = 0; i < arguments.length; i++) {\n utils.mix(ret, arguments[i]);\n }\n return ret;\n },\n viewportWidth: 0,\n viewportHeight: 0\n};\n\nmix(utils, domUtils);\n","'use strict';\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar React = require('react');\nvar PropTypes = require('prop-types');\n\nvar _require = require('react-dom'),\n findDOMNode = _require.findDOMNode;\n\nvar scrollIntoView = require('dom-scroll-into-view');\n\nvar IMPERATIVE_API = ['blur', 'checkValidity', 'click', 'focus', 'select', 'setCustomValidity', 'setSelectionRange', 'setRangeText'];\n\nfunction getScrollOffset() {\n return {\n x: window.pageXOffset !== undefined ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft,\n y: window.pageYOffset !== undefined ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop\n };\n}\n\nvar Autocomplete = function (_React$Component) {\n _inherits(Autocomplete, _React$Component);\n\n function Autocomplete(props) {\n _classCallCheck(this, Autocomplete);\n\n var _this = _possibleConstructorReturn(this, (Autocomplete.__proto__ || Object.getPrototypeOf(Autocomplete)).call(this, props));\n\n _this.state = {\n isOpen: false,\n highlightedIndex: null\n };\n _this._debugStates = [];\n _this.ensureHighlightedIndex = _this.ensureHighlightedIndex.bind(_this);\n _this.exposeAPI = _this.exposeAPI.bind(_this);\n _this.handleInputFocus = _this.handleInputFocus.bind(_this);\n _this.handleInputBlur = _this.handleInputBlur.bind(_this);\n _this.handleChange = _this.handleChange.bind(_this);\n _this.handleKeyDown = _this.handleKeyDown.bind(_this);\n _this.handleInputClick = _this.handleInputClick.bind(_this);\n _this.maybeAutoCompleteText = _this.maybeAutoCompleteText.bind(_this);\n return _this;\n }\n\n _createClass(Autocomplete, [{\n key: 'componentWillMount',\n value: function componentWillMount() {\n // this.refs is frozen, so we need to assign a new object to it\n this.refs = {};\n this._ignoreBlur = false;\n this._ignoreFocus = false;\n this._scrollOffset = null;\n this._scrollTimer = null;\n }\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n clearTimeout(this._scrollTimer);\n this._scrollTimer = null;\n }\n }, {\n key: 'componentWillReceiveProps',\n value: function componentWillReceiveProps(nextProps) {\n if (this.state.highlightedIndex !== null) {\n this.setState(this.ensureHighlightedIndex);\n }\n if (nextProps.autoHighlight && (this.props.value !== nextProps.value || this.state.highlightedIndex === null)) {\n this.setState(this.maybeAutoCompleteText);\n }\n }\n }, {\n key: 'componentDidMount',\n value: function componentDidMount() {\n if (this.isOpen()) {\n this.setMenuPositions();\n }\n }\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps, prevState) {\n if (this.state.isOpen && !prevState.isOpen || 'open' in this.props && this.props.open && !prevProps.open) this.setMenuPositions();\n\n this.maybeScrollItemIntoView();\n if (prevState.isOpen !== this.state.isOpen) {\n this.props.onMenuVisibilityChange(this.state.isOpen);\n }\n }\n }, {\n key: 'exposeAPI',\n value: function exposeAPI(el) {\n var _this2 = this;\n\n this.refs.input = el;\n IMPERATIVE_API.forEach(function (ev) {\n return _this2[ev] = el && el[ev] && el[ev].bind(el);\n });\n }\n }, {\n key: 'maybeScrollItemIntoView',\n value: function maybeScrollItemIntoView() {\n if (this.isOpen() && this.state.highlightedIndex !== null) {\n var itemNode = this.refs['item-' + this.state.highlightedIndex];\n var menuNode = this.refs.menu;\n scrollIntoView(findDOMNode(itemNode), findDOMNode(menuNode), { onlyScrollIfNeeded: true });\n }\n }\n }, {\n key: 'handleKeyDown',\n value: function handleKeyDown(event) {\n if (Autocomplete.keyDownHandlers[event.key]) Autocomplete.keyDownHandlers[event.key].call(this, event);else if (!this.isOpen()) {\n this.setState({\n isOpen: true\n });\n }\n }\n }, {\n key: 'handleChange',\n value: function handleChange(event) {\n this.props.onChange(event, event.target.value);\n }\n }, {\n key: 'getFilteredItems',\n value: function getFilteredItems(props) {\n var items = props.items;\n\n if (props.shouldItemRender) {\n items = items.filter(function (item) {\n return props.shouldItemRender(item, props.value);\n });\n }\n\n if (props.sortItems) {\n items.sort(function (a, b) {\n return props.sortItems(a, b, props.value);\n });\n }\n\n return items;\n }\n }, {\n key: 'maybeAutoCompleteText',\n value: function maybeAutoCompleteText(state, props) {\n var highlightedIndex = state.highlightedIndex;\n var value = props.value,\n getItemValue = props.getItemValue;\n\n var index = highlightedIndex === null ? 0 : highlightedIndex;\n var items = this.getFilteredItems(props);\n for (var i = 0; i < items.length; i++) {\n if (props.isItemSelectable(items[index])) break;\n index = (index + 1) % items.length;\n }\n var matchedItem = items[index] && props.isItemSelectable(items[index]) ? items[index] : null;\n if (value !== '' && matchedItem) {\n var itemValue = getItemValue(matchedItem);\n var itemValueDoesMatch = itemValue.toLowerCase().indexOf(value.toLowerCase()) === 0;\n if (itemValueDoesMatch) {\n return { highlightedIndex: index };\n }\n }\n return { highlightedIndex: null };\n }\n }, {\n key: 'ensureHighlightedIndex',\n value: function ensureHighlightedIndex(state, props) {\n if (state.highlightedIndex >= this.getFilteredItems(props).length) {\n return { highlightedIndex: null };\n }\n }\n }, {\n key: 'setMenuPositions',\n value: function setMenuPositions() {\n var node = this.refs.input;\n var rect = node.getBoundingClientRect();\n var computedStyle = global.window.getComputedStyle(node);\n var marginBottom = parseInt(computedStyle.marginBottom, 10) || 0;\n var marginLeft = parseInt(computedStyle.marginLeft, 10) || 0;\n var marginRight = parseInt(computedStyle.marginRight, 10) || 0;\n this.setState({\n menuTop: rect.bottom + marginBottom,\n menuLeft: rect.left + marginLeft,\n menuWidth: rect.width + marginLeft + marginRight\n });\n }\n }, {\n key: 'highlightItemFromMouse',\n value: function highlightItemFromMouse(index) {\n this.setState({ highlightedIndex: index });\n }\n }, {\n key: 'selectItemFromMouse',\n value: function selectItemFromMouse(item) {\n var _this3 = this;\n\n var value = this.props.getItemValue(item);\n // The menu will de-render before a mouseLeave event\n // happens. Clear the flag to release control over focus\n this.setIgnoreBlur(false);\n this.setState({\n isOpen: false,\n highlightedIndex: null\n }, function () {\n _this3.props.onSelect(value, item);\n });\n }\n }, {\n key: 'setIgnoreBlur',\n value: function setIgnoreBlur(ignore) {\n this._ignoreBlur = ignore;\n }\n }, {\n key: 'renderMenu',\n value: function renderMenu() {\n var _this4 = this;\n\n var items = this.getFilteredItems(this.props).map(function (item, index) {\n var element = _this4.props.renderItem(item, _this4.state.highlightedIndex === index, { cursor: 'default' });\n return React.cloneElement(element, {\n onMouseEnter: _this4.props.isItemSelectable(item) ? function () {\n return _this4.highlightItemFromMouse(index);\n } : null,\n onClick: _this4.props.isItemSelectable(item) ? function () {\n return _this4.selectItemFromMouse(item);\n } : null,\n ref: function ref(e) {\n return _this4.refs['item-' + index] = e;\n }\n });\n });\n var style = {\n left: this.state.menuLeft,\n top: this.state.menuTop,\n minWidth: this.state.menuWidth\n };\n var menu = this.props.renderMenu(items, this.props.value, style);\n return React.cloneElement(menu, {\n ref: function ref(e) {\n return _this4.refs.menu = e;\n },\n // Ignore blur to prevent menu from de-rendering before we can process click\n onTouchStart: function onTouchStart() {\n return _this4.setIgnoreBlur(true);\n },\n onMouseEnter: function onMouseEnter() {\n return _this4.setIgnoreBlur(true);\n },\n onMouseLeave: function onMouseLeave() {\n return _this4.setIgnoreBlur(false);\n }\n });\n }\n }, {\n key: 'handleInputBlur',\n value: function handleInputBlur(event) {\n var _this5 = this;\n\n if (this._ignoreBlur) {\n this._ignoreFocus = true;\n this._scrollOffset = getScrollOffset();\n this.refs.input.focus();\n return;\n }\n var setStateCallback = void 0;\n var highlightedIndex = this.state.highlightedIndex;\n\n if (this.props.selectOnBlur && highlightedIndex !== null) {\n var items = this.getFilteredItems(this.props);\n var item = items[highlightedIndex];\n var value = this.props.getItemValue(item);\n setStateCallback = function setStateCallback() {\n return _this5.props.onSelect(value, item);\n };\n }\n this.setState({\n isOpen: false,\n highlightedIndex: null\n }, setStateCallback);\n var onBlur = this.props.inputProps.onBlur;\n\n if (onBlur) {\n onBlur(event);\n }\n }\n }, {\n key: 'handleInputFocus',\n value: function handleInputFocus(event) {\n var _this6 = this;\n\n if (this._ignoreFocus) {\n this._ignoreFocus = false;\n var _scrollOffset = this._scrollOffset,\n x = _scrollOffset.x,\n y = _scrollOffset.y;\n\n this._scrollOffset = null;\n // Focus will cause the browser to scroll the <input> into view.\n // This can cause the mouse coords to change, which in turn\n // could cause a new highlight to happen, cancelling the click\n // event (when selecting with the mouse)\n window.scrollTo(x, y);\n // Some browsers wait until all focus event handlers have been\n // processed before scrolling the <input> into view, so let's\n // scroll again on the next tick to ensure we're back to where\n // the user was before focus was lost. We could do the deferred\n // scroll only, but that causes a jarring split second jump in\n // some browsers that scroll before the focus event handlers\n // are triggered.\n clearTimeout(this._scrollTimer);\n this._scrollTimer = setTimeout(function () {\n _this6._scrollTimer = null;\n window.scrollTo(x, y);\n }, 0);\n return;\n }\n this.setState({ isOpen: true });\n var onFocus = this.props.inputProps.onFocus;\n\n if (onFocus) {\n onFocus(event);\n }\n }\n }, {\n key: 'isInputFocused',\n value: function isInputFocused() {\n var el = this.refs.input;\n return el.ownerDocument && el === el.ownerDocument.activeElement;\n }\n }, {\n key: 'handleInputClick',\n value: function handleInputClick() {\n // Input will not be focused if it's disabled\n if (this.isInputFocused() && !this.isOpen()) this.setState({ isOpen: true });\n }\n }, {\n key: 'composeEventHandlers',\n value: function composeEventHandlers(internal, external) {\n return external ? function (e) {\n internal(e);external(e);\n } : internal;\n }\n }, {\n key: 'isOpen',\n value: function isOpen() {\n return 'open' in this.props ? this.props.open : this.state.isOpen;\n }\n }, {\n key: 'render',\n value: function render() {\n if (this.props.debug) {\n // you don't like it, you love it\n this._debugStates.push({\n id: this._debugStates.length,\n state: this.state\n });\n }\n\n var inputProps = this.props.inputProps;\n\n var open = this.isOpen();\n return React.createElement(\n 'div',\n _extends({ style: _extends({}, this.props.wrapperStyle) }, this.props.wrapperProps),\n this.props.renderInput(_extends({}, inputProps, {\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': open,\n autoComplete: 'off',\n ref: this.exposeAPI,\n onFocus: this.handleInputFocus,\n onBlur: this.handleInputBlur,\n onChange: this.handleChange,\n onKeyDown: this.composeEventHandlers(this.handleKeyDown, inputProps.onKeyDown),\n onClick: this.composeEventHandlers(this.handleInputClick, inputProps.onClick),\n value: this.props.value\n })),\n open && this.renderMenu(),\n this.props.debug && React.createElement(\n 'pre',\n { style: { marginLeft: 300 } },\n JSON.stringify(this._debugStates.slice(Math.max(0, this._debugStates.length - 5), this._debugStates.length), null, 2)\n )\n );\n }\n }]);\n\n return Autocomplete;\n}(React.Component);\n\nAutocomplete.propTypes = {\n /**\n * The items to display in the dropdown menu\n */\n items: PropTypes.array.isRequired,\n /**\n * The value to display in the input field\n */\n value: PropTypes.any,\n /**\n * Arguments: `event: Event, value: String`\n *\n * Invoked every time the user changes the input's value.\n */\n onChange: PropTypes.func,\n /**\n * Arguments: `value: String, item: Any`\n *\n * Invoked when the user selects an item from the dropdown menu.\n */\n onSelect: PropTypes.func,\n /**\n * Arguments: `item: Any, value: String`\n *\n * Invoked for each entry in `items` and its return value is used to\n * determine whether or not it should be displayed in the dropdown menu.\n * By default all items are always rendered.\n */\n shouldItemRender: PropTypes.func,\n /**\n * Arguments: `item: Any`\n *\n * Invoked when attempting to select an item. The return value is used to\n * determine whether the item should be selectable or not.\n * By default all items are selectable.\n */\n isItemSelectable: PropTypes.func,\n /**\n * Arguments: `itemA: Any, itemB: Any, value: String`\n *\n * The function which is used to sort `items` before display.\n */\n sortItems: PropTypes.func,\n /**\n * Arguments: `item: Any`\n *\n * Used to read the display value from each entry in `items`.\n */\n getItemValue: PropTypes.func.isRequired,\n /**\n * Arguments: `item: Any, isHighlighted: Boolean, styles: Object`\n *\n * Invoked for each entry in `items` that also passes `shouldItemRender` to\n * generate the render tree for each item in the dropdown menu. `styles` is\n * an optional set of styles that can be applied to improve the look/feel\n * of the items in the dropdown menu.\n */\n renderItem: PropTypes.func.isRequired,\n /**\n * Arguments: `items: Array<Any>, value: String, styles: Object`\n *\n * Invoked to generate the render tree for the dropdown menu. Ensure the\n * returned tree includes every entry in `items` or else the highlight order\n * and keyboard navigation logic will break. `styles` will contain\n * { top, left, minWidth } which are the coordinates of the top-left corner\n * and the width of the dropdown menu.\n */\n renderMenu: PropTypes.func,\n /**\n * Styles that are applied to the dropdown menu in the default `renderMenu`\n * implementation. If you override `renderMenu` and you want to use\n * `menuStyle` you must manually apply them (`this.props.menuStyle`).\n */\n menuStyle: PropTypes.object,\n /**\n * Arguments: `props: Object`\n *\n * Invoked to generate the input element. The `props` argument is the result\n * of merging `props.inputProps` with a selection of props that are required\n * both for functionality and accessibility. At the very least you need to\n * apply `props.ref` and all `props.on<event>` event handlers. Failing to do\n * this will cause `Autocomplete` to behave unexpectedly.\n */\n renderInput: PropTypes.func,\n /**\n * Props passed to `props.renderInput`. By default these props will be\n * applied to the `<input />` element rendered by `Autocomplete`, unless you\n * have specified a custom value for `props.renderInput`. Any properties\n * supported by `HTMLInputElement` can be specified, apart from the\n * following which are set by `Autocomplete`: value, autoComplete, role,\n * aria-autocomplete. `inputProps` is commonly used for (but not limited to)\n * placeholder, event handlers (onFocus, onBlur, etc.), autoFocus, etc..\n */\n inputProps: PropTypes.object,\n /**\n * Props that are applied to the element which wraps the `<input />` and\n * dropdown menu elements rendered by `Autocomplete`.\n */\n wrapperProps: PropTypes.object,\n /**\n * This is a shorthand for `wrapperProps={{ style: <your styles> }}`.\n * Note that `wrapperStyle` is applied before `wrapperProps`, so the latter\n * will win if it contains a `style` entry.\n */\n wrapperStyle: PropTypes.object,\n /**\n * Whether or not to automatically highlight the top match in the dropdown\n * menu.\n */\n autoHighlight: PropTypes.bool,\n /**\n * Whether or not to automatically select the highlighted item when the\n * `<input>` loses focus.\n */\n selectOnBlur: PropTypes.bool,\n /**\n * Arguments: `isOpen: Boolean`\n *\n * Invoked every time the dropdown menu's visibility changes (i.e. every\n * time it is displayed/hidden).\n */\n onMenuVisibilityChange: PropTypes.func,\n /**\n * Used to override the internal logic which displays/hides the dropdown\n * menu. This is useful if you want to force a certain state based on your\n * UX/business logic. Use it together with `onMenuVisibilityChange` for\n * fine-grained control over the dropdown menu dynamics.\n */\n open: PropTypes.bool,\n debug: PropTypes.bool\n};\nAutocomplete.defaultProps = {\n value: '',\n wrapperProps: {},\n wrapperStyle: {\n display: 'inline-block'\n },\n inputProps: {},\n renderInput: function renderInput(props) {\n return React.createElement('input', props);\n },\n onChange: function onChange() {},\n onSelect: function onSelect() {},\n isItemSelectable: function isItemSelectable() {\n return true;\n },\n renderMenu: function renderMenu(items, value, style) {\n return React.createElement('div', { style: _extends({}, style, this.menuStyle), children: items });\n },\n\n menuStyle: {\n borderRadius: '3px',\n boxShadow: '0 2px 12px rgba(0, 0, 0, 0.1)',\n background: 'rgba(255, 255, 255, 0.9)',\n padding: '2px 0',\n fontSize: '90%',\n position: 'fixed',\n overflow: 'auto',\n maxHeight: '50%' },\n autoHighlight: true,\n selectOnBlur: false,\n onMenuVisibilityChange: function onMenuVisibilityChange() {}\n};\nAutocomplete.keyDownHandlers = {\n ArrowDown: function ArrowDown(event) {\n event.preventDefault();\n var items = this.getFilteredItems(this.props);\n if (!items.length) return;\n var highlightedIndex = this.state.highlightedIndex;\n\n var index = highlightedIndex === null ? -1 : highlightedIndex;\n for (var i = 0; i < items.length; i++) {\n var p = (index + i + 1) % items.length;\n if (this.props.isItemSelectable(items[p])) {\n index = p;\n break;\n }\n }\n if (index > -1 && index !== highlightedIndex) {\n this.setState({\n highlightedIndex: index,\n isOpen: true\n });\n }\n },\n ArrowUp: function ArrowUp(event) {\n event.preventDefault();\n var items = this.getFilteredItems(this.props);\n if (!items.length) return;\n var highlightedIndex = this.state.highlightedIndex;\n\n var index = highlightedIndex === null ? items.length : highlightedIndex;\n for (var i = 0; i < items.length; i++) {\n var p = (index - (1 + i) + items.length) % items.length;\n if (this.props.isItemSelectable(items[p])) {\n index = p;\n break;\n }\n }\n if (index !== items.length) {\n this.setState({\n highlightedIndex: index,\n isOpen: true\n });\n }\n },\n Enter: function Enter(event) {\n var _this7 = this;\n\n // Key code 229 is used for selecting items from character selectors (Pinyin, Kana, etc)\n if (event.keyCode !== 13) return;\n // In case the user is currently hovering over the menu\n this.setIgnoreBlur(false);\n if (!this.isOpen()) {\n // menu is closed so there is no selection to accept -> do nothing\n return;\n } else if (this.state.highlightedIndex == null) {\n // input has focus but no menu item is selected + enter is hit -> close the menu, highlight whatever's in input\n this.setState({\n isOpen: false\n }, function () {\n _this7.refs.input.select();\n });\n } else {\n // text entered + menu item has been highlighted + enter is hit -> update value to that of selected menu item, close the menu\n event.preventDefault();\n var item = this.getFilteredItems(this.props)[this.state.highlightedIndex];\n var value = this.props.getItemValue(item);\n this.setState({\n isOpen: false,\n highlightedIndex: null\n }, function () {\n //this.refs.input.focus() // TODO: file issue\n _this7.refs.input.setSelectionRange(value.length, value.length);\n _this7.props.onSelect(value, item);\n });\n }\n },\n Escape: function Escape() {\n // In case the user is currently hovering over the menu\n this.setIgnoreBlur(false);\n this.setState({\n highlightedIndex: null,\n isOpen: false\n });\n },\n Tab: function Tab() {\n // In case the user is currently hovering over the menu\n this.setIgnoreBlur(false);\n }\n};\n\n\nmodule.exports = Autocomplete;"],"sourceRoot":""}