text: /**
   * Copyright © Magento, Inc. All rights reserved.
   * See COPYING.txt for license details.
   */
  
  define([
      'jquery',
      'ko',
      'uiComponent',
      'underscore',
      'Magento_Checkout/js/action/select-shipping-address',
      'Magento_Checkout/js/model/quote',
      'Magento_Checkout/js/model/shipping-address/form-popup-state',
      'Magento_Checkout/js/checkout-data',
      'Magento_Customer/js/customer-data'
  ], function ($, ko, Component, _, selectShippingAddressAction, quote, formPopUpState, checkoutData, customerData) {
      'use strict';
  
      var countryData = customerData.get('directory-data');
  
      return Component.extend({
          defaults: {
              template: 'Magento_Checkout/shipping-address/address-renderer/default'
          },
  
          /** @inheritdoc */
          initObservable: function () {
              this._super();
              this.isSelected = ko.computed(function () {
                  var isSelected = false,
                      shippingAddress = quote.shippingAddress();
  
                  if (shippingAddress) {
                      isSelected = shippingAddress.getKey() == this.address().getKey(); //eslint-disable-line eqeqeq
                  }
  
                  return isSelected;
              }, this);
  
              return this;
          },
  
          /**
           * @param {String} countryId
           * @return {String}
           */
          getCountryName: function (countryId) {
              return countryData()[countryId] != undefined ? countryData()[countryId].name : ''; //eslint-disable-line
          },
  
          /**
           * Get customer attribute label
           *
           * @param {*} attribute
           * @returns {*}
           */
          getCustomAttributeLabel: function (attribute) {
              var resultAttribute;
  
              if (typeof attribute === 'string') {
                  return attribute;
              }
  
              if (attribute.label) {
                  return attribute.label;
              }
  
              resultAttribute = _.findWhere(this.source.get('customAttributes')[attribute['attribute_code']], {
                  value: attribute.value
              });
  
              return resultAttribute && resultAttribute.label || attribute.value;
          },
  
          /** Set selected customer shipping address  */
          selectAddress: function () {
              selectShippingAddressAction(this.address());
              checkoutData.setSelectedShippingAddress(this.address().getKey());
          },
  
          /**
           * Edit address.
           */
          editAddress: function () {
              formPopUpState.isVisible(true);
              this.showPopup();
  
          },
  
          /**
           * Show popup.
           */
          showPopup: function () {
              $('[data-open-modal="opc-new-shipping-address"]').trigger('click');
          }
      });
  });
  