/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
v4.34.7 */
import{J as f,K as s,M as k,P as x,a as u,b as o,x as h}from"./RNRMSLW5.js";import"./G6QKOIC3.js";export default $arcgis.t(([{watch:b,whenOnce:L}])=>{var v=(n,e,t=!1)=>{if(!n||!e)return!1;let i=new URL(n),r=new URL(e);return!t&&i.protocol!==r.protocol||i.host==null||r.host==null?!1:i.host.toLowerCase()===r.host.toLowerCase()&&i.port===r.port};var w=u`@layer{.arcgis-print__exported-file{display:flex;align-items:center;justify-content:space-between}.arcgis-print__exported-file-link-title,.arcgis-print__exported-file-link-description{word-wrap:break-word;word-break:break-all;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical}}`,d="arcgis-print",p={exportedFile:`${d}__exported-file`,exportedFileLinkTitle:`${d}__exported-file-link-title`,exportedFileLinkDescription:`${d}__exported-file-link-description`};function _(n){let{state:e,extension:t}=n;switch(e){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return t?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}function $(n,e){return!n||n==="all"||!!(e&&n.includes(e))}var m=class extends f{constructor(){super(...arguments),this._handleLinkClick=e=>{if(!e||e.state!=="ready"||!e.url)return;let t=e.url,i=document.createElement("a");i.target="_blank",i.href=t,i.rel="noreferrer",i.download=e.formattedName??"";{i.click();return}}}static{this.properties={saveAsButtonCallback:0,allowedFormatsForSaving:1,exportedLink:0,viewModel:0,messages:0}}static{this.styles=w}static{this.shadowRootOptions=h}loaded(){this.manager.onLifecycle(()=>[b(()=>this.exportedLink.state,()=>this.requestUpdate())])}render(){let{exportedLink:e}=this,t=e.formattedName??"";return o`<calcite-list-item .label=${t}>${this._renderExportedLinkItemContent(e)}${this._renderExportedLinkItemIcon(e)}${this._renderExportedLinkItemAction(e)}</calcite-list-item>${this._renderExportedLinkItemPopover(e)}`}_renderExportedLinkItemPopover(e){let t=this.messages,i=e.formattedName??"",{state:r}=e,c=this.saveAsButtonCallback&&r!=="error"&&$(this.allowedFormatsForSaving,e.extension);return r!=="pending"&&c?o`<calcite-popover auto-close label=Popover offset-distance=1 overlay-positioning=fixed pointer-disabled .referenceElement=${`${i}-popover-button`} scale=s><calcite-list label>${e.portalItem?o`<calcite-list-item .label=${t.openItem} @calciteListItemSelect=${()=>{let a=e.portalItem;if(!a?.itemPageUrl)return;let l=document.createElement("a");l.target="_blank",l.href=a.itemPageUrl,l.rel="noreferrer",l.click()}}><calcite-icon icon=launch2 scale=s slot=content-start></calcite-icon></calcite-list-item>`:o`<calcite-list-item .label=${t.saveAs} @calciteListItemSelect=${async()=>{this.saveAsButtonCallback&&(L(()=>e.portalItem).then(a=>{a.itemPageUrl&&this.requestUpdate()}),await this.saveAsButtonCallback(e))}}><calcite-icon icon=save scale=s slot=content-start></calcite-icon></calcite-list-item>`}<calcite-list-item label=Delete @calciteListItemSelect=${()=>this.viewModel.exportedLinks.remove(e)}><calcite-icon icon=trash scale=s slot=content-start></calcite-icon></calcite-list-item></calcite-list></calcite-popover>`:null}_renderExportedLinkItemContent(e){let t=this.messages,{url:i,state:r,error:c}=e,a=e.formattedName??"",l=v(i||null,document.location.href),g=r==="error"?c?.name==="print-task:cim-symbol-unsupported"?t.exportWebMapCIMError:t.exportWebMapError:null;return o`<div class=${s(p.exportedFile)} slot=content @click=${()=>this._handleLinkClick(e)}><div><div class=${s(p.exportedFileLinkTitle)}>${a}</div><div class=${s(p.exportedFileLinkDescription)}>${r==="pending"?t.generatingExport:g||(l?t.ready:t.linkReady)}</div></div>${r==="ready"?o`<calcite-icon .ariaLabel=${`${a}. ${t.linkReady}`} .icon=${l?"download-to":"launch"} scale=s slot=content-end></calcite-icon>`:null}</div>`}_renderExportedLinkItemIcon(e){return e.state==="pending"?o`<calcite-loader inline .label=${this.messages.generatingExport} scale=m slot=content-start></calcite-loader>`:o`<calcite-icon .icon=${_(e)} scale=s slot=content-start></calcite-icon>`}_renderExportedLinkItemAction(e){let{state:t}=e,i=e.formattedName??"",r=this.saveAsButtonCallback&&t!=="error"&&$(this.allowedFormatsForSaving,e.extension);return t!=="pending"?o`<calcite-action .icon=${r?"ellipsis":"x"} id=${(r?`${i}-popover-button`:void 0)??k} @click=${r?void 0:()=>{this.viewModel.exportedLinks.remove(e)}} slot=actions-end .text=${r?"options":"remove"}></calcite-action>`:null}};x("arcgis-print-exported-link",m);return m},"core/reactiveUtils")