text: import{html,PolymerElement}from"../../@polymer/polymer/polymer-element.js";import{HAXWiring}from"../hax-body-behaviors/lib/HAXWiring.js";import{CountUp}from"../../countup.js/dist/countUp.min.js";class CountUpElement extends PolymerElement{static get template(){return html`
        <style>
          :host {
            display: inline-flex;
            --count-up-color: #000000;
          }
  
          :host([hidden]) {
            display: none;
          }
  
          .wrapper {
            display: block;
            text-align: center;
            width: 100%;
            height: 100%;
          }
  
          #counter {
            color: var(--count-up-color);
            @apply --count-up-number;
          }
        </style>
        <div class="wrapper">
          <slot name="prefix"></slot>
          <div id="counter"></div>
          <slot name="suffix"></slot>
        </div>
      `}static get haxProperties(){return{canScale:!0,canPosition:!0,canEditSource:!1,gizmo:{title:"Count up",description:"count up js wrapper with minimal styling",icon:"icons:android",color:"green",groups:["Up"],handles:[{type:"todo:read-the-docs-for-usage"}],meta:{author:"btopro",owner:"The Pennsylvania State University"}},settings:{quick:[],configure:[{property:"start",description:"",inputMethod:"textfield"},{property:"end",description:"",inputMethod:"textfield"},{property:"duration",description:"",inputMethod:"textfield"},{property:"noeasing",description:"",inputMethod:"boolean"},{property:"decimalplaces",description:"",inputMethod:"textfield"},{property:"separator",description:"",inputMethod:"textfield"},{property:"decimal",description:"",inputMethod:"textfield"},{property:"prefix",description:"",inputMethod:"textfield"},{property:"suffix",description:"",inputMethod:"textfield"}],advanced:[]}}}static get properties(){let props={start:{name:"start",type:Number,value:0},end:{name:"end",type:Number,value:100},duration:{name:"duration",type:Number,value:2.5},noeasing:{name:"noeasing",type:Boolean,value:!1},decimalplaces:{name:"decimalPlaces",type:Number,value:0},separator:{name:"separator",type:String,value:","},decimal:{name:"decimal",type:String,value:"."},prefixtext:{name:"prefixtext",type:String,value:" "},suffixtext:{name:"suffixtext",type:String,value:" "},thresholds:{type:Array,value:[0,.25,.5,.75,1]},rootMargin:{type:String,value:"0px"},ratio:{type:Number,reflectToAttribute:!0,readOnly:!0},visibleLimit:{type:Number,value:.5,reflectToAttribute:!0}};return super.properties&&(props=Object.assign(props,super.properties)),props}static get tag(){return"count-up"}connectedCallback(){super.connectedCallback(),this.HAXWiring=new HAXWiring,this.HAXWiring.setup(CountUpElement.haxProperties,CountUpElement.tag,this),this.observer=new IntersectionObserver(this.handleIntersectionCallback.bind(this),{root:document.rootElement,rootMargin:this.rootMargin,threshold:this.thresholds}),this.observer.observe(this);const options={startVal:this.start,decimalPlaces:this.decimalplaces,duration:this.duration,useEasing:!this.noeasing,separator:this.separator,decimal:this.decimal,prefix:this.prefixtext,suffix:this.suffixtext};this._countUp=new CountUp(this.$.counter,this.end,options)}handleIntersectionCallback(entries){for(let entry of entries)this._setRatio(Number(entry.intersectionRatio).toFixed(2)),this.ratio>=this.visibleLimit&&this._countUp.start()}}customElements.define(CountUpElement.tag,CountUpElement);export{CountUpElement,CountUp};