/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import e from"./U2FD6RFU.js";import d from"./YFLYHPA6.js";import{b as w}from"./W4YXXJAS.js";import{b}from"./77CU4WA2.js";import"./TRGFYBOH.js";import{a as g}from"./6S75SIVV.js";import"./5IZMQFRP.js";import"./FOQPGXXA.js";import"./ED6SUP22.js";import"./E6P6PYNW.js";import"./IKKBLHLZ.js";import"./CUA2IUXX.js";import"./4UZDZNJD.js";import"./KOTG6W5Z.js";import"./6SC7YR5Y.js";import"./Z6NOHRUL.js";import"./GVM4XYEI.js";import"./NGDVSE4Z.js";import"./BTNJZZQQ.js";import"./ZYQ4P2ON.js";import"./5MKH4QDV.js";import"./3GWWHA4S.js";import"./3YYHZQJB.js";import"./JEJ23R3P.js";import"./TONS7KZJ.js";import"./Q62UEPOL.js";import"./44A5XEM4.js";import{b as m}from"./ABSRNM72.js";import{F as a,G as n,H as v,K as l,L as c,h as f,i as s,j as p}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([$,R,{n:y},{o:x}])=>{var L=f`/** @license
 * Copyright 2025 Esri
 *
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
:host {
  display: block;
  /**
  * @prop --solutions-social-share-action-width: Width of action button
  * @prop --solutions-social-share-width--s: Width of component when scale is set to \`s\`
  * @prop --solutions-social-share-width--m: Width of component when scale is set to \`m\`
  * @prop --solutions-social-share-width--l: Width of component when scale is set to \`l\`
  * @prop --solutions-social-share-width-horizontal--s: Width of component when \`share-icons-layout\` is set to \`horizontal\` and scale is set to 's'
  * @prop --solutions-social-share-width-horizontal--m: Width of component when \`share-icons-layout\` is set to \`horizontal\` and scale is set to 'm'
  * @prop --solutions-social-share-width-horizontal--l: Width of component when \`share-icons-layout\` is set to \`horizontal\` and scale is set to 'l'
  */
  --solutions-social-share-action-width: initial;
  --solutions-social-share-width--s: 200px;
  --solutions-social-share-width--m: 280px;
  --solutions-social-share-width--l: 320px;
  --solutions-social-share-width-horizontal--s: 300px;
  --solutions-social-share-width-horizontal--m: 380px;
  --solutions-social-share-width-horizontal--l: 420px;
  --solutions-social-share-background-color: var(--calcite-color-foreground-1);
  --solutions-social-share-popover-button-background-color: transparent;
  --solutions-social-share-popover-button-icon-color: var(--calcite-ui-icon-color);
  --solutions-social-share-border: 1px solid var(--calcite-color-border-1);
  position: relative;
  display: flex;
  block-size: 100%;
  flex: 1 1 auto;
  flex-flow: column;
  align-items: stretch;
}

.solutions-social-share__popover-button {
  background-color: var(--solutions-social-share-popover-button-background-color);
  --calcite-color-focus: initial;
}

.solutions-social-share__popover-button calcite-icon {
  color: var(--solutions-social-share-popover-button-icon-color);
}

.solutions-social-share__dialog {
  background-color: var(--solutions-social-share-background-color);
  border: var(--solutions-social-share-border);
  box-sizing: border-box;
  height: auto;
  padding: 10px 0;
  border-radius: 5px;
  color: var(--calcite-color-text-1);
}

.solutions-social-share__options {
  margin: 0;
  padding: 1% 0 0 0;
  list-style-type: none;
}

.solutions-social-share__options li {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 5%;
  transition: background-color 0.15s ease-out 0s;
}

.solutions-social-share__options li .solutions-social-share__icon,
.solutions-social-share__options li .solutions-social-share__option-text {
  display: inline-block;
}

.solutions-social-share__options li .solutions-social-share__icon {
  display: flex;
  align-items: center;
}

.solutions-social-share__options li .solutions-social-share__option-text {
  width: 85%;
  margin-left: 10px;
  word-break: break-word;
}

.solutions-social-share__options li .solutions-social-share__option-text--rtl {
  margin-left: 0;
  margin-right: 10px;
}

.solutions-social-share__options li:hover {
  cursor: pointer;
  background-color: var(--calcite-color-foreground-2);
}

.solutions-social-share__x-logo {
  color: var(--calcite-color-text-1);
}

.solutions-social-share__success {
  display: flex;
  flex-direction: column;
  padding: 15px;
}

.solutions-social-share__success-header {
  display: flex;
  align-items: center;
  font-weight: bold;
  margin-bottom: 10px;
}

.solutions-social-share__success-icon {
  display: flex;
  align-items: center;
  margin-right: 5px;
}

.solutions-social-share__success-icon calcite-icon {
  color: var(--calcite-color-status-success);
}

.solutions-social-share__success-message {
  line-height: 16px;
}

.solutions-social-share__layout--horizontal .solutions-social-share__options {
  display: flex;
  justify-content: space-around;
  margin-bottom: 8%;
}

.solutions-social-share__layout--horizontal .solutions-social-share__options li {
  flex-direction: column;
  padding: 0;
}

.solutions-social-share__layout--horizontal .solutions-social-share__options li .solutions-social-share__option-text {
  word-break: break-word;
  margin-left: 0;
  margin-top: 10px;
  text-align: center;
}

.solutions-social-share__layout--horizontal .solutions-social-share__options li:hover {
  background-color: unset;
}

.solutions-social-share__icon-container {
  display: flex;
  align-items: center;
}

calcite-action {
  width: var(--solutions-social-share-action-width);
}

:host([scale=s]) .solutions-social-share__dialog {
  width: var(--solutions-social-share-width--s);
}

:host([scale=s]) .solutions-social-share__icon {
  width: 16px;
  height: 16px;
}

:host([scale=s]) .solutions-social-share__option-text {
  font-size: var(--calcite-font-size--1);
}

:host([scale=s]) .solutions-social-share__dialog.solutions-social-share__layout--horizontal {
  width: var(--solutions-social-share-width-horizontal--s);
}

:host([scale=m]) .solutions-social-share__dialog {
  width: var(--solutions-social-share-width--m);
}

:host([scale=m]) .solutions-social-share__icon {
  width: 24px;
  height: 24px;
}

:host([scale=m]) .solutions-social-share__option-text {
  font-size: var(--calcite-font-size-0);
}

:host([scale=m]) .solutions-social-share__dialog.solutions-social-share__layout--horizontal {
  width: var(--solutions-social-share-width-horizontal--m);
}

:host([scale=l]) .solutions-social-share__dialog {
  width: var(--solutions-social-share-width--l);
}

:host([scale=l]) .solutions-social-share__icon {
  width: 32px;
  height: 32px;
}

:host([scale=l]) .solutions-social-share__option-text {
  font-size: var(--calcite-font-size-1);
}

:host([scale=l]) .solutions-social-share__dialog.solutions-social-share__layout--horizontal {
  width: var(--solutions-social-share-width-horizontal--l);
}`,S=".calcite-mode-dark",C={facebook:"https://www.facebook.com/sharer/sharer.php?u={url}",x:"https://x.com/intent/post?url={url}",linkedIn:"https://www.linkedin.com/sharing/share-offsite/?url={url}",bluesky:"https://bsky.app/intent/compose?text={url}"},I="https://arcg.is/prod/shorten",u=class extends v{constructor(){super(...arguments),this.actionApperance="transparent",this.autoUpdateShareUrl=!0,this.buttonAppearance="transparent",this.inlineSuccessPopoverPlacement="trailing",this.mode="popover",this.popoverButtonIconScale="m",this.popoverPositioning="absolute",this.removePopoverOffset=!1,this.scale="s",this.shareButtonKind="neutral",this.shareButtonScale="m",this.shareButtonText="",this.shareButtonType="button",this.shareIconsLayout="vertical",this.shareText="",this.shareUrl=window.location.href,this.shortenShareUrl=!0,this.socialMedia=!0,this.solutionId="",this.solutionTitle="",this.solutionVersion="",this.successMessage="",this._copied=!1,this._inlineCopyLinkOpened=!1,this._opened=!1,this._translations=g({name:"solution-social-share",blocking:!0}),this._configContextConsumer=b({context:w,subscribe:!0}),this._copyLinkPopoverRef=a(),this._dialogContentRef=a(),this._popoverActionRef=a(),this._popoverButtonRef=a(),this._popoverRef=a(),this._shareListRef=a()}static{this.properties={actionApperance:1,autoUpdateShareUrl:[5,{},{type:Boolean}],buttonAppearance:1,inlineSuccessPopoverPlacement:[3,{},{reflect:!0}],mode:[3,{},{reflect:!0}],popoverButtonIconScale:[3,{},{reflect:!0}],popoverPositioning:[3,{},{reflect:!0}],removePopoverOffset:[7,{},{reflect:!0,type:Boolean}],scale:[3,{},{reflect:!0}],shareButtonKind:[3,{},{reflect:!0}],shareButtonScale:[3,{},{reflect:!0}],shareButtonText:1,shareButtonType:[3,{},{reflect:!0}],shareIconsLayout:[3,{},{reflect:!0}],shareText:[3,{},{reflect:!0}],shareUrl:1,shortenShareUrl:[7,{},{reflect:!0,type:Boolean}],socialMedia:[7,{},{reflect:!0,type:Boolean}],solutionId:1,solutionTitle:1,solutionVersion:1,successMessage:[3,{},{reflect:!0}],_copied:[16,{},{state:!0}],_inlineCopyLinkOpened:[16,{},{state:!0}],_opened:[16,{},{state:!0}],_translations:[16,{},{state:!0}]}}static{this.styles=L}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}loaded(){this._setupAutoCloseListeners(),this.mode==="popover"&&this._popoverRef.value&&(this._opened&&(this._popoverRef.value.open=!0),this.listenOn(this._popoverRef.value,"calcitePopoverOpen",()=>{if(!this._shareListRef.value)return;this._shareListRef.value.children[0].focus()}),this.listenOn(this._popoverRef.value,"keydown",this._handlePopoverRefKeyDown))}render(){let o=this._copied&&this.mode==="popover"?this._renderSuccess():s`<div class=solutions-social-share__dialog-content>${this._renderOptions()}</div>`,e=this.shareIconsLayout==="vertical"?" solutions-social-share__layout--vertical":" solutions-social-share__layout--horizontal",t=` calcite-mode-${this.el.closest(S)?"dark":"light"}`,i=s`<div class=${`solutions-social-share__dialog${e}${t}`} ${n(this._dialogContentRef)}>${o}</div>`,r=this.removePopoverOffset?0:6;return this.mode==="popover"?[s`<calcite-popover .label=${this._translations.share?.label??""} reference-element=shareButton placement=bottom-start .scale=${this.scale} overlay-positioning=${this.popoverPositioning??c} offset-distance=${r??c} pointer-disabled=${this.removePopoverOffset??c} ${n(this._popoverRef)}>${i}</calcite-popover>`,this._renderButton()]:[i,s`<calcite-popover .label=${this._translations.share?.label??""} reference-element=copyToClipboard .placement=${this.inlineSuccessPopoverPlacement} .scale=${this.scale} overlay-positioning=fixed ${n(this._copyLinkPopoverRef)}>${this._renderSuccess()}</calcite-popover>`]}_setupAutoCloseListeners(){this.listenOn(document.documentElement,"click",this._autoCloseCallback),this.mode==="popover"&&this._popoverRef.value?(this.listenOn(this._popoverRef.value,"click",this._stopPropagationCallback),this.listenOn(this._popoverRef.value,"calcitePopoverClose",this._resetPopoverCopyState)):this._dialogContentRef.value&&this.listenOn(this._dialogContentRef.value,"click",this._stopPropagationCallback)}_handlePopoverRefKeyDown(o){if(o.code==="Tab"){if(!this._shareListRef.value)return;let e=o.target,t=this._shareListRef.value.children[0],i=this._shareListRef.value.children[this._shareListRef.value.children.length-1];o.shiftKey&&e===t?(o.preventDefault(),i.focus()):!o.shiftKey&&e===i&&(o.preventDefault(),t.focus())}else o.code==="Escape"&&(this._closePopover(),this.shareButtonType==="button"?this._popoverButtonRef.value?.setFocus():this._popoverActionRef.value?.setFocus())}_autoCloseCallback(){this.mode==="popover"?(this._opened=!1,this._popoverRef.value.open=this._opened):(this._copyLinkPopoverRef.value&&(this._copyLinkPopoverRef.value.open=!1),this._inlineCopyLinkOpened=!1)}_stopPropagationCallback(o){o.stopPropagation()}_resetPopoverCopyState(){this.shareButtonType==="button"?this._popoverButtonRef.value?.setFocus():this._popoverActionRef.value?.setFocus(),setTimeout(()=>{this._copied=!1},200)}_renderButton(){let o=this.shareButtonScale!=null?this.shareButtonScale:this.scale;return this.shareButtonType==="button"?s`<calcite-button .appearance=${this.buttonAppearance} class=solutions-social-share__popover-button id=shareButton .kind=${this.shareButtonKind} .label=${this._translations.share?.label} @click=${this._togglePopover.bind(this)} .scale=${o} title=${this._translations.share?.label??c} ${n(this._popoverButtonRef)}>${this.shareButtonText}</calcite-button>`:s`<calcite-action alignment=center .appearance=${this.actionApperance} class=solutions-social-share__popover-button id=shareButton .label=${this._translations.share?.label} @click=${this._togglePopover.bind(this)} .scale=${o} text title=${this._translations.share?.label??c} ${n(this._popoverActionRef)}><div class=solutions-social-share__icon-container><calcite-icon icon=share .scale=${this.popoverButtonIconScale}></calcite-icon></div></calcite-action>`}_renderSuccess(){let o=this._translations.success;return s`<div class=solutions-social-share__success><span class=solutions-social-share__success-header><span class=solutions-social-share__success-icon><calcite-icon icon=check-circle-f .scale=${this.scale}></calcite-icon></span>${o?.label}</span><span class=solutions-social-share__success-message>${this.successMessage||o?.url}</span></div>`}_renderOptions(){let o=this._translations.options,e=document.dir==="rtl"?" solutions-social-share__option-text--rtl":"";return s`<ul class=solutions-social-share__options role=menu ${n(this._shareListRef)}><li id=copyToClipboard @click=${this._handleShareItem.bind(this,"link")} @keydown=${this._handleOptionKeyDown("link")} role=menuitem tabindex=0><span class=solutions-social-share__icon><calcite-icon icon=link .scale=${this.scale}></calcite-icon></span><span class=${`solutions-social-share__option-text${e}`}>${o?.link?.label}</span></li>${this.socialMedia?[s`<li @click=${this._handleShareItem.bind(this,"facebook")} @keydown=${this._handleOptionKeyDown("facebook")} role=menuitem tabindex=0><span class=solutions-social-share__icon>${this._renderFacebookIcon()}</span><span class=${`solutions-social-share__option-text${e}`}>${o?.facebook?.label}</span></li>`,s`<li @click=${this._handleShareItem.bind(this,"x")} @keydown=${this._handleOptionKeyDown("x")} role=menuitem tabindex=0><span class=solutions-social-share__icon>${this._renderXIcon()}</span><span class=${`solutions-social-share__option-text${e}`}>\r\n                X</span></li>`,s`<li @click=${this._handleShareItem.bind(this,"linkedIn")} @keydown=${this._handleOptionKeyDown("linkedIn")} role=menuitem tabindex=0><span class=solutions-social-share__icon>${this._renderLinkedInIcon()}</span><span class=${`solutions-social-share__option-text${e}`}>${o?.linkedIn?.label}</span></li>`,s`<li @click=${this._handleShareItem.bind(this,"bluesky")} @keydown=${this._handleOptionKeyDown("bluesky")} role=menuitem tabindex=0><span class=solutions-social-share__icon>${this._renderBlueSkyIcon()}</span><span class=${`solutions-social-share__option-text${e}`}>${o?.blueSky?.label}</span></li>`]:null}</ul>`}_handleOptionKeyDown(o){return e=>{let t=e.code;(t==="Space"||t==="Enter")&&this._handleShareItem(o)}}_renderFacebookIcon(){return s`<svg height=100% style=${l({fillRule:"evenodd",clipRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"2"})} version=1.1 viewBox="0 0 512 512" width=100% xmlns=http://www.w3.org/2000/svg>${p`<g><path d="M512,256c0,-141.385 -114.615,-256 -256,-256c-141.385,0 -256,114.615 -256,256c0,127.777 93.616,233.685 216,252.89l0,-178.89l-65,0l0,-74l65,0l0,-56.4c0,-64.16 38.219,-99.6 96.695,-99.6c28.009,0 57.305,5 57.305,5l0,63l-32.281,0c-31.801,0 -41.719,19.733 -41.719,39.978l0,48.022l71,0l-11.35,74l-59.65,0l0,178.89c122.385,-19.205 216,-125.113 216,-252.89Z" style=${l({fill:"#1877f2",fillRule:"nonzero"})} /><path d="M355.65,330l11.35,-74l-71,0l0,-48.022c0,-20.245 9.917,-39.978 41.719,-39.978l32.281,0l0,-63c0,0 -29.297,-5 -57.305,-5c-58.476,0 -96.695,35.44 -96.695,99.6l0,56.4l-65,0l0,74l65,0l0,178.89c13.033,2.045 26.392,3.11 40,3.11c13.608,0 26.966,-1.065 40,-3.11l0,-178.89l59.65,0Z" style=${l({fill:"#fff",fillRule:"nonzero"})} /></g>`}</svg>`}_renderXIcon(){return s`<svg class="solutions-social-share__x-logo" viewBox="0 0 1200 1227" fill=none xmlns=http://www.w3.org/2000/svg>${p`<rect height=400 style=${l({fill:"none"})} width=400 x=56 y=56 /><path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z" fill=currentColor />`}</svg>`}_renderBlueSkyIcon(){return s`<svg fill=#0f85fe xmlns=http://www.w3.org/2000/svg viewBox="0 0 512 512">${p`<path d="M111.8 62.2C170.2 105.9 233 194.7 256 242.4c23-47.6 85.8-136.4 144.2-180.2c42.1-31.6 110.3-56 110.3 21.8c0 15.5-8.9 130.5-14.1 149.2C478.2 298 412 314.6 353.1 304.5c102.9 17.5 129.1 75.5 72.5 133.5c-107.4 110.2-154.3-27.6-166.3-62.9l0 0c-1.7-4.9-2.6-7.8-3.3-7.8s-1.6 3-3.3 7.8l0 0c-12 35.3-59 173.1-166.3 62.9c-56.5-58-30.4-116 72.5-133.5C100 314.6 33.8 298 15.7 233.1C10.4 214.4 1.5 99.4 1.5 83.9c0-77.8 68.2-53.4 110.3-21.8z" />`}</svg>`}_renderLinkedInIcon(){return s`<svg height=100% style=${l({fillRule:"evenodd",clipRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"2"})} version=1.1 viewBox="0 0 512 512" width=100% xmlns=http://www.w3.org/2000/svg>${p`<g id=g5891><path d="M512,64c0,-35.323 -28.677,-64 -64,-64l-384,0c-35.323,0 -64,28.677 -64,64l0,384c0,35.323 28.677,64 64,64l384,0c35.323,0 64,-28.677 64,-64l0,-384Z" id=background style=${l({fill:"#2867b2"})} /><g id=shapes><rect height=257.962 id=rect11 style=${l({fill:"#fff"})} width=85.76 x=61.053 y=178.667 /><path d="M104.512,54.28c-29.341,0 -48.512,19.29 -48.512,44.573c0,24.752 18.588,44.574 47.377,44.574l0.554,0c29.903,0 48.516,-19.822 48.516,-44.574c-0.555,-25.283 -18.611,-44.573 -47.935,-44.573Z" id=path13-0 style=${l({fill:"#fff",fillRule:"nonzero"})} /><path d="M357.278,172.601c-45.49,0 -65.866,25.017 -77.276,42.589l0,-36.523l-85.738,0c1.137,24.197 0,257.961 0,257.961l85.737,0l0,-144.064c0,-7.711 0.554,-15.42 2.827,-20.931c6.188,-15.4 20.305,-31.352 43.993,-31.352c31.012,0 43.436,23.664 43.436,58.327l0,138.02l85.741,0l0,-147.93c0,-79.237 -42.305,-116.097 -98.72,-116.097Z" id=path15 style=${l({fill:"#fff",fillRule:"nonzero"})} /></g></g>`}</svg>`}_togglePopover(o){o.stopPropagation(),this._opened=!this._opened,this._popoverRef.value.open=this._opened}_closePopover(){this._opened=!1,this._popoverRef.value.open=this._opened}async _handleShareItem(o){this._telemetry?.logEvent({category:y.SOLUTION_DETAILS,action:"Share",dimensions:[this.solutionTitle,this.solutionId,this.solutionVersion,x(o)]}),this.shareUrl=await this._generateShareUrl();let e=null,t=navigator?.userAgent?.includes("Chrome")??!1,i=(navigator?.userAgent?.includes("Safari")??!1)&&!t;!i&&this.shortenShareUrl&&(e=await this._shortenUrl(this.shareUrl));let h=e||this.shareUrl;switch(o){case"link":navigator.clipboard.writeText(h),this.mode==="inline"&&(this._copyLinkPopoverRef.value.open=!0,setTimeout(()=>this._copyLinkPopoverRef.value.open=!1,3e3)),this._inlineCopyLinkOpened=!0,this._copied=!0,this.mode==="popover"&&setTimeout(()=>this._closePopover(),2e3);return;case"facebook":case"bluesky":case"x":case"linkedIn":{let r;i&&(r=window.open("","_blank"),this.shortenShareUrl&&(h=await this._shortenUrl(this.shareUrl)||h));let d={url:encodeURI(h)},k=o==="x"?{...d,text:this.shareText}:d,_=$.substitute(C[o],k);this.mode==="popover"&&this._closePopover(),i&&r?(r.location=_,r.focus()):window.open(encodeURI(_),"_blank")}return}}async _shortenUrl(o){let t=(await R(I,{query:{longUrl:o,f:"json"}}))?.data?.data?.url;if(t)return t.replace("http://","https://")}_generateShareUrl(){return this.autoUpdateShareUrl&&(this.shareUrl=window.location.href),this.shareUrl}};m("solution-social-share",u);return u},"intl","request",d,e)