{"version":3,"file":"infinitegrid.framelayout.js","sources":["../node_modules/@egjs/component/dist/component.esm.js","../src/browser.ts","../src/consts.ts","../src/utils.ts","../src/ItemManager.ts","../src/DOMRenderer.ts","../src/Watcher.ts","../src/Infinite.ts","../src/AutoSizer.ts","../src/ImageLoaded.ts","../src/LayoutManager.ts","../src/InfiniteGrid.ts","../src/layouts/FrameLayout.ts","../src/index.framelayout.ts"],"sourcesContent":["/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/component project is licensed under the MIT license\n\n@egjs/component JavaScript library\nhttps://naver.github.io/egjs-component\n\n@version 2.1.2\n*/\n/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nfunction isUndefined(value) {\n return typeof value === \"undefined\";\n}\n/**\n * A class used to manage events in a component\n * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스\n * @alias eg.Component\n */\n\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n var Component =\n /*#__PURE__*/\n function () {\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Component.VERSION; // ex) 2.0.0\n * @memberof eg.Component\n */\n\n /**\n * @support {\"ie\": \"7+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n */\n function Component() {\n this._eventHandler = {};\n this.options = {};\n }\n /**\n * Triggers a custom event.\n * @ko 커스텀 이벤트를 발생시킨다\n * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름\n * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터\n * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고\n * @example\n class Some extends eg.Component {\n some(){\n \tif(this.trigger(\"beforeHi\")){ // When event call to stop return false.\n \tthis.trigger(\"hi\");// fire hi event.\n \t}\n }\n }\n const some = new Some();\n some.on(\"beforeHi\", (e) => {\n if(condition){\n \te.stop(); // When event call to stop, `hi` event not call.\n }\n });\n some.on(\"hi\", (e) => {\n // `currentTarget` is component instance.\n console.log(some === e.currentTarget); // true\n });\n // If you want to more know event design. You can see article.\n // https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F\n */\n\n\n var _proto = Component.prototype;\n\n _proto.trigger = function trigger(eventName, customEvent) {\n if (customEvent === void 0) {\n customEvent = {};\n }\n\n var handlerList = this._eventHandler[eventName] || [];\n var hasHandlerList = handlerList.length > 0;\n\n if (!hasHandlerList) {\n return true;\n } // If detach method call in handler in first time then handler list calls.\n\n\n handlerList = handlerList.concat();\n customEvent.eventType = eventName;\n var isCanceled = false;\n var arg = [customEvent];\n var i = 0;\n\n customEvent.stop = function () {\n isCanceled = true;\n };\n\n customEvent.currentTarget = this;\n\n for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n restParam[_key - 2] = arguments[_key];\n }\n\n if (restParam.length >= 1) {\n arg = arg.concat(restParam);\n }\n\n for (i = 0; handlerList[i]; i++) {\n handlerList[i].apply(this, arg);\n }\n\n return !isCanceled;\n };\n /**\n * Executed event just one time.\n * @ko 이벤트가 한번만 실행된다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n alert(\"hi\");\n }\n thing() {\n this.once(\"hi\", this.hi);\n }\n }\n var some = new Some();\n some.thing();\n some.trigger(\"hi\");\n // fire alert(\"hi\");\n some.trigger(\"hi\");\n // Nothing happens\n */\n\n\n _proto.once = function once(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var i;\n\n for (i in eventHash) {\n this.once(i, eventHash[i]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var self = this;\n this.on(eventName, function listener() {\n for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n arg[_key2] = arguments[_key2];\n }\n\n handlerToAttach.apply(self, arg);\n self.off(eventName, listener);\n });\n }\n\n return this;\n };\n /**\n * Checks whether an event has been attached to a component.\n * @ko 컴포넌트에 이벤트가 등록됐는지 확인한다.\n * @param {String} eventName The name of the event to be attached 등록 여부를 확인할 이벤트의 이름\n * @return {Boolean} Indicates whether the event is attached. 이벤트 등록 여부\n * @example\n class Some extends eg.Component {\n some() {\n this.hasOn(\"hi\");// check hi event.\n }\n }\n */\n\n\n _proto.hasOn = function hasOn(eventName) {\n return !!this._eventHandler[eventName];\n };\n /**\n * Attaches an event to a component.\n * @ko 컴포넌트에 이벤트를 등록한다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.on(\"hi\",this.hi); //attach event\n }\n }\n */\n\n\n _proto.on = function on(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.on(name, eventHash[name]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var handlerList = this._eventHandler[eventName];\n\n if (isUndefined(handlerList)) {\n this._eventHandler[eventName] = [];\n handlerList = this._eventHandler[eventName];\n }\n\n handlerList.push(handlerToAttach);\n }\n\n return this;\n };\n /**\n * Detaches an event from the component.\n * @ko 컴포넌트에 등록된 이벤트를 해제한다\n * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름\n * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.off(\"hi\",this.hi); //detach event\n }\n }\n */\n\n\n _proto.off = function off(eventName, handlerToDetach) {\n // All event detach.\n if (isUndefined(eventName)) {\n this._eventHandler = {};\n return this;\n } // All handler of specific event detach.\n\n\n if (isUndefined(handlerToDetach)) {\n if (typeof eventName === \"string\") {\n this._eventHandler[eventName] = undefined;\n return this;\n } else {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.off(name, eventHash[name]);\n }\n\n return this;\n }\n } // The handler of specific event detach.\n\n\n var handlerList = this._eventHandler[eventName];\n\n if (handlerList) {\n var k;\n var handlerFunction;\n\n for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) {\n if (handlerFunction === handlerToDetach) {\n handlerList = handlerList.splice(k, 1);\n break;\n }\n }\n }\n\n return this;\n };\n\n return Component;\n }();\n\n Component.VERSION = \"2.1.2\";\n return Component;\n}();\n\nexport default Component;\n//# sourceMappingURL=component.esm.js.map\n","import { WindowMockType } from \"./types\";\n\nlet win: WindowMockType;\n\nif (typeof window === \"undefined\") {\n\t// window is undefined in node.js\n\twin = {\n\t\tdocument: {},\n\t\tnavigator: {\n\t\t\tuserAgent: \"\",\n\t\t},\n\t};\n} else {\n\twin = window;\n}\n\nexport { win as window };\nexport const document = win.document;\n","import { window, document } from \"./browser\";\nimport { IAlign } from \"./types\";\n\nconst ua = window.navigator.userAgent;\n\nexport const SUPPORT_COMPUTEDSTYLE = !!(\"getComputedStyle\" in window);\nexport const SUPPORT_ADDEVENTLISTENER = !!(\"addEventListener\" in document);\nexport const SUPPORT_PASSIVE = (() => {\n\tlet supportsPassiveOption = false;\n\n\ttry {\n\t\tif (SUPPORT_ADDEVENTLISTENER && Object.defineProperty) {\n\t\t\tdocument.addEventListener(\"test\", null, Object.defineProperty({},\n\t\t\t\t\"passive\", {\n\t\t\t\t\tget() {\n\t\t\t\t\t\tsupportsPassiveOption = true;\n\t\t\t\t\t},\n\t\t\t\t}));\n\t\t}\n\t} catch (e) {\n\t\t//\n\t}\n\treturn supportsPassiveOption;\n})();\n\nexport const IS_IE = /MSIE|Trident|Windows Phone|Edge/.test(ua);\nexport const IS_IOS = /iPhone|iPad/.test(ua);\nexport const IS_ANDROID2 = /Android 2\\./.test(ua);\nexport const CONTAINER_CLASSNAME = \"_eg-infinitegrid-container_\";\nexport const IGNORE_CLASSNAME = \"_eg-infinitegrid-ignore_\";\nexport const TRANSITION_NAME = \"_INFINITEGRID_TRANSITION\";\n\nexport const APPEND = true;\nexport const PREPEND = false;\nexport const VERTICAL = \"vertical\";\nexport const HORIZONTAL = \"horizontal\";\nexport const CACHE = true;\nexport const NO_CACHE = false;\nexport const TRUSTED = true;\nexport const NO_TRUSTED = false;\nexport const MULTI = true;\nexport const SINGLE = false;\nexport const DUMMY_POSITION = -100000;\nexport const GROUPKEY_ATT = \"data-groupkey\";\n\nexport const DEFAULT_OPTIONS = {\n\thorizontal: false,\n\tmargin: 0,\n};\n\nexport const agent = ua.toLowerCase();\nexport const isMobile = /mobi|ios|android/.test(agent);\n\nexport const ALIGN: IAlign = {\n\tSTART: \"start\",\n\tCENTER: \"center\",\n\tEND: \"end\",\n\tJUSTIFY: \"justify\",\n};\n\nexport const IDLE = 0;\nexport const LOADING_APPEND = 1;\nexport const LOADING_PREPEND = 2;\nexport const PROCESSING = 4;\n\nconst webkit = /applewebkit\\/([\\d|.]*)/g.exec(agent);\n\nexport const WEBKIT_VERSION = (webkit && parseInt(webkit[1], 10)) || 0;\nexport const DEFENSE_BROWSER = (WEBKIT_VERSION && WEBKIT_VERSION < 537);\n\ninterface ITransitionEnd {\n\ttransitionend: string;\n\twebkitTransitionEnd: string;\n\tMSTransitionEnd: string;\n\toTransitionEnd: string;\n\tmozTransitionEnd: string;\n}\n\nexport const [TRANSFORM, TRANSITION, TRANSITION_END] = (() => {\n\tconst properties: ITransitionEnd = {\n\t\ttransitionend: \"\",\n\t\twebkitTransitionEnd: \"-webkit-\",\n\t\tMSTransitionEnd: \"-ms-\",\n\t\toTransitionEnd: \"-o-\",\n\t\tmozTransitionEnd: \"-moz-\",\n\t};\n\n\tfor (const property in properties) {\n\t\tconst prefix = properties[property as keyof ITransitionEnd];\n\n\t\tif (`on${property.toLowerCase()}` in window) {\n\t\t\treturn [`${prefix}transform`, `${prefix}transition`, property];\n\t\t}\n\t}\n\treturn [];\n})() as [\"transform\", \"transition\", \"transitionend\"];\n","\nimport { window, document } from \"./browser\";\nimport {\n\tSUPPORT_COMPUTEDSTYLE,\n\tSUPPORT_ADDEVENTLISTENER,\n\tSUPPORT_PASSIVE,\n\tVERTICAL,\n\tHORIZONTAL,\n\tDEFAULT_OPTIONS,\n} from \"./consts\";\nimport { IJQuery, IRectlProperties, InnerSizeType, ClientSizeType, ScrollSizeType, OffsetSizeType, WindowMockType } from \"./types\";\n\nexport function toArray(nodes: HTMLCollection): HTMLElement[];\nexport function toArray(nodes: T[] | NodeListOf): T[];\nexport function toArray(nodes: T[] | NodeListOf | HTMLCollection) {\n\t// SCRIPT5014 in IE8\n\tconst array = [];\n\n\tif (nodes) {\n\t\tfor (let i = 0, len = nodes.length; i < len; i++) {\n\t\t\tarray.push(nodes[i]);\n\t\t}\n\t}\n\treturn array;\n}\nexport function matchHTML(html: string) {\n\treturn html.match(/^<([A-z]+)\\s*([^>]*)>/);\n}\n/**\n * Select or create element\n * @param {String|HTMLElement|jQuery} param\n * when string given is as HTML tag, then create element\n * otherwise it returns selected elements\n * @param {Boolean} multi\n * @returns {HTMLElement}\n */\nexport function $(param: WindowMockType, multi?: false): WindowMockType;\nexport function $(\n\tparam: string | HTMLElement | Array | IJQuery,\n\tmulti: true,\n): HTMLElement[];\nexport function $(\n\tparam: string | HTMLElement | Array | IJQuery,\n\tmulti?: false,\n): HTMLElement;\nexport function $(\n\tparam: string | HTMLElement | WindowMockType | IJQuery,\n\tmulti?: false,\n): HTMLElement | WindowMockType;\nexport function $(\n\tparam: string | WindowMockType | HTMLElement | Array | IJQuery,\n\tmulti = false,\n): HTMLElement | WindowMockType | HTMLElement[] {\n\tlet el: WindowMockType | HTMLElement | HTMLElement[] | NodeListOf;\n\n\tif (typeof param === \"string\") { // String (HTML, Selector)\n\t\t// check if string is HTML tag format\n\t\tconst match = matchHTML(param);\n\n\t\t// creating element\n\t\tif (match) { // HTML\n\t\t\tconst dummy = document.createElement(\"div\");\n\n\t\t\tdummy.innerHTML = param;\n\t\t\tel = dummy.childNodes as NodeListOf;\n\t\t} else { // Selector\n\t\t\tel = document.querySelectorAll(param);\n\t\t}\n\t\tif (multi) {\n\t\t\treturn toArray(el as NodeListOf);\n\t\t} else {\n\t\t\treturn el && (el as NodeListOf)[0];\n\t\t}\n\t} else if (isWindow(param)) { // window\n\t\tel = param;\n\t} else if (isJQuery(param)) { // jQuery\n\t\tel = multi ? $(param.toArray(), true) :\n\t\t\t$(param.get(0), false);\n\t} else if (Array.isArray(param)) {\n\t\tel = param.map(v => $(v));\n\t\tif (!multi) {\n\t\t\tel = el.length >= 1 ? (el as HTMLElement[])[0] : undefined;\n\t\t}\n\t} else if (param.nodeName &&\n\t\t(param.nodeType === 1 || param.nodeType === 9)) { // HTMLElement, Document\n\t\tel = param;\n\t}\n\treturn el;\n}\nexport function addEvent(\n\telement: Element | WindowMockType,\n\ttype: string,\n\thandler: (...args: any[]) => any,\n\teventListenerOptions?: boolean | { [key: string]: any },\n) {\n\tif (SUPPORT_ADDEVENTLISTENER) {\n\t\tlet options = eventListenerOptions || false;\n\n\t\tif (typeof eventListenerOptions === \"object\") {\n\t\t\toptions = SUPPORT_PASSIVE ? eventListenerOptions : false;\n\t\t}\n\t\telement.addEventListener(type, handler, options);\n\t} else if ((element as any).attachEvent) {\n\t\t(element as any).attachEvent(`on${type}`, handler);\n\t} else {\n\t\t(element as any)[`on${type}`] = handler;\n\t}\n}\nexport function removeEvent(\n\telement: Element | WindowMockType,\n\ttype: string,\n\thandler: (...args: any[]) => any,\n) {\n\tif (element.removeEventListener) {\n\t\telement.removeEventListener(type, handler, false);\n\t} else if ((element as any).detachEvent) {\n\t\t(element as any).detachEvent(`on${type}`, handler);\n\t} else {\n\t\t(element as any)[`on${type}`] = null;\n\t}\n}\nexport function addOnceEvent(\n\telement: Element,\n\ttype: string,\n\thandler: (...args: any[]) => any,\n\teventListenerOptions?: boolean | { [key: string]: any },\n) {\n\tconst callback = (e: any) => {\n\t\tremoveEvent(element, type, callback);\n\t\thandler(e);\n\t};\n\n\taddEvent(element, type, callback, eventListenerOptions);\n}\nexport function scroll(el: HTMLElement | WindowMockType, horizontal = false) {\n\tconst prop = `scroll${horizontal ? \"Left\" : \"Top\"}` as \"scrollLeft\" | \"scrollTop\";\n\n\tif (isWindow(el)) {\n\t\treturn window[horizontal ? \"pageXOffset\" : \"pageYOffset\"] || document.body[prop] || document.documentElement[prop];\n\t} else {\n\t\treturn el[prop];\n\t}\n}\nexport function scrollTo(el: WindowMockType | Element, x: number, y: number) {\n\tif (isWindow(el)) {\n\t\tel.scroll(x, y);\n\t} else {\n\t\tel.scrollLeft = x;\n\t\tel.scrollTop = y;\n\t}\n}\nexport function scrollBy(el: WindowMockType | Element, x: number, y: number) {\n\tif (isWindow(el)) {\n\t\tel.scrollBy(x, y);\n\t} else {\n\t\tel.scrollLeft += x;\n\t\tel.scrollTop += y;\n\t}\n}\nexport function getStyles(el: Element) {\n\treturn (SUPPORT_COMPUTEDSTYLE ?\n\t\twindow.getComputedStyle(el) : (el as any).currentStyle) || {};\n}\nfunction _getSize(el: WindowMockType | Document | HTMLElement, name: \"Width\" | \"Height\", isOffset?: boolean) {\n\tif (isWindow(el)) { // WINDOW\n\t\treturn window[`inner${name}` as InnerSizeType] || document.body[`client${name}` as ClientSizeType];\n\t} else if (isDocument(el)) { // DOCUMENT_NODE\n\t\tconst doc = (el as Document).documentElement;\n\t\tconst body = (el as Document).body;\n\n\t\treturn Math.max(\n\t\t\tbody[`scroll${name}` as ScrollSizeType], doc[`scroll${name}` as ScrollSizeType],\n\t\t\tbody[`offset${name}` as OffsetSizeType], doc[`offset${name}` as OffsetSizeType],\n\t\t\tdoc[`client${name}` as ClientSizeType],\n\t\t);\n\t} else { // NODE\n\t\tlet size = 0;\n\n\t\tif (isOffset) {\n\t\t\tconst clientRect = el.getBoundingClientRect();\n\n\t\t\tsize = name === \"Width\" ? clientRect.right - clientRect.left : clientRect.bottom - clientRect.top;\n\t\t} else {\n\t\t\tsize = el[`client${name}` as ClientSizeType] || el[`offset${name}` as OffsetSizeType];\n\t\t}\n\t\tif (size) {\n\t\t\treturn size;\n\t\t}\n\t\tconst cssSize = getStyles(el)[name.toLowerCase()];\n\n\t\treturn (~cssSize.indexOf(\"px\") && parseFloat(cssSize)) || 0;\n\t}\n}\n\nexport function innerWidth(el: WindowMockType | Document | HTMLElement) {\n\treturn _getSize(el, \"Width\", false);\n}\nexport function innerHeight(el: WindowMockType | Document | HTMLElement) {\n\treturn _getSize(el, \"Height\", false);\n}\nexport function outerWidth(el: WindowMockType | Document | HTMLElement) {\n\treturn _getSize(el, \"Width\", true);\n}\nexport function outerHeight(el: WindowMockType | Document | HTMLElement) {\n\treturn _getSize(el, \"Height\", true);\n}\nexport function getSize(el: HTMLElement) {\n\treturn {\n\t\twidth: outerWidth(el),\n\t\theight: outerHeight(el),\n\t};\n}\nexport const STYLE: {\n\tvertical: IRectlProperties,\n\thorizontal: IRectlProperties,\n} = {\n\tvertical: {\n\t\tstartPos1: \"top\",\n\t\tendPos1: \"bottom\",\n\t\tsize1: \"height\",\n\t\tstartPos2: \"left\",\n\t\tendPos2: \"right\",\n\t\tsize2: \"width\",\n\t},\n\thorizontal: {\n\t\tstartPos1: \"left\",\n\t\tendPos1: \"right\",\n\t\tsize1: \"width\",\n\t\tstartPos2: \"top\",\n\t\tendPos2: \"bottom\",\n\t\tsize2: \"height\",\n\t},\n};\n\nexport function getStyleNames(isHorizontal: boolean): IRectlProperties {\n\treturn STYLE[isHorizontal ? HORIZONTAL : VERTICAL];\n}\nexport function assign(target: A, source: B): A & B;\nexport function assign(target: A, source1: B, source2: C): A & B & C;\nexport function assign(target: A, source1: B, source2: C, source3: D): A & B & C & D;\nexport function assign(target: { [key: string]: any }, ...sources: Array<{ [key: string]: any }>): { [key: string]: any };\nexport function assign(target: { [key: string]: any }, ...sources: Array<{ [key: string]: any }>) {\n\tsources.forEach(source => {\n\t\tfor (const key in source) {\n\t\t\ttarget[key] = source[key];\n\t\t}\n\t});\n\treturn target;\n}\nexport function assignOptions(\n\tdefaultOptions: A, options: B): typeof DEFAULT_OPTIONS & A & B {\n\treturn assign({},\n\t\tDEFAULT_OPTIONS,\n\t\tdefaultOptions,\n\t\toptions);\n}\n\nexport function toZeroArray(outline?: number[]) {\n\tif (!outline || !outline.length) {\n\t\treturn [0];\n\t}\n\treturn outline;\n}\nexport function cloneItems(items: T[]) {\n\treturn items.map(item => assign({}, item));\n}\nexport function isJQuery(el: any): el is IJQuery {\n\treturn (typeof (window as any).jQuery === \"function\" && el instanceof (window as any).jQuery) ||\n\t\tel.constructor.prototype.jquery && el.toArray;\n}\nexport function isWindow(el: any): el is WindowMockType {\n\treturn el === window;\n}\nexport function isDocument(el: Node): el is Document {\n\treturn el.nodeType === 9;\n}\n\nexport function fill(arr: T[], value: T) {\n\tconst length = arr.length;\n\n\tfor (let i = length - 1; i >= 0; --i) {\n\t\tarr[i] = value;\n\t}\n\n\treturn arr;\n}\n\nexport function isUndefined(target: any): target is undefined {\n\treturn typeof target === \"undefined\";\n}\n","import { MULTI, GROUPKEY_ATT, IGNORE_CLASSNAME, DUMMY_POSITION } from \"./consts\";\nimport { $, toArray, isUndefined, assign } from \"./utils\";\nimport { CursorType, IJQuery, IInfiniteGridGroup, IInfiniteGridItem, IItemManagerStatus } from \"./types\";\n\nexport default class ItemManager {\n\tpublic static from(\n\t\telements: HTMLElement[] | string | string[] | IJQuery, selector: string,\n\t\t{ groupKey }: { groupKey: string | number }) {\n\t\tconst filted = ItemManager.selectItems($(elements, MULTI), selector);\n\n\t\t// Item Structure\n\t\treturn toArray(filted).map(el => ({\n\t\t\tel,\n\t\t\tgroupKey,\n\t\t\tcontent: el.outerHTML,\n\t\t\trect: {\n\t\t\t\ttop: DUMMY_POSITION,\n\t\t\t\tleft: DUMMY_POSITION,\n\t\t\t},\n\t\t}));\n\t}\n\tpublic static selectItems(elements: HTMLElement[], selector?: string) {\n\t\treturn elements.filter(v => {\n\t\t\tconst classNames = v.className.split(\" \");\n\n\t\t\tif (classNames.some(c => c === IGNORE_CLASSNAME)) {\n\t\t\t\treturn false;\n\t\t\t} else if (!selector || selector === \"*\") {\n\t\t\t\treturn v;\n\t\t\t} else {\n\t\t\t\treturn classNames.some(c => c === selector);\n\t\t\t}\n\t\t});\n\t}\n\tpublic static pluck(data: A[], property: B):\n\t\tA[B] extends any[] ? A[B] : Array {\n\t\treturn data.reduce((acc, v) => acc.concat(v[property]), []) as any;\n\t}\n\tpublic _data: IInfiniteGridGroup[];\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\tpublic getStatus(startKey?: string | number, endKey?: string | number): IItemManagerStatus {\n\t\tconst datas = this._data;\n\t\tconst startIndex = Math.max(this.indexOf(startKey), 0);\n\t\tconst endIndex = this.indexOf(endKey) + 1 || datas.length;\n\n\t\treturn {\n\t\t\t_data: datas.slice(startIndex, endIndex).map(data => {\n\t\t\t\tconst items = data.items.map(item => {\n\t\t\t\t\tconst item2 = assign({}, item);\n\n\t\t\t\t\tdelete item2.el;\n\t\t\t\t\treturn item2;\n\t\t\t\t});\n\t\t\t\tconst data2 = assign({}, data);\n\n\t\t\t\tdata2.items = items;\n\t\t\t\treturn data2;\n\t\t\t}),\n\t\t};\n\t}\n\tpublic setStatus(status: IItemManagerStatus) {\n\t\tconst data = status._data;\n\n\t\tthis.set(data);\n\t}\n\tpublic size() {\n\t\treturn this._data.length;\n\t}\n\tpublic fit(base: number, horizontal: boolean) {\n\t\tif (!this._data.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst property = horizontal ? \"left\" : \"top\";\n\n\t\tif (base !== 0) {\n\t\t\tthis._data = this._data.map(v => {\n\t\t\t\tv.items = v.items.map(item => {\n\t\t\t\t\titem.rect[property] -= base;\n\t\t\t\t\treturn item;\n\t\t\t\t});\n\t\t\t\tv.outlines.start = v.outlines.start.map(start => start - base);\n\t\t\t\tv.outlines.end = v.outlines.end.map(end => end - base);\n\t\t\t\treturn v;\n\t\t\t});\n\t\t}\n\t}\n\tpublic pluck(property: T, start?: number, end?: number) {\n\t\tconst data = isUndefined(start) ? this._data :\n\t\t\tthis._data.slice(start, (isUndefined(end) ? start : end) + 1);\n\n\t\treturn ItemManager.pluck(data, property);\n\t}\n\tpublic getOutline(index: number, property: keyof IInfiniteGridGroup[\"outlines\"]) {\n\t\tconst data = this._data[index];\n\n\t\treturn data ? data.outlines[property] : [];\n\t}\n\tpublic getEdgeIndex(cursor: CursorType, start: number, end: number) {\n\t\tconst prop = cursor === \"start\" ? \"min\" : \"max\";\n\t\tlet index = -1;\n\t\tlet targetValue = cursor === \"start\" ? Infinity : -Infinity;\n\n\t\tfor (let i = start; i <= end; i++) {\n\t\t\tconst value = Math[prop](...this.getOutline(i, cursor));\n\n\t\t\tif ((cursor === \"start\" && targetValue > value) ||\n\t\t\t\t(cursor === \"end\" && targetValue < value)) {\n\t\t\t\ttargetValue = value;\n\t\t\t\tindex = i;\n\t\t\t}\n\t\t}\n\t\treturn index;\n\t}\n\tpublic getEdgeValue(cursor: CursorType, start: number, end: number) {\n\t\tconst outlines = this.pluck(\"outlines\", this.getEdgeIndex(cursor, start, end))\n\t\t\t.reduce((acc, v) => acc.concat(v[cursor]), []);\n\n\t\treturn outlines.length ? Math[cursor === \"start\" ? \"min\" : \"max\"](...outlines) : 0;\n\t}\n\tpublic clearOutlines(startCursor = -1, endCursor = -1) {\n\t\tconst datas = this.get();\n\n\t\tdatas.forEach((group, cursor) => {\n\t\t\tif (startCursor <= cursor && cursor <= endCursor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tgroup.items.forEach(item => {\n\t\t\t\titem.rect.top = DUMMY_POSITION;\n\t\t\t\titem.rect.left = DUMMY_POSITION;\n\t\t\t});\n\t\t\tgroup.outlines.start = [];\n\t\t\tgroup.outlines.end = [];\n\t\t});\n\t}\n\tpublic getMaxEdgeValue() {\n\t\tconst groups = this.get();\n\t\tconst length = groups.length;\n\n\t\tfor (let i = length - 1; i >= 0; --i) {\n\t\t\tconst end = groups[i].outlines.end;\n\n\t\t\tif (end.length) {\n\t\t\t\tconst pos = Math.max(...end);\n\n\t\t\t\treturn pos;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\tpublic append(layouted: IInfiniteGridGroup) {\n\t\tthis._data.push(layouted);\n\t\treturn layouted.items;\n\t}\n\tpublic prepend(layouted: IInfiniteGridGroup) {\n\t\tthis._data.unshift(layouted);\n\t\treturn layouted.items;\n\t}\n\tpublic clear() {\n\t\tthis._data = [];\n\t}\n\tpublic remove(element: HTMLElement, start: number, end: number) {\n\t\tlet items: IInfiniteGridItem[] = [];\n\t\tlet groups: IInfiniteGridGroup[] = [];\n\t\tconst key = element.getAttribute(GROUPKEY_ATT);\n\t\tconst datas = this.get(start, end)\n\t\t\t.filter(v => String(v.groupKey) === key);\n\n\t\tif (!datas.length) {\n\t\t\treturn { items, groups };\n\t\t}\n\t\tconst data = datas[0];\n\n\t\tconst length = data.items.length;\n\t\tlet idx = -1;\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tif (data.items[i].el === element) {\n\t\t\t\tidx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (idx >= 0) {\n\t\t\t// remove item information\n\t\t\titems = data.items.splice(idx, 1);\n\n\t\t\tif (!data.items.length) {\n\t\t\t\tthis._data.splice(this.indexOf(data), 1);\n\t\t\t\tgroups = [data];\n\t\t\t} else {\n\t\t\t\tthis.set(data, key);\n\t\t\t}\n\t\t}\n\t\treturn { items, groups };\n\t}\n\tpublic indexOf(data: IInfiniteGridGroup | string | number) {\n\t\tconst groupKey = typeof data === \"object\" ? data.groupKey : data;\n\t\tconst datas = this._data;\n\t\tconst length = datas.length;\n\n\t\tfor (let i = 0; i < length; ++i) {\n\t\t\tif (groupKey === datas[i].groupKey) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\tpublic get(start?: number, end?: number) {\n\t\treturn isUndefined(start) ? this._data :\n\t\t\tthis._data.slice(start, (isUndefined(end) ? start : end) + 1);\n\t}\n\tpublic set(data: IInfiniteGridGroup | IInfiniteGridGroup[], key?: string | number) {\n\t\tif (!Array.isArray(data)) {\n\t\t\tif (!isUndefined(key)) {\n\t\t\t\tconst len = this._data.length;\n\t\t\t\tlet idx = -1;\n\n\t\t\t\tfor (let i = 0; i < len; i++) {\n\t\t\t\t\tif (this._data[i].groupKey === key) {\n\t\t\t\t\t\tidx = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tidx > 0 && (this._data[idx] = data);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._data = data.concat();\n\t\t}\n\t}\n\tpublic getData(index: number) {\n\t\treturn this._data[index];\n\t}\n}\n","import {\n\tAPPEND,\n\tPREPEND,\n\tDUMMY_POSITION,\n\tMULTI,\n\tGROUPKEY_ATT,\n\tCONTAINER_CLASSNAME,\n\tTRANSITION_NAME,\n\tTRANSITION,\n\tTRANSITION_END,\n\tTRANSFORM,\n} from \"./consts\";\nimport { window, document } from \"./browser\";\nimport {\n\t$,\n\tinnerHeight,\n\tinnerWidth,\n\tgetSize,\n\tgetStyles,\n\taddOnceEvent,\n\tassign,\n} from \"./utils\";\nimport { RectType, IPosition, ISize, IJQuery, IInfiniteGridItem, WindowMockType, IDOMRendererStatus, IDOMRendererSize } from \"./types\";\n\nexport function resetSize(item: IInfiniteGridItem) {\n\titem.orgSize = null;\n\titem.size = null;\n}\nexport interface IDOMRendererOptions {\n\tisEqualSize: boolean;\n\tisConstantSize: boolean;\n\thorizontal: boolean;\n\tcontainer: boolean | HTMLElement;\n}\n\nexport interface IDOMRendererOrgStyle {\n\tposition?: CSSStyleDeclaration[\"position\"];\n\toverflowX?: CSSStyleDeclaration[\"overflowX\"];\n\toverflowY?: CSSStyleDeclaration[\"overflowY\"];\n}\n\nfunction createContainer(element: HTMLElement) {\n\tconst container = document.createElement(\"div\");\n\n\tcontainer.className = CONTAINER_CLASSNAME;\n\tcontainer.style.position = \"relative\";\n\tcontainer.style.height = \"100%\";\n\n\tconst children = element.children;\n\tconst length = children.length;\t// for IE8\n\n\tfor (let i = 0; i < length; i++) {\n\t\tcontainer.appendChild(children[0]);\n\t}\n\telement.appendChild(container);\n\treturn container;\n}\nfunction render(properties: RectType[], rect: IInfiniteGridItem[\"rect\"], styles: HTMLElement[\"style\"]) {\n\tproperties.forEach(p => {\n\t\t(p in rect) && (styles[p] = `${rect[p]}px`);\n\t});\n}\nfunction setTransition(styles: HTMLElement[\"style\"], transitionDuration?: number, pos1?: IPosition, pos2?: IPosition) {\n\tstyles[`${TRANSITION}-property`] = transitionDuration ? `${TRANSFORM},width,height` : \"\";\n\tstyles[`${TRANSITION}-duration`] = transitionDuration ? `${transitionDuration}s` : \"\";\n\tstyles[`${TRANSITION}-delay`] = transitionDuration ? `0s` : \"\";\n\tstyles[TRANSFORM] = transitionDuration ? `translate(${pos1.left - pos2.left}px,${pos1.top - pos2.top}px)` : \"\";\n}\n\nexport default class DOMRenderer {\n\tpublic static renderItem(item: IInfiniteGridItem, rect: IInfiniteGridItem[\"rect\"], transitionDuration?: number) {\n\t\tif (!item.el) {\n\t\t\treturn;\n\t\t}\n\t\tconst { el, prevRect } = item;\n\t\tconst styles = el.style;\n\n\t\t// for debugging\n\t\tel.setAttribute(GROUPKEY_ATT, `${item.groupKey}`);\n\t\tstyles.position = \"absolute\";\n\t\trender([\"width\", \"height\"], rect, styles);\n\t\tif (transitionDuration && TRANSITION && prevRect) {\n\t\t\tsetTransition(styles, transitionDuration, rect as IPosition, prevRect as IPosition);\n\t\t\tif ((el as any)[TRANSITION_NAME]) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tel[TRANSITION_NAME] = true;\n\t\t\taddOnceEvent(el, TRANSITION_END, () => {\n\t\t\t\tconst itemRect = item.rect;\n\n\t\t\t\tsetTransition(styles);\n\t\t\t\trender([\"left\", \"top\"], itemRect, styles);\n\t\t\t\titem.prevRect = itemRect;\n\t\t\t\tel[TRANSITION_NAME] = false;\n\t\t\t});\n\t\t} else {\n\t\t\trender([\"left\", \"top\"], rect, styles);\n\t\t\titem.prevRect = rect;\n\t\t}\n\t}\n\tpublic static renderItems(items: IInfiniteGridItem[], transitionDuration?: number) {\n\t\titems.forEach(item => {\n\t\t\tDOMRenderer.renderItem(item, item.rect, transitionDuration);\n\t\t});\n\t}\n\tpublic static removeItems(items: IInfiniteGridItem[]) {\n\t\titems.forEach(item => {\n\t\t\tif (item.el) {\n\t\t\t\tDOMRenderer.removeElement(item.el);\n\t\t\t\titem.el = null;\n\t\t\t}\n\t\t});\n\t}\n\tpublic static removeElement(element: HTMLElement) {\n\t\tconst parentNode = element && element.parentNode;\n\n\t\tif (!parentNode) {\n\t\t\treturn;\n\t\t}\n\t\tparentNode.removeChild(element);\n\t}\n\tpublic static createElements(items: IInfiniteGridItem[]) {\n\t\tif (!items.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst noElementItems = items.filter(item => !item.el);\n\n\t\tif (!noElementItems.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst elements = $(noElementItems.map(({ content }) =>\n\t\t\tcontent.replace(/^[\\s\\uFEFF]+|[\\s\\uFEFF]+$/g, \"\")).join(\"\"), MULTI);\n\n\t\tnoElementItems.forEach((item, index) => {\n\t\t\titem.el = elements[index];\n\t\t});\n\t}\n\tpublic container: HTMLElement;\n\tpublic view: WindowMockType | HTMLElement;\n\tpublic options: IDOMRendererOptions = {\n\t\tisEqualSize: false,\n\t\tisConstantSize: false,\n\t\thorizontal: false,\n\t\tcontainer: false,\n\t};\n\tpublic _size: IDOMRendererSize = {\n\t\tcontainer: -1,\n\t\tview: -1,\n\t\tviewport: -1,\n\t\titem: null,\n\t};\n\tpublic _orgStyle: IDOMRendererOrgStyle = {};\n\tconstructor(element: string | HTMLElement | IJQuery, options: IDOMRendererOptions) {\n\t\tassign(this.options, options);\n\t\tthis._init(element);\n\t\tthis.resize();\n\t}\n\tpublic getStatus() {\n\t\treturn {\n\t\t\tcssText: this.container.style.cssText,\n\t\t\t_size: assign({}, this._size),\n\t\t};\n\t}\n\tpublic setStatus(status: IDOMRendererStatus) {\n\t\tthis.container.style.cssText = status.cssText;\n\t\tassign(this._size, status._size);\n\t}\n\tpublic updateSize(items: IInfiniteGridItem[]) {\n\t\tconst { isEqualSize, isConstantSize } = this.options;\n\t\tconst size = this._size;\n\n\t\treturn items.map(item => {\n\t\t\tif (!item.el) {\n\t\t\t\treturn item;\n\t\t\t}\n\t\t\tif (isEqualSize && !size.item) {\n\t\t\t\tsize.item = getSize(item.el);\n\t\t\t}\n\t\t\titem.size = (isEqualSize && assign({}, size.item)) ||\n\t\t\t\t(isConstantSize && item.orgSize && assign({}, item.orgSize)) ||\n\t\t\t\tgetSize(item.el);\n\t\t\tif (!item.orgSize) {\n\t\t\t\titem.orgSize = assign({}, item.size);\n\t\t\t}\n\t\t\treturn item;\n\t\t});\n\t}\n\tpublic append(items: IInfiniteGridItem[]) {\n\t\tthis._insert(items, APPEND, {\n\t\t\ttop: DUMMY_POSITION,\n\t\t\tleft: DUMMY_POSITION,\n\t\t});\n\t}\n\tpublic prepend(items: IInfiniteGridItem[]) {\n\t\tthis._insert(items, PREPEND, {\n\t\t\ttop: DUMMY_POSITION,\n\t\t\tleft: DUMMY_POSITION,\n\t\t});\n\t}\n\tpublic createAndInsert(items: IInfiniteGridItem[], isAppend?: boolean) {\n\t\tDOMRenderer.createElements(items);\n\n\t\tDOMRenderer.renderItems(items);\n\t\tthis._insert(items, isAppend);\n\t}\n\tpublic getViewSize() {\n\t\treturn this._size.view;\n\t}\n\tpublic getViewportSize() {\n\t\treturn this._size.viewport;\n\t}\n\tpublic getContainerSize() {\n\t\treturn this._size.container;\n\t}\n\tpublic setContainerSize(size: number) {\n\t\tthis._size.container = size;\n\t\tthis.container.style[this.options.horizontal ? \"width\" : \"height\"] = `${size}px`;\n\t}\n\tpublic resize() {\n\t\tconst horizontal = this.options.horizontal;\n\t\tconst view = this.view;\n\t\tconst size = this._calcSize();\n\n\t\tif (size === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst isResize = size !== this._size.viewport;\n\n\t\tif (isResize) {\n\t\t\tthis._size = {\n\t\t\t\tviewport: size,\n\t\t\t\titem: null,\n\t\t\t};\n\t\t}\n\t\tthis._size.view = horizontal ? innerWidth(view) : innerHeight(view);\n\t\treturn isResize;\n\t}\n\tpublic isNeededResize() {\n\t\treturn this._calcSize() !== this._size.viewport;\n\t}\n\tpublic clear() {\n\t\tthis.container.innerHTML = \"\";\n\t\tthis.container.style[this.options.horizontal ? \"width\" : \"height\"] = \"\";\n\n\t\tthis._size = {\n\t\t\titem: null,\n\t\t\tviewport: -1,\n\t\t\tcontainer: -1,\n\t\t\tview: -1,\n\t\t};\n\t}\n\tpublic destroy() {\n\t\tthis.clear();\n\t\tconst container = this.options.container;\n\n\t\tfor (const p in this._orgStyle) {\n\t\t\t(this[container ? \"view\" : \"container\"] as HTMLElement).style[p as keyof IDOMRendererOrgStyle] =\n\t\t\t\tthis._orgStyle[p as keyof IDOMRendererOrgStyle];\n\t\t}\n\t\tcontainer && this.container.parentNode.removeChild(this.container);\n\t}\n\tprivate _init(el: HTMLElement | IJQuery | string) {\n\t\tconst element = $(el);\n\t\tconst style = getStyles(element);\n\t\tconst { container, horizontal } = this.options;\n\n\t\tif (style.position === \"static\") {\n\t\t\tthis._orgStyle.position = element.style.position;\n\t\t\telement.style.position = \"relative\";\n\t\t}\n\t\tif (container) {\n\t\t\tconst target = horizontal ? [\"X\", \"Y\"] : [\"Y\", \"X\"];\n\n\t\t\tthis._orgStyle.overflowX = element.style.overflowX;\n\t\t\tthis._orgStyle.overflowY = element.style.overflowY;\n\t\t\telement.style[`overflow${target[0]}` as \"overflowX\" | \"overflowY\"] = \"scroll\";\n\t\t\telement.style[`overflow${target[1]}` as \"overflowX\" | \"overflowY\"] = \"hidden\";\n\t\t\tthis.view = element;\n\t\t\tthis.container = container === true ? createContainer(this.view as HTMLElement) : container;\n\t\t} else {\n\t\t\tthis.view = window;\n\t\t\tthis.container = element;\n\t\t}\n\t}\n\tprivate _insert(items: IInfiniteGridItem[], isAppend?: boolean, styles?: IInfiniteGridItem[\"rect\"]) {\n\t\tconst container = this.container;\n\t\tconst df = document.createDocumentFragment();\n\n\t\titems.forEach(item => {\n\t\t\tstyles && DOMRenderer.renderItem(item, styles);\n\t\t\tisAppend ? df.appendChild(item.el) : df.insertBefore(item.el, df.firstChild);\n\t\t});\n\t\tisAppend ?\n\t\t\tcontainer.appendChild(df) :\n\t\t\tcontainer.insertBefore(df, container.firstChild);\n\t}\n\tprivate _calcSize() {\n\t\treturn this.options.horizontal ?\n\t\t\tinnerHeight(this.container) : innerWidth(this.container);\n\t}\n}\n","import {\n\tIS_IOS,\n} from \"./consts\";\nimport {\n\twindow,\n} from \"./browser\";\nimport {\n\taddEvent,\n\tremoveEvent,\n\tscroll,\n\tscrollTo,\n\tscrollBy,\n\tassign,\n} from \"./utils\";\nimport { WindowMockType, IWatchStatus } from \"./types\";\n\nexport interface IWatcherOptions {\n\tcontainer: HTMLElement;\n\tisOverflowScroll: boolean;\n\thorizontal: boolean;\n\tresize: () => void;\n\tcheck: (e?: {\n\t\tisForward: boolean,\n\t\tscrollPos: number,\n\t\torgScrollPos: number,\n\t\thorizontal: boolean,\n\t}) => void;\n}\n\nexport default class Watcher {\n\tpublic options: IWatcherOptions;\n\tprivate _timer: {\n\t\tresize: any;\n\t};\n\tprivate _containerOffset: number;\n\tprivate _view: WindowMockType | HTMLElement;\n\tprivate _isScrollIssue: boolean;\n\tprivate _prevPos: number;\n\tconstructor(view: WindowMockType | HTMLElement, options: Partial = {}) {\n\t\tassign(this.options = {\n\t\t\tcontainer: view as HTMLElement,\n\t\t\tresize: () => void 0,\n\t\t\tcheck: () => void 0,\n\t\t\tisOverflowScroll: false,\n\t\t\thorizontal: false,\n\t\t}, options);\n\t\tthis._timer = {\n\t\t\tresize: null,\n\t\t};\n\t\tthis.reset();\n\t\tthis._containerOffset = 0;\n\t\tthis._view = view;\n\t\tthis._isScrollIssue = IS_IOS;\n\t\tthis._onCheck = this._onCheck.bind(this);\n\t\tthis._onResize = this._onResize.bind(this);\n\t\tthis.attachEvent();\n\t\tthis.resize();\n\t\tthis.setScrollPos();\n\t}\n\tpublic getStatus(): IWatchStatus {\n\t\treturn {\n\t\t\t_prevPos: this._prevPos,\n\t\t\tscrollPos: this.getOrgScrollPos(),\n\t\t};\n\t}\n\tpublic setStatus(status: IWatchStatus, applyScrollPos = true) {\n\t\tthis._prevPos = status._prevPos;\n\t\tapplyScrollPos && this.scrollTo(status.scrollPos);\n\t}\n\tpublic scrollBy(pos: number) {\n\t\tconst arrPos = this.options.horizontal ? [pos, 0] : [0, pos];\n\n\t\tscrollBy(this._view, arrPos[0], arrPos[1]);\n\t\tthis.setScrollPos();\n\t}\n\tpublic scrollTo(pos: number) {\n\t\tconst arrPos = this.options.horizontal ? [pos, 0] : [0, pos];\n\n\t\tscrollTo(this._view, arrPos[0], arrPos[1]);\n\t}\n\tpublic getScrollPos() {\n\t\treturn this._prevPos;\n\t}\n\tpublic setScrollPos(pos = this.getOrgScrollPos()) {\n\t\tlet rawPos = pos;\n\n\t\tif (typeof pos === \"undefined\") {\n\t\t\trawPos = this.getOrgScrollPos();\n\t\t}\n\t\tthis._prevPos = rawPos - this.getContainerOffset();\n\t}\n\tpublic attachEvent() {\n\t\taddEvent(this._view, \"scroll\", this._onCheck);\n\t\taddEvent(window, \"resize\", this._onResize);\n\t}\n\tpublic getOrgScrollPos() {\n\t\treturn scroll(this._view, this.options.horizontal);\n\t}\n\tpublic reset() {\n\t\tthis._prevPos = null;\n\t}\n\tpublic getContainerOffset() {\n\t\treturn this._containerOffset;\n\t}\n\tpublic resize() {\n\t\tthis._containerOffset = this.options.isOverflowScroll ? 0 : this._getOffset();\n\t}\n\tpublic detachEvent() {\n\t\tremoveEvent(this._view, \"scroll\", this._onCheck);\n\t\tremoveEvent(window, \"resize\", this._onResize);\n\t}\n\tpublic destroy() {\n\t\tthis.detachEvent();\n\t\tthis.reset();\n\t}\n\tprivate _onCheck() {\n\t\tconst prevPos = this.getScrollPos();\n\t\tconst orgScrollPos = this.getOrgScrollPos();\n\n\t\tthis.setScrollPos(orgScrollPos);\n\t\tconst scrollPos = this.getScrollPos();\n\n\t\tif (prevPos === null || (this._isScrollIssue && orgScrollPos === 0) || prevPos === scrollPos) {\n\t\t\torgScrollPos && (this._isScrollIssue = false);\n\t\t\treturn;\n\t\t}\n\t\tthis._isScrollIssue = false;\n\t\tthis.options.check({\n\t\t\tisForward: prevPos < scrollPos,\n\t\t\tscrollPos,\n\t\t\torgScrollPos,\n\t\t\thorizontal: this.options.horizontal,\n\t\t});\n\t}\n\tprivate _getOffset() {\n\t\tconst { container, horizontal } = this.options;\n\t\tconst rect = container.getBoundingClientRect();\n\n\t\treturn rect[horizontal ? \"left\" : \"top\"] + this.getOrgScrollPos();\n\t}\n\tprivate _onResize() {\n\t\tif (this._timer.resize) {\n\t\t\tclearTimeout(this._timer.resize);\n\t\t}\n\t\tthis._timer.resize = setTimeout(() => {\n\t\t\tthis.resize();\n\t\t\tthis.options.resize();\n\t\t\tthis._timer.resize = null;\n\t\t\tthis.reset();\n\t\t}, 100);\n\t}\n\n}\n","import ItemManager from \"./ItemManager\";\nimport { assign } from \"./utils\";\nimport { CursorType, IInfiniteGridItem, IInfiniteGridGroup, IInfiniteStatus } from \"./types\";\n\nfunction isVisible(group: IInfiniteGridGroup, threshold: number, scrollPos: number, endScrollPos: number) {\n\tconst { items, outlines } = group;\n\tconst start = outlines.start;\n\tconst end = outlines.end;\n\n\tif (start.length === 0 || end.length === 0 || !items.length || !items[0].el) {\n\t\treturn 2;\n\t}\n\tconst min = Math.min(...start);\n\tconst max = Math.max(...end);\n\n\tif ((endScrollPos + threshold < min)) {\n\t\treturn +1;\n\t} else if ((scrollPos - threshold > max)) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nexport interface IInfiniteOptions {\n\tuseRecycle?: boolean;\n\tthreshold?: number;\n\tappend?: (e?: { cache: IInfiniteGridGroup[] }) => void;\n\tprepend?: (e?: { cache: IInfiniteGridGroup[] }) => void;\n\trecycle?: (e?: { start: number, end: number }) => void;\n}\nclass Infinite {\n\tpublic options: Required;\n\tprivate _items: ItemManager;\n\tprivate _status: IInfiniteStatus;\n\tconstructor(itemManger: ItemManager, options: IInfiniteOptions) {\n\t\tthis.options = assign({\n\t\t\tuseRecycle: true,\n\t\t\tthreshold: 100,\n\t\t\tappend: () => void 0,\n\t\t\tprepend: () => void 0,\n\t\t\trecycle: () => void 0,\n\t\t}, options);\n\n\t\tthis._items = itemManger;\n\t\tthis.clear();\n\t}\n\tpublic setSize(size: number) {\n\t\tthis._status.size = size;\n\t}\n\tpublic recycle(scrollPos: number, isForward?: boolean) {\n\t\tif (!this.options.useRecycle) {\n\t\t\treturn;\n\t\t}\n\t\tconst { startCursor, endCursor, size } = this._status;\n\n\t\tif (startCursor === -1 || endCursor === -1) {\n\t\t\treturn;\n\t\t}\n\t\tconst endScrollPos = scrollPos + size;\n\t\tconst { threshold, recycle } = this.options;\n\t\tconst visibles = this._items.get(startCursor, endCursor)\n\t\t\t.map(group => isVisible(group, threshold, scrollPos, endScrollPos));\n\t\tconst length = visibles.length;\n\t\tlet start = isForward ? 0 : visibles.lastIndexOf(0);\n\t\tlet end = isForward ? visibles.indexOf(0) - 1 : visibles.length - 1;\n\n\t\tif (!isForward && start !== -1) {\n\t\t\tstart += 1;\n\t\t}\n\t\tif (start < 0 || end < 0 || start > end || end - start + 1 >= length) {\n\t\t\treturn;\n\t\t}\n\t\tstart = startCursor + start;\n\t\tend = startCursor + end;\n\n\t\trecycle({ start, end });\n\t\tif (isForward) {\n\t\t\tthis.setCursor(\"start\", end + 1);\n\t\t} else {\n\t\t\tthis.setCursor(\"end\", start - 1);\n\t\t}\n\t}\n\tpublic scroll(scrollPos: number) {\n\t\tconst startCursor = this.getCursor(\"start\");\n\t\tconst endCursor = this.getCursor(\"end\");\n\t\tconst items = this._items;\n\n\t\tif (typeof scrollPos !== \"number\" || startCursor === -1 ||\n\t\t\tendCursor === -1 || !items.size()) {\n\t\t\treturn;\n\t\t}\n\t\tconst size = this._status.size;\n\t\tconst { threshold, append, prepend } = this.options;\n\t\tconst datas = items.get();\n\t\tconst endScrollPos = scrollPos + size;\n\t\tconst startEdgePos = Math.max(...datas[startCursor].outlines.start);\n\t\tconst endEdgePos = Math.min(...datas[endCursor].outlines.end);\n\t\tconst visibles = datas.map((group, i) => {\n\t\t\tconst { start, end } = group.outlines;\n\n\t\t\tif (!start.length || !end.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst startPos = Math.min(...start);\n\t\t\tconst endPos = Math.max(...end);\n\n\t\t\tif (startPos - threshold <= endScrollPos && scrollPos <= endPos + threshold) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t\tconst startIndex = visibles.indexOf(true);\n\t\tconst endIndex = visibles.lastIndexOf(true);\n\n\t\tif (~startIndex && startIndex < startCursor) {\n\t\t\tprepend({ cache: datas.slice(startIndex, Math.min(startCursor, endIndex + 1)) });\n\t\t} else if (endCursor < endIndex) {\n\t\t\tappend({ cache: datas.slice(Math.max(startIndex, endCursor + 1), endIndex + 1) });\n\t\t} else if (endScrollPos >= endEdgePos - threshold) {\n\t\t\tappend({ cache: datas.slice(endCursor + 1, endCursor + 2) });\n\t\t} else if (scrollPos <= startEdgePos + threshold) {\n\t\t\tprepend({ cache: datas.slice(startCursor - 1, startCursor) });\n\t\t}\n\t}\n\tpublic setCursor(cursor: CursorType, index: number) {\n\t\tconst status = this._status;\n\t\tconst items = this._items;\n\t\tconst size = items.size();\n\n\t\tif (!this.options.useRecycle) {\n\t\t\tstatus.startCursor = 0;\n\t\t\tif (items.getOutline(size - 1, \"end\").length) {\n\t\t\t\tstatus.endCursor = size - 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (cursor !== \"end\") {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (cursor === \"start\") {\n\t\t\tstatus.startCursor = index;\n\t\t} else {\n\t\t\tstatus.endCursor = Math.min(size - 1, index);\n\t\t}\n\t\tstatus.startCursor = Math.max(0, status.startCursor);\n\t}\n\tpublic setStatus(status: IInfiniteStatus) {\n\t\tthis._status = assign(this._status, status);\n\t}\n\tpublic getStatus(startKey: string | number, endKey: string | number): IInfiniteStatus {\n\t\tconst { startCursor, endCursor, size } = this._status;\n\t\tconst startIndex = Math.max(this._items.indexOf(startKey), 0);\n\t\tconst endIndex = (this._items.indexOf(endKey) + 1 || this._items.size()) - 1;\n\t\tconst start = Math.max(startCursor - startIndex, ~startCursor ? 0 : -1);\n\t\tconst end = Math.max(Math.min(endCursor - startIndex, endIndex - startIndex), start);\n\n\t\treturn {\n\t\t\tstartCursor: start,\n\t\t\tendCursor: end,\n\t\t\tsize,\n\t\t};\n\t}\n\tpublic getEdgeOutline(cursor: CursorType) {\n\t\tconst { startCursor, endCursor } = this._status;\n\n\t\tif (startCursor === -1 || endCursor === -1) {\n\t\t\treturn [];\n\t\t}\n\t\treturn this._items.getOutline(cursor === \"start\" ? startCursor : endCursor, cursor);\n\t}\n\tpublic getEdgeValue(cursor: CursorType) {\n\t\tconst outlines = this.getEdgeOutline(cursor);\n\n\t\treturn outlines.length ? Math[cursor === \"start\" ? \"min\" : \"max\"](...outlines) : 0;\n\t}\n\tpublic getVisibleItems() {\n\t\treturn this._items.pluck(\"items\", this._status.startCursor, this._status.endCursor);\n\t}\n\tpublic getCursor(cursor: CursorType) {\n\t\treturn this._status[cursor === \"start\" ? \"startCursor\" : \"endCursor\"];\n\t}\n\tpublic getVisibleData() {\n\t\treturn this._items.get(this._status.startCursor, this._status.endCursor);\n\t}\n\tpublic remove(element: HTMLElement): {\n\t\titems: IInfiniteGridItem[],\n\t\tgroups: IInfiniteGridGroup[],\n\t} {\n\t\tconst { startCursor, endCursor } = this._status;\n\t\tconst result =\n\t\t\tthis._items.remove(element, startCursor, endCursor);\n\n\t\tif (result.groups.length) {\n\t\t\tthis.setCursor(\"end\", endCursor - 1);\n\t\t}\n\t\tif (!this._items.size()) {\n\t\t\tthis._status.startCursor = -1;\n\t\t\tthis._status.endCursor = -1;\n\t\t}\n\t\treturn result;\n\t}\n\tpublic clear() {\n\t\tthis._status = {\n\t\t\tstartCursor: -1,\n\t\t\tendCursor: -1,\n\t\t\tsize: -1,\n\t\t};\n\t}\n}\n\nexport default Infinite;\n","import { window } from \"./browser\";\nimport { addEvent, removeEvent, innerWidth, innerHeight } from \"./utils\";\n\nconst elements: HTMLElement[] = [];\n\nfunction onResize() {\n\tAutoSizer.resizeAll();\n}\nexport interface IAutoSizierElemenet extends HTMLElement {\n\t__PREFIX__?: string;\n}\nexport default class AutoSizer {\n\tpublic static add(element: IAutoSizierElemenet, prefix = \"data-\") {\n\t\tif (!elements.length) {\n\t\t\taddEvent(window, \"resize\", onResize);\n\t\t}\n\t\telement.__PREFIX__ = prefix;\n\t\telements.push(element);\n\t\tAutoSizer.resize(element);\n\t}\n\tpublic static remove(element: IAutoSizierElemenet, isFixed = false) {\n\t\tconst fixed = element.getAttribute(`${element.__PREFIX__}fixed`) || \"width\";\n\n\t\tif (!isFixed) {\n\t\t\telement.style[fixed === \"width\" ? \"height\" : \"width\"] = \"\";\n\t\t}\n\t\tconst index = elements.indexOf(element);\n\n\t\tif (index < 0) {\n\t\t\treturn;\n\t\t}\n\t\telements.splice(index, 1);\n\t\tif (!elements.length) {\n\t\t\tremoveEvent(window, \"reisze\", onResize);\n\t\t}\n\t}\n\tpublic static resize(element: IAutoSizierElemenet, prefix = \"data-\") {\n\t\tconst elementPrefix = typeof element.__PREFIX__ === \"string\" ? element.__PREFIX__ : prefix;\n\t\tconst dataWidth = parseInt(element.getAttribute(`${elementPrefix}width`), 10) || 0;\n\t\tconst dataHeight = parseInt(element.getAttribute(`${elementPrefix}height`), 10) || 0;\n\t\tconst fixed = element.getAttribute(`${elementPrefix}fixed`);\n\n\t\tif (fixed === \"height\") {\n\t\t\tconst size = innerHeight(element) || dataHeight;\n\n\t\t\telement.style.width = `${dataWidth / dataHeight * size}px`;\n\t\t} else {\n\t\t\tconst size = innerWidth(element) || dataWidth;\n\n\t\t\telement.style.height = `${dataHeight / dataWidth * size}px`;\n\t\t}\n\t}\n\tpublic static resizeAll() {\n\t\telements.forEach(element => AutoSizer.resize(element));\n\t}\n}\n","import { IS_IE } from \"./consts\";\nimport { addEvent, removeEvent, toArray } from \"./utils\";\nimport AutoSizer from \"./AutoSizer\";\n\nexport const CHECK_ALL: 1 = 1;\nexport const CHECK_ONLY_ERROR: 2 = 2;\n\nexport interface IImageLoadedOptions {\n\tprefix?: string;\n\tlength?: number;\n\ttype?: 1 | 2;\n\tcomplete?: () => void;\n\tend?: () => void;\n\terror?: (e: { target: LoadingImageElement, itemIndex: number }) => void;\n}\nexport interface LoadingImageElement extends HTMLImageElement {\n\t__ITEM_INDEX__?: number;\n}\n\nfunction isDataAttribute(target: HTMLElement, prefix: string) {\n\treturn !!target.getAttribute(`${prefix}width`);\n}\n\nclass ImageLoaded {\n\tpublic static CHECK_ALL = 1;\n\tpublic static CHECK_ONLY_ERROR = 2;\n\tpublic static waitImageLoaded(\n\t\tchecklist: LoadingImageElement[][],\n\t\t{ prefix = \"\", length, type, complete, error, end }: IImageLoadedOptions,\n\t) {\n\t\tlet checkCount = 0;\n\t\tlet endCount = length;\n\n\t\tif (type !== CHECK_ONLY_ERROR) {\n\t\t\tcheckCount = endCount;\n\t\t}\n\t\tconst checkEnd = () => {\n\t\t\tif (--endCount !== 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tend && end();\n\t\t};\n\t\tconst checkImage = () => {\n\t\t\tcheckCount--;\n\t\t\tif (checkCount !== 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcomplete && complete();\n\t\t};\n\t\tconst onError = (target: LoadingImageElement, itemIndex = target.__ITEM_INDEX__) => {\n\t\t\terror && error({\n\t\t\t\ttarget,\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t};\n\t\tconst onCheck = (e: Event) => {\n\t\t\tconst target = (e.target || e.srcElement) as LoadingImageElement;\n\n\t\t\tremoveEvent(target, \"error\", onCheck);\n\t\t\tremoveEvent(target, \"load\", onCheck);\n\n\t\t\tif (type === CHECK_ALL && isDataAttribute(target, prefix)) {\n\t\t\t\tAutoSizer.remove(target, e.type === \"error\");\n\t\t\t} else {\n\t\t\t\tcheckImage();\n\t\t\t}\n\t\t\tif (e.type === \"error\") {\n\t\t\t\tonError(target);\n\t\t\t}\n\t\t\tdelete target.__ITEM_INDEX__;\n\t\t\tcheckEnd();\n\t\t};\n\n\t\tchecklist.forEach((images, i) => {\n\t\t\timages.forEach(v => {\n\t\t\t\t// workaround for IE\n\t\t\t\tif (v.complete && (!IS_IE || (IS_IE && v.naturalWidth))) {\n\t\t\t\t\tif (!v.naturalWidth) {\n\t\t\t\t\t\tonError(v, i);\n\t\t\t\t\t}\n\t\t\t\t\tcheckImage();\n\t\t\t\t\tcheckEnd();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tv.__ITEM_INDEX__ = i;\n\t\t\t\tif (type === CHECK_ALL && isDataAttribute(v, prefix)) {\n\t\t\t\t\tAutoSizer.add(v, prefix);\n\t\t\t\t\tcheckImage();\n\t\t\t\t}\n\t\t\t\taddEvent(v, \"load\", onCheck);\n\t\t\t\taddEvent(v, \"error\", onCheck);\n\n\t\t\t\tIS_IE && v.setAttribute(\"src\", v.getAttribute(\"src\"));\n\t\t\t});\n\t\t});\n\t}\n\tpublic static checkImageLoaded(el: HTMLElement) {\n\t\tif (el.tagName === \"IMG\") {\n\t\t\treturn (el as HTMLImageElement).complete ? [] : [(el as HTMLImageElement)];\n\t\t} else {\n\t\t\treturn toArray(el.querySelectorAll(\"img\"));\n\t\t}\n\t}\n\tpublic static check(\n\t\telements: HTMLElement[],\n\t\t{ prefix, type = CHECK_ALL, complete, error, end }: IImageLoadedOptions,\n\t) {\n\t\tconst images = elements.map(element => this.checkImageLoaded(element));\n\t\tconst length = images.reduce((sum, element) => sum + element.length, 0);\n\n\t\tif (type === CHECK_ONLY_ERROR || length === 0) {\n\t\t\t// convert to async\n\t\t\tsetTimeout(() => {\n\t\t\t\tcomplete && complete();\n\t\t\t\tif (length === 0) {\n\t\t\t\t\tend && end();\n\t\t\t\t}\n\t\t\t}, 0);\n\t\t}\n\t\tif (length > 0) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.waitImageLoaded(images, { prefix, length, type, complete, error, end });\n\t\t\t}, 0);\n\t\t}\n\t}\n}\n\nexport default ImageLoaded;\n","import AutoSizer from \"./AutoSizer\";\nimport ImageLoaded, { CHECK_ALL, CHECK_ONLY_ERROR } from \"./ImageLoaded\";\nimport ItemManager from \"./ItemManager\";\nimport { matchHTML, $, assign } from \"./utils\";\nimport { DUMMY_POSITION } from \"./consts\";\nimport DOMRenderer from \"./DOMRenderer\";\nimport { ILayout, ILayoutResult, IInfiniteGridItem, IInfiniteGridGroup, IErrorCallbackOptions } from \"./types\";\n\nfunction hasTarget(target: T[], value: T) {\n\treturn ~target.indexOf(value);\n}\n\nexport interface ILayoutManagerOptions {\n\tattributePrefix?: string;\n\tisEqualSize?: boolean;\n\tisConstantSize?: boolean;\n\thorizontal?: boolean;\n}\n\nexport interface ICompleteCallbackOptions {\n\tgroups?: ILayoutResult[];\n\titems?: IInfiniteGridItem[];\n\tisAppend?: boolean;\n}\nexport interface IEndCallbackOptions {\n\tremove: HTMLElement[];\n\tlayout?: boolean;\n}\nexport interface ILayoutManagerCallbacks {\n\tcomplete: (e: ICompleteCallbackOptions) => void;\n\terror: (e: IErrorCallbackOptions) => void;\n\tend: (e: IEndCallbackOptions) => void;\n}\n\nexport default class LayoutMananger {\n\tpublic options: Required;\n\tpublic _items: ItemManager;\n\tpublic _renderer: DOMRenderer;\n\tpublic _layout: ILayout;\n\tconstructor(items: ItemManager, renderer: DOMRenderer, options: ILayoutManagerOptions = {}) {\n\t\tassign(this.options = {\n\t\t\tattributePrefix: \"data-\",\n\t\t\tisEqualSize: false,\n\t\t\tisConstantSize: false,\n\t\t\thorizontal: false,\n\t\t}, options);\n\n\t\tthis._items = items;\n\t\tthis._renderer = renderer;\n\t\tthis._layout = null;\n\t}\n\tpublic setLayout(layout: ILayout) {\n\t\tthis._layout = layout;\n\t}\n\tpublic setSize(size: number) {\n\t\tthis._layout.setSize(size);\n\t}\n\tpublic append(\n\t\t{\n\t\t\tgroups,\n\t\t\titems,\n\t\t\tisUpdate,\n\t\t}: {\n\t\t\tgroups: IInfiniteGridGroup[],\n\t\t\titems: IInfiniteGridItem[],\n\t\t\tisUpdate?: boolean,\n\t\t},\n\t\tcallbacks: Partial,\n\t) {\n\t\tthis._insert({ groups, items, isUpdate, isAppend: true }, callbacks);\n\t}\n\tpublic prepend(\n\t\t{\n\t\t\tgroups,\n\t\t\titems,\n\t\t\tisUpdate,\n\t\t}: {\n\t\t\tgroups: IInfiniteGridGroup[],\n\t\t\titems: IInfiniteGridItem[],\n\t\t\tisUpdate?: boolean,\n\t\t},\n\t\tcallbacks: Partial,\n\t) {\n\t\tthis._insert({ groups, items, isUpdate, isAppend: false }, callbacks);\n\t}\n\tpublic layout(isRelayout: boolean, groups: IInfiniteGridGroup[], items: IInfiniteGridItem[]) {\n\t\tconst renderer = this._renderer;\n\t\tconst { isEqualSize, isConstantSize } = renderer.options;\n\t\tconst layoutGroups = groups.filter(group => {\n\t\t\tconst item = group.items[0];\n\n\t\t\treturn item.orgSize && item.rect.top > DUMMY_POSITION / 10;\n\t\t});\n\n\t\tif (!layoutGroups.length) {\n\t\t\treturn [];\n\t\t}\n\t\tlet outline = layoutGroups[0].outlines.start;\n\n\t\tif (isRelayout) {\n\t\t\toutline = [outline.length ? Math.min(...outline) : 0];\n\t\t\tif (!isConstantSize && items.length) {\n\t\t\t\trenderer.updateSize(items);\n\n\t\t\t\t// update invisible items' size\n\t\t\t\tif (isEqualSize && items[0].size) {\n\t\t\t\t\tItemManager.pluck(layoutGroups, \"items\").forEach(item => {\n\t\t\t\t\t\titem.size = assign({}, items[0].size);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._layout.layout(layoutGroups, outline);\n\t\treturn layoutGroups;\n\t}\n\tpublic destroy() {\n\t\tthis._items = null;\n\t\tthis._renderer = null;\n\t}\n\tprivate _complete(\n\t\tgroups: IInfiniteGridGroup[],\n\t\titems: IInfiniteGridItem[],\n\t\tisAppend: boolean,\n\t\tisUpdate: boolean,\n\t\tcallback: ILayoutManagerCallbacks[\"complete\"],\n\t) {\n\t\tconst itemManager = this._items;\n\t\tconst cursor = isAppend ? \"end\" : \"start\";\n\t\tconst groupIndex = itemManager.indexOf(groups[0]);\n\t\tconst prevGroup = itemManager.getData(groupIndex + (isAppend ? -1 : 1));\n\t\tlet outline = prevGroup ? prevGroup.outlines[cursor] : [0];\n\n\t\tthis._renderer.updateSize(items);\n\n\t\tconst groupInfos = groups.map(group => {\n\t\t\tconst groupOutline = group.outlines[isAppend ? \"start\" : \"end\"];\n\t\t\tconst isRelayout = isUpdate || !outline.length || (outline.length === groupOutline.length ?\n\t\t\t\t!outline.every((v, index) => v === groupOutline[index]) : true);\n\n\t\t\tif (!isRelayout) {\n\t\t\t\toutline = group.outlines[isAppend ? \"end\" : \"start\"];\n\t\t\t\tDOMRenderer.renderItems(group.items);\n\t\t\t\treturn group;\n\t\t\t}\n\t\t\tconst groupItems = group.items;\n\t\t\tconst groupInfo = this._layout[isAppend ? \"append\" : \"prepend\"](groupItems, outline, true);\n\n\t\t\tassign(group, groupInfo);\n\t\t\tDOMRenderer.renderItems(groupInfo.items);\n\t\t\toutline = groupInfo.outlines[isAppend ? \"end\" : \"start\"];\n\n\t\t\treturn groupInfo;\n\t\t});\n\n\t\tcallback({\n\t\t\tgroups: groupInfos,\n\t\t\titems,\n\t\t\tisAppend,\n\t\t});\n\t}\n\tprivate _error(\n\t\tremoveTarget: HTMLElement[],\n\t\treplaceTarget: number[],\n\t\ttarget: HTMLImageElement,\n\t\titems: IInfiniteGridItem[],\n\t\terrorIndex: number,\n\t\tcallback: ILayoutManagerCallbacks[\"error\"],\n\t) {\n\t\tconst item = items[errorIndex];\n\t\tconst element = item.el;\n\t\tconst prefix = this.options.attributePrefix;\n\n\t\t// remove item\n\t\tconst removeItem = () => {\n\t\t\tif (hasTarget(removeTarget, element)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tremoveTarget.push(element);\n\t\t\tconst index = replaceTarget.indexOf(errorIndex);\n\n\t\t\tindex !== -1 && replaceTarget.splice(index, 1);\n\t\t};\n\t\t// remove image\n\t\tconst remove = () => {\n\t\t\tif (target === element) {\n\t\t\t\tremoveItem();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (hasTarget(removeTarget, element)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttarget.parentNode.removeChild(target);\n\t\t\titem.content = element.outerHTML;\n\t\t\tif (hasTarget(replaceTarget, errorIndex)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treplaceTarget.push(errorIndex);\n\t\t};\n\t\t// replace image\n\t\tconst replace = (src: string) => {\n\t\t\tif (hasTarget(removeTarget, element)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (src) {\n\t\t\t\tif (matchHTML(src) || typeof src === \"object\") {\n\t\t\t\t\tconst parentNode = target.parentNode;\n\n\t\t\t\t\tparentNode.insertBefore($(src), target);\n\t\t\t\t\tparentNode.removeChild(target);\n\t\t\t\t\titem.content = element.outerHTML;\n\t\t\t\t} else {\n\t\t\t\t\ttarget.src = src;\n\t\t\t\t\tif (target.getAttribute(`${prefix}width`)) {\n\t\t\t\t\t\tAutoSizer.remove(target);\n\t\t\t\t\t\ttarget.removeAttribute(`${prefix}width`);\n\t\t\t\t\t\ttarget.removeAttribute(`${prefix}height`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\titem.content = element.outerHTML;\n\t\t\tif (hasTarget(replaceTarget, errorIndex)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treplaceTarget.push(errorIndex);\n\t\t};\n\t\t// replace item\n\t\tconst replaceItem = (content: string) => {\n\t\t\tif (hasTarget(removeTarget, element)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telement.innerHTML = content;\n\t\t\titem.content = element.outerHTML;\n\t\t\tif (hasTarget(replaceTarget, errorIndex)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treplaceTarget.push(errorIndex);\n\t\t};\n\n\t\tcallback({\n\t\t\ttarget,\n\t\t\telement,\n\t\t\titems,\n\t\t\titem,\n\t\t\titemIndex: errorIndex,\n\t\t\treplace,\n\t\t\treplaceItem,\n\t\t\tremove,\n\t\t\tremoveItem,\n\t\t});\n\t}\n\tprivate _end(\n\t\tremoveTarget: HTMLElement[],\n\t\treplaceTarget: number[],\n\t\titems: IInfiniteGridItem[],\n\t\tcallback: ILayoutManagerCallbacks[\"end\"],\n\t) {\n\t\tconst { attributePrefix } = this.options;\n\n\t\tconst removeTargetLength = removeTarget.length;\n\t\tconst replaceTargetLength = replaceTarget.length;\n\n\t\tif (!removeTargetLength && !replaceTargetLength) {\n\t\t\tcallback({ remove: [] });\n\t\t\treturn;\n\t\t}\n\t\tconst layoutedItems = replaceTarget.map(itemIndex => items[itemIndex]);\n\n\t\tif (!replaceTargetLength) {\n\t\t\tcallback({ remove: removeTarget, layout: true });\n\t\t\treturn;\n\t\t}\n\t\t// wait layoutComplete beacause of error event.\n\t\tImageLoaded.check(layoutedItems.map(v => v.el), {\n\t\t\tprefix: attributePrefix,\n\t\t\tcomplete: () => {\n\t\t\t\tthis._renderer.updateSize(layoutedItems);\n\t\t\t\tcallback({ remove: removeTarget, layout: true });\n\t\t\t},\n\t\t});\n\t}\n\tprivate _insert(\n\t\t{\n\t\t\tgroups,\n\t\t\titems = ItemManager.pluck(groups, \"items\"),\n\t\t\tisAppend,\n\t\t\tisUpdate,\n\t\t}: {\n\t\t\tgroups: IInfiniteGridGroup[],\n\t\t\titems: IInfiniteGridItem[],\n\t\t\tisAppend: boolean,\n\t\t\tisUpdate: boolean,\n\t\t},\n\t\t{\n\t\t\terror = () => void 0,\n\t\t\tcomplete = () => void 0,\n\t\t\tend = () => void 0,\n\t\t}: Partial,\n\t) {\n\t\tif (!groups.length) {\n\t\t\treturn;\n\t\t}\n\t\tconst checkGroups = isAppend ? groups : groups.reverse();\n\t\tconst replaceTarget: number[] = [];\n\t\tconst removeTarget: HTMLElement[] = [];\n\t\tconst elements = items.map(item => item.el);\n\t\tconst type = this.options.isEqualSize && this._renderer._size.item ? CHECK_ONLY_ERROR : CHECK_ALL;\n\t\tconst prefix = this.options.attributePrefix;\n\n\t\tImageLoaded.check(elements, {\n\t\t\tprefix,\n\t\t\ttype,\n\t\t\tcomplete: () => {\n\t\t\t\tif (!this._items) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._complete(checkGroups, items, isAppend, isUpdate, complete);\n\t\t\t},\n\t\t\terror: ({ target, itemIndex }) => {\n\t\t\t\tif (!this._items) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._error(removeTarget, replaceTarget, target, items, itemIndex, error);\n\t\t\t},\n\t\t\tend: () => {\n\t\t\t\tif (!this._items) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._end(removeTarget, replaceTarget, items, end);\n\t\t\t},\n\t\t});\n\t}\n}\n","/**\n * Copyright (c) 2017 NAVER Corp.\n * egjs projects are licensed under the MIT license\n*/\nimport Component from \"@egjs/component\";\nimport ItemManager from \"./ItemManager\";\nimport DOMRenderer, { resetSize } from \"./DOMRenderer\";\nimport Watcher from \"./Watcher\";\nimport {\n\tAPPEND,\n\tPREPEND,\n\tCACHE,\n\tNO_CACHE,\n\tTRUSTED,\n\tNO_TRUSTED,\n\tIS_ANDROID2,\n\tIDLE,\n\tLOADING_APPEND,\n\tLOADING_PREPEND,\n\tPROCESSING,\n\tDEFENSE_BROWSER,\n\tIGNORE_CLASSNAME,\n\tDUMMY_POSITION,\n\tIS_IOS,\n} from \"./consts\";\nimport Infinite from \"./Infinite\";\nimport { toArray, $, outerHeight, outerWidth, assign } from \"./utils\";\nimport LayoutMananger from \"./LayoutManager\";\nimport {\n\tIJQuery, ILayout,\n\tCursorType, StyleType,\n\tIItemManagerStatus, IInfiniteGridItem,\n\tIInfiniteGridGroup, IErrorCallbackOptions, IDOMRendererStatus, IWatchStatus, IInfiniteStatus, IInfiniteGridStatus\n} from \"./types\";\n\n// IE8\n// https://stackoverflow.com/questions/43216659/babel-ie8-inherit-issue-with-object-create\n/* eslint-disable */\n// if (typeof Object.create !== \"function\") {\n// // tslint:disable\n// Object.create = (o: any, properties: any) => {\n// if (typeof o !== \"object\" && typeof o !== \"function\") {\n// throw new TypeError(\"Object prototype may only be an Object: \" + o);\n// } else if (o === null) {\n// throw new Error(\"This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument.\");\n// }\n// function F() { }\n// F.prototype = o;\n// return new F();\n// };\n// // tslint:enable\n// }\n/* eslint-enable */\n\nexport interface IInfiniteGridOptions {\n\titemSelector: string;\n\tisOverflowScroll: boolean;\n\tthreshold: number;\n\tisEqualSize: boolean;\n\tisConstantSize: boolean;\n\tuseRecycle: boolean;\n\thorizontal: boolean;\n\ttransitionDuration: number;\n\tuseFit: boolean;\n\tattributePrefix: string;\n}\n\n/**\n * A module used to arrange card elements including content infinitely according to layout type. With this module, you can implement various layouts composed of different card elements whose sizes vary. It guarantees performance by maintaining the number of DOMs the module is handling under any circumstance\n * @ko 콘텐츠가 있는 카드 엘리먼트를 레이아웃 타입에 따라 무한으로 배치하는 모듈. 다양한 크기의 카드 엘리먼트를 다양한 레이아웃으로 배치할 수 있다. 카드 엘리먼트의 개수가 계속 늘어나도 모듈이 처리하는 DOM의 개수를 일정하게 유지해 최적의 성능을 보장한다\n * @alias eg.InfiniteGrid\n * @extends eg.Component\n *\n * @example\n```\n\n - \n
test1
\n \n - \n
test2
\n \n - \n
test3
\n \n - \n
test4
\n \n - \n
test5
\n \n - \n
test6
\n \n
\n\n```\n *\n * @support {\"ie\": \"8+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n **/\nclass InfiniteGrid extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.InfiniteGrid.VERSION; // ex) 3.3.3\n\t * @memberof eg.InfiniteGrid\n\t */\n\tpublic static VERSION = \"#__VERSION__#\";\n\n\tpublic options: IInfiniteGridOptions;\n\tprivate _loadingBar: {\n\t\tappend?: HTMLElement,\n\t\tprepend?: HTMLElement,\n\t};\n\tprivate _items: ItemManager;\n\tprivate _renderer: DOMRenderer;\n\tprivate _manager: LayoutMananger;\n\tprivate _watcher: Watcher;\n\tprivate _infinite: Infinite;\n\tprivate _status: IInfiniteGridStatus[\"_status\"];\n\n\t/**\n\t * @param {HTMLElement|String|jQuery} element A base element for a module 모듈을 적용할 기준 엘리먼트\n\t * @param {Object} [options] The option object of the eg.InfiniteGrid module eg.InfiniteGrid 모듈의 옵션 객체\n\t * @param {String} [options.itemSelector] A selector to select card elements that make up the layout레이아웃을 구성하는 카드 엘리먼트를 선택할 선택자(selector)\n\t * @param {Boolean} [options.useRecycle=true] Indicates whether keep the number of DOMs is maintained. If the useRecycle value is 'true', keep the number of DOMs is maintained. If the useRecycle value is 'false', the number of DOMs will increase as card elements are added. DOM의 수를 유지할지 여부를 나타낸다. useRecycle 값이 'true'이면 DOM 개수를 일정하게 유지한다. useRecycle 값이 'false' 이면 카드 엘리먼트가 추가될수록 DOM 개수가 계속 증가한다.\n\t * @param {Boolean} [options.isOverflowScroll=false] Indicates whether overflow:scroll is appliedoverflow:scroll 적용여부를 결정한다.\n\t * @param {Boolean} [options.horizontal=false] Direction of the scroll movement (true: horizontal, false: vertical) 스크롤 이동 방향 (true 가로방향, false 세로방향)\n\t * @param {Boolean} [options.useFit=true] The useFit option scrolls upwards so that no space is visible until an item is added 위로 스크롤할 시 아이템을 추가하는 동안 보이는 빈 공간을 안보이게 한다.\n\t * @param {Boolean} [options.isEqualSize=false] Indicates whether sizes of all card elements are equal to one another. If sizes of card elements to be arranged are all equal and this option is set to \"true\", the performance of layout arrangement can be improved. 카드 엘리먼트의 크기가 동일한지 여부. 배치될 카드 엘리먼트의 크기가 모두 동일할 때 이 옵션을 'true'로 설정하면 레이아웃 배치 성능을 높일 수 있다\n\t * @param {Boolean} [options.isConstantSize=false] Indicates whether sizes of all card elements does not change, the performance of layout arrangement can be improved. 모든 카드 엘리먼트의 크기가 불변일 때 이 옵션을 'true'로 설정하면 레이아웃 배치 성능을 높일 수 있다\n\t * @param {Number} [options.transitionDruation=0] Indicates how many seconds a transition effect takes to complete. 트랜지션 효과를 완료하는데 걸리는 시간을 나타낸다.\n\t * @param {Number} [options.threshold=100] The threshold size of an event area where card elements are added to a layout.레이아웃에 카드 엘리먼트를 추가하는 이벤트가 발생하는 기준 영역의 크기.\n\t * @param {String} [options.attributePrefix=\"data-\"] The prefix to use element's data attribute.엘리먼트의 데이타 속성에 사용할 접두사.\n\t */\n\tconstructor(element: HTMLElement | string | IJQuery, options?: Partial) {\n\t\tsuper();\n\t\tassign(this.options = {\n\t\t\titemSelector: \"*\",\n\t\t\tisOverflowScroll: false,\n\t\t\tthreshold: 100,\n\t\t\tisEqualSize: false,\n\t\t\tisConstantSize: false,\n\t\t\tuseRecycle: true,\n\t\t\thorizontal: false,\n\t\t\ttransitionDuration: 0,\n\t\t\tuseFit: true,\n\t\t\tattributePrefix: \"data-\",\n\t\t}, options);\n\t\tDEFENSE_BROWSER && (this.options.useFit = false);\n\t\tIS_ANDROID2 && (this.options.isOverflowScroll = false);\n\t\tthis._reset();\n\t\tthis._loadingBar = {};\n\n\t\tconst {\n\t\t\tisOverflowScroll,\n\t\t\tisEqualSize,\n\t\t\tisConstantSize,\n\t\t\thorizontal,\n\t\t\tthreshold,\n\t\t\tuseRecycle,\n\t\t} = this.options;\n\n\t\tthis._items = new ItemManager();\n\t\tthis._renderer = new DOMRenderer(element, {\n\t\t\tisEqualSize,\n\t\t\tisConstantSize,\n\t\t\thorizontal,\n\t\t\tcontainer: isOverflowScroll,\n\t\t});\n\t\tthis._watcher = new Watcher(\n\t\t\tthis._renderer.view,\n\t\t\t{\n\t\t\t\tisOverflowScroll,\n\t\t\t\thorizontal,\n\t\t\t\tcontainer: this._renderer.container,\n\t\t\t\tresize: () => this._onResize(),\n\t\t\t\tcheck: param => this._onCheck(param),\n\t\t\t});\n\n\t\tthis._infinite = new Infinite(this._items, {\n\t\t\tuseRecycle,\n\t\t\tthreshold,\n\t\t\tappend: param => this._requestAppend(param),\n\t\t\tprepend: param => this._requestPrepend(param),\n\t\t\trecycle: param => this._recycle(param),\n\t\t});\n\t}\n\t/**\n\t * Adds a card element at the bottom of a layout. This method is available only if the isProcessing() method returns false.\n\t * @ko 카드 엘리먼트를 레이아웃 아래에 추가한다. isProcessing() 메서드의 반환값이 'false'일 때만 이 메서드를 사용할 수 있다\n\t * 이 메소드는 isProcessing()의 반환값이 false일 경우에만 사용 가능하다.\n\t * @param {Array|jQuery} elements Array of the card elements to be added 추가할 카드 엘리먼트의 배열\n\t * @param {Number|String} [groupKey] The group key to be configured in a card element. It is automatically generated by default.\n\t * 추가할 카드 엘리먼트에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * infinitegrid.append(\"<div class='item'>test1</div><div class='item'>test2</div>\");\n\t * infinitegrid.append([\"<div class='item'>test1</div>\", \"<div class='item'>test2</div>\"]);\n\t * infinitegrid.append([HTMLElement1, HTMLElement2]);\n\t * infinitegrid.append(jQuery([\"<div class='item'>test1</div>\", \"<div class='item'>test2</div>\"]));\n\t */\n\tpublic append(elements: HTMLElement[] | IJQuery | string[] | string, groupKey?: string | number) {\n\t\tthis._manager && this._insert({\n\t\t\telements,\n\t\t\tisAppend: APPEND,\n\t\t\tgroupKey,\n\t\t});\n\t\treturn this;\n\t}\n\t/**\n\t * Adds a card element at the top of a layout. This method is available only if the isProcessing() method returns false.\n\t * @ko 카드 엘리먼트를 레이아웃의 위에 추가한다. isProcessing() 메서드의 반환값이 'false'일 때만 이 메서드를 사용할 수 있다\n\t * @param {Array|jQuery} elements Array of the card elements to be added 추가할 카드 엘리먼트 배열\n\t * @param {Number|String} [groupKey] The group key to be configured in a card element. It is automatically generated by default.\n\t * 추가할 카드 엘리먼트에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * infinitegrid.prepend(\"<div class='item'>test1</div><div class='item'>test2</div>\");\n\t * infinitegrid.prepend([\"<div class='item'>test1</div>\", \"<div class='item'>test2</div>\"]);\n\t * infinitegrid.prepend([HTMLElement1, HTMLElement2]);\n\t * infinitegrid.prepend(jQuery([\"<div class='item'>test1</div>\", \"<div class='item'>test2</div>\"]));\n\t */\n\tpublic prepend(elements: HTMLElement[] | IJQuery | string[] | string, groupKey?: string | number) {\n\t\tthis._manager && this._insert({\n\t\t\telements,\n\t\t\tisAppend: PREPEND,\n\t\t\tgroupKey,\n\t\t});\n\t\treturn this;\n\t}\n\t/**\n\t * Specifies the Layout class to use.\n\t * @ko 사용할 Layout 클래스를 지정한다.\n\t * @param {Class|Object} LayoutKlass The Layout class to use or an instance of a layout moudle사용할 Layout 클래스 또는 레이아웃 모듈의 인스턴스\n\t * @param {Object} options Options to apply to the Layout.Layout에 적용할 옵션\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * infinitegrid.setLayout(eg.InfiniteGrid.GridLayout, {\n\t * margin: 10,\n\t * align: \"start\"\n\t * });\n\t * infinitegrid.setLayout(eg.InfiniteGrid.JustifiedLayout, {\n\t * margin: 10,\n\t * minSize: 100,\n\t * maxSize: 200\n\t * });\n\t * infinitegrid.setLayout(eg.InfiniteGrid.SquareLayout, {\n\t * margin: 10,\n\t * column: 2\n\t * });\n\t * infinitegrid.setLayout(eg.InfiniteGrid.FrameLayout, {\n\t * margin: 10,\n\t * frame: [\n\t * [1, 2],\n\t * [4, 3],\n\t * ]\n\t * });\n\t * infinitegrid.setLayout(eg.InfiniteGrid.PackingLayout, {\n\t * margin: 10,\n\t * aspectRatio: 1.5\n\t * });\n\t * var layout = new eg.InfiniteGrid.GridLayout({\n\t * margin: 10,\n\t * align: \"start\"\n\t * });\n\t * infinitegrid.setLayout(layout);\n\t */\n\tpublic setLayout(LayoutKlass: ILayout | (new (...args: any[]) => ILayout), options = {}) {\n\t\tconst { isEqualSize, isConstantSize, attributePrefix, horizontal } = this.options;\n\n\t\tif (!this._manager) {\n\t\t\tthis._manager = new LayoutMananger(this._items, this._renderer, {\n\t\t\t\tattributePrefix,\n\t\t\t\tisEqualSize,\n\t\t\t\tisConstantSize,\n\t\t\t});\n\t\t}\n\t\tif (typeof LayoutKlass === \"function\") {\n\t\t\tthis._manager.setLayout(new LayoutKlass(assign(options, {\n\t\t\t\thorizontal,\n\t\t\t})));\n\t\t} else {\n\t\t\tLayoutKlass.options.horizontal = horizontal;\n\t\t\tthis._manager.setLayout(LayoutKlass);\n\t\t}\n\t\tthis._renderer.resize();\n\t\tthis._setSize(this._renderer.getViewportSize());\n\t\treturn this;\n\t}\n\t/**\n\t * Returns the layouted items.\n\t * @ko 레이아웃된 아이템들을 반환한다.\n\t * @param {Boolean} includeCached Indicates whether to include the cached items. 캐싱된 아이템을 포함할지 여부를 나타낸다.\n\t * @returns List of items 아이템의 목록\n\t */\n\tpublic getItems(includeCached = false): IInfiniteGridItem[] {\n\t\treturn includeCached ? this._items.pluck(\"items\") : this._infinite.getVisibleItems();\n\t}\n\t/**\n\t * Rearranges a layout.\n\t * @ko 레이아웃을 다시 배치한다.\n\t * @param {Boolean} [isRelayout=true] Indicates whether a card element is being relayouted 카드 엘리먼트 재배치 여부\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic layout(isRelayout = true) {\n\t\tif (!this._manager) {\n\t\t\treturn this;\n\t\t}\n\t\tconst renderer = this._renderer;\n\t\tconst itemManager = this._items;\n\t\tconst infinite = this._infinite;\n\t\tconst isResize = renderer.resize();\n\t\tconst items = this.getItems();\n\t\tconst { isEqualSize, isConstantSize, transitionDuration } = this.options;\n\t\tconst isLayoutAll = isRelayout && (isEqualSize || isConstantSize);\n\t\tconst size = itemManager.size();\n\n\t\tif (isRelayout) {\n\t\t\tthis._watcher.resize();\n\t\t\tif (isResize) {\n\t\t\t\tthis._setSize(renderer.getViewportSize());\n\t\t\t}\n\t\t}\n\t\t// check childElement\n\t\tif (!size || !items.length) {\n\t\t\tconst children = toArray(renderer.container.children);\n\n\t\t\tif (children.length) {\n\t\t\t\tthis._insert({\n\t\t\t\t\telements: children,\n\t\t\t\t\tisAppend: true,\n\t\t\t\t\tisChildren: true,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (renderer.getContainerSize()) {\n\t\t\t\t\trenderer.setContainerSize(0);\n\t\t\t\t}\n\t\t\t\tthis._requestAppend({});\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\t// layout datas\n\t\tconst startCursor = infinite.getCursor(\"start\");\n\t\tconst endCursor = infinite.getCursor(\"end\");\n\t\tconst data = isLayoutAll || !(isRelayout && isResize) ? itemManager.get() :\n\t\t\titemManager.get(startCursor, endCursor);\n\n\t\t// LayoutManger interface\n\t\tthis._manager.layout(isRelayout, data, isResize ? items : []);\n\t\tif (isLayoutAll) {\n\t\t\tthis._fit();\n\t\t} else if (isRelayout && isResize) {\n\t\t\titemManager.clearOutlines(startCursor, endCursor);\n\t\t}\n\t\tDOMRenderer.renderItems(items, transitionDuration);\n\t\tisRelayout && this._watcher.setScrollPos();\n\t\tthis._onLayoutComplete({\n\t\t\titems,\n\t\t\tisAppend: APPEND,\n\t\t\tfromCache: CACHE,\n\t\t\tisTrusted: NO_TRUSTED,\n\t\t\tuseRecycle: false,\n\t\t\tisLayout: true,\n\t\t});\n\t\treturn this;\n\t}\n\t/**\n\t * Removes a item element on a grid layout.\n\t * @ko 그리드 레이아웃의 카드 엘리먼트를 삭제한다.\n\t * @param {HTMLElement} item element to be removed 삭제될 아이템 엘리먼트\n\t * @return {Object} Removed item element 삭제된 아이템 엘리먼트 정보\n\t */\n\tpublic remove(element: HTMLElement, isLayout = true) {\n\t\tif (element) {\n\t\t\tconst {items, groups} = this._infinite.remove(element);\n\n\t\t\titems && DOMRenderer.removeElement(element);\n\t\t\tisLayout && this.layout(groups.length > 0);\n\t\t\treturn items;\n\t\t}\n\t\treturn null;\n\t}\n\t/**\n\t * Returns the list of group keys which belongs to card elements currently being maintained. You can use the append() or prepend() method to configure group keys so that multiple card elements can be managed at once. If you do not use these methods to configure group keys, groupkey is automatically generated.\n\t * @ko 현재 유지하고 있는 카드 엘리먼트의 그룹 키 목록을 반환한다. 여러 개의 카드 엘리먼트를 묶어서 관리할 수 있도록 append() 메서드나 prepend() 메서드에서 그룹 키를 지정할 수 있다. append() 메서드나 prepend() 메서드에서 그룹 키를 지정하지 않았다면 자동으로 그룹키가 생성된다.\n\t * @param {Boolean} includeCached Indicates whether to include the cached groups. 캐싱된 그룹을 포함할지 여부를 나타낸다.\n\t * @return {Array} List of group keys 그룹 키의 목록\n\t */\n\tpublic getGroupKeys(includeCached?: boolean) {\n\t\tconst data = includeCached ?\n\t\t\tthis._items.get() : this._infinite.getVisibleData();\n\n\t\treturn data.map(v => v.groupKey);\n\t}\n\t/**\n\t * Returns the current state of a module such as location information. You can use the setStatus() method to restore the information returned through a call to this method.\n\t * @ko 카드의 위치 정보 등 모듈의 현재 상태 정보를 반환한다. 이 메서드가 반환한 정보를 저장해 두었다가 setStatus() 메서드로 복원할 수 있다\n\t * @return {Object} State object of the eg.InfiniteGrid moduleeg.InfiniteGrid 모듈의 상태 객체\n\t */\n\tpublic getStatus(startKey?: string | number, endKey?: string | number): IInfiniteGridStatus {\n\t\treturn {\n\t\t\t_status: assign({}, this._status),\n\t\t\t_items: this._items.getStatus(startKey, endKey),\n\t\t\t_renderer: this._renderer.getStatus(),\n\t\t\t_watcher: this._watcher.getStatus(),\n\t\t\t_infinite: this._infinite.getStatus(startKey, endKey),\n\t\t};\n\t}\n\t/**\n\t * Sets the state of the eg.InfiniteGrid module with the information returned through a call to the getStatue() method.\n\t * @ko getStatue() 메서드가 저장한 정보로 eg.InfiniteGrid 모듈의 상태를 설정한다.\n\t * @param {Object} status State object of the eg.InfiniteGrid module eg.InfiniteGrid 모듈의 상태 객체\n\t * @param {boolean} [applyScrollPos=true] Checks whether to scroll스크롤의 위치를 복원할지 결정한다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic setStatus(status: IInfiniteGridStatus, applyScrollPos = true) {\n\t\tif (!status) {\n\t\t\treturn this;\n\t\t}\n\t\tconst { _status, _renderer, _items, _watcher, _infinite } = status;\n\n\t\tif (!_status ||\n\t\t\t!_renderer || !_items || !_watcher || !_infinite) {\n\t\t\treturn this;\n\t\t}\n\t\tconst items = this._items;\n\t\tconst renderer = this._renderer;\n\t\tconst watcher = this._watcher;\n\t\tconst infinite = this._infinite;\n\n\t\twatcher.detachEvent();\n\t\tassign(this._status, _status);\n\t\tthis._status.processingStatus = IDLE;\n\t\titems.setStatus(_items);\n\t\trenderer.setStatus(_renderer);\n\t\tinfinite.setStatus(_infinite);\n\n\t\tconst visibleItems = this.getItems();\n\t\tconst length = visibleItems.length;\n\n\t\trenderer.createAndInsert(visibleItems, true);\n\n\t\tconst isReLayout = renderer.isNeededResize();\n\n\t\twatcher.setStatus(_watcher, applyScrollPos);\n\t\twatcher.attachEvent();\n\n\t\tconst { isConstantSize, isEqualSize } = this.options;\n\n\t\tif (!length) {\n\t\t\tthis._requestAppend({ cache: [] });\n\t\t} else if (isReLayout) {\n\t\t\trenderer.resize();\n\t\t\tthis._setSize(renderer.getViewportSize());\n\n\t\t\tif (isConstantSize) {\n\t\t\t\tthis.layout(true);\n\t\t\t} else {\n\t\t\t\tthis._items.clearOutlines();\n\t\t\t\tthis._postLayout({\n\t\t\t\t\tfromCache: true,\n\t\t\t\t\tgroups: isEqualSize ? items.get() : infinite.getVisibleData(),\n\t\t\t\t\titems: visibleItems,\n\t\t\t\t\tnewItems: visibleItems,\n\t\t\t\t\tisAppend: true,\n\t\t\t\t\tisTrusted: false,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tthis.layout(false);\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t * Clears added card elements and data.\n\t * @ko 추가된 카드 엘리먼트와 데이터를 모두 지운다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic clear() {\n\t\tthis._items.clear();\n\t\tthis._renderer.clear();\n\t\tthis._infinite.clear();\n\t\tthis._reset();\n\t\tthis._appendLoadingBar();\n\t\treturn this;\n\t}\n\t/**\n\t * Specifies the Loading Bar to use for append or prepend items.\n\t * @ko 아이템을 append 또는 prepend 하기 위해 사용할 로딩 바를 지정한다.\n\t * @param {String|Object} [userLoadingBar={}] The loading bar HTML markup or element or element selector 로딩 바 HTML 또는 element 또는 selector \n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic setLoadingBar(userLoadingBar: {\n\t\tappend?: string | HTMLElement,\n\t\tprepepnd?: string | HTMLElement,\n\t} | string = {}) {\n\t\tconst loadingBarObj: {\n\t\t\tappend?: string | HTMLElement,\n\t\t\tprepend?: string | HTMLElement,\n\t\t} = typeof userLoadingBar === \"object\" ? userLoadingBar : {\n\t\t\tappend: userLoadingBar,\n\t\t\tprepend: userLoadingBar,\n\t\t};\n\n\t\tthis._status.loadingSize = 0;\n\t\tthis._status.loadingStyle = {};\n\t\tconst loadingBar = this._loadingBar;\n\n\t\tfor (const type in loadingBarObj) {\n\t\t\tloadingBar[type as \"append\" | \"prepend\"] = $(loadingBarObj[type as \"append\" | \"prepend\"]);\n\t\t\tloadingBar[type as \"append\" | \"prepend\"].className += ` ${IGNORE_CLASSNAME}`;\n\t\t}\n\t\tthis._appendLoadingBar();\n\t\treturn this;\n\t}\n\t/**\n\t * Checks whether a card element or data is being added.\n\t * @ko 카드 엘리먼트 추가 또는 데이터 로딩이 진행 중인지 확인한다\n\t * @return {Boolean} Indicates whether a card element or data is being added 카드 엘리먼트 추가 또는 데이터 로딩 진행 중 여부\n\t */\n\tpublic isProcessing() {\n\t\treturn this._isProcessing() || this._isLoading();\n\t}\n\t/**\n\t * Returns the element of loading bar.\n\t * @ko 로딩 바의 element를 반환한다.\n\t * @param {Boolean} [isAppend=currentLoadingBar|true] Checks whether the card element is added to the append () method. 카드 엘리먼트가 append() 메서드로 추가 할 것인지 확인한다.\n\t * @return {Element} The element of loading bar. 로딩 바의 element\n\t */\n\tpublic getLoadingBar(isAppend = this._getLoadingStatus() !== LOADING_PREPEND) {\n\t\treturn this._loadingBar[isAppend ? \"append\" : \"prepend\"];\n\t}\n\t/**\n\t * Start loading for append/prepend during loading data.\n\t * @ko 데이터가 로딩되는 동안 append/prepend하길 위해 로딩을 시작한다.\n\t * @param {Boolean} [isAppend=true] Checks whether the card element is added to the append () method. 카드 엘리먼트가 append() 메서드로 추가 할 것인지 확인한다.\n\t * @param {Object} [userStyle = {display: \"block\"}] custom style to apply to this loading bar for start. 로딩 시작을 위한 로딩 바에 적용할 커스텀 스타일 \n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic startLoading(isAppend?: boolean, userStyle: StyleType = { display: \"block\" }) {\n\t\tif (this._isLoading()) {\n\t\t\treturn this;\n\t\t}\n\t\tconst type = isAppend ? \"append\" : \"prepend\";\n\n\t\tthis._process(isAppend ? LOADING_APPEND : LOADING_PREPEND);\n\t\tif (!this._loadingBar[type]) {\n\t\t\treturn this;\n\t\t}\n\t\tthis._renderLoading(userStyle);\n\t\tthis._status.loadingStyle = userStyle;\n\t\tif (!isAppend) {\n\t\t\tthis._fit();\n\t\t} else {\n\t\t\tthis._setContainerSize(this._getEdgeValue(\"end\") + this._status.loadingSize);\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t * End loading after startLoading() for append/prepend\n\t * @ko append/prepend하길 위해 startLoading() 호출해선 걸었던 로딩을 끝낸다.\n\t * @param {Object} [userStyle = {display: \"none\"}] custom style to apply to this loading bar for end 로딩 시작을 위한 로딩 바에 적용할 커스텀 스타일 \n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic endLoading(userStyle: StyleType = { display: \"none\" }) {\n\t\tif (!this._isLoading()) {\n\t\t\treturn this;\n\t\t}\n\t\tconst isAppend = this._getLoadingStatus() === LOADING_APPEND;\n\t\tconst type = isAppend ? \"append\" : \"prepend\";\n\t\tconst el = this._loadingBar[type];\n\t\tconst status = this._status;\n\t\tconst size = status.loadingSize;\n\n\t\tthis._process(LOADING_APPEND | LOADING_PREPEND, false);\n\t\tstatus.loadingSize = 0;\n\t\tstatus.loadingStyle = {};\n\t\tif (el) {\n\t\t\tconst style: StyleType = assign({\n\t\t\t\t[this.options.horizontal ? \"left\" : \"top\"]: `${-size}px`,\n\t\t\t}, userStyle);\n\n\t\t\tfor (const property in style) {\n\t\t\t\tel.style[property as keyof StyleType] = style[property as keyof StyleType];\n\t\t\t}\n\t\t\tif (!isAppend) {\n\t\t\t\tthis._fitItems(size);\n\t\t\t} else {\n\t\t\t\tthis._setContainerSize(this._getEdgeValue(\"end\"));\n\t\t\t}\n\t\t}\n\t\tif (this.options.useRecycle && !this.isProcessing()) {\n\t\t\tthis._infinite.recycle(this._watcher.getScrollPos(), isAppend);\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t * Retrieves the item via index or the element.\n\t * @ko index 또는 element를 통해 아이템을 가져온다.\n\t * @param {number | HTMLElement} [groupIndex=0] The element corresponding to item or the index of the group where the item is in position item에 해당하는 element 또는 해당 item이 있는 group의 index\n\t * @param {number} [itemIndex] If groupIndex is used, the index of the item in the group groupIndex를 사용할 경우 해당 group에 있는 Item의 index \n\t * @return The item containing the content, size and position,etccontent, size, position 등이 담겨있는 item 정보\n\t * @example\n\n\t ig.getItem(0, 0);\n\t ig.getItem(element);\n\n\t {\n\t el: HTMLElement,\n\t content: \"...
\",\n\t size: {width: ..., height: ...},\n\t rect: {top: ..., left: ..., width: ..., height: ...},\n\t }\n\t */\n\tpublic getItem(groupIndex = 0, itemIndex?: number): IInfiniteGridItem {\n\t\tif (itemIndex == null && typeof groupIndex === \"object\") {\n\t\t\tif (!groupIndex) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst items = this.getItems();\n\t\t\tconst length = items.length;\n\n\t\t\tfor (let i = 0; i < length; ++i) {\n\t\t\t\tif (items[i].el === groupIndex) {\n\t\t\t\t\treturn items[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst group = this._items.getData(groupIndex);\n\n\t\t\treturn group && group.items[itemIndex || 0];\n\t\t}\n\t}\n\t/**\n\t * Updates the item via index or the element.\n\t * @ko index 또는 element를 통해 아이템을 업데이트한다.\n\t * @param {number | HTMLElement} [groupIndex=0] The element corresponding to item or the index of the group where the item is in position item에 해당하는 element 또는 해당 item이 있는 group의 index\n\t * @param {number} [itemIndex] If groupIndex is used, the index of the item in the group groupIndex를 사용할 경우 해당 group에 있는 Item의 index \n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\telement.innerHTML = \"2\";\n\telement.style.height = \"400px\";\n\tig.updateItem(element);\n\tig.updateItem(0, 0);\n\t */\n\tpublic updateItem(groupIndex?: number, itemIndex?: number) {\n\t\tconst item = this.getItem(groupIndex, itemIndex);\n\n\t\tthis._updateItem(item) && this.layout(false);\n\n\t\treturn this;\n\t}\n\t/**\n\t * Update the currently displayed items.\n\t * @ko 현재보여주는 아이템들을 업데이트한다.\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\telement.innerHTML = \"2\";\n\telement.style.height = \"400px\";\n\n\telement2.innerHTML = \"2\";\n\telement2.style.height = \"400px\";\n\n\tig.updateItems();\n\t */\n\tpublic updateItems() {\n\t\tthis.getItems().forEach(item => {\n\t\t\tthis._updateItem(item);\n\t\t});\n\t\tthis.layout(false);\n\t\treturn this;\n\t}\n\t/**\n\t * Move to some group or item position.\n\t * @ko 해당하는 그룹 또는 아이템의 위치로 이동한다.\n\t * @param {Number} [index] group's index 그룹의 index\n\t * @param {Number} [itemIndex=-1] item's index 그룹의 index\n\t * @return {eg.InfiniteGrid} An instance of a module itself모듈 자신의 인스턴스\n\t */\n\tpublic moveTo(index?: number, itemIndex = 0) {\n\t\tif (this.isProcessing()) {\n\t\t\treturn this;\n\t\t}\n\t\tconst data = this._items.getData(index);\n\n\t\tif (!data) {\n\t\t\treturn this;\n\t\t}\n\t\tconst infinite = this._infinite;\n\t\tconst outlines = data.outlines;\n\t\tconst items = data.items;\n\t\tconst item = items[itemIndex];\n\t\tconst isResize = outlines.start && (outlines.start.length === 0);\n\t\tconst startCursor = infinite.getCursor(\"start\");\n\t\tconst endCursor = infinite.getCursor(\"end\");\n\t\tconst isInCursor = startCursor <= index && index <= endCursor;\n\t\tconst { useRecycle, horizontal } = this.options;\n\n\t\tif (isInCursor || !useRecycle || !isResize) {\n\t\t\tlet pos = item ? item.rect[horizontal ? \"left\" : \"top\"] : Math.max(...outlines.start);\n\t\t\tconst fit = Math.min(...outlines.start);\n\n\t\t\tif (fit < 0) {\n\t\t\t\t// base < 0\n\t\t\t\tthis._fitItems(fit, 0);\n\t\t\t\tpos -= fit;\n\t\t\t}\n\t\t\tconst isAppend = index > startCursor;\n\n\t\t\tif (isInCursor || isAppend) {\n\t\t\t\tthis._scrollTo(pos);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tthis._postLayout({\n\t\t\t\tfromCache: true,\n\t\t\t\tgroups: [data],\n\t\t\t\titems,\n\t\t\t\tnewItems: [],\n\t\t\t\tisAppend,\n\t\t\t\tisTrusted: false,\n\t\t\t\tmoveCache: true,\n\t\t\t\tmoveItem: itemIndex,\n\t\t\t});\n\t\t\treturn this;\n\t\t} else {\n\t\t\tconst isAppend = index > endCursor || index < startCursor - 1;\n\n\t\t\tthis._postCache({\n\t\t\t\tisAppend,\n\t\t\t\tcache: [data],\n\t\t\t\tisTrusted: false,\n\t\t\t\tmoveItem: itemIndex,\n\t\t\t});\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n * Destroys elements, properties, and events used on a grid layout.\n * @ko 그리드 레이아웃에 사용한 엘리먼트와 속성, 이벤트를 해제한다\n */\n\tpublic destroy() {\n\t\tthis._infinite.clear();\n\t\tthis._watcher.destroy();\n\t\tthis._manager.destroy();\n\t\tthis._reset();\n\t\tthis._items.clear();\n\t\tthis._renderer.destroy();\n\t}\n\tprivate _setContainerSize(size: number) {\n\t\tthis._renderer.setContainerSize(Math.max(this._items.getMaxEdgeValue(), size));\n\t}\n\tprivate _appendLoadingBar() {\n\t\tconst loadingBar = this._loadingBar;\n\t\tconst container = this._renderer.container;\n\n\t\tfor (const type in loadingBar) {\n\t\t\tcontainer.appendChild(loadingBar[type as \"append\" | \"prepend\"]);\n\t\t}\n\t}\n\tprivate _setSize(size: number) {\n\t\tthis._infinite.setSize(this._renderer.getViewSize());\n\t\tthis._manager.setSize(size);\n\t}\n\tprivate _fitItems(base: number, margin = 0) {\n\t\tbase > 0 && this._watcher.scrollBy(-base);\n\t\tthis._items.fit(base, this.options.horizontal);\n\t\tDOMRenderer.renderItems(this.getItems());\n\t\tthis._setContainerSize(this._getEdgeValue(\"end\") || margin);\n\t\tbase < 0 && this._watcher.scrollBy(-base);\n\t}\n\t// called by visible\n\tprivate _fit(useFit = this.options.useFit) {\n\t\tlet base = this._getEdgeValue(\"start\");\n\t\tconst margin = (this._getLoadingStatus() === LOADING_PREPEND && this._status.loadingSize) || 0;\n\t\tconst { isConstantSize, isEqualSize, useRecycle } = this.options;\n\n\t\tif (!useRecycle || !useFit || isConstantSize || isEqualSize) {\n\t\t\tif (base < margin) {\n\t\t\t\tthis._fitItems(base - margin, margin);\n\t\t\t}\n\t\t\tbase = 0;\n\t\t} else if (base !== 0 || margin) {\n\t\t\tthis._fitItems(base - margin, margin);\n\t\t} else {\n\t\t\treturn 0;\n\t\t}\n\t\tthis._isLoading() && this._renderLoading();\n\t\treturn base;\n\t}\n\tprivate _getEdgeValue(cursor: CursorType) {\n\t\treturn this._infinite.getEdgeValue(cursor);\n\t}\n\tprivate _isProcessing() {\n\t\treturn (this._status.processingStatus & PROCESSING) > 0;\n\t}\n\tprivate _isLoading() {\n\t\treturn this._getLoadingStatus() > 0;\n\t}\n\tprivate _getLoadingStatus() {\n\t\treturn this._status.processingStatus & (LOADING_APPEND | LOADING_PREPEND);\n\t}\n\tprivate _process(status: number, isAdd = true) {\n\t\tif (isAdd) {\n\t\t\tthis._status.processingStatus |= status;\n\t\t} else {\n\t\t\tthis._status.processingStatus -= this._status.processingStatus & status;\n\t\t}\n\t}\n\tprivate _insert({\n\t\telements,\n\t\tisAppend,\n\t\tisChildren,\n\t\tgroupKey = new Date().getTime() + Math.floor(Math.random() * 1000),\n\t}: {\n\t\telements: string | string[] | HTMLElement[] | IJQuery,\n\t\tisAppend?: boolean,\n\t\tisChildren?: boolean,\n\t\tgroupKey?: string | number,\n\t}) {\n\t\tif (this._isProcessing() || elements.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst items = ItemManager.from(elements, this.options.itemSelector, {\n\t\t\tgroupKey,\n\t\t});\n\n\t\tif (!items.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst group: IInfiniteGridGroup = {\n\t\t\tgroupKey,\n\t\t\titems,\n\t\t\toutlines: { start: [], end: [] },\n\t\t};\n\t\tconst method = isAppend ? \"append\" : \"prepend\";\n\n\t\tthis._items[method](group);\n\n\t\tif (!isAppend) {\n\t\t\tconst infinite = this._infinite;\n\t\t\tconst startCursor = infinite.getCursor(\"start\");\n\t\t\tconst endCursor = infinite.getCursor(\"end\");\n\n\t\t\tinfinite.setCursor(\"start\", startCursor + 1);\n\t\t\tinfinite.setCursor(\"end\", endCursor + 1);\n\t\t}\n\t\tthis._postLayout({\n\t\t\tfromCache: NO_CACHE,\n\t\t\tgroups: [group],\n\t\t\titems,\n\t\t\tnewItems: items,\n\t\t\tisAppend,\n\t\t\tisChildren,\n\t\t\tisTrusted: NO_TRUSTED,\n\t\t});\n\t}\n\t// add items, and remove items for recycling\n\tprivate _recycle({ start, end }: { start: number, end: number }) {\n\t\tif (!this.options.useRecycle) {\n\t\t\treturn;\n\t\t}\n\t\tDOMRenderer.removeItems(this._items.pluck(\"items\", start, end));\n\t}\n\tprivate _renderLoading(userStyle = this._status.loadingStyle) {\n\t\tif (!this._isLoading()) {\n\t\t\treturn;\n\t\t}\n\t\tconst isAppend = this._getLoadingStatus() === LOADING_APPEND;\n\t\tconst el = this._loadingBar[isAppend ? \"append\" : \"prepend\"];\n\n\t\tif (!el) {\n\t\t\treturn;\n\t\t}\n\t\tconst style = assign({\n\t\t\tposition: \"absolute\",\n\t\t}, userStyle);\n\n\t\tfor (const property in style) {\n\t\t\tel.style[property as keyof StyleType] = style[property as keyof StyleType];\n\t\t}\n\t\tthis._status.loadingSize = this.options.horizontal ? outerWidth(el) : outerHeight(el);\n\t\tconst posName = this.options.horizontal ? \"left\" : \"top\";\n\n\t\tif (!(posName in style)) {\n\t\t\tconst pos = isAppend ? this._getEdgeValue(\"end\") : this._getEdgeValue(\"start\") - this._status.loadingSize;\n\n\t\t\tel.style[posName] = `${pos}px`;\n\t\t}\n\t}\n\tprivate _updateItem(item: IInfiniteGridItem) {\n\t\tif (item && item.el) {\n\t\t\titem.content = item.el.outerHTML;\n\n\t\t\t!this.options.isEqualSize && resetSize(item);\n\t\t\tthis._renderer.updateSize([item]);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\tprivate _setScrollPos(pos: number) {\n\t\tthis._watcher.setScrollPos(this._watcher.getContainerOffset() + pos);\n\t}\n\tprivate _scrollTo(pos: number) {\n\t\tthis._watcher.scrollTo(this._watcher.getContainerOffset() + pos);\n\t}\n\tprivate _onImageError(e: IErrorCallbackOptions) {\n\t\t/**\n\t\t * This event is fired when an error occurs in the image.\n\t\t * @ko 이미지 로드에 에러가 날 때 발생하는 이벤트.\n\t\t * @event eg.InfiniteGrid#imageError\n\t\t * @param {eg.InfiniteGrid.IErrorCallbackOptions} e The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @example\n\tig.on(\"imageError\", e => {\n\t e.remove();\n\t e.removeItem();\n\t e.replace(\"http://...jpg\");\n\t e.replace(imageElement);\n\t e.replaceItem(\"item html\");\n\t});\n\t\t */\n\t\tthis.trigger(\"imageError\", assign(e, { element: e.item.el }));\n\t}\n\tprivate _postCache({\n\t\tcache,\n\t\tisAppend,\n\t\tisTrusted = true,\n\t\tmoveItem = -1,\n\t}: {\n\t\tcache: IInfiniteGridGroup[],\n\t\tisAppend?: boolean,\n\t\tisTrusted?: boolean,\n\t\tmoveItem?: number,\n\t}) {\n\t\tconst { isConstantSize } = this.options;\n\t\tconst items = ItemManager.pluck(cache, \"items\");\n\t\tlet fromCache = true;\n\t\tconst newItems = items.filter(item => {\n\t\t\tif (!item.orgSize) {\n\t\t\t\tfromCache = false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn !isConstantSize && item.rect.top < DUMMY_POSITION / 10;\n\t\t});\n\n\t\tthis._postLayout({\n\t\t\tfromCache,\n\t\t\tgroups: cache,\n\t\t\titems,\n\t\t\tnewItems,\n\t\t\tisAppend,\n\t\t\tisTrusted,\n\t\t\tmoveItem,\n\t\t});\n\t}\n\tprivate _postLayout({\n\t\tfromCache,\n\t\tgroups,\n\t\titems = ItemManager.pluck(groups, \"items\"),\n\t\tnewItems,\n\t\tisAppend,\n\t\tisChildren,\n\t\tisTrusted,\n\t\tmoveCache,\n\t\tmoveItem = -2,\n\t}: {\n\t\tfromCache: boolean,\n\t\tgroups: IInfiniteGridGroup[],\n\t\titems: IInfiniteGridItem[],\n\t\tnewItems?: IInfiniteGridItem[],\n\t\tisAppend: boolean,\n\t\tisChildren?: boolean,\n\t\tisTrusted?: boolean,\n\t\tmoveCache?: boolean,\n\t\tmoveItem?: number,\n\t}) {\n\t\tthis._process(PROCESSING);\n\t\tconst method = isAppend ? \"append\" : \"prepend\";\n\t\tconst itemManager = this._items;\n\t\tconst horizontal = this.options.horizontal;\n\n\t\t// If container has children, it does not render first.\n\t\tif (!isChildren) {\n\t\t\tDOMRenderer.createElements(items);\n\t\t\tthis._renderer[method](items);\n\t\t}\n\t\tthis._manager[method]({\n\t\t\tgroups,\n\t\t\titems: newItems,\n\t\t}, {\n\t\t\t\tcomplete: () => {\n\t\t\t\t\tconst infinite = this._infinite;\n\t\t\t\t\tconst startCursor = Math.max(infinite.getCursor(\"start\"), 0);\n\t\t\t\t\tconst endCursor = Math.max(infinite.getCursor(\"end\"), 0);\n\t\t\t\t\tlet requestStartCursor = itemManager.indexOf(groups[0].groupKey);\n\t\t\t\t\tlet requestEndCursor = itemManager.indexOf(groups[groups.length - 1].groupKey);\n\t\t\t\t\tlet isInCursor = true;\n\n\t\t\t\t\tif (requestStartCursor > endCursor + 1 || requestEndCursor < startCursor - 1) {\n\t\t\t\t\t\tisInCursor = false;\n\t\t\t\t\t}\n\t\t\t\t\tif (isInCursor) {\n\t\t\t\t\t\tif (isAppend) {\n\t\t\t\t\t\t\trequestStartCursor = startCursor;\n\t\t\t\t\t\t\trequestEndCursor = Math.max(endCursor, requestEndCursor);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trequestStartCursor = Math.max(Math.min(startCursor, requestStartCursor), 0);\n\t\t\t\t\t\t\trequestEndCursor = endCursor;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t!isInCursor && this._recycle({ start: startCursor, end: endCursor });\n\t\t\t\t\tinfinite.setCursor(\"start\", requestStartCursor);\n\t\t\t\t\tinfinite.setCursor(\"end\", requestEndCursor);\n\n\t\t\t\t\tif (moveItem > -1) {\n\t\t\t\t\t\tconst pos = items[moveItem].rect[horizontal ? \"left\" : \"top\"];\n\n\t\t\t\t\t\tif (!isInCursor && !moveCache) {\n\t\t\t\t\t\t\titemManager.clearOutlines(requestStartCursor, requestEndCursor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._scrollTo(pos);\n\t\t\t\t\t\tthis._setScrollPos(pos);\n\t\t\t\t\t}\n\t\t\t\t\tthis._onLayoutComplete({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tisAppend,\n\t\t\t\t\t\tfromCache,\n\t\t\t\t\t\tisTrusted,\n\t\t\t\t\t\tuseRecycle: false,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\terror: e => this._onImageError(e),\n\t\t\t\tend: ({ remove, layout }) => {\n\t\t\t\t\tremove.forEach(el => this.remove(el, false));\n\t\t\t\t\tif (layout) {\n\t\t\t\t\t\tthis.layout(false);\n\t\t\t\t\t} else if (!this.isProcessing() && this.options.useRecycle) {\n\t\t\t\t\t\tconst watcher = this._watcher;\n\t\t\t\t\t\tconst scrollPos = watcher.getScrollPos();\n\n\t\t\t\t\t\tthis._infinite.recycle(scrollPos, isAppend);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\treturn this;\n\t}\n\t// called by visible\n\tprivate _requestAppend({ cache }: { cache?: IInfiniteGridGroup[] }) {\n\t\tif (this._isProcessing()) {\n\t\t\treturn;\n\t\t}\n\t\tif (cache && cache.length) {\n\t\t\tthis._postCache({ cache, isAppend: APPEND });\n\t\t} else {\n\t\t\t/**\n\t\t\t * This event is fired when a card element must be added at the bottom or right of a layout because there is no card to be displayed on screen when a user scrolls near bottom or right.\n\t\t\t * @ko 카드 엘리먼트가 레이아웃의 아래나 오른쪽에 추가돼야 할 때 발생하는 이벤트. 사용자가 아래나 오른쪽으로 스크롤해서 화면에 표시될 카드가 없을 때 발생한다\n\t\t\t * @event eg.InfiniteGrid#append\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String|Number} groupKey The group key of the first group visible on the screen 화면에 보여지는 마지막 그룹의 그룹키\n\t\t\t * @param {Boolean} param.isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n\t\t\t * @param {Function} param.startLoading Start loading for append loading data. 뒷쪽에 추가되는 데이터 로딩을 시작한다. \n\t\t\t * @param {Object} param.startLoading.userStyle The custom style to apply to this loading bar for start. 로딩을 시작할 때 로딩 바에 적용될 사용자 스타일 \n\t\t\t * @param {Function} param.endLoading End loading after startLoading() for append/prepend loading data. 데이터 로딩을 위해 append/prepend startLoading() 호출 이후 로딩을 끝낸다.\n\t\t\t * @param {Object} param.endLoading.userStyle The custom style to apply to this loading bar for start. 로딩이 끝날 때 로딩 바에 적용될 사용자 스타일 \n\t\t\t */\n\t\t\tthis.trigger(\"append\", {\n\t\t\t\tisTrusted: TRUSTED,\n\t\t\t\tgroupKey: this.getGroupKeys().pop() || \"\",\n\t\t\t\tstartLoading: (userStyle: StyleType) => {\n\t\t\t\t\tthis.startLoading(true, userStyle);\n\t\t\t\t},\n\t\t\t\tendLoading: (userStyle: StyleType) => {\n\t\t\t\t\tthis.endLoading(userStyle);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\t// called by visible\n\tprivate _requestPrepend({ cache }: { cache?: IInfiniteGridGroup[] }) {\n\t\tthis._fit(this.options.useFit || !cache.length);\n\t\tif (this._isProcessing()) {\n\t\t\treturn;\n\t\t}\n\t\tif (cache && cache.length) {\n\t\t\tthis._postCache({ cache, isAppend: PREPEND });\n\t\t} else {\n\t\t\t/**\n\t\t\t * This event is fired when a card element must be added at the top or left of a layout because there is no card to be displayed on screen when a user scrolls near top or left.\n\t\t\t * @ko 카드가 레이아웃의 위나 왼쪽에 추가돼야 할 때 발생하는 이벤트. 사용자가 위나 왼쪽으로 스크롤해서 화면에 표시될 카드가 없을 때 발생한다.\n\t\t\t * @event eg.InfiniteGrid#prepend\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String|Number} groupKey The group key of the first group visible on the screen 화면에 보여지는 첫번째 그룹의 그룹키\n\t\t\t * @param {Boolean} param.isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n\t\t\t * @param {Function} param.startLoading Start loading for prepend loading data. 앞쪽에 추가되는 데이터 로딩을 시작한다. \n\t\t\t * @param {Object} param.startLoading.userStyle The custom style to apply to this loading bar for start. 로딩을 시작할 때 로딩 바에 적용될 사용자 스타일 \n\t\t\t * @param {Function} param.endLoading End loading after startLoading() for append/prepend loading data. 데이터 로딩을 위해 append/prepend startLoading() 호출 이후 로딩을 끝낸다.\n\t\t\t * @param {Object} param.endLoading.userStyle The custom style to apply to this loading bar for start. 로딩이 끝날 때 로딩 바에 적용될 사용자 스타일 \n\t\t\t */\n\t\t\tthis.trigger(\"prepend\", {\n\t\t\t\tisTrusted: TRUSTED,\n\t\t\t\tgroupKey: this.getGroupKeys().shift(),\n\t\t\t\tstartLoading: (userStyle: StyleType) => {\n\t\t\t\t\tthis.startLoading(false, userStyle);\n\t\t\t\t},\n\t\t\t\tendLoading: (userStyle: StyleType) => {\n\t\t\t\t\tthis.endLoading(userStyle);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\tprivate _onResize() {\n\t\tthis.layout(true);\n\t}\n\tprivate _onCheck({\n\t\tisForward,\n\t\tscrollPos,\n\t\thorizontal,\n\t\torgScrollPos,\n\t}: {\n\t\tisForward: boolean,\n\t\tscrollPos: number,\n\t\thorizontal: boolean,\n\t\torgScrollPos: number,\n\t}) {\n\t\t/**\n\t\t * This event is fired when the user scrolls.\n\t\t * @ko 사용자가 스크롤 할 경우 발생하는 이벤트.\n\t\t * @event eg.InfiniteGrid#change\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Boolean} param.isForward Indicates whether the scroll progression direction is forward or backword. 스크롤 진행방향이 앞쪽으로 진행하는 지, 뒤쪽으로 진행하는지를 나타낸다.\n\t\t * @param {Number} param.scrollPos Current scroll position value relative to the infiniteGrid container element. infiniteGrid 컨테이너 엘리먼트 기준의 현재 스크롤 위치값\n\t\t * @param {Boolean} param.orgScrollPos Current position of the scroll 현재 스크롤 위치값\n\t\t * @param {Boolean} param.isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n\t\t * @param {Boolean} options.horizontal Direction of the scroll movement (true: horizontal, false: vertical) 스크롤 이동 방향 (true 가로방향, false 세로방향\n\t\t */\n\t\tthis.trigger(\"change\", {\n\t\t\tisForward,\n\t\t\thorizontal,\n\t\t\tscrollPos,\n\t\t\torgScrollPos,\n\t\t});\n\t\tthis._infinite.scroll(scrollPos);\n\t}\n\tprivate _onLayoutComplete({\n\t\titems,\n\t\tisAppend,\n\t\tisTrusted = false,\n\t\tuseRecycle = this.options.useRecycle,\n\t\tfromCache = false,\n\t\tisLayout = false,\n\t}: {\n\t\titems: IInfiniteGridItem[],\n\t\tisAppend: boolean,\n\t\tisTrusted: boolean,\n\t\tuseRecycle: boolean,\n\t\tfromCache: boolean,\n\t\tisLayout?: boolean,\n\t}) {\n\t\tconst viewSize = this._renderer.getViewSize();\n\n\t\tif (!isAppend) {\n\t\t\tthis._fit();\n\t\t} else {\n\t\t\tthis._isLoading() && this._renderLoading();\n\t\t}\n\n\t\tconst watcher = this._watcher;\n\t\tconst scrollPos = watcher.getScrollPos();\n\n\t\t// recycle after _fit beacause prepend and append are occured simultaneously by scroll.\n\t\tif (!isLayout && useRecycle && !this._isLoading()) {\n\t\t\tthis._infinite.recycle(scrollPos, isAppend);\n\t\t}\n\n\t\tconst size = this._getEdgeValue(\"end\");\n\n\t\tif (isAppend) {\n\t\t\tthis._setContainerSize(size + this._status.loadingSize || 0);\n\t\t\tif (scrollPos > 0) {\n\t\t\t\t!IS_IOS && this._scrollTo(scrollPos);\n\t\t\t}\n\t\t}\n\t\t!isLayout && this._process(PROCESSING, false);\n\n\t\t/**\n\t\t * This event is fired when layout is successfully arranged through a call to the append(), prepend(), or layout() method.\n\t\t * @ko 레이아웃 배치가 완료됐을 때 발생하는 이벤트. append() 메서드나 prepend() 메서드, layout() 메서드 호출 후 카드의 배치가 완료됐을 때 발생한다\n\t\t * @event eg.InfiniteGrid#layoutComplete\n\t\t *\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Array} param.target Rearranged card elements재배치된 카드 엘리먼트들\n\t\t * @param {Boolean} param.fromCache Check whether these items are cache or not 해당 아이템들이 캐시인지 아닌지 확인한다.\n\t\t * @param {Boolean} param.isLayout Returns true if this is an event called by resize event or layout method. Returns false if this is an event called by adding an item. 해당 이벤트가 리사이즈 이벤트 또는 layout() 메서드를 통해 호출됐으면 true, 아이템 추가로 호출됐으면 false를 반환한다.\n\t\t * @param {Boolean} param.isAppend Checks whether the append() method is used to add a card element. It returns true even though the layoutComplete event is fired after the layout() method is called. 카드 엘리먼트가 append() 메서드로 추가됐는지 확인한다. layout() 메서드가 호출된 후 layoutComplete 이벤트가 발생해도 'true'를 반환한다.\n\t\t * @param {Boolean} param.isScroll Checks whether scrolling has occurred after the append(), prepend(), ..., etc method is called append, prend 등 호출 후 스크롤이 생겼는지 확인한다.\n\t\t * @param {Number} param.scrollPos Current scroll position value relative to the infiniteGrid container element. infiniteGrid 컨테이너 엘리먼트 기준의 현재 스크롤 위치값\n\t\t * @param {Number} param.orgScrollPos Current position of the scroll 현재 스크롤 위치값\n\t\t * @param {Number} param.size The size of container element 컨테이너 엘리먼트의 크기\n\t\t * @param {Boolean} param.isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n\t\t * @param {Function} param.endLoading End loading after startLoading() for append/prepend loading data. 데이터 로딩을 위해 append/prepend startLoading() 호출 이후 로딩을 끝낸다.\n\t\t * @param {Object} param.endLoading.userStyle The custom style to apply to this loading bar for start. 로딩이 끝날 때 로딩 바에 적용될 사용자 스타일 \n\t\t */\n\t\tthis.trigger(\"layoutComplete\", {\n\t\t\ttarget: items.concat(),\n\t\t\tisAppend,\n\t\t\tisTrusted,\n\t\t\tfromCache,\n\t\t\tisLayout,\n\t\t\tisScroll: viewSize < watcher.getContainerOffset() + size,\n\t\t\tscrollPos,\n\t\t\torgScrollPos: watcher.getOrgScrollPos(),\n\t\t\tsize,\n\t\t\tendLoading: (userStyle: StyleType) => {\n\t\t\t\tthis.endLoading(userStyle);\n\t\t\t},\n\t\t});\n\t\tthis._infinite.scroll(scrollPos);\n\t}\n\tprivate _reset() {\n\t\tthis._status = {\n\t\t\tprocessingStatus: IDLE,\n\t\t\tloadingSize: 0,\n\t\t\tloadingStyle: {},\n\t\t};\n\t}\n}\n\nexport default InfiniteGrid;\n","import { APPEND, PREPEND, DUMMY_POSITION } from \"../consts\";\nimport { getStyleNames, assignOptions, fill, cloneItems } from \"../utils\";\nimport { ILayout, IRectlProperties, ISize, IInfiniteGridGroup, IInfiniteGridItem } from \"../types\";\n\nexport type FrameType = number[][];\nexport interface IFrameShape {\n\tleft?: number;\n\ttop?: number;\n\ttype: any;\n\twidth: number;\n\theight: number;\n\tindex?: number;\n}\nexport interface IFrameLayoutInterface {\n\thorizontal: boolean;\n\tmargin: number;\n\tframe: FrameType;\n\tframeFill: boolean;\n\titemSize: number | ISize;\n\t[key: string]: any;\n}\n/*\nFrame\n[\n[1, 1, 1, 1, 1],\n[0, 0, 2, 2, 2],\n[0, 0, 2, 2, 2],\n[3, 4, 5, 5, 5],\n]\n*/\nfunction disableFrame(\n\tframe: FrameType,\n\ttype: number,\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number,\n) {\n\tfor (let i = top; i < top + height; ++i) {\n\t\tfor (let j = left; j < left + width; ++j) {\n\t\t\tif (type !== frame[i][j]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tframe[i][j] = 0;\n\t\t}\n\t}\n}\nfunction searchShapeInFrame(\n\tframe: FrameType,\n\ttype: number,\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number,\n) {\n\tconst size: IFrameShape = {\n\t\tleft,\n\t\ttop,\n\t\ttype,\n\t\twidth: 1,\n\t\theight: 1,\n\t};\n\n\tfor (let i = left; i < width; ++i) {\n\t\tif (frame[top][i] === type) {\n\t\t\tsize.width = i - left + 1;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\tfor (let i = top; i < height; ++i) {\n\t\tif (frame[i][left] === type) {\n\t\t\tsize.height = i - top + 1;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\t// After finding the shape, it will not find again.\n\tdisableFrame(frame, type, top, left, size.width, size.height);\n\treturn size;\n}\nfunction getShapes(frame: FrameType) {\n\tconst height = frame.length;\n\tconst width = height ? frame[0].length : 0;\n\tconst shapes: IFrameShape[] = [];\n\n\tfor (let i = 0; i < height; ++i) {\n\t\tfor (let j = 0; j < width; ++j) {\n\t\t\tconst type = frame[i][j];\n\n\t\t\tif (!type) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Separate shapes with other numbers.\n\t\t\tshapes.push(searchShapeInFrame(frame, type, i, j, width, height));\n\t\t}\n\t}\n\tshapes.sort((a, b) => (a.type < b.type ? -1 : 1));\n\treturn {\n\t\tshapes,\n\t\twidth,\n\t\theight,\n\t};\n}\n/**\n * @classdesc FrameLayout is a layout that allows you to place cards in a given frame. It is a layout that corresponds to a level intermediate between the placement of the image directly by the designer and the layout using the algorithm.\n * @ko FrameLayout은 주어진 프레임에 맞춰 카드를 배치하는 레이아웃입니다. 디자이너가 직접 이미지를 배치하는 것과 알고리즘을 사용한 배치의 중간 정도 수준에 해당하는 레이아웃이다.\n * @class eg.InfiniteGrid.FrameLayout\n * @param {Object} [options] The option object of eg.InfiniteGrid.FrameLayout module eg.InfiniteGrid.FrameLayout 모듈의 옵션 객체\n * @param {String} [options.margin=0] Margin used to create space around items 아이템들 사이의 공간\n * @param {Boolean} [options.horizontal=false] Direction of the scroll movement (false: vertical, true: horizontal) 스크롤 이동 방향 (false: 세로방향, true: 가로방향)\n * @param {Boolean} [options.itemSize=0] The size of the items. If it is 0, it is calculated as the size of the first item in items. 아이템의 사이즈. 만약 아이템 사이즈가 0이면, 아이템들의 첫번째 아이템의 사이즈로 계산이 된다. \n * @param {Boolean} [options.frame=[]] The size of the items. If it is 0, it is calculated as the size of the first item in items. 아이템의 사이즈. 만약 아이템 사이즈가 0이면, 아이템들의 첫번째 아이템의 사이즈로 계산이 된다. \n * @param {Boolean} [options.frameFill=true] Make sure that the frame can be attached after the previous frame. 다음 프레임이 전 프레임에 이어 붙일 수 있는지 있는지 확인한다. \n * @example\n```\n\n```\n **/\nclass FrameLayout implements ILayout {\n\tpublic options: IFrameLayoutInterface;\n\tprotected _itemSize: number | ISize;\n\tprotected _shapes: {\n\t\tshapes: IFrameShape[],\n\t\twidth?: number,\n\t\theight?: number,\n\t};\n\tprotected _size: number;\n\tprotected _style: IRectlProperties;\n\n\tconstructor(options: Partial = {}) {\n\t\tthis.options = assignOptions({\n\t\t\tmargin: 0,\n\t\t\thorizontal: false,\n\t\t\titemSize: 0,\n\t\t\tframe: [],\n\t\t\tframeFill: true,\n\t\t}, options);\n\t\tconst frame = this.options.frame.map(row => row.slice());\n\n\t\tthis._itemSize = this.options.itemSize || 0;\n\t\t// divide frame into shapes.\n\t\tthis._shapes = getShapes(frame);\n\t\tthis._size = 0;\n\t\tthis._style = getStyleNames(this.options.horizontal);\n\t}\n\t/**\n\t * Adds items of groups at the bottom of a outline.\n\t * @ko 그룹들의 아이템들을 아웃라인 아래에 추가한다.\n\t * @method eg.InfiniteGrid.FrameLayout#layout\n\t * @param {Array} groups Array of groups to be layouted 레이아웃할 그룹들의 배열\n\t * @param {Array} outline Array of outline points to be reference points 기준점이 되는 아웃라인 점들의 배열\n\t * @return {eg.InfiniteGrid.FrameLayout} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * layout.layout(groups, [100, 200, 300, 400]);\n\t */\n\tpublic layout(groups: IInfiniteGridGroup[] = [], outline: number[] = []) {\n\t\tconst length = groups.length;\n\t\tlet point = outline;\n\n\t\tfor (let i = 0; i < length; ++i) {\n\t\t\tconst group = groups[i];\n\t\t\tconst outlines = this._layout(group.items, point, APPEND);\n\n\t\t\tgroup.outlines = outlines;\n\t\t\tpoint = outlines.end;\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t * Set the viewport size of the layout.\n\t * @ko 레이아웃의 가시 사이즈를 설정한다.\n\t * @method eg.InfiniteGrid.FrameLayout#setSize\n\t * @param {Number} size The viewport size of container area where items are added to a layout 레이아웃에 아이템을 추가하는 컨테이너 영역의 가시 사이즈\n\t * @return {eg.InfiniteGrid.FrameLayout} An instance of a module itself모듈 자신의 인스턴스\n\t * @example\n\t * layout.setSize(800);\n\t */\n\tpublic setSize(size: number) {\n\t\tthis._size = size;\n\t\treturn this;\n\t}\n\t/**\n\t * Adds items at the bottom of a outline.\n\t * @ko 아이템들을 아웃라인 아래에 추가한다.\n\t * @method eg.InfiniteGrid.FrameLayout#append\n\t * @param {Array} items Array of items to be layouted 레이아웃할 아이템들의 배열\n\t * @param {Array} [outline=[]] Array of outline points to be reference points 기준점이 되는 아웃라인 점들의 배열\n\t * @return {Object} Layouted items and outline of start and end 레이아웃이 된 아이템과 시작과 끝의 아웃라인이 담긴 정보\n\t * @example\n\t * layout.prepend(items, [100]);\n\t */\n\tpublic append(items: IInfiniteGridItem[], outline?: number[], cache?: boolean) {\n\t\treturn this._insert(items, outline, APPEND, cache);\n\t}\n\t/**\n\t * Adds items at the top of a outline.\n\t * @ko 아이템을 아웃라인 위에 추가한다.\n\t * @method eg.InfiniteGrid.FrameLayout#prepend\n\t * @param {Array} items Array of items to be layouted 레이아웃할 아이템들의 배열\n\t * @param {Array} [outline=[]] Array of outline points to be reference points 기준점이 되는 아웃라인 점들의 배열\n\t * @return {Object} Layouted items and outline of start and end 레이아웃이 된 아이템과 시작과 끝의 아웃라인이 담긴 정보\n\t * @example\n\t * layout.prepend(items, [100]);\n\t */\n\tpublic prepend(items: IInfiniteGridItem[], outline?: number[], cache?: boolean) {\n\t\treturn this._insert(items, outline, PREPEND, cache);\n\t}\n\tprotected _getItemSize() {\n\t\tthis._checkItemSize();\n\n\t\treturn this._itemSize;\n\t}\n\tprotected _checkItemSize() {\n\t\tif (this.options.itemSize) {\n\t\t\tthis._itemSize = this.options.itemSize;\n\t\t\treturn;\n\t\t}\n\t\tconst style = this._style;\n\t\tconst size = style.size2;\n\t\tconst margin = this.options.margin;\n\n\t\t// if itemSize is not in options, caculate itemSize from size.\n\t\tthis._itemSize = (this._size + margin) / this._shapes[size] - margin;\n\t}\n\tprotected _layout(items: IInfiniteGridItem[], outline: number[] = [], isAppend?: boolean) {\n\t\tconst length = items.length;\n\t\tconst style = this._style;\n\t\tconst { margin, frameFill } = this.options;\n\t\tconst size1Name = style.size1;\n\t\tconst size2Name = style.size2;\n\t\tconst pos1Name = style.startPos1;\n\t\tconst pos2Name = style.startPos2;\n\t\tconst itemSize = this._getItemSize();\n\t\tconst isItemObject = typeof itemSize === \"object\";\n\t\tconst itemSize2 = isItemObject ? (itemSize as ISize)[size2Name] : itemSize as number;\n\t\tconst itemSize1 = isItemObject ? (itemSize as ISize)[size1Name] : itemSize as number;\n\t\tconst shapesSize = this._shapes[size2Name];\n\t\tconst shapes = this._shapes.shapes;\n\t\tconst shapesLength = shapes.length;\n\t\tconst startOutline = fill(new Array(shapesSize), DUMMY_POSITION);\n\t\tconst endOutline = fill(new Array(shapesSize), DUMMY_POSITION);\n\t\tlet dist = 0;\n\t\tlet end = 0;\n\n\t\tif (!shapesLength) {\n\t\t\treturn { start: outline, end: outline };\n\t\t}\n\t\tfor (let i = 0; i < length; i += shapesLength) {\n\t\t\tfor (let j = 0; j < shapesLength && i + j < length; ++j) {\n\t\t\t\tconst item = items[i + j];\n\t\t\t\tconst shape = shapes[j];\n\t\t\t\tconst shapePos1 = shape[pos1Name];\n\t\t\t\tconst shapePos2 = shape[pos2Name];\n\t\t\t\tconst shapeSize1 = shape[size1Name];\n\t\t\t\tconst shapeSize2 = shape[size2Name];\n\t\t\t\tconst pos1 = end - dist + shapePos1 * (itemSize1 + margin);\n\t\t\t\tconst pos2 = shapePos2 * (itemSize2 + margin);\n\t\t\t\tconst size1 = shapeSize1 * (itemSize1 + margin) - margin;\n\t\t\t\tconst size2 = shapeSize2 * (itemSize2 + margin) - margin;\n\n\t\t\t\tfor (let k = shapePos2; k < shapePos2 + shapeSize2 && k < shapesSize; ++k) {\n\t\t\t\t\tif (startOutline[k] === DUMMY_POSITION) {\n\t\t\t\t\t\tstartOutline[k] = pos1;\n\t\t\t\t\t}\n\t\t\t\t\tstartOutline[k] = Math.min(startOutline[k], pos1);\n\t\t\t\t\tendOutline[k] = Math.max(endOutline[k], pos1 + size1 + margin);\n\t\t\t\t}\n\t\t\t\titem.rect = {\n\t\t\t\t\t[pos1Name]: pos1,\n\t\t\t\t\t[pos2Name]: pos2,\n\t\t\t\t\t[size1Name]: size1,\n\t\t\t\t\t[size2Name]: size2,\n\t\t\t\t};\n\t\t\t}\n\t\t\tend = Math.max(...endOutline);\n\t\t\t// check dist once\n\t\t\tif (i !== 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// find & fill empty block\n\t\t\tif (!frameFill) {\n\t\t\t\tdist = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdist = end;\n\n\t\t\tfor (let j = 0; j < shapesSize; ++j) {\n\t\t\t\tif (startOutline[j] === DUMMY_POSITION) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// the dist between frame's end outline and next frame's start outline\n\t\t\t\t// expect that next frame's start outline is startOutline[j] + end\n\t\t\t\tdist = Math.min(startOutline[j] + end - endOutline[j], dist);\n\t\t\t}\n\t\t}\n\t\tfor (let i = 0; i < shapesSize; ++i) {\n\t\t\tif (startOutline[i] !== DUMMY_POSITION) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tstartOutline[i] = Math.max(...startOutline);\n\t\t\tendOutline[i] = startOutline[i];\n\t\t}\n\t\t// The target outline is start outline when type is APPENDING\n\t\tconst targetOutline = isAppend ? startOutline : endOutline;\n\t\tconst prevOutlineEnd = outline.length === 0 ? 0 : Math[isAppend ? \"max\" : \"min\"](...outline);\n\t\tlet prevOutlineDist = isAppend ? 0 : end;\n\n\t\tif (frameFill && outline.length === shapesSize) {\n\t\t\tprevOutlineDist = -DUMMY_POSITION;\n\t\t\tfor (let i = 0; i < shapesSize; ++i) {\n\t\t\t\tif (startOutline[i] === endOutline[i]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// if appending type is PREPEND, subtract dist from appending group's height.\n\n\t\t\t\tprevOutlineDist = Math.min(targetOutline[i] + prevOutlineEnd - outline[i], prevOutlineDist);\n\t\t\t}\n\t\t}\n\t\tfor (let i = 0; i < shapesSize; ++i) {\n\t\t\tstartOutline[i] += prevOutlineEnd - prevOutlineDist;\n\t\t\tendOutline[i] += prevOutlineEnd - prevOutlineDist;\n\t\t}\n\t\titems.forEach(item => {\n\t\t\titem.rect[pos1Name] += prevOutlineEnd - prevOutlineDist;\n\t\t});\n\t\treturn {\n\t\t\tstart: startOutline.map(point => parseInt(point, 10)),\n\t\t\tend: endOutline.map(point => parseInt(point, 10)),\n\t\t};\n\t}\n\tprivate _insert(items: IInfiniteGridItem[] = [], outline: number[] = [], isAppend?: boolean, cache?: boolean) {\n\t\t// this only needs the size of the item.\n\t\tconst clone = cache ? items : cloneItems(items);\n\n\t\treturn {\n\t\t\titems: clone,\n\t\t\toutlines: this._layout(clone, outline, isAppend),\n\t\t};\n\t}\n}\n\nexport default FrameLayout;\n","/**\n * Copyright (c) NAVER Corp.\n * egjs-infinitegrid projects are licensed under the MIT license\n */\nimport InfiniteGrid from \"./InfiniteGrid\";\nimport FrameLayout from \"./layouts/FrameLayout\";\n\n(InfiniteGrid as any).FrameLayout = FrameLayout;\n\nexport default InfiniteGrid;\n"],"names":["isUndefined","value","Component","_eventHandler","options","_proto","prototype","trigger","eventName","customEvent","handlerList","hasHandlerList","length","concat","eventType","isCanceled","arg","i","stop","currentTarget","_len","arguments","restParam","Array","_key","apply","once","handlerToAttach","eventHash","self","on","listener","_len2","_key2","off","hasOn","name","push","handlerToDetach","undefined","k","handlerFunction","splice","VERSION","win","window","document","navigator","userAgent","ua","SUPPORT_COMPUTEDSTYLE","SUPPORT_ADDEVENTLISTENER","SUPPORT_PASSIVE","supportsPassiveOption","Object","defineProperty","addEventListener","get","e","IS_IE","test","IS_IOS","IS_ANDROID2","CONTAINER_CLASSNAME","IGNORE_CLASSNAME","TRANSITION_NAME","APPEND","PREPEND","VERTICAL","HORIZONTAL","CACHE","NO_CACHE","TRUSTED","NO_TRUSTED","MULTI","DUMMY_POSITION","GROUPKEY_ATT","DEFAULT_OPTIONS","horizontal","margin","agent","toLowerCase","isMobile","IDLE","LOADING_APPEND","LOADING_PREPEND","PROCESSING","webkit","exec","WEBKIT_VERSION","parseInt","DEFENSE_BROWSER","TRANSFORM","TRANSITION","TRANSITION_END","nodes","array","len","html","match","param","multi","el","matchHTML","dummy","createElement","innerHTML","childNodes","querySelectorAll","toArray","isWindow","isJQuery","$","isArray","map","v","nodeName","nodeType","element","type","handler","eventListenerOptions","attachEvent","removeEventListener","detachEvent","callback","removeEvent","addEvent","prop","body","documentElement","x","y","scroll","scrollLeft","scrollTop","scrollBy","getComputedStyle","currentStyle","isOffset","isDocument","doc","Math","max","size","clientRect","getBoundingClientRect","right","left","bottom","top","cssSize","getStyles","indexOf","parseFloat","_getSize","width","outerWidth","height","outerHeight","STYLE","vertical","startPos1","endPos1","size1","startPos2","endPos2","size2","isHorizontal","target","_i","sources","forEach","source","key","defaultOptions","assign","items","item","jQuery","constructor","jquery","arr","clear","ItemManager","elements","selector","_a","groupKey","filted","selectItems","content","outerHTML","rect","filter","classNames","className","split","some","c","data","property","reduce","acc","startKey","endKey","datas","_data","startIndex","endIndex","slice","item2","data2","status","set","base","outlines","start","end","pluck","index","cursor","targetValue","Infinity","getOutline","getEdgeIndex","startCursor","endCursor","group","groups","pos","layouted","unshift","getAttribute","String","idx","orgSize","container","style","position","children","appendChild","properties","styles","p","transitionDuration","pos1","pos2","isEqualSize","isConstantSize","view","viewport","_init","resize","DOMRenderer","prevRect","setAttribute","render","setTransition","addOnceEvent","itemRect","renderItem","removeElement","parentNode","removeChild","noElementItems","replace","join","cssText","_size","getSize","_insert","isAppend","createElements","renderItems","_calcSize","isResize","innerWidth","innerHeight","_orgStyle","overflowX","overflowY","createContainer","df","createDocumentFragment","insertBefore","firstChild","check","isOverflowScroll","_timer","reset","_containerOffset","_view","_isScrollIssue","_onCheck","bind","_onResize","setScrollPos","_prevPos","scrollPos","getOrgScrollPos","applyScrollPos","scrollTo","arrPos","rawPos","getContainerOffset","_getOffset","prevPos","getScrollPos","orgScrollPos","isForward","clearTimeout","setTimeout","_this","threshold","endScrollPos","min","itemManger","useRecycle","append","prepend","recycle","_items","_status","_b","visibles","isVisible","lastIndexOf","setCursor","getCursor","startEdgePos","endEdgePos","startPos","endPos","cache","getEdgeOutline","result","remove","AutoSizer","resizeAll","prefix","onResize","__PREFIX__","isFixed","fixed","elementPrefix","dataWidth","dataHeight","CHECK_ALL","CHECK_ONLY_ERROR","ImageLoaded","checklist","complete","error","checkCount","endCount","checkEnd","checkImage","onError","itemIndex","__ITEM_INDEX__","onCheck","srcElement","isDataAttribute","images","naturalWidth","add","tagName","checkImageLoaded","sum","waitImageLoaded","renderer","attributePrefix","_renderer","_layout","layout","setSize","callbacks","isUpdate","isRelayout","layoutGroups","outline","updateSize","itemManager","groupIndex","prevGroup","getData","groupInfos","groupOutline","every","groupItems","groupInfo","removeTarget","replaceTarget","errorIndex","removeItem","hasTarget","src","removeAttribute","replaceItem","removeTargetLength","replaceTargetLength","layoutedItems","_c","_d","_e","_f","checkGroups","reverse","_complete","_error","_end","tslib_1","_super","itemSelector","useFit","_reset","_loadingBar","_watcher","Watcher","_infinite","Infinite","_requestAppend","_requestPrepend","_recycle","_manager","LayoutKlass","LayoutMananger","setLayout","_setSize","getViewportSize","includeCached","getVisibleItems","infinite","getItems","isLayoutAll","isChildren","getContainerSize","setContainerSize","_fit","clearOutlines","_onLayoutComplete","fromCache","isTrusted","isLayout","getVisibleData","getStatus","watcher","processingStatus","setStatus","visibleItems","createAndInsert","isReLayout","isNeededResize","_postLayout","newItems","_appendLoadingBar","userLoadingBar","loadingBarObj","loadingSize","loadingStyle","loadingBar","_isProcessing","_isLoading","_getLoadingStatus","userStyle","display","_process","_renderLoading","_setContainerSize","_getEdgeValue","_fitItems","isProcessing","getItem","_updateItem","isInCursor","fit","_scrollTo","moveCache","moveItem","_postCache","destroy","getMaxEdgeValue","getViewSize","getEdgeValue","isAdd","from","method","removeItems","posName","resetSize","requestStartCursor","requestEndCursor","_setScrollPos","_onImageError","getGroupKeys","pop","startLoading","endLoading","shift","viewSize","isScroll","InfiniteGrid","frame","j","disableFrame","shapes","searchShapeInFrame","sort","a","b","assignOptions","itemSize","frameFill","row","_itemSize","_shapes","getShapes","_style","getStyleNames","point","_checkItemSize","size1Name","size2Name","pos1Name","pos2Name","_getItemSize","isItemObject","itemSize2","itemSize1","shapesSize","shapesLength","startOutline","fill","endOutline","dist","shape","shapePos1","shapePos2","shapeSize1","shapeSize2","targetOutline","prevOutlineEnd","prevOutlineDist","clone","cloneItems","FrameLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;;;;;;;;;;IASA;;;;IAIA,SAASA,WAAT,CAAqBC,KAArB,EAA4B;IAC1B,SAAO,OAAOA,KAAP,KAAiB,WAAxB;IACD;IACD;;;;;;;IAOA,IAAIC,SAAS;IACb;IACA,YAAY;IACV,MAAIA,SAAS;IACb;IACA,cAAY;IACV;;;;;;;;;;;IAWA;;;IAGA,aAASA,SAAT,GAAqB;IACnB,WAAKC,aAAL,GAAqB,EAArB;IACA,WAAKC,OAAL,GAAe,EAAf;IACD;IACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BA,QAAIC,MAAM,GAAGH,SAAS,CAACI,SAAvB;;IAEAD,IAAAA,MAAM,CAACE,OAAP,GAAiB,SAASA,OAAT,CAAiBC,SAAjB,EAA4BC,WAA5B,EAAyC;IACxD,UAAIA,WAAW,KAAK,KAAK,CAAzB,EAA4B;IAC1BA,QAAAA,WAAW,GAAG,EAAd;IACD;;IAED,UAAIC,WAAW,GAAG,KAAKP,aAAL,CAAmBK,SAAnB,KAAiC,EAAnD;IACA,UAAIG,cAAc,GAAGD,WAAW,CAACE,MAAZ,GAAqB,CAA1C;;IAEA,UAAI,CAACD,cAAL,EAAqB;IACnB,eAAO,IAAP;IAC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