1"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_toPropertyKey(r.key),r)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!==_typeof(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _createSuper(n){var r=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(n);return _possibleConstructorReturn(this,r?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _possibleConstructorReturn(t,e){if(e&&("object"===_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _wrapNativeSuper(t){var n="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(e,t)})(t)}function _construct(t,e,n){return(_construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);e=new(Function.bind.apply(t,r));return n&&_setPrototypeOf(e,n.prototype),e}).apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function _isNativeFunction(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)} 2/*! 3 * @package Prime Rating - Web Component 4 * @author Abhishek Das <[email protected]> 5 * @copyright Copyright (C) 2012-2024 VirtuePlanet Services LLP. All rights reserved. 6 * @license GNU General Public License version 2 or later; see LICENSE.txt 7 * @link https://www.virtueplanet.com 8 */var PrimeRating=function(){_inherits(n,_wrapNativeSuper(HTMLElement));var e=_createSuper(n);function n(){var t;return _classCallCheck(this,n),(t=e.call(this)).attachShadow({mode:"open"}),t}return _createClass(n,[{key:"max",get:function(){return this._getPositiveNumberAttribute("max",5)},set:function(t){this.setAttribute("max",t)}},{key:"name",get:function(){return this.getAttribute("name")}
8,set:function(t){this.setAttribute("name",t)}},{key:"rating",get:function(){return this._getPositiveNumberAttribute("rating",0)},set:function(t){this.setAttribute("rating",t)}},{key:"half",get:function(){return this._getValidBooleanAttribute("half",!1)},set:function(t){this.setAttribute("half",t)}},{key:"readonly",get:function(){return this._getValidBooleanAttribute("readonly",!1)},set:function(t){this.setAttribute("readonly",t)}},{key:"unratedMsg",get:function(){return this.getAttribute("unrated-msg")},set:function(t){this.setAttribute("unrated-msg",t)}},{key:"hint",get:function(){return this.getAttribute("hint")},set:function(t){this.setAttribute("hint",t)}},{key:"color",get:function(){return this._getValidColorAttribute("color","#000000")},set:function(t){this.setAttribute("color",t)}},{key:"size",get:function(){return this._getPositiveNumberAttribute("size",0)},set:function(t){this.setAttribute("size",t)}},{key:"attributeChangedCallback",value:function(t,e,n){this._render()}},{key:"connectedCallback",value:function(){this._render()}},{key:"disconnectedCallback",value:function(){this.innerHTML=""}},{key:"_render",value:function(){this.innerHTML="";var t,e=document.createElement("div");e.classList.add("container"),this.readonly&&e.classList.add("readonly");for(var n,r=1;r<=this.max;r++)(t=document.createElement("i")).classList.add("star"),t.setAttribute("aria-hidden","true"),t.setAttribute("data-rating",r),!this.readonly&&this.hint&&t.setAttribute("title",r+" "+this.hint),e.append(t);this.readonly?.5<this.rating&&this.hint?e.setAttribute("title",this.hint+" "+this.rating):this.rating<.5&&this.unratedMsg&&e.setAttribute("title",this.unratedMsg):this.name&&((n=document.createElement("input")).setAttribute("type","hidden"),n.setAttribute("name",this.name),n.setAttribute("value",this.rating),this.appendChild(n)),this.shadowRoot.innerHTML=this._getStyles(),this.shadowRoot.append(e),this._setStarRating(this.rating),this.readonly||this._bindEvents()}},{key:"_setStarRating",value:function(t){for(var e,n=this.shadowRoot.querySelector(".container"),r=t,i=0;i<this.max;i++)(e=n.children[i]).classList.remove("star-full"),e.classList.remove("star-half"),0<r&&(this.half&&r<1&&r<=.5?e.classList.add("star-half"):.5<r&&e.classList.add("star-full")),r--}},{key:"_bindEvents",value:function(){this.shadowRoot.querySelector(".container").addEventListener("mouseover",this._bindMouseover.bind(this)),this.shadowRoot.querySelector(".container").addEventListener("mouseleave",this._bindMouseleave.bind(this)),this.shadowRoot.querySelector(".container").addEventListener("click",this._bindClick.bind(this))}},{key:"_bindMouseover",value:function(t){if(!t.target)return!1;t.target.classList.contains("star")&&(t=t.target.dataset.rating,this._setStarRating(t))}},{key:"_bindMouseleave",value:function(){this._setStarRating(this.rating)}},{key:"_bindClick",value:function(t){if(!t.target)return!1;t.target.classList.contains("star")&&(t=t.target.dataset.rating,this.rating=t,this._setStarRating(t),t=this.querySelector("input[type='hidden']"))&&t.setAttribute("value",this.rating)}},{key:"_getPositiveNumberAttribute",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,t=this.getAttribute(t);return!(t=t?parseFloat(t):0)||t<0?e:t}},{key:"_getValidBooleanAttribute",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],t=this.getAttribute(t);return t="true"===(t=null===t?e:t)||"TRUE"===t||"1"===t}},{key:"_getValidColorAttribute",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"#000000",t=this.getAttribute(t),n=(new Option).style;return n.color=t,(""!=n.color?n.color:e).replace("#","%23")}},{key:"_getStyles",value:function(){return"\n <style>\n .container {\n display: inline-block;\n }\n .star {\n display: inline-block;\n width: ".concat(this.size,"px;\n height: ").concat(this.size,"px;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='").concat(this.color,"' viewBox='0 0 16 16'%3E%3Cpath d='M16 6.204l-5.528-0.803-2.472-5.009-2.472 5.009-5.528 0.803 4 3.899-0.944 5.505 4.944-2.599 4.944 2.599-0.944-5.505 4-3.899zM8 11.773l-3.492 1.836 0.667-3.888-2.825-2.753 3.904-0.567 1.746-3.537 1.746 3.537 3.904 0.567-2.825 2.753 0.667 3.888-3.492-1.836z'%3E%3C/path%3E%3C/svg%3E%0A\");\n background-repeat: no-repeat;\n background-color: transparent;\n background-position: 50% 50%;\n background-size: contain;\n margin-right: 2px;\n }\n .star-full {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='").concat(this.color,"' viewBox='0 0 16 16'%3E%3Cpath d='M16 6.204l-5.528-0.803-2.472-5.009-2.472 5.009-5.528 0.803 4 3.899-0.944 5.505 4.944-2.599 4.944 2.599-0.944-5.505 4-3.899z'%3E%3C/path%3E%3C/svg%3E\");\n }\n .star-half {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='").concat(this.color,"' viewBox='0 0 16 16'%3E%3Cpath d='M16 6.204l-5.528-0.803-2.472-5.009-2.472 5.009-5.528 0.803 4 3.899-0.944 5.505 4.944-2.599 4.944 2.599-0.944-5.505 4-3.899zM8 11.773l-0.015 0.008 0.015-8.918 1.746 3.537 3.904 0.567-2.825 2.753 0.667 3.888-3.492-1.836z'%3E%3C/path%3E%3C/svg%3E%0A\");\n }\n .container:not(.readonly) .star {\n cursor: pointer;\n }\n </style>\n ")}}],[{key:"observedAttributes",get:function(){return["max","name","rating","half","readonly","unrated-msg","hint","color","size"]}}]),n}();window.customElements.define("prime-rating",PrimeRating);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.