'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index$1 = require('./index-9a9efa1c.js');
const index = require('./index-a8de2b09.js');
const data = require('./data-4380242c.js');
const box_label = require('./box_label-bc4011bb.js');

// Read more about how stencil stores work here: https://stenciljs.com/docs/stencil-store
const { state, onChange } = index.createStore({
    i18n: {
        maxweightlabel: '',
        weightlabel: '',
        maxmeasurementlabel: '',
        sizeheading: '',
        senddirectcta: '',
        stampshopcta: '',
    },
    market: {
        currency: '',
    },
});

const pnProductPricelistResultCss = "pn-button-dropdown .pn-button-dropdown>pn-button>.pn-button{min-height:initial}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}@media screen and (max-width: 767px){.sr-only-mobile{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}}";
const PnProductPricelistResultStyle0 = pnProductPricelistResultCss;

const PnFindProductPricelistResult = class {
    constructor(hostRef) {
        index$1.registerInstance(this, hostRef);
        this.item = null;
        this.description = [];
        this.shownitems = [];
        this.showMeasurement = false;
        this.weightText = '';
    }
    componentWillLoad() {
        this.composeItems();
    }
    composeItems() {
        if (this.item.description) {
            this.description = this.item.description.split('#bullet').filter(x => x !== '');
        }
        this.showMeasurement = this.item.maxmått !== null || this.item.rulle !== null;
        this.shownitems = [this.item];
        // if (this.item.pricestamps) {
        //   this.shownitems.push({...this.item, priceagent: null, pricesenddirect: null});
        // }
        // if (this.item.priceagent) {
        //   this.shownitems.push({...this.item, pricestamps: null, pricesenddirect: null});
        // }
        // if (this.item.pricesenddirect) {
        //   this.shownitems.push({...this.item, pricestamps: null, priceagent: null});
        // }
        // // Parcels are always in KG. Letter KG must be converted from grams
        // this.weightText = (this.item.what === "parcel") ? this.item.maxweight + 'kg' :
        // (this.item.what === "letter" && this.item.maxweight > 999) ? Math.round(this.item.maxweight/1000) + " kg" : this.item.maxweight + " g";
    }
    render() {
        return (index$1.h(index$1.Host, { key: '0174101aee0ddd39c8d6aa8eda2c7e5a107675f9' }, this.shownitems.map(item => (index$1.h("pn-product-card", { "data-productid": item.id }, index$1.h("pn-illustration", { slot: "illustration", illustration: this.item.illustration }), index$1.h("div", { slot: "title" }, index$1.h("h2", null, item.name, " "), this.item.highestrankusp ? (this.item.highestrankusp === 'Billigast' ? (index$1.h("pn-titletag", { slot: "Billigast", icon: box_label.box_label }, this.item.highestrankusp)) : (index$1.h("pn-titletag", { slot: "Snabbast", icon: box_label.bolt, color: "blue700" }, this.item.highestrankusp))) : null), index$1.h("div", { slot: "content" }, index$1.h("div", { class: "content" }, this.item.description ? (index$1.h("div", { class: "description" }, this.description.map(desc => (index$1.h("li", null, desc))))) : null, this.item.info ? index$1.h("div", { class: "description" }, this.item.info) : null)), this.item.note ? (index$1.h("small", { slot: "note" }, index$1.h("p", null, this.item.note))) : null, this.item.additionalusp ? (index$1.h("div", { slot: "additionalUSP" })) : null, this.showMeasurement ? index$1.h("pn-product-card-info", { paket: this.item.maxmått, rulle: this.item.rulle }) : null, index$1.h("div", { slot: "cardprice" }, this.item.pricesenddirect ? (index$1.h("pn-product-card-price", { slot: "sendDirectPrice", label: state.i18n.senddirectcta, amount: this.item.pricesenddirect + '', currency: state.market.currency, url: data.sendDirectUrl, service: this.item.name + '-portal' })) : null, this.item.pricestamps ? (index$1.h("pn-product-card-price", { slot: "stampPrice", label: state.i18n.stampshopcta, amount: this.item.pricestamps + '', currency: state.market.currency, url: data.stampShopUrl, service: this.item.name + '-eshop' })) : null))
        // <pn-product-tile>
        //   <pn-illustration slot="illustration" illustration={ item.illustration }></pn-illustration>
        //   <div slot="content">
        //     <div class="content">
        //       <h3>{item.name}</h3>
        //       {(item.description) ? (<div class="description">{item.description}</div>) : null}
        //       {(item.info) ? (<div class="description">{item.info}</div>) : null}
        //     </div>
        //   </div>
        //   { item.maxweight ? (<pn-product-tile-info label={state.i18n.maxweightlabel} text={this.weightText}></pn-product-tile-info>) : null }
        //   {/* { item.maximummeasurements ? (<pn-product-tile-info label={state.i18n.maxmeasurementlabel} text={item.maximummeasurements}></pn-product-tile-info>) : null } */}
        //   { item.pricestamps ? (<pn-product-tile-price slot="price" label={state.i18n.stampshopcta} amount={item.pricestamps+''} currency={ state.market.currency }></pn-product-tile-price>) : null }
        //   {/* { item.priceagent ? (<pn-product-tile-price slot="price" label="" amount={item.priceagent+''} currency={ state.market.currency } url="https://shop.postnord.se/ebutik/default.aspx"></pn-product-tile-price>) : null } */}
        //   { item.pricesenddirect ? (<pn-product-tile-price slot="price" label={state.i18n.senddirectcta} amount={item.pricesenddirect+''} currency={ state.market.currency } url="https://portal.postnord.com/skickadirekt/"></pn-product-tile-price>) : null }
        //   { item.note ? (<small slot="note"><p>{item.note}</p></small>) : null }
        // </pn-product-tile>
        ))));
    }
    static get watchers() { return {
        "item": ["composeItems"]
    }; }
};
PnFindProductPricelistResult.style = PnProductPricelistResultStyle0;

exports.pn_product_pricelist_result = PnFindProductPricelistResult;

//# sourceMappingURL=pn-product-pricelist-result.cjs.entry.js.map