'use strict';

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

const index = require('./index-9a9efa1c.js');
const pnFindServiceAndPriceStore = require('./pn-find-service-and-price-store-1b5945fe.js');
require('./index-a8de2b09.js');

const pnFindServiceAndPriceResultCss = "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 PnFindServiceAndPriceResultStyle0 = pnFindServiceAndPriceResultCss;

const PnfindServiceAndPriceResult = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.item = null;
        this.shownitems = [];
        this.weightText = '';
    }
    componentWillLoad() {
        this.composeItems();
    }
    composeItems() {
        this.shownitems = [this.item];
        // this.shownitems = [];
        // 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.h(index.Host, { key: 'bf4e52c4adcba72ffeb9063b1fd30dafe6fa39eb' }, this.shownitems.map(item => (index.h("pn-product-card", null, index.h("pn-illustration", { slot: "illustration", illustration: item.illustration }), index.h("div", { slot: "content" }, index.h("div", { class: "content" }, index.h("h3", null, item.name), item.description ? index.h("div", { class: "description" }, item.description) : null, item.info ? index.h("div", { class: "description" }, item.info) : null)), item.maxweight ? index.h("pn-product-tile-info", { label: pnFindServiceAndPriceStore.state.i18n.maxweightlabel, text: this.weightText }) : null, item.pricestamps ? (index.h("pn-product-tile-price", { slot: "price", label: pnFindServiceAndPriceStore.state.i18n.stampshopcta, amount: item.pricestamps + '', currency: pnFindServiceAndPriceStore.state.market.currency })) : null, item.pricesenddirect ? (index.h("pn-product-tile-price", { slot: "price", label: pnFindServiceAndPriceStore.state.i18n.senddirectcta, amount: item.pricesenddirect + '', currency: pnFindServiceAndPriceStore.state.market.currency, url: "https://portal.postnord.com/skickadirekt/" })) : null, item.note ? (index.h("small", { slot: "note" }, index.h("p", null, item.note))) : null)))));
    }
    static get watchers() { return {
        "item": ["composeItems"]
    }; }
};
PnfindServiceAndPriceResult.style = PnFindServiceAndPriceResultStyle0;

exports.pn_find_service_and_price_result = PnfindServiceAndPriceResult;

//# sourceMappingURL=pn-find-service-and-price-result.cjs.entry.js.map