<html><head></head><body>{"version":3,"file":"score-image.js","sources":["../../../../src/components/score/score-image/score-image.ts"],"sourcesContent":["import { TemplateResult, html, css } from 'lit';\nimport { OutlineElement } from '../../base/outline-element/outline-element';\nimport { customElement } from 'lit/decorators.js';\n\n/**\n * The Score image component\n * @element score-image\n * @slot - default\n */\n@customElement('score-image')\nexport class scoreImage extends OutlineElement {\n /**\n * From the spec (http://www.w3.org/TR/cssom-view/#dom-element-clientwidth)\n *\n * The clientWidth attribute must run these steps:\n * If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.\n *\n * :host (parent of img) is given display: block, so it has a layout box\n */\n static styles = css`\n :host {\n display: block;\n height: 100%;\n }\n `;\n\n firstUpdated() {\n this.resizer();\n }\n\n // code adopted to TS from easy_responsive_images JS file - https://git.drupalcode.org/project/easy_responsive_images/-/blob/1.3.x/js/resizer.js\n resizer() {\n // Fetch all images containing a \"data-srcset\" attribute.\n const images = this.querySelectorAll(\n 'img[data-srcset]'\n ) as NodeListOf<htmlimageelement>;\n\n // Find the best suitable image to display.\n const updateImage = function (image: HTMLImageElement) {\n const imgWidth = Math.floor(image.clientWidth);\n const parentWidth = Math.floor(\n (image.parentNode as HTMLElement).clientWidth\n );\n const availableWidth = parentWidth > imgWidth ? parentWidth : imgWidth;\n const attrWidth = image.getAttribute('width');\n //const attrHeight = image.getAttribute('height');\n const sources = image.getAttribute('data-srcset')?.split(',');\n const currentSrc = image.getAttribute('src');\n\n // If the selected image is already bigger than the available width,\n // we do not update the image.\n if (attrWidth && +attrWidth > availableWidth) {\n return;\n }\n\n // Find the best matching source based on actual image space.\n let source!: string;\n let responsiveImgPath!: string;\n let responsiveImgWidth!: string;\n\n for (source of sources!) {\n const array = source.split(' ');\n responsiveImgPath = array[0];\n responsiveImgWidth = array[1].slice(0, -1);\n if (availableWidth < +responsiveImgWidth) {\n break;\n }\n }\n\n if (responsiveImgPath === currentSrc) {\n return;\n }\n\n // Clear the image src attribute to force the image to update and work\n // around browser caching issues.\n image.src = '';\n\n // Update the \"src\" with the new image and also set the \"width\"\n // attribute to easily check if we need a new image after resize.\n image.src = responsiveImgPath;\n image.setAttribute('width', responsiveImgWidth);\n image.setAttribute('height', '100%');\n\n // Interpolate height from new width to prevent layout shift\n // if (attrWidth && attrHeight) {\n // image.setAttribute(\n // 'height',\n // Math.round(\n // (parseInt(responsiveImgWidth) * parseInt(attrHeight)) /\n // parseInt(attrWidth)\n // ).toString()\n // );\n // }\n\n // easy_responsive_images sets <img height=""/> property. We need to either\n // update it to the natural image height if available, or remove the\n // property entirely if not available.\n // const naturalImageHeight = image.naturalHeight;\n // if (naturalImageHeight > 0) {\n // image.setAttribute('height', naturalImageHeight.toString());\n // } else {\n // image.removeAttribute('height');\n // }\n // image.removeAttribute('height');\n\n // Update the image width/height onload to make it easier for the\n // browser to show the image.\n image.onload = function () {\n const onloadImage = this as HTMLImageElement;\n onloadImage.setAttribute('width', Math.floor(onloadImage.width) + '');\n };\n };\n\n // Create a ResizeObserver to update the image \"src\" attribute when its\n // parent container resizes.\n const observer = new ResizeObserver(entries => {\n for (const entry of entries) {\n const images = entry.target.querySelectorAll(\n 'img[data-srcset]'\n ) as NodeListOf<htmlimageelement>;\n images.forEach(image => {\n updateImage(image);\n });\n }\n });\n\n // Attach the ResizeObserver to the image containers.\n images.forEach(image => {\n updateImage(image);\n observer.observe(image.parentNode as HTMLElement);\n });\n }\n\n render(): TemplateResult {\n return html` <slot></slot> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'score-image': scoreImage;\n }\n}\n"],"names":["scoreImage","OutlineElement","firstUpdated","this","resizer","images","querySelectorAll","updateImage","image","imgWidth","Math","floor","clientWidth","parentWidth","parentNode","availableWidth","attrWidth","getAttribute","sources","_a","split","currentSrc","source","responsiveImgPath","responsiveImgWidth","array","slice","src","setAttribute","onload","width","observer","ResizeObserver","entries","entry","target","forEach","observe","render","html","styles","css","__decorate","customElement"],"mappings":"owBAUO,IAAMA,EAAN,cAAyBC,EAgB9BC,eACEC,KAAKC,SACN,CAGDA,UAEE,MAAMC,EAASF,KAAKG,iBAClB,oBAIIC,EAAc,SAAUC,SAC5B,MAAMC,EAAWC,KAAKC,MAAMH,EAAMI,aAC5BC,EAAcH,KAAKC,MACtBH,EAAMM,WAA2BF,aAE9BG,EAAiBF,EAAcJ,EAAWI,EAAcJ,EACxDO,EAAYR,EAAMS,aAAa,SAE/BC,EAA6C,QAAnCC,EAAAX,EAAMS,aAAa,sBAAgB,IAAAE,OAAA,EAAAA,EAAAC,MAAM,KACnDC,EAAab,EAAMS,aAAa,OAItC,GAAID,IAAcA,EAAYD,EAC5B,OAIF,IAAIO,EACAC,EACAC,EAEJ,IAAKF,KAAUJ,EAAU,CACvB,MAAMO,EAAQH,EAAOF,MAAM,KAG3B,GAFAG,EAAoBE,EAAM,GAC1BD,EAAqBC,EAAM,GAAGC,MAAM,GAAI,GACpCX,GAAkBS,EACpB,KAEH,CAEGD,IAAsBF,IAM1Bb,EAAMmB,IAAM,GAIZnB,EAAMmB,IAAMJ,EACZf,EAAMoB,aAAa,QAASJ,GAC5BhB,EAAMoB,aAAa,SAAU,QA0B7BpB,EAAMqB,OAAS,WACO1B,KACRyB,aAAa,QAASlB,KAAKC,MADnBR,KACqC2B,OAAS,GACpE,EACF,EAIMC,EAAW,IAAIC,gBAAeC,IAClC,IAAK,MAAMC,KAASD,EAAS,CACZC,EAAMC,OAAO7B,iBAC1B,oBAEK8B,SAAQ5B,IACbD,EAAYC,EAAM,GAErB,KAIHH,EAAO+B,SAAQ5B,IACbD,EAAYC,GACZuB,EAASM,QAAQ7B,EAAMM,WAA0B,GAEpD,CAEDwB,SACE,OAAOC,CAAI,iBACZ,GApHMvC,EAAMwC,OAAGC,CAAG;;;;;IATRzC,EAAU0C,EAAA,CADtBC,EAAc,gBACF3C"}</htmlimageelement></htmlimageelement><style> .hidden { display: none; } </style> <a href="http://web-sitemap.bfbqq.net" class="hidden">青岛新闻网</a> <a href="http://www.asungroup.com" class="hidden">Sun-City-feedback@asungroup.com</a> <a href="http://www.rf518.com" class="hidden">Gaming-platform-media@rf518.com</a> <a href="http://www.mygril-yaoyao.com" class="hidden">皇冠博彩</a> <a href="http://wvnnjw.epmf.net" class="hidden">留学网</a> <a href="http://eykrwu.bryleegadgets.net" class="hidden">汕头赶集网</a> <a href="http://www.cceweb.net" class="hidden">博彩平台大全</a> <a href="http://web-sitemap.cndg88.com" class="hidden">上海保姆网</a> <a href="http://christianwomengifts.net" class="hidden">PClady摩登学院</a> <a href="http://agzrer.scionmotors.com" class="hidden">华夏婴童网</a> <a href="http://www.waki-aiai.net" class="hidden">Sun-City-support@waki-aiai.net</a> <a href="http://www.smxjjl.com" class="hidden">Sports-in-Sabah-billing@smxjjl.com</a> <a href="http://www.pronewport.com" class="hidden">Sun-City-hr@pronewport.com</a> <a href="http://www.vko29.com" class="hidden">365-Sports-Betting-billing@vko29.com</a> <a href="http://hwgiss.at-funeral.com" class="hidden">无性婚姻网</a> <a href="http://www.pf168shop.com" class="hidden">Sabah-online-platform-hr@pf168shop.com</a> <a href="http://www.uc1112.com" class="hidden">Venetian-gambling-info@uc1112.com</a> <a href="http://jnhgib.ct-mall.com" class="hidden">黄河农村商业银行</a> <a href="http://www.yibangyi.net" class="hidden">365bet中文</a> <a href="http://www.babyfeedingshop.com" class="hidden">欧洲杯买球</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=科普一下det365亚洲版的百科✔️网址:la666.net✔️科普一下det365亚洲版的百科✔️网址:la666.net✔️.nzq" class="hidden">环球56在线</a> <a href="https://stock.adobe.com/search/images?k=>>✔️最新网址:ad22.net✔️手输<<信誉在线赌博亚洲体育博彩网站" class="hidden">IQ测试</a> <a href="https://m.facebook.com/public/✔️网址:ad11.net✔️雷竞技raybet官网✔️网址:ad11.net✔️雷竞技raybet官网.lkx" class="hidden">赢在路上教育培训学校</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=✔️最新网址:la55.net✔️raybet雷电竞平台介绍.ftq" class="hidden">脸盆网</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=✔️网址:la66.net✔️(关于澳门威尼斯人app下载的简介)澳门威尼斯人app下载.mnq" class="hidden">旺成科技</a> <a href="https://stock.adobe.com/search?k=✔️网址:ad11.net✔️科普一下赌博平台大全登陆官方网址澳门的百科.bck" class="hidden">52pk梦幻龙族2官方合作专区</a> <a href="https://es-la.facebook.com/public/十大正规赌博网站排名-维基百科✔️网址:la66.net✔️.gyq" class="hidden">宜搜</a> <a href="https://stock.adobe.com/search?k=✔️网址:la666.net✔️科普一下最正规体育博彩最全赌博网站的百科" class="hidden">环球黑卡</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=kb体育app官方下载>>✔️最新网址:la55.net✔️手输<<.yxb" class="hidden">微步信息</a> <a href="https://m.facebook.com/public/pg电子麻将胡了2体验版平台介绍✔️网址:la666.net✔️pg电子麻将胡了2体验版平台介绍✔️网址:la666.net✔️" class="hidden">途牛南京旅游网</a> <a href="/cn/yyypfj-767101" class="hidden">中国政协新闻网</a> <a href="/sttcs/hot-news/unalliedly.html" class="hidden">不凡游戏网</a> <a href="/html/cjjifc-731005" class="hidden">比一比装修网</a> <a href="/sttcs/hot-news/traceability.html" class="hidden">陶家居商城</a> <a href="/sttcs/hot-news/abietate.html" class="hidden">杭州吉屋网</a> </body></html>