import{parseFragment as t,registerTemplate as e,freezeTemplate as s,registerDecorators as i,registerComponent as r}from"@kdcloudjs/kwc";import{s as l}from"../kddsCommon-CucK_w70.js";import o from"./shadowBaseClassPrivate.js";import"../observable-tloG64m6.js";import"../i18n-B98kiI7M.js";import{C as c}from"../utilsPrivate-CI3EeA5x.js";import{updateRawLinkInfo as a}from"./routingService.js";import"../client-Ddi3i8XR.js";import"../ssr-C2pjZzfv.js";import"../empty_html-CjXB8rB4.js";import"./iso8601Utils.js";import"../colorValid-qIPgkqGp.js";var n=[[l]];const u=t`<a${"a0:href"}${"a0:title"}${"a0:target"}${"a0:tabindex"}${3}>${"t1"}</a>`;function h(t,e,s,i){const{ti:r,b:l,d:o,sp:c,st:a}=t,{_m0:n,_m1:h}=i;return[e.hasValue?a(u,1,[c(0,{on:h||(i._m1={click:l(e.handleClick)}),attrs:{href:e.computedUrl,title:e.tooltip,target:e.target,tabindex:r(e.tabIndex)}},null),c(1,null,o(e.computedLabel))]):null]}var d=e(h);h.stylesheets=[],h.stylesheetToken="kwc-4srcbceqndb",h.legacyStylesheetToken="D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\formattedUrl-undefined_formattedUrl",n&&h.stylesheets.push.apply(h.stylesheets,n),s(h);class p extends o{constructor(...t){super(...t),this.target=void 0,this.tooltip=void 0,this.label=void 0,this.tabIndex=void 0,this._url=void 0,this._value=void 0,this._connected=!1,this._dispatcher=()=>{}}get value(){return this._value}set value(t){this._value=t,this._connected&&this.updateLinkInfo(t)}connectedCallback(){super.connectedCallback(),this._connected=!0,this.updateLinkInfo(this.value)}disconnectedCallback(){this._connected=!1}focus(){this.urlAnchor&&this.urlAnchor.focus()}blur(){this.urlAnchor&&this.urlAnchor.blur()}click(){const t=this.urlAnchor;t&&t.click&&t.click()}get urlAnchor(){if(this._connected&&this.hasValue)return this.template.querySelector("a")}handleClick(t){this._dispatcher(t)}updateLinkInfo(t){a(this,{url:c(t),target:this.target}).then(t=>{this._url=t.url,this._dispatcher=t.dispatcher})}get computedLabel(){const{label:t,computedUrl:e}=this;return null!=t&&""!==t?t:e}get computedUrl(){return this._url||c(this.value)}get hasValue(){const t=this.value;return null!=t&&""!==t}}i(p,{publicProps:{target:{config:0},tooltip:{config:0},label:{config:0},tabIndex:{config:0},value:{config:3}},publicMethods:["focus","blur","click"],track:{_url:1,_value:1},fields:["_connected","_dispatcher"]});const m=r(p,{tmpl:d,sel:"D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\formattedUrl-",apiVersion:63});export{m as default};
