"use strict";var e=require("@kdcloudjs/kwc"),t=require("../kddsUtilsTruncation-BZ8KpmAj.js"),s=require("../i18n-CP31jeWH.js"),r=require("./shadowBaseClassPrivate.js");require("../observable-BXDJFaLN.js");var i=require("../normalize-DKPi18vK.js"),a=require("../AddressFormat-DKKW6OtZ.js");require("../intlFormat-Bs-dlvDH.js"),require("./configProvider.js"),require("./utilsPrivate.js"),require("../client-Co_j5m_k.js"),require("../ssr-RXknEJpO.js"),require("./iso8601Utils.js"),require("../colorValid-BBnkvgd_.js"),require("../empty_html-hFq4zm9t.js"),require("./i18nCldrOptions.js"),require("./i18nService.js"),require("./features.js"),require("../classSet-B5xuJbNb.js"),require("../labelUtils-C2UzbgdZ.js"),require("../label-DdXuOVTE.js");var n=[[t.stylesheet4]];const o=e.parseFragment`<div${"c0"}${2}>${"t1"}</div>`,l=e.parseFragment`<div${"c0"}${2}>${"t1"}</div>`,d=[];function u(e,t,s,r){const{ncls:i,k:a,d:n,sp:u,st:c,i:h,f:p,ti:g,h:m}=e;return p([t.showPlainText?p([h(t.addressLines,function(e){return c(o,a(1,e),[u(0,{className:i(t.computedAddressLineClass)},null),u(1,null,n(e))])})]):d,t.showMapLink?m("a",{attrs:{"aria-label":t.computedAriaLabel,href:t.mapUrl,tabindex:g(t.internalTabIndex),target:"_blank",rel:"noopener"},key:2},p([h(t.addressLines,function(e){return c(l,a(4,e),[u(0,{className:i(t.computedAddressLineClass)},null),u(1,null,n(e))])})])):null])}var c=e.registerTemplate(u);u.stylesheets=[],u.stylesheetToken="kwc-4fumc8oc7m0",u.legacyStylesheetToken="D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\formattedAddress-undefined_formattedAddress",n&&u.stylesheets.push.apply(u.stylesheets,n),e.freezeTemplate(u);const h="truncate";class p extends r{constructor(...e){super(...e),this.state={street:"",city:"",province:"",country:"",postalCode:"",latitude:"",longitude:"",disabled:!1},this.href=void 0,this.locale=s.locale,this._showStaticMap=void 0}get street(){return this.state.street}set street(e){this.state.street=e}get city(){return this.state.city}set city(e){this.state.city=e}get province(){return this.state.province}set province(e){this.state.province=e}get country(){return this.state.country}set country(e){this.state.country=e}get postalCode(){return this.state.postalCode}set postalCode(e){this.state.postalCode=e}get latitude(){return this.state.latitude}set latitude(e){this.state.latitude=e}get longitude(){return this.state.longitude}set longitude(e){this.state.longitude=e}get disabled(){return this.state.disabled}set disabled(e){this.state.disabled=i.normalizeBoolean(e)}get variant(){return this._variant||h}set variant(e){this._variant=i.normalizeString(e,{fallbackValue:h,validValues:[h,"plain"]})}get showStaticMap(){return this._showStaticMap||!1}set showStaticMap(e){this._showStaticMap=i.normalizeBoolean(e)}click(){this.addressLink&&this.addressLink.click()}get showPlainText(){return this.hasValue&&this.isPlainText}get showMapLink(){return this.hasValue&&this.isMapLink}get isPlainText(){return this.disabled}get isMapLink(){return!this.disabled}get hasValue(){return!!(this.street||this.city||this.province||this.country||this.postalCode)}get address(){const[e,t]=this.locale.split("-");return a.address.formatAddressAllFields(e,t,{address:this.street,city:this.city,state:this.province,country:this.country,zipCode:this.postalCode})||""}get addressLines(){return this.address.split("\n")}get mapQuery(){const{address:e,latitude:t,longitude:s}=this;return t&&s?`${t},${s}`:e}get computedAriaLabel(){return this.address}get internalTabIndex(){return this.getAttribute("tabindex")}get mapUrl(){return encodeURI("https://www.google.com/maps?q=")+encodeURIComponent(this.mapQuery)}get addressLink(){return this.template.querySelector("a")}get computedAddressLineClass(){return this.variant===h?"kdds-truncate":null}}e.registerDecorators(p,{publicProps:{locale:{config:0},street:{config:3},city:{config:3},province:{config:3},country:{config:3},postalCode:{config:3},latitude:{config:3},longitude:{config:3},disabled:{config:3},variant:{config:3},showStaticMap:{config:3}},publicMethods:["click"],track:{state:1,href:1,_showStaticMap:1}});const g=e.registerComponent(p,{tmpl:c,sel:"D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\formattedAddress-",apiVersion:63});module.exports=g;
