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AAW;aACvB;YACD,MAAM,EAAE;gBACP,MAAM,EAAE,IAAI,CAAC,YAAY;gBACzB,IAAI,EAAE,IAAI,CAAC,UAAU;gBACrB,GAAG,EAAE,IAAI,CAAC,SAAS;gBACnB,KAAK,EAAE,IAAI,CAAC,WAAW;aACvB;YACD,QAAQ,EAAE;gBACT,MAAM,EAAE,kBAAkB,CAAC,MAAM;gBACjC,IAAI,EAAE,kBAAkB,CAAC,IAAI;gBAC7B,KAAK,EAAE,kBAAkB,CAAC,KAAK;gBAC/B,GAAG,EAAE,kBAAkB,CAAC,GAAG;aAC3B;YACD,MAAM,EAAE;gBACP,MAAM,EAAE,IAAI,CAAC,YAAY;gBACzB,IAAI,EAAE,IAAI,CAAC,UAAU;gBACrB,GAAG,EAAE,IAAI,CAAC,SAAS;gBACnB,KAAK,EAAE,IAAI,CAAC,WAAW;aACvB;YACD,IAAI,EAAE;gBACL,KAAK,EAAE,kBAAkB,CAAC,KAAK;gBAC/B,MAAM,EAAE,kBAAkB,CAAC,MAAM;aACjC;SACD,CAAC;IACH,CAAC;CACD;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { Base } from './Base';\nimport { deepAssign } from '@dojo/core/lang';\n\nexport interface TopLeft {\n\tleft: number;\n\ttop: number;\n}\n\nexport interface BottomRight {\n\tbottom: number;\n\tright: number;\n}\n\nexport interface Size {\n\theight: number;\n\twidth: number;\n}\n\nexport interface DimensionResults {\n\tposition: TopLeft & BottomRight;\n\toffset: TopLeft & Size;\n\tsize: Size;\n\tscroll: TopLeft & Size;\n\tclient: TopLeft & Size;\n}\n\nconst defaultDimensions = {\n\tclient: {\n\t\theight: 0,\n\t\tleft: 0,\n\t\ttop: 0,\n\t\twidth: 0\n\t},\n\toffset: {\n\t\theight: 0,\n\t\tleft: 0,\n\t\ttop: 0,\n\t\twidth: 0\n\t},\n\tposition: {\n\t\tbottom: 0,\n\t\tleft: 0,\n\t\tright: 0,\n\t\ttop: 0\n\t},\n\tscroll: {\n\t\theight: 0,\n\t\tleft: 0,\n\t\ttop: 0,\n\t\twidth: 0\n\t},\n\tsize: {\n\t\twidth: 0,\n\t\theight: 0\n\t}\n};\n\nexport class Dimensions extends Base {\n\tpublic get(key: string | number): Readonly<DimensionResults> {\n\t\tconst node = this.getNode(key) as HTMLElement;\n\n\t\tif (!node) {\n\t\t\treturn deepAssign({}, defaultDimensions);\n\t\t}\n\n\t\tconst boundingDimensions = node.getBoundingClientRect();\n\n\t\treturn {\n\t\t\tclient: {\n\t\t\t\theight: node.clientHeight,\n\t\t\t\tleft: node.clientLeft,\n\t\t\t\ttop: node.clientTop,\n\t\t\t\twidth: node.clientWidth\n\t\t\t},\n\t\t\toffset: {\n\t\t\t\theight: node.offsetHeight,\n\t\t\t\tleft: node.offsetLeft,\n\t\t\t\ttop: node.offsetTop,\n\t\t\t\twidth: node.offsetWidth\n\t\t\t},\n\t\t\tposition: {\n\t\t\t\tbottom: boundingDimensions.bottom,\n\t\t\t\tleft: boundingDimensions.left,\n\t\t\t\tright: boundingDimensions.right,\n\t\t\t\ttop: boundingDimensions.top\n\t\t\t},\n\t\t\tscroll: {\n\t\t\t\theight: node.scrollHeight,\n\t\t\t\tleft: node.scrollLeft,\n\t\t\t\ttop: node.scrollTop,\n\t\t\t\twidth: node.scrollWidth\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\twidth: boundingDimensions.width,\n\t\t\t\theight: boundingDimensions.height\n\t\t\t}\n\t\t};\n\t}\n}\n\nexport default Dimensions;\n"]}