@esri/solutions-components 0.10.46 → 0.10.47

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/dist/cjs/calcite-block_5.cjs.entry.js +21 -1
  2. package/dist/cjs/crowdsource-reporter.cjs.entry.js +53 -3
  3. package/dist/cjs/instant-apps-export.cjs.entry.js +18 -5
  4. package/dist/cjs/instant-apps-language-switcher.cjs.entry.js +5 -6
  5. package/dist/cjs/instant-apps-scoreboard.cjs.entry.js +13 -6
  6. package/dist/cjs/instant-apps-time-filter.cjs.entry.js +7 -12
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/solutions-components.cjs.js +1 -1
  9. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +84 -2
  10. package/dist/components/crowdsource-reporter.js +57 -5
  11. package/dist/components/instant-apps-export.js +18 -5
  12. package/dist/components/instant-apps-filter-list2.js +23 -2
  13. package/dist/components/instant-apps-language-switcher.js +5 -6
  14. package/dist/components/instant-apps-scoreboard.js +14 -6
  15. package/dist/components/instant-apps-time-filter.js +7 -12
  16. package/dist/esm/calcite-block_5.entry.js +21 -1
  17. package/dist/esm/crowdsource-reporter.entry.js +53 -3
  18. package/dist/esm/instant-apps-export.entry.js +18 -5
  19. package/dist/esm/instant-apps-language-switcher.entry.js +5 -6
  20. package/dist/esm/instant-apps-scoreboard.entry.js +13 -6
  21. package/dist/esm/instant-apps-time-filter.entry.js +7 -12
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/solutions-components.js +1 -1
  24. package/dist/solutions-components/p-94e51621.entry.js +6 -0
  25. package/dist/solutions-components/{p-2cf41651.entry.js → p-c7f86f73.entry.js} +1 -1
  26. package/dist/solutions-components/p-e9a0d2f3.entry.js +6 -0
  27. package/dist/solutions-components/p-f09744aa.entry.js +6 -0
  28. package/dist/solutions-components/p-f86c2a0c.entry.js +6 -0
  29. package/dist/solutions-components/p-fdeceaf6.entry.js +29 -0
  30. package/dist/solutions-components/solutions-components.esm.js +1 -1
  31. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +17 -0
  32. package/dist/types/components.d.ts +4 -0
  33. package/package.json +7 -7
  34. package/dist/solutions-components/p-2291bf3f.entry.js +0 -6
  35. package/dist/solutions-components/p-5e694bcc.entry.js +0 -29
  36. package/dist/solutions-components/p-6e5ea1cb.entry.js +0 -6
  37. package/dist/solutions-components/p-cb27611e.entry.js +0 -6
  38. package/dist/solutions-components/p-f4880179.entry.js +0 -6
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright 2022 Esri
3
- * Licensed under the Apache License, Version 2.0
4
- * http://www.apache.org/licenses/LICENSE-2.0
5
- */
6
- import{r as t,c as n,h as i,H as s,g as e}from"./p-4e6eb06e.js";import{l as o}from"./p-d001e961.js";import{g as r}from"./p-5104cc98.js";import{g as a}from"./p-a9a72626.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-ac122d9e.js";const p=(()=>{let t=0;return()=>(t+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${t}`)})();function c(t){const n=[];for(let i=0,s=t.length;i<s;i++)n.push(t[i]);return n}function l(t,n){const i=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(n);return i?parseFloat(i.replace("px","")):0}function h(t,n={}){return{width:n.width||function(t){const n=l(t,"border-left-width"),i=l(t,"border-right-width");return t.clientWidth+n+i}(t),height:n.height||function(t){const n=l(t,"border-top-width"),i=l(t,"border-bottom-width");return t.clientHeight+n+i}(t)}}const d=16384;function u(t){return new Promise(((n,i)=>{const s=new Image;s.decode=()=>n(s),s.onload=()=>n(s),s.onerror=i,s.crossOrigin="anonymous",s.decoding="async",s.src=t}))}const f=(t,n)=>{if(t instanceof n)return!0;const i=Object.getPrototypeOf(t);return null!==i&&(i.constructor.name===n.name||f(i,n))};function g(t,n,i){const s=window.getComputedStyle(t,i),e=s.getPropertyValue("content");if(""===e||"none"===e)return;const o=p();try{n.className=`${n.className} ${o}`}catch(t){return}const r=document.createElement("style");r.appendChild(function(t,n,i){const s=`.${t}:${n}`,e=i.cssText?function(t){const n=t.getPropertyValue("content");return`${t.cssText} content: '${n.replace(/'|"/g,"")}';`}(i):function(t){return c(t).map((n=>`${n}: ${t.getPropertyValue(n)}${t.getPropertyPriority(n)?" !important":""};`)).join(" ")}(i);return document.createTextNode(`${s}{${e}}`)}(o,i,s)),n.appendChild(r)}const v="application/font-woff",x="image/jpeg",m={woff:v,woff2:v,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:x,jpeg:x,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function _(t){const n=function(t){const n=/\.([^./]*?)$/g.exec(t);return n?n[1]:""}(t).toLowerCase();return m[n]||""}function b(t){return-1!==t.search(/^(data:)/)}function w(t,n){return`data:${n};base64,${t}`}async function y(t,n,i){const s=await fetch(t,n);if(404===s.status)throw new Error(`Resource "${s.url}" not found`);const e=await s.blob();return new Promise(((t,n)=>{const o=new FileReader;o.onerror=n,o.onloadend=()=>{try{t(i({res:s,result:o.result}))}catch(t){n(t)}},o.readAsDataURL(e)}))}const k={};async function P(t,n,i){const s=function(t,n,i){let s=t.replace(/\?.*/,"");return i&&(s=t),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),n?`[${n}]${s}`:s}(t,n,i.includeQueryParams);if(null!=k[s])return k[s];let e;i.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+(new Date).getTime());try{const s=await y(t,i.fetchRequestInit,(({res:t,result:i})=>(n||(n=t.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(i))));e=w(s,n)}catch(n){e=i.imagePlaceholder||"";let s=`Failed to fetch resource: ${t}`;n&&(s="string"==typeof n?n:n.message),s&&console.warn(s)}return k[s]=e,e}const $=t=>null!=t.tagName&&"SLOT"===t.tagName.toUpperCase();async function S(t,n,i){return i||!n.filter||n.filter(t)?Promise.resolve(t).then((t=>async function(t,n){return f(t,HTMLCanvasElement)?async function(t){const n=t.toDataURL();return"data:,"===n?t.cloneNode(!1):u(n)}(t):f(t,HTMLVideoElement)?async function(t,n){if(t.currentSrc){const n=document.createElement("canvas"),i=n.getContext("2d");return n.width=t.clientWidth,n.height=t.clientHeight,null==i||i.drawImage(t,0,0,n.width,n.height),u(n.toDataURL())}const i=t.poster,s=_(i);return u(await P(i,s,n))}(t,n):f(t,HTMLIFrameElement)?async function(t){var n;try{if(null===(n=null==t?void 0:t.contentDocument)||void 0===n?void 0:n.body)return await S(t.contentDocument.body,{},!0)}catch(t){}return t.cloneNode(!1)}(t):t.cloneNode(!1)}(t,n))).then((i=>async function(t,n,i){var s,e;let o=[];return o=$(t)&&t.assignedNodes?c(t.assignedNodes()):f(t,HTMLIFrameElement)&&(null===(s=t.contentDocument)||void 0===s?void 0:s.body)?c(t.contentDocument.body.childNodes):c((null!==(e=t.shadowRoot)&&void 0!==e?e:t).childNodes),0===o.length||f(t,HTMLVideoElement)||await o.reduce(((t,s)=>t.then((()=>S(s,i))).then((t=>{t&&n.appendChild(t)}))),Promise.resolve()),n}(t,i,n))).then((n=>function(t,n){return f(n,Element)&&(function(t,n){const i=n.style;if(!i)return;const s=window.getComputedStyle(t);s.cssText?(i.cssText=s.cssText,i.transformOrigin=s.transformOrigin):c(s).forEach((e=>{let o=s.getPropertyValue(e);if("font-size"===e&&o.endsWith("px")){const t=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o=`${t}px`}f(t,HTMLIFrameElement)&&"display"===e&&"inline"===o&&(o="block"),"d"===e&&n.getAttribute("d")&&(o=`path(${n.getAttribute("d")})`),i.setProperty(e,o,s.getPropertyPriority(e))}))}(t,n),function(t,n){g(t,n,":before"),g(t,n,":after")}(t,n),function(t,n){f(t,HTMLTextAreaElement)&&(n.innerHTML=t.value),f(t,HTMLInputElement)&&n.setAttribute("value",t.value)}(t,n),function(t,n){if(f(t,HTMLSelectElement)){const i=Array.from(n.children).find((n=>t.value===n.getAttribute("value")));i&&i.setAttribute("selected","")}}(t,n)),n}(t,n))).then((t=>async function(t,n){const i=t.querySelectorAll?t.querySelectorAll("use"):[];if(0===i.length)return t;const s={};for(let e=0;e<i.length;e++){const o=i[e].getAttribute("xlink:href");if(o){const i=t.querySelector(o),e=document.querySelector(o);i||!e||s[o]||(s[o]=await S(e,n,!0))}}const e=Object.values(s);if(e.length){const n="http://www.w3.org/1999/xhtml",i=document.createElementNS(n,"svg");i.setAttribute("xmlns",n),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";const s=document.createElementNS(n,"defs");i.appendChild(s);for(let t=0;t<e.length;t++)s.appendChild(e[t]);t.appendChild(i)}return t}(t,n))):null}const C=/url\((['"]?)([^'"]+?)\1\)/g,E=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,F=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function M(t){return-1!==t.search(C)}async function j(t,n,i){if(!M(t))return t;const s=function(t,{preferredFontFormat:n}){return n?t.replace(F,(t=>{for(;;){const[i,,s]=E.exec(t)||[];if(!s)return"";if(s===n)return`src: ${i};`}})):t}(t,i),e=function(t){const n=[];return t.replace(C,((t,i,s)=>(n.push(s),t))),n.filter((t=>!b(t)))}(s);return e.reduce(((t,s)=>t.then((t=>async function(t,n,i,s,e){try{const o=i?function(t,n){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const i=document.implementation.createHTMLDocument(),s=i.createElement("base"),e=i.createElement("a");return i.head.appendChild(s),i.body.appendChild(e),n&&(s.href=n),e.href=t,e.href}(n,i):n,r=_(n);let a;return a=e?w(await e(o),r):await P(o,r,s),t.replace(function(t){const n=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${n})(['"]?\\))`,"g")}(n),`$1${a}$3`)}catch(t){}return t}(t,s,n,i)))),Promise.resolve(s))}async function L(t,n,i){var s;const e=null===(s=n.style)||void 0===s?void 0:s.getPropertyValue(t);if(e){const s=await j(e,null,i);return n.style.setProperty(t,s,n.style.getPropertyPriority(t)),!0}return!1}async function T(t,n){f(t,Element)&&(await async function(t,n){await L("background",t,n)||await L("background-image",t,n),await L("mask",t,n)||await L("mask-image",t,n)}(t,n),await async function(t,n){const i=f(t,HTMLImageElement);if((!i||b(t.src))&&(!f(t,SVGImageElement)||b(t.href.baseVal)))return;const s=i?t.src:t.href.baseVal,e=await P(s,_(s),n);await new Promise(((n,s)=>{t.onload=n,t.onerror=s;const o=t;o.decode&&(o.decode=n),"lazy"===o.loading&&(o.loading="eager"),i?(t.srcset="",t.src=e):t.href.baseVal=e}))}(t,n),await async function(t,n){const i=c(t.childNodes).map((t=>T(t,n)));await Promise.all(i).then((()=>t))}(t,n))}const D={};async function I(t){let n=D[t];if(null!=n)return n;const i=await fetch(t);return n={url:t,cssText:await i.text()},D[t]=n,n}async function O(t,n){let i=t.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,e=(i.match(/url\([^)]+\)/g)||[]).map((async e=>{let o=e.replace(s,"$1");return o.startsWith("https://")||(o=new URL(o,t.url).href),y(o,n.fetchRequestInit,(({result:t})=>(i=i.replace(e,`url(${t})`),[e,t])))}));return Promise.all(e).then((()=>i))}function z(t){if(null==t)return[];const n=[];let i=t.replace(/(\/\*[\s\S]*?\*\/)/gi,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const t=s.exec(i);if(null===t)break;n.push(t[0])}i=i.replace(s,"");const e=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let t=e.exec(i);if(null===t){if(t=o.exec(i),null===t)break;e.lastIndex=o.lastIndex}else o.lastIndex=e.lastIndex;n.push(t[0])}return n}async function R(t,n){const i=null!=n.fontEmbedCSS?n.fontEmbedCSS:n.skipFonts?null:await async function(t,n){const i=await async function(t,n){if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");const i=c(t.ownerDocument.styleSheets),s=await async function(t,n){const i=[],s=[];return t.forEach((i=>{if("cssRules"in i)try{c(i.cssRules||[]).forEach(((t,e)=>{if(t.type===CSSRule.IMPORT_RULE){let o=e+1;const r=I(t.href).then((t=>O(t,n))).then((t=>z(t).forEach((t=>{try{i.insertRule(t,t.startsWith("@import")?o+=1:i.cssRules.length)}catch(n){console.error("Error inserting rule from remote css",{rule:t,error:n})}})))).catch((t=>{console.error("Error loading remote css",t.toString())}));s.push(r)}}))}catch(e){const o=t.find((t=>null==t.href))||document.styleSheets[0];null!=i.href&&s.push(I(i.href).then((t=>O(t,n))).then((t=>z(t).forEach((t=>{o.insertRule(t,i.cssRules.length)})))).catch((t=>{console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",e)}})),Promise.all(s).then((()=>(t.forEach((t=>{if("cssRules"in t)try{c(t.cssRules||[]).forEach((t=>{i.push(t)}))}catch(n){console.error(`Error while reading CSS rules from ${t.href}`,n)}})),i)))}(i,n);return function(t){return t.filter((t=>t.type===CSSRule.FONT_FACE_RULE)).filter((t=>M(t.style.getPropertyValue("src"))))}(s)}(t,n);return(await Promise.all(i.map((t=>j(t.cssText,t.parentStyleSheet?t.parentStyleSheet.href:null,n))))).join("\n")}(t,n);if(i){const n=document.createElement("style"),s=document.createTextNode(i);n.appendChild(s),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}async function H(t,n={}){const{width:i,height:s}=h(t,n),e=await S(t,n,!0);return await R(e,n),await T(e,n),function(t,n){const{style:i}=t;n.backgroundColor&&(i.backgroundColor=n.backgroundColor),n.width&&(i.width=`${n.width}px`),n.height&&(i.height=`${n.height}px`);const s=n.style;null!=s&&Object.keys(s).forEach((t=>{i[t]=s[t]}))}(e,n),await async function(t,n,i){const s="http://www.w3.org/2000/svg",e=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject");return e.setAttribute("width",`${n}`),e.setAttribute("height",`${i}`),e.setAttribute("viewBox",`0 0 ${n} ${i}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),e.appendChild(o),o.appendChild(t),async function(t){return Promise.resolve().then((()=>(new XMLSerializer).serializeToString(t))).then(encodeURIComponent).then((t=>`data:image/svg+xml;charset=utf-8,${t}`))}(e)}(e,i,s)}async function V(t,n={}){const{width:i,height:s}=h(t,n),e=await H(t,n),o=await u(e),r=document.createElement("canvas"),a=r.getContext("2d"),p=n.pixelRatio||function(){let t,n;try{n=process}catch(t){}const i=n&&n.env?n.env.devicePixelRatio:null;return i&&(t=parseInt(i,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),c=n.canvasWidth||i,l=n.canvasHeight||s;return r.width=c*p,r.height=l*p,n.skipAutoScale||function(t){(t.width>d||t.height>d)&&(t.width>d&&t.height>d?t.width>t.height?(t.height*=d/t.width,t.width=d):(t.width*=d/t.height,t.height=d):t.width>d?(t.height*=d/t.width,t.width=d):(t.width*=d/t.height,t.height=d))}(r),r.style.width=`${c}`,r.style.height=`${l}`,n.backgroundColor&&(a.fillStyle=n.backgroundColor,a.fillRect(0,0,r.width,r.height)),a.drawImage(o,0,0,r.width,r.height),r}const G="instant-apps-export calcite-mode-light",U="instant-apps-export-print instant-apps-export-print__pdf",W="instant-apps-export-print instant-apps-export-print__img",A="instant-apps-export-print__img--extra-content",B="instant-apps-export-print__content-container",N="instant-apps-export-print__extra-container",J="instant-apps-export-print__legend-container",q="instant-apps-export-print__compass-container",X="instant-apps-export-print__scale-bar-container",K="instant-apps-export-print__popup-container",Q="instant-apps-export-print__popup-content",Y="instant-apps-export-print__popup-title",Z="instant-apps-export-print__view",tt="instant-apps-export-print__view-container",nt="instant-apps-export-print__view-wrapper",it="instant-app-export-drag",st=class{constructor(i){t(this,i),this.exportOutputUpdated=n(this,"exportOutputUpdated",7),this.fileTypes=["PDF","JPG","PNG"],this.output=void 0,this.beforeExport=()=>Promise.resolve(),this.popoverIcon="export",this.extraContent=void 0,this.extraContentLabel=void 0,this.headerTitle="",this.logoImage="",this.includeExtraContent=!0,this.showExtraContentInImg=!1,this.includeLegend=!0,this.includeMap=!0,this.includePopup=!1,this.includeFileFormat=!0,this.mode="popover",this.popoverPositioning="absolute",this.popoverPlacement="auto",this.scale="m",this.showHeaderTitle=!0,this.showIncludeLegend=!0,this.showIncludeMap=!1,this.showIncludePopup=!0,this.showScaleBar=!1,this.view=void 0,this.maskBackground="rgba(255, 51, 0, 0.1)",this.maskBorder="2px dashed rgb(255, 51, 0)",this.baseClass=G,this.exportIsLoading=void 0,this.messages=void 0,this.selectedFileType="PDF"}watchIncludeMap(t){t&&this.updateLegend()}watchView(){this.handleIncludePopup()}async componentWillLoad(){this.baseClass="dark"===a(this.el)?"instant-apps-export calcite-mode-dark":G,r(this),await this.initializeModules()}componentDidLoad(){this.printContainerEl.prepend(this.printEl),this.handleIncludePopup()}async initializeModules(){const[t,n]=await o(["esri/core/Handles","esri/core/reactiveUtils"]);return this.handles=new t,this.reactiveUtils=n,Promise.resolve()}render(){const t="popover"===this.mode?this.renderPopover():this.renderPanel(),n=this.renderCompass();return i(s,{key:"9811c244faf2c794db3edaad498a9a902cb3faad"},i("div",{key:"cb880c04d46ec06a9588cedc0bd90ab62d25c0ac",class:this.baseClass,onMouseEnter:this.handleWidgetCreation.bind(this),onFocusin:this.handleWidgetCreation.bind(this)},t,i("div",{key:"fc7ccd1eeb4b6a82bd9804d1aa73c4f242085a56",class:"instant-apps-export__visually-hidden"},n)))}renderPopover(){var t,n,s;const e=this.renderPanel();return[i("calcite-popover",{referenceElement:"export-popover-btn",label:null===(t=this.messages)||void 0===t?void 0:t.exportPopover,overlayPositioning:this.popoverPositioning,placement:this.popoverPlacement,autoClose:!0,ref:t=>this.popoverEl=t},e),i("calcite-action",{id:"export-popover-btn",alignment:"center",icon:this.popoverIcon,scale:this.scale,title:null===(n=this.messages)||void 0===n?void 0:n.exportBtn,text:null===(s=this.messages)||void 0===s?void 0:s.exportBtn})]}renderPanel(){var t,n,s;const e=this.showHeaderTitle?this.renderTitle():null,o=null!=this.extraContent?this.renderSwitch("includeExtraContent",this.extraContentLabel,"PDF"!==this.selectedFileType&&!this.showExtraContentInImg):null,r=this.showIncludeMap?this.renderSwitch("includeMap",void 0,"PDF"!==this.selectedFileType):null,a=this.includeMap?this.renderMapOptions():null,p=this.includeFileFormat?this.renderSelectFileType():null,c="PDF"===this.selectedFileType?this.renderPrint():this.renderImg();return i("div",{class:"inline"===this.mode?"instant-apps-export__inline-container":"instant-apps-export__popover-container"},e,o,r,a,p,this.includeMap?i("calcite-button",{appearance:"transparent",width:"full",onClick:this.setMapAreaOnClick.bind(this,!0),disabled:this.exportIsLoading},null===(t=this.messages)||void 0===t?void 0:t.setMapArea):null,i("calcite-button",{width:"full",onClick:this.exportOnClick.bind(this),disabled:this.exportIsLoading},"PDF"===this.selectedFileType?null===(n=this.messages)||void 0===n?void 0:n.export:null===(s=this.messages)||void 0===s?void 0:s.preview),c)}renderTitle(){var t;return i("calcite-label",null,null===(t=this.messages)||void 0===t?void 0:t.title,i("calcite-input",{value:this.headerTitle,onCalciteInputInput:this.updateHeaderTitle.bind(this)}))}renderSwitch(t,n,s){var e;const o=null!=n?n:null===(e=this.messages)||void 0===e?void 0:e[t];return i("calcite-label",{layout:"inline-space-between"},o,i("calcite-switch",{checked:this[t],value:t,onCalciteSwitchChange:this.optionOnChange.bind(this),disabled:s}))}renderSelectFileType(){var t;return i("calcite-label",null,null===(t=this.messages)||void 0===t?void 0:t.fileType,i("calcite-select",{onCalciteSelectChange:this.handleSelectFileType.bind(this)},this.fileTypes.map((t=>i("calcite-option",{value:t,selected:t===this.selectedFileType},t)))))}renderMapOptions(){const t=this.showIncludeLegend?this.renderSwitch("includeLegend"):null,n=this.showIncludePopup?this.renderSwitch("includePopup"):null;return i("div",null,t,n)}renderPrint(){const t=this.includeMap?this.renderPrintMap():null,n=this.renderExtraContent(),s=this.includeMap&&this.showIncludeLegend?this.renderLegend():null,e=this.includeMap&&this.showIncludePopup?this.renderPopup():null;return i("div",{ref:t=>this.printContainerEl=t},i("div",{class:U,ref:t=>this.printEl=t},t,s,i("div",{class:B},e,n)))}renderPrintMap(){return i("div",{class:tt,ref:t=>this.viewContainerEl=t},i("div",{class:nt,ref:t=>this.viewWrapperEl=t},this.headerTitle?i("instant-apps-header",{logoImage:this.logoImage,logoScale:"s",titleText:this.headerTitle,backgroundColor:"#fff",textColor:"#323232"}):null,i("img",{class:Z,ref:t=>this.viewEl=t}),i("div",{class:X,ref:t=>this.scaleBarContainerEl=t})))}renderLegend(){return i("div",{class:J,ref:t=>this.legendContainerEl=t})}renderCompass(){return i("div",{class:q,ref:t=>this.compassContainerEl=t})}renderPopup(){return i("div",{class:K,ref:t=>this.popupContainerEl=t},i("div",{ref:t=>this.popupTitleEl=t,class:Y}),i("div",{ref:t=>this.popupContentEl=t,class:Q}))}renderExtraContent(){return i("div",{class:N,id:"export-content",ref:t=>this.extraContainerEl=t})}renderImg(){const t=this.includeMap?this.renderPrintMap():null,n=this.includeMap&&this.showIncludeLegend?this.renderLegend():null;let s;return this.includeMap&&this.showIncludePopup?s=this.renderPopup():this.showExtraContentInImg&&null!=this.extraContent&&this.includeExtraContent&&(s=this.renderExtraContent()),i("div",{ref:t=>this.printContainerEl=t},i("div",{class:W,ref:t=>this.printEl=t},t,n,s))}optionOnChange(t){const{checked:n,value:i}=t.target;this[i]=n,this.updateExportOutput()}updateHeaderTitle(t){this.headerTitle=t.target.value,this.updateExportOutput()}async exportOnClick(){this.removeScreenshotElements(),await this.beforeExport(),null==this.viewWrapperEl||this.viewWrapperEl.contains(this.compassContainerEl)||this.viewWrapperEl.append(this.compassContainerEl),this.handleViewExportOnClick(),null!=this.popoverEl&&(this.popoverEl.open=!1)}async exportPreviewOnClick(){"PDF"===this.selectedFileType?await this.exportPDF():this.exportImg()}async exportPDF(){this.removeScreenshotElements(),await this.beforeExport(),null==this.viewWrapperEl||this.viewWrapperEl.contains(this.compassContainerEl)||this.viewWrapperEl.append(this.compassContainerEl),this.handleViewExportOnClick(),null!=this.popoverEl&&(this.popoverEl.open=!1)}exportImg(){var t;if(this.resetPopupVisibility(),null==this.dataUrl)return;const n=document.createElement("a");n.id="download-link",n.href=this.dataUrl,n.download=null!==(t=this.headerTitle)&&void 0!==t?t:document.title,n.click(),this.dataUrl=null,this.exportIsLoading=!1,this.removeScreenshotElements(),this.resetPrintContent()}async handleViewExportOnClick(){null!=this.view?(this.addPrintStyling(),document.body.prepend(this.printEl),this.handleExtraContent(),this.includeMap?(this.updateScaleBar(),this.viewScreenshot(),this.handleImgLoaded()):this.handleImgLoaded()):null!=this.popoverEl&&(this.popoverEl.open=!1)}addPrintStyling(){null==this.printStyleEl&&(this.printStyleEl=document.createElement("style"),this.printStyleEl.innerHTML='\n @media print {\n @page {\n size: Portrait;\n margin: .25in;\n }\n\n html, body {\n padding: 0;\n margin: 0;\n height: 100%;\n width: 100%;\n }\n\n body > *:not(.instant-apps-export-print) { display: none; }\n }\n\n * {\n -webkit-print-color-adjust: exact;\n color-adjust: exact;\n }\n\n\n .instant-apps-export-print {\n position: absolute;\n z-index: -999;\n color: #323232 !important;\n --esri-calcite-mode-name: "light";\n }\n\n .instant-apps-export-print__pdf {\n height: 100%;\n width: 100%;\n display: grid;\n gap: 24px;\n grid-auto-flow: row;\n }\n\n .instant-apps-export-print__img {\n display: grid;\n width: auto;\n }\n\n .instant-apps-export-print__img--extra-content {\n grid-template-columns: 2fr minmax(0, 325px);\n }\n\n .instant-apps-export-print, .instant-apps-export-print * {\n box-sizing: border-box;\n }\n\n .instant-apps-export-print__view-section {\n height: 100%;\n }\n\n .instant-apps-export-print__view-container {\n height: 100%;\n width: 100%;\n display: flex;\n justify-content: center;\n }\n\n .instant-apps-export-print__img .instant-apps-export-print__view-container {\n grid-row: 1;\n grid-column: 1;\n }\n\n .instant-apps-export-print__view-wrapper {\n height: fit-content;\n width: fit-content;\n position: relative;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .instant-apps-export-print__pdf .instant-apps-export-print__view-wrapper {\n border: 2pt solid #323232;\n }\n\n .instant-apps-export-print__img .instant-apps-export-print__view-wrapper {\n border: 1pt solid #323232;\n }\n\n .instant-apps-export-print__view {\n object-fit: contain;\n }\n\n .instant-apps-export-print__extra-container {\n grid-row: 1 / span 2;\n grid-column: 2;\n }\n \n .instant-apps-export-print__extra-container .esri-feature.esri-widget .esri-widget__heading.esri-feature__title {\n display: block;\n }\n\n .instant-apps-export-print__popup-container {\n height: min-content;\n max-width: 325px;\n display: none;\n color: #323232;\n background: #fff;\n break-inside: avoid;\n }\n\n .instant-apps-export-print__pdf .instant-apps-export-print__popup-container {\n border: 1pt solid #323232;\n }\n\n .instant-apps-export-print__img .instant-apps-export-print__popup-container {\n grid-row: 1 / span 2;\n grid-column: 2;\n }\n\n .instant-apps-export-print__popup-title {\n border-bottom: 1pt solid #323232;\n }\n\n .instant-apps-export-print__popup-content {\n background: #fff;\n padding-top: 8pt;\n }\n\n .instant-apps-export-print__popup-content .esri-feature-media__chart {\n background: #fff;\n }\n\n .instant-apps-export-print__legend-container {\n height: min-content;\n background: #fff;\n overflow: unset;\n }\n\n .instant-apps-export-print__img .instant-apps-export-print__legend-container {\n margin: 14px;\n grid-row: 2;\n grid-column: 1;\n }\n\n .esri-legend--card, .esri-legend--card__service-content {\n flex-flow: row wrap;\n }\n\n .instant-apps-export-print .esri-widget > *:not(.esri-scale-bar.esri-widget > *) {\n background: #fff;\n color: #323232;\n }\n\n .instant-apps-export-print__popup-content *, .instant-apps-export-print__img .esri-feature.esri-widget * {\n color: #323232;\n }\n\n .instant-apps-export-print .esri-widget__heading {\n margin: 4pt 7pt;\n padding: 0;\n color: #323232;\n }\n\n .instant-apps-export-print .esri-legend__ramp-label:before {\n border-color: rgba(0,0,0,0) rgba(50,50,50,.8) rgba(0,0,0,0) rgba(0,0,0,0);\n }\n\n .instant-apps-export-print .esri-legend--card__section {\n padding: 4pt 0 4pt;\n min-width: unset;\n border-left: none;\n }\n\n .instant-apps-export-print .esri-legend--card__section:first-child {\n border-left: none;\n }\n\n .instant-apps-export-print .esri-legend--card__service {\n border: none;\n flex: 0 1 auto;\n break-inside: avoid;\n }\n\n .instant-apps-export-print .esri-legend--card {\n border: none;\n gap: 6pt 12pt;\n }\n\n .instant-apps-export-print .esri-legend--card:not(:first-child),\n .instant-apps-export-print .esri-compass.esri-widget:not(:first-child) {\n display: none;\n }\n\n .instant-apps-export-print .esri-legend--card__service-caption-container {\n height: unset;\n padding: 0;\n border-bottom: none;\n }\n\n .instant-apps-export-print .esri-legend--card__service-caption-text {\n padding-bottom: 4px;\n }\n\n .instant-apps-export-print__compass-container {\n position: absolute;\n top: 65px;\n left: 15px;\n background: #fff;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n --calcite-ui-icon-color: #000;\n border-radius: 50%;\n height: fit-content;\n }\n\n .instant-apps-export-print__compass-container .esri-compass {\n background: #fff;\n }\n\n .instant-apps-export-print__compass-container .esri-compass__icon.esri-icon-compass {\n color: #000;\n }\n\n .instant-apps-export-print__compass-container.esri-compass.esri-widget--button {\n background: #fff;\n }\n\n .instant-apps-export-print__scale-bar-container {\n width: 100%;\n position: absolute;\n bottom: 15px;\n margin: 0 15px;\n }\n\n .instant-apps-export-print__scale-bar-container .esri-scale-bar__label {\n color: #323232;\n font-size: 10px;\n padding: 0 4px;\n }\n \n .instant-apps-export-print__scale-bar-container--position .esri-scale-bar__label {\n height: 10px;\n padding: 0 2px;\n line-height: 11px;\n }\n\n .instant-apps-export-print__scale-bar-container .esri-scale-bar__bar-container:nth-child(1n+3) {\n display: none;\n }\n\n .instant-apps-export-print__scale-bar-container--position .esri-scale-bar__bar-container.esri-scale-bar__bar-container--line {\n align-items: center;\n }\n\n .instant-apps-export-print__scale-bar-container .esri-scale-bar__line {\n background-color: rgba(255, 255, 255, 0.66);\n }\n\n .instant-apps-export-print__scale-bar-container .esri-scale-bar__line--top {\n width: var(--instant-apps-scale-bar-top) !important;\n border-bottom: 2px solid #323232;\n }\n\n .instant-apps-export-print__scale-bar-container .esri-scale-bar__line--bottom {\n width: var(--instant-apps-scale-bar-bottom) !important;\n border-top: 2px solid #323232;\n }\n\n .instant-apps-export-print__scale-bar-container--position .esri-scale-bar__label-container--line {\n position: unset;\n margin: 0 2px;\n background-color: rgba(255, 255, 255, 0.66);\n height: 10px;\n display: flex;\n align-items: center;\n }\n\n .instant-apps-export-print__scale-bar-container .esri-scale-bar__line--top:before,\n .instant-apps-export-print__scale-bar-container .esri-scale-bar__line--top:after,\n .instant-apps-export-print__scale-bar-container .esri-scale-bar__line--bottom:before,\n .instant-apps-export-print__scale-bar-container .esri-scale-bar__line--bottom:after {\n background-color: #323232;\n border-right: 2px solid #323232;\n }\n\n .instant-apps-export-print__popup-container .esri-feature-media__item-navigation {\n display: none;\n }\n\n .instant-apps-export-print__popup-container .esri-feature-media__chart.esri-feature-media__chart--rendered * {\n width: 100%!important;\n }\n\n .instant-apps-export-print__popup-content .esri-popup__content {\n margin: 0;\n }\n\n .instant-apps-export-print__content-container {\n display: flex;\n gap: 24px;\n break-inside: avoid;\n break-before: auto;\n }',document.body.prepend(this.printStyleEl))}handleImgLoaded(){this.exportIsLoading=!0,setTimeout((()=>{"PDF"===this.selectedFileType&&(this.exportIsLoading=!1),this.setupViewPrintElements()}),1500)}handleExtraContent(){const t=this.printEl.querySelector("#export-content");if(null!=t){t.innerHTML="";const n=null!=this.extraContent&&this.includeExtraContent;this.printEl.classList.toggle(A,"PDF"!==this.selectedFileType&&this.showExtraContentInImg&&n),n?(t.style.display="block",t.append(this.extraContent.cloneNode(!0))):t.style.display="none"}else this.showExtraContentInImg&&"PDF"!==this.selectedFileType&&!this.includeExtraContent&&this.printEl.classList.toggle(A,!1)}resetPrintContent(){var t,n,i;if(null!=this.view){this.screenshot=null,null===(t=this.printContainerEl)||void 0===t||t.prepend(this.printEl),null===(n=this.printStyleEl)||void 0===n||n.remove(),null===(i=this.tmpPopupTitleEl)||void 0===i||i.remove(),this.printStyleEl=void 0;const s=this.printEl.querySelector("#export-content");s&&(s.innerHTML="")}}async updatePopupToPrint(){var t,n;if(null==this.view||null==this.popupContainerEl)return;this.popupContainerEl.style.display=this.includePopup&&this.view.popup.visible?"block":"none",this.checkPopupOpen();const i=this.includePopup&&(this.view.popup.visible||this.popupHiddenByMapArea)&&null!=this.view.popup.selectedFeature;if(this.printEl.classList.toggle(A,"PDF"!==this.selectedFileType&&i),i){const i=document.createElement(`h${null!==(t=this.view.popup.headingLevel)&&void 0!==t?t:2}`);i.innerHTML=null!==(n=this.view.popup.title)&&void 0!==n?n:"",i.className="esri-widget__heading esri-popup__header-title",null==this.popupTitleEl?(this.tmpPopupTitleEl=document.createElement("div"),this.tmpPopupTitleEl.prepend(i),this.tmpPopupTitleEl.style.display=this.view.popup.title?"block":"none",this.popupContainerEl.prepend(this.tmpPopupTitleEl)):(this.popupTitleEl.style.display=this.view.popup.title?"block":"none",this.popupTitleEl.innerHTML="",this.popupTitleEl.prepend(i))}}updateExportOutput(){this.output={},this.showHeaderTitle&&(this.output.headerTitle=this.headerTitle),this.showIncludeLegend&&(this.output.includeLegend=this.includeLegend),this.showIncludeMap&&(this.output.includeMap=this.includeMap),this.showIncludePopup&&(this.output.includePopup=this.includePopup),this.exportOutputUpdated.emit()}setupViewPrintElements(){if(null!=this.view)if(this.handleLegendSetup(),"PDF"===this.selectedFileType){const t=document.title;this.showHeaderTitle&&this.headerTitle&&(document.title=this.headerTitle),window.print(),document.title=t,setTimeout((()=>{this.resetPrintContent()}),1e3)}else this.convertToImage()}convertToImage(){const t={backgroundColor:"#FFF",skipFonts:!0};"JPG"===this.selectedFileType?async function(t,n={}){return(await V(t,n)).toDataURL("image/jpeg",n.quality||1)}(this.printEl,t).then(this.handleGetImage.bind(this)):async function(t,n={}){return(await V(t,n)).toDataURL()}(this.printEl,t).then(this.handleGetImage.bind(this))}handleGetImage(t){var n;this.resetPrintContent(),this.dataUrl=t,this.setMapAreaOnClick(!1),this.showPreview(t),null===(n=this.view)||void 0===n||n.container.classList.remove("screenshot-cursor"),this.setMaskPosition(null)}handleLegendSetup(){var t;if(this.showIncludeLegend&&null!=this.view&&this.includeMap&&null!=this.legendContainerEl){const n=null!=this.legend&&(null===(t=this.legend.activeLayerInfos)||void 0===t?void 0:t.length)>0;this.legendContainerEl.style.display=this.includeLegend&&n?"block":"none"}}handleWidgetCreation(){this.includeMap&&(this.handleLegendCreation(),this.handleCompassCreation(),this.updatePopupToPrint())}handleIncludePopup(){var t,n;if(this.showIncludePopup){const i="includePopup";null===(t=this.handles)||void 0===t||t.remove(i),null===(n=this.reactiveUtils)||void 0===n||n.whenOnce((()=>{var t;return null===(t=this.view)||void 0===t?void 0:t.ready})).then((()=>{var t;null===(t=this.handles)||void 0===t||t.add(this.reactiveUtils.watch((()=>{var t,n;return null===(n=null===(t=this.view)||void 0===t?void 0:t.popup)||void 0===n?void 0:n.visible}),(t=>{this.settingMapArea||(this.includePopup=t)})),i)}))}}handleLegendCreation(){var t,n,i,s,e;if(null!=this.view&&this.showIncludeLegend&&null!=this.legendContainerEl){const o=this.view.map,r=null===(n=null===(t=this.legend)||void 0===t?void 0:t.view)||void 0===n?void 0:n.map;null!=(null===(i=null==o?void 0:o.portalItem)||void 0===i?void 0:i.id)&&(null===(s=null==o?void 0:o.portalItem)||void 0===s?void 0:s.id)===(null===(e=null==r?void 0:r.portalItem)||void 0===e?void 0:e.id)||this.updateLegend()}}updateLegend(){var t;null===(t=this.view)||void 0===t||t.when((async t=>{if(null!=this.legend&&(this.legend.destroy(),this.legend=null),null!=this.legendContainerEl){this.legendContainerEl.innerHTML="";const n=document.createElement("div");this.legendContainerEl.append(n);const[i]=await o(["esri/widgets/Legend"]);this.legend=new i({container:n,view:t,respectLayerDefinitionExpression:!0,style:{type:"card",layout:"side-by-side"}})}}))}handleCompassCreation(){var t,n,i,s;if(null!=this.view&&null!=this.compassContainerEl){const e=this.view.map,o=null===(n=null===(t=this.compass)||void 0===t?void 0:t.view)||void 0===n?void 0:n.map;(null===(i=null==e?void 0:e.portalItem)||void 0===i?void 0:i.id)===(null===(s=null==o?void 0:o.portalItem)||void 0===s?void 0:s.id)||this.updateCompass()}}updateCompass(){var t;null===(t=this.view)||void 0===t||t.when((async t=>{var n;null===(n=this.compass)||void 0===n||n.destroy(),this.compass=null;const i=document.createElement("div");this.compassContainerEl.append(i);const[s]=await o(["esri/widgets/Compass"]);this.compass=new s({container:i,view:t})}))}updateScaleBar(){if(this.scaleBarContainerEl&&null!=this.view&&(this.scaleBarContainerEl.innerHTML="",this.showScaleBar)){const t=this.view.ui.getComponents(),n=null==t?void 0:t.find((({container:t})=>{var n;return null===(n=null==t?void 0:t.className)||void 0===n?void 0:n.includes("esri-scale-bar")}));null!=(null==n?void 0:n.container)&&"string"!=typeof n.container&&this.scaleBarContainerEl.append(n.container.cloneNode(!0))}}async viewScreenshot(){var t;if(null!=this.view&&this.includeMap&&(null==this.screenshot&&(null===(t=this.scaleBarContainerEl)||void 0===t||t.classList.toggle("instant-apps-export-print__scale-bar-container--position",this.view.width>1e3),this.screenshot=await this.view.takeScreenshot({width:2*this.view.width,height:2*this.view.height})),this.handleScaleBarSize(),null!=this.viewEl&&null!=this.viewWrapperEl)){const{height:t,width:n}=this.screenshot.data;t>n?this.setMaxRowHeightOnViewContainer():this.setMaxWidthOnViewContainer(),this.viewEl.src=this.screenshot.dataUrl}}setMaxRowHeightOnViewContainer(){"PDF"===this.selectedFileType&&(this.printEl.style.gridTemplateRows="minmax(auto, 70%)"),this.viewEl.style.height="100%",this.viewEl.style.width="",this.viewWrapperEl.style.height="100%",this.viewWrapperEl.style.width="fit-content"}setMaxWidthOnViewContainer(){this.printEl.style.gridTemplateRows="",this.viewEl.style.width="100%",this.viewEl.style.height="",this.viewWrapperEl.style.height="fit-content",this.viewWrapperEl.style.width="100%"}checkPopupOpen(){if(null!=this.view){const t=this.view.popup.container,n=null==t?void 0:t.querySelector(".esri-popup .esri-feature__main-container");if(null!=n){const t=n.querySelectorAll("canvas");this.popupContentEl.innerHTML="",this.popupContentEl.append(n.cloneNode(!0));const i=this.popupContentEl.querySelectorAll("canvas");t.forEach(((t,n)=>{var s;const e=t.toDataURL(),o=document.createElement("img");o.src=e;const r=t.getAttribute("style");r&&o.setAttribute("style",r);const a=i[n];null!=a&&(a.replaceWith(o),document.querySelector("link[href*='esri/themes/dark/main.css']")&&null!=(null===(s=o.parentElement)||void 0===s?void 0:s.parentElement)&&(o.parentElement.style.background="#242424",o.parentElement.parentElement.style.background="#242424"))}))}}}createScreenshot(){var t,n,i;if(null!=this.view){this.screenshotPreview=document.createElement("div"),this.screenshotPreview.className="screenshot-preview hide",this.screenshotImgContainer=document.createElement("div"),this.screenshotImgContainer.className="screenshot-img-container",this.screenshotImg=document.createElement("img");const s=document.createElement("div"),e=document.createElement("calcite-button"),o=document.createElement("calcite-button");e.innerHTML="PDF"===this.selectedFileType?null===(t=this.messages)||void 0===t?void 0:t.export:null===(n=this.messages)||void 0===n?void 0:n.downloadImage,o.innerHTML=null===(i=this.messages)||void 0===i?void 0:i.returnToMap,o.appearance="outline-fill",e.onclick=this.exportPreviewOnClick.bind(this),o.onclick=this.screenshotReturn.bind(this),s.append(o,e),this.screenshotImgContainer.append(this.screenshotImg,s),this.screenshotPreview.append(this.screenshotImgContainer),this.view.container.append(this.screenshotPreview)}}createMaskDiv(){null!=this.view&&(this.maskDivEl=document.createElement("div"),this.maskDivEl.id="screenshot-mask",this.maskDivEl.className="hide screenshot-cursor",this.maskDivEl.style.setProperty("--instant-apps-screenshot-mask-background",this.maskBackground),this.maskDivEl.style.setProperty("--instant-apps-screenshot-mask-border",this.maskBorder),this.screenshotStyle=document.createElement("style"),this.screenshotStyle.innerHTML="\n.screenshot-preview.hide, .hide {\n display: none;\n}\n\n.screenshot-cursor {\n cursor: crosshair;\n}\n\n.relative {\n position: relative;\n}\n\n#screenshot-mask {\n position: absolute;\n background: var(--instant-apps-screenshot-mask-background);\n border: var(--instant-apps-screenshot-mask-border);\n}\n\n.screenshot-preview {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n text-align: center;\n background-color: rgba(0, 0, 0, 0.75);\n}\n\n.screenshot-preview * {\n box-sizing: border-box;\n}\n\n.screenshot-img-container img {\n max-height: 75%;\n max-width: 75%;\n object-fit: contain;\n box-shadow: 2px 2px 5px 0 rgba(0, 0, 0, 0.5);\n margin-bottom: 0.5em;\n}\n\n.screenshot-img-container {\n height: 100%;\n width: 100%;\n overflow-y: auto;\n margin-bottom: 8px;\n display: flex;\n flex-flow: column;\n align-items: center;\n justify-content: center;\n}\n\n.screenshot-img-container calcite-button {\n margin: 5px;\n}",this.view.container.append(this.screenshotStyle),this.view.container.append(this.maskDivEl))}screenshotReturn(){this.removeScreenshotElements(),this.exportIsLoading=!1,this.screenshot=null,this.resetPopupVisibility()}setMapAreaOnClick(t){null!=this.view&&(this.settingMapArea=!0,t&&this.view.popup.visible&&(this.popupHiddenByMapArea=!0,this.view.popup.container.style.display="none"),this.exportIsLoading=!0,this.createMaskDiv(),this.createScreenshot(),this.view.container.classList.add("screenshot-cursor","relative"),this.view.addHandles(this.view.on("drag",(async t=>{null!=this.view&&(t.stopPropagation(),"end"!==t.action?this.updateMaskSize(t):this.maskScreenshot())})),it))}updateMaskSize(t){if(null!=this.view){const n=this.clamp(Math.min(t.origin.x,t.x),0,this.view.width),i=this.clamp(Math.max(t.origin.x,t.x),0,this.view.width),s=this.clamp(Math.min(t.origin.y,t.y),0,this.view.height),e=this.clamp(Math.max(t.origin.y,t.y),0,this.view.height);this.area={x:n,y:s,width:i-n,height:e-s},this.setMaskPosition(this.area)}}maskScreenshot(){var t;if(null!=this.view&&null!=this.area){this.view.removeHandles(it);const n=this.area.height,i=this.area.width;this.showScaleBar&&(null===(t=this.scaleBarContainerEl)||void 0===t||t.classList.toggle("instant-apps-export-print__scale-bar-container--position",this.view.width>1e3&&.75*this.view.width<i)),this.view.takeScreenshot({area:this.area,width:2*i,height:2*n,format:"jpg"}).then((t=>{var n;this.screenshot=t,null===(n=this.view)||void 0===n||n.container.classList.remove("screenshot-cursor"),this.setMaskPosition(null),"PDF"===this.selectedFileType?(this.showPreview(null==t?void 0:t.dataUrl),this.resetPopupVisibility()):(null==this.viewWrapperEl||this.viewWrapperEl.contains(this.compassContainerEl)||this.viewWrapperEl.append(this.compassContainerEl),this.handleViewExportOnClick(),null!=this.popoverEl&&(this.popoverEl.open=!1))}))}}setMaskPosition(t){null!=t?(this.maskDivEl.classList.remove("hide"),this.maskDivEl.style.left=`${t.x}px`,this.maskDivEl.style.top=`${t.y}px`,this.maskDivEl.style.width=`${t.width}px`,this.maskDivEl.style.height=`${t.height}px`):this.maskDivEl.remove()}clamp(t,n,i){return t<n?n:t>i?i:t}showPreview(t){t&&(this.screenshotPreview.classList.remove("hide"),null!=this.screenshotImg&&(this.screenshotImg.src=t))}handleScaleBarSize(){var t;if(this.showScaleBar&&"2d"===(null===(t=this.view)||void 0===t?void 0:t.type)&&null!=this.scaleBarContainerEl){const t=this.scaleBarContainerEl.querySelector(".esri-scale-bar__line--top"),n=this.scaleBarContainerEl.querySelector(".esri-scale-bar__line--bottom");this.setScalebarWidth(t,"top"),this.setScalebarWidth(n,"bottom")}}setScalebarWidth(t,n){var i;if(null!=t&&null!=this.screenshot){const s=this.screenshot.data.width/2,e=Number(t.style.width.replace("px",""));null===(i=this.scaleBarContainerEl)||void 0===i||i.style.setProperty(`--instant-apps-scale-bar-${n}`,e/s*100+"%")}}removeScreenshotElements(){var t,n,i;null===(t=this.view)||void 0===t||t.removeHandles(it),null===(n=this.screenshotPreview)||void 0===n||n.remove(),null===(i=this.screenshotStyle)||void 0===i||i.remove()}resetPopupVisibility(){this.view&&this.settingMapArea&&this.popupHiddenByMapArea&&(this.view.popup.container.style.display=""),this.settingMapArea=!1,this.popupHiddenByMapArea=!1}handleSelectFileType(t){this.selectedFileType=t.target.value,"PDF"===this.selectedFileType?(this.includeMap=this.pdfIncludeMap,this.showExtraContentInImg||(this.includeExtraContent=this.pdfIncludeExtraContent)):(this.pdfIncludeMap=this.includeMap,this.includeMap=!0,this.showExtraContentInImg||(this.pdfIncludeExtraContent=this.includeExtraContent,this.includeMap=!0,this.includeExtraContent=!1))}get el(){return e(this)}static get watchers(){return{includeMap:["watchIncludeMap"],view:["watchView"]}}};st.style=":host{display:block;--instant-apps-export-action-background:var(--calcite-color-foreground-1);--instant-apps-export-action-background-hover:var(--calcite-color-foreground-2);--instant-apps-export-action-background-press:var(--calcite-color-foreground-3);--instant-apps-export-action-height:100%;--instant-apps-export-action-width:fit-content;--instant-apps-export-action-icon-color:var(--calcite-color-text-3);--instant-apps-export-action-icon-hover-color:var(--calcite-color-text-1);--instant-apps-export-background:var(--calcite-color-foreground-1);--instant-apps-export-text-color:var(--calcite-color-text-1);--instant-apps-export-popover-width:250px}.instant-apps-export{height:100%}.instant-apps-export *{box-sizing:border-box}.instant-apps-export__popover-container,.instant-apps-export__inline-container{padding:12px;background:var(--instant-apps-export-background);--calcite-color-text-1:var(--instant-apps-export-text-color)}.instant-apps-export__popover-container{width:var(--instant-apps-export-popover-width)}.instant-apps-export calcite-action{height:var(--instant-apps-export-action-height);width:var(--instant-apps-export-action-width);--calcite-color-foreground-1:var(--instant-apps-export-action-background);--calcite-color-foreground-2:var(--instant-apps-export-action-background-hover);--calcite-color-foreground-3:var(--instant-apps-export-action-background-press);--calcite-color-text-3:var(--instant-apps-export-action-icon-color);--calcite-color-text-1:var(--instant-apps-export-action-icon-hover-color)}.instant-apps-export .instant-apps-export-print{display:none}.instant-apps-export .instant-apps-export-print_img{display:flex;flex-flow:row wrap}.instant-apps-export__visually-hidden{position:absolute;top:0;z-index:-1;visibility:hidden}.instant-apps-export calcite-input{--calcite-color-foreground-1:var(--instant-apps-export-background);--calcite-color-text-1:var(--instant-apps-export-text-color)}.instant-apps-export calcite-popover{--calcite-color-foreground-1:var(--instant-apps-export-background)}.instant-apps-export calcite-switch{--calcite-color-foreground-1:#fff;--calcite-color-foreground-2:#f3f3f3}.instant-apps-export calcite-button:last-of-type{margin-top:0.5rem}.instant-apps-export .calcite-mode-dark calcite-switch{--calcite-color-foreground-1:#2b2b2b;--calcite-color-foreground-2:#202020}.instant-apps-export__compass-container.esri-widget{background:#fff;box-shadow:0 1px 2px rgba(0, 0, 0, 0.3)}.instant-apps-export__compass-container.esri-widget .esri-compass__icon.esri-icon-compass{color:#6e6e6e}.hide{display:none}.screenshotCursor{cursor:crosshair}";export{st as instant_apps_export}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright 2022 Esri
3
- * Licensed under the Apache License, Version 2.0
4
- * http://www.apache.org/licenses/LICENSE-2.0
5
- */
6
- import{r as t,c as i,g as s,h as e,H as a,F as h}from"./p-4e6eb06e.js";import{l,g as o}from"./p-f4aadb3b.js";import{g as c,a as n,b as r,c as d,h as u,d as p,q as f}from"./p-d572627c.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";const m=class{constructor(s){t(this,s),this.togglePanel=i(this,"togglePanel",7),this.center=void 0,this.commentButtonText=void 0,this.commentSubmittedMessage=void 0,this.defaultWebmap="",this.description=void 0,this.enableAnonymousAccess=void 0,this.enableAnonymousComments=void 0,this.enableComments=void 0,this.enableHome=!0,this.enableLogin=void 0,this.enableNewReports=void 0,this.enableSearch=!0,this.enableZoom=!0,this.isMobile=void 0,this.layerExpressions=[],this.layerId=void 0,this.level=void 0,this.locale=void 0,this.loginTitle=void 0,this.mapInfos=[],this.mapView=void 0,this.objectId=void 0,this.reportButtonText=void 0,this.reportingOptions=void 0,this.reportsHeader=void 0,this.reportSubmittedMessage=void 0,this.searchConfiguration=void 0,this.showComments=void 0,this.showUserImageInCommentsList=!1,this.showFeatureSymbol=!1,this.showMyReportsOnly=!1,this.theme="light",this.zoomToScale=void 0,this.floorLevel=void 0,this._featureCreationFailedErrorMsg=void 0,this._filterActive=!1,this._flowItems=[],this._hasValidLayers=!1,this._mapInfo=void 0,this._reportSubmitted=!1,this._selectedLayerName=void 0,this._showSubmitCancelButton=!1,this._showLoadingIndicator=!1,this._sidePanelCollapsed=!1,this._translations=void 0,this._updatedProgressBarStatus=.25,this._updatedSorting=void 0,this._updatedSortOption="sortNewest",this._commentSubmitted=!1,this._addingCommentFailed=!1}get el(){return s(this)}_createFeature;_currentFeatureId;_defaultCenter;_defaultLevel;_editableLayerIds;_featureDetails;_featureList;_currentFeature;_selectedRelatedFeature;_relatedTable;_filterList;_highlightHandle;_layerList;_createRelatedFeature;_layers;_mapChange;_mapClickHandle;reactiveUtils;FeatureFilter;_selectedFeature;_selectedFeatureIndex;_selectedLayerId;_shareNode;_urlParamsLoaded;_validLayers;_nonVisibleValidLayers;_selectedLayer;_layerItemsHash;_showFullPanel;_floorExpression;_formElements=[];_prevSelectedLayerId;_currentLayerExpressions;_initDefExpressions;async isMobileWatchHandler(){this.updatePanelState(!1,this._showFullPanel)}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(){await this.mapView.when((async()=>{this.setInitExpressions(),await this.setMapView()}))}async floorLevelWatchHandler(){if(this._editableLayerIds)for(const t of this._editableLayerIds){const i=await c(this.mapView,t);i.floorInfo?.floorField&&this._updateFloorDefinitionExpression(i)}"layer-list"===this._flowItems[this._flowItems.length-1]&&this._layerList&&await this._layerList.refresh(),this._featureList&&this._featureList.refresh(),this._createFeature&&this._createFeature.refresh(this.floorLevel)}async showMyReportsOnlyWatchHandler(){this._editableLayerIds&&(await this._updateFeatures(),setTimeout((()=>{"layer-list"===this._flowItems[this._flowItems.length-1]&&this._layerList&&this._layerList.refresh(),this._featureList&&this._featureList.refresh()}),50))}togglePanel;async componentWillLoad(){this._urlParamsLoaded=!1,await this._initModules(),await this._getTranslations(),await(this.mapView?.when((async()=>{this._layers=this.reportingOptions?Object.keys(this.reportingOptions).filter((t=>this.reportingOptions[t].visible)):[],this.setInitExpressions(),await this.setMapView()})))}componentWillRender(){this._flowItems.includes("filter-panel")&&this._filterList?.updateInitDefExpressions({initDefExpressions:this._initDefExpressions})}render(){const t="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return e(a,{key:"f1dd6d85210210a73fff30a5d98370da1834be7b"},this._reportSubmitted&&e("calcite-alert",{key:"b84760fcbf4bfcf0f038be272f74eda97ce17bd9","auto-close":!0,class:t+" report-submitted-msg",icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._reportSubmitted=!1},open:!0,placement:"top"},e("div",{key:"27aa04dd8575ad27898f7848bc2733a03a33e70f",slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&e("calcite-alert",{key:"3fc2721bed573ad10bbb1c81af126e2e8ca90b12","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},e("div",{key:"4993e5c5b52d650b094c2890d0e4516cc87ffb69",slot:"title"},this._translations.error),e("div",{key:"272b17f4c0239d8b295d6f2c0c02f1ba236d840d",slot:"message"},this._featureCreationFailedErrorMsg)),this._commentSubmitted&&e("calcite-alert",{key:"5b9e1a2bd129888ec0764ad9b05e5056653d3c33","auto-close":!0,class:"report-submitted "+t,icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._commentSubmitted=!1},open:!0,placement:"top"},e("div",{key:"bd428297f5fe85cbf7edc42c61c64c299d7954b7",slot:"message"},this.commentSubmittedMessage||this._translations.commentSubmittedMsg)),this._addingCommentFailed&&e("calcite-alert",{key:"2aa1927ca27f9ec15a16f8e68905a1cf203ef833","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._addingCommentFailed=!1},open:!0,placement:"top"},e("div",{key:"4bff5fb03586edf0f9ea21649d1de4c34034e539",slot:"title"},this._translations.error),e("div",{key:"7ea6c71dbbac15c2f43242ba00c9e461177051a1",slot:"message"},this._translations.addingCommentFailedMsg)),e("div",{key:"3aa6bfc19a1e82ab90d2ab42aa9a577b3a2b6d8f"},e("calcite-shell",{key:"f27355d4f655c0a0931158f38f0be3eb28f6c4d4","content-behind":!0},this._getReporter())))}async _initModules(){const[t,i]=await l(["esri/core/reactiveUtils","esri/layers/support/FeatureFilter"]);this.reactiveUtils=t,this.FeatureFilter=i}async setSelectedLayer(t,i){this._selectedLayerId=t,this._selectedLayer=await c(this.mapView,t),this._selectedLayerName=i,this._validLayers.forEach((i=>{this._nonVisibleValidLayers.find((t=>t.id===i.id))||i.set("visible",!t||i.id===t)}))}_getLayersConfig(t){return this.reportingOptions&&this.reportingOptions[t]?this.reportingOptions[t]:null}_getReporter(){const t=[];return this._flowItems.forEach((i=>{switch(i){case"layer-list":t.push(this.getLayerListFlowItem());break;case"feature-list":t.push(this.getFeatureListFlowItem(this._selectedLayerId,this._selectedLayerName));break;case"filter-panel":t.push(this.getFilterPanel());break;case"feature-details":t.push(this.getFeatureDetailsFlowItem());break;case"reporting-layer-list":t.push(this.getChooseCategoryFlowItem());break;case"feature-create":t.push(this.getFeatureCreateFlowItem());break;case"comment-details":t.push(this.getCommentDetailsFlowItem());break;case"add-comment":t.push(this.getAddCommentFlowItem())}})),e("calcite-panel",{class:"width-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},this.mapView?e("calcite-flow",null,t?.length>0&&t):e("calcite-loader",{label:"",scale:"m"}))}async sortOptionClick(t,i,s){this._updatedSorting={field:t,order:i},this._updatedSortOption=s}_toggleSort(){const t=this.reportingOptions&&this.reportingOptions[this._selectedLayerId]&&this.reportingOptions[this._selectedLayerId].like&&this.reportingOptions[this._selectedLayerId].likeField;return e("calcite-popover",{autoClose:!0,label:"",offsetDistance:0,placement:this.isMobile?"leading-start":"bottom-start",pointerDisabled:!0,referenceElement:"sort-popover"},e("calcite-list",{"selection-mode":"single"},e("calcite-list-item",{label:this._translations.sortNewest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"desc","sortNewest")},selected:"sortNewest"===this._updatedSortOption,value:"sortNewest"}),e("calcite-list-item",{label:this._translations.sortOldest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"asc","sortOldest")},selected:"sortOldest"===this._updatedSortOption,value:"sortOldest"}),t&&e(h,null,e("calcite-list-item",{label:this._translations.sortHighestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"desc","sortHighestVoted")},selected:"sortHighestVoted"===this._updatedSortOption,value:"sortHighestVoted"}),e("calcite-list-item",{label:this._translations.sortLowestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"asc","sortLowestVoted")},selected:"sortLowestVoted"===this._updatedSortOption,value:"sortLowestVoted"}))))}async _handleFilterListReset(){this._filterActive=!1}async _handleFilterUpdate(t){this._showLoadingIndicator=!0,this._filterActive=t,await this._featureList.refresh(),this._showLoadingIndicator=!1}getLayerListFlowItem(){return e("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportsHeader},this.isMobile&&this.getActionToExpandCollapsePanel(),this._hasValidLayers&&this.enableNewReports&&e("calcite-button",{appearance:"solid",onClick:this.navigateToChooseCategory.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),e("calcite-panel",{"full-height":!0,"full-width":!0},e("layer-list",{applyLayerViewFilter:this.showMyReportsOnly,class:"height-full",layers:this._editableLayerIds?.length>0?this._editableLayerIds:this._layers,locale:this.locale,mapView:this.mapView,onLayerSelect:this.displayFeaturesList.bind(this),onLayersListLoaded:this.layerListLoaded.bind(this),ref:t=>this._layerList=t,showFeatureCount:!0,showNextIcon:!0})))}getChooseCategoryFlowItem(){const t=this.reportingOptions?Object.keys(this.reportingOptions).filter((t=>this.reportingOptions[t].visible&&this.reportingOptions[t].reporting&&this._layerItemsHash[t]&&this._layerItemsHash[t].supportsAdd)):[];return e("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},e("calcite-panel",{"full-height":!0,"full-width":!0},e("div",{class:"progress-bar"},e("calcite-progress",{type:"determinate",value:this._updatedProgressBarStatus})),e("calcite-notice",{class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},e("div",{slot:"message"},this._translations.chooseCategoryMsg)),e("layer-list",{class:"height-full",layers:t,locale:this.locale,mapView:this.mapView,onLayerSelect:this.navigateToCreateFeature.bind(this),showFeatureCount:!1,showNextIcon:!1})))}getFeatureCreateFlowItem(){return e("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,onCalciteFlowItemBack:this.backFromCreateFeaturePanel.bind(this)},this._showSubmitCancelButton&&e("div",{class:"width-full",slot:"footer"},e("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:this.onCreateFeatureSubmitButtonClick.bind(this),width:"full"},this._translations.submit),e("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateFeaturePanel.bind(this),width:"full"},this._translations.cancel)),e("calcite-panel",{"full-height":!0,"full-width":!0},e("div",{class:"progress-bar"},e("calcite-progress",{type:"determinate",value:this._updatedProgressBarStatus})),e("create-feature",{customizeSubmit:!0,enableSearch:!0,floorLevel:this.floorLevel,formElements:this._formElements.find((t=>t.id===this._selectedLayerId)),isMobile:this.isMobile,locale:this.locale,mapView:this.mapView,onDrawComplete:this.onFormReady.bind(this),onEditingAttachment:this.showSubmitCancelButton.bind(this),onFail:this.createFeatureFailed.bind(this),onModeChanged:this.backFromCreateFeaturePanel.bind(this),onProgressStatus:this.updatedProgressStatus.bind(this),onSuccess:this.onReportSubmitted.bind(this),ref:t=>this._createFeature=t,searchConfiguration:this.searchConfiguration,selectedLayerId:this._selectedLayerId})))}updatedProgressStatus(t){this._updatedProgressBarStatus=t.detail}onFormReady(){this._showSubmitCancelButton=!0}showSubmitCancelButton(t){this._showSubmitCancelButton=!t.detail}onCreateFeatureSubmitButtonClick(){this._createFeature&&this._createFeature.submit()}backFromCreateFeaturePanel(){this._createFeature&&this.updateNonVisibleLayersOnMap(!1),this.backFromSelectedPanel()}onCreateRelatedFeatureSubmitButtonClick(){this._createRelatedFeature&&this._createRelatedFeature.submit()}backFromCreateRelatedFeaturePanel(){this._createRelatedFeature&&(this._showSubmitCancelButton=!1),this.backFromSelectedPanel()}createFeatureFailed(t){console.error(t.detail),this._featureCreationFailedErrorMsg=t.detail.message}async onReportSubmitted(){this.updateNonVisibleLayersOnMap(!1),await this.navigateToHomePage(),this._reportSubmitted=!0,this._updatedProgressBarStatus=.25,this._showFullPanel&&this.updatePanelState(this._sidePanelCollapsed,!1)}addCommentFailed(t){console.error(t.detail),this._addingCommentFailed=!0}async onCommentSubmitted(){this._commentSubmitted=!0,this.backFromSelectedPanel(),this._showLoadingIndicator=!0,await this._featureDetails.refresh(this._currentFeature),setTimeout((()=>{this._showLoadingIndicator=!1}),300)}async navigateToHomePage(){await this.setSelectedFeatures([]),this._layerList&&await this._layerList.refresh(),1===this._editableLayerIds.length?(await this._featureList.refresh(),this._flowItems=["feature-list"]):this._flowItems=["layer-list"]}async navigateToCreateFeature(t){t.detail.layerId&&t.detail.layerName&&await this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this.updateNonVisibleLayersOnMap(!0),this._getFormElements(),this._showSubmitCancelButton=!1,this.updatePanelState(!1,!0),this._flowItems=[...this._flowItems,"feature-create"]}navigateToChooseCategory(){this.updatePanelState(!1,!0),this._flowItems=[...this._flowItems,"reporting-layer-list"]}updateNonVisibleLayersOnMap(t){this._nonVisibleValidLayers.find((t=>t.id===this._selectedLayerId))&&this._selectedLayer.set("visible",t)}async layerListLoaded(t){const i=t.detail,s=await n(this.mapView),e=[];this._validLayers=[],this._nonVisibleValidLayers=[],s.forEach((t=>{i.includes(t.id)&&(this._validLayers.push(t),t.visible||this._nonVisibleValidLayers.push(t),this._getLayersConfig(t.id)?.reporting&&this._layerItemsHash[t.id]&&this._layerItemsHash[t.id].supportsAdd&&e.push(t.id))})),this.handleMapClick(),this._hasValidLayers=e.length>0,this._urlParamsLoaded||(this._urlParamsLoaded=!0,await this.loadFeatureFromURLParams())}async displayFeaturesList(t){this._updatedSorting={field:"",order:"desc"},this._updatedSortOption="sortNewest",await this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this.handleSelectedLayersFilter(),this._flowItems=[...this._flowItems,"feature-list"],this._prevSelectedLayerId=this._selectedLayerId}async backFromFilterPanel(){null!=this._filterList&&(this._currentLayerExpressions=await this._filterList.getCurrentLayerExpressions()),await this._featureList.refresh(),this.backFromSelectedPanel()}backFromSelectedPanel(){this._updatedProgressBarStatus=.25;const t=[...this._flowItems];"comment-details"!==t[t.length-1]&&"add-comment"!==t[t.length-1]&&this.clearHighlights(),"reporting-layer-list"!==t[t.length-1]&&("feature-create"!==t[t.length-1]||"feature-list"!==t[0]&&"feature-list"!==t[t.length-2])||this.updatePanelState(this._sidePanelCollapsed,!1),t.pop(),1!==t.length||"layer-list"!==t[0]?this._flowItems=[...t]:this.navigateToHomePage()}toggleSidePanel(){this._sidePanelCollapsed=!this._sidePanelCollapsed,this.togglePanel.emit({panelState:this._sidePanelCollapsed,isFormOpen:this._showFullPanel})}updatePanelState(t,i){this._sidePanelCollapsed=t,this._showFullPanel=i,this.togglePanel.emit({panelState:this._sidePanelCollapsed,isFormOpen:this._showFullPanel})}async onFeatureSelectFromList(t){this._showLoadingIndicator=!0,await this.setSelectedFeatures([t.detail]),this._flowItems=[...this._flowItems,"feature-details"]}async getRelatedTable(){const t=this._currentFeature.layer,i=await r(this.mapView);t.relationships.some((s=>{const e=i.filter((i=>t.url===i.url&&i.layerId===s.relatedTableId));if(e&&e.length>0)return this._relatedTable=e[0],!0}))}async updatingFeatureDetails(t){this._showLoadingIndicator=t}async selectionChanged(t){this.updatingFeatureDetails(!0),await this.setCurrentFeature(t.detail.selectedFeature[0]),this.highlightOnMap(t.detail.selectedFeature[0]),this._selectedFeatureIndex=t.detail.selectedFeatureIndex,await this._featureDetails.refresh(t.detail.selectedFeature[0])}showAddCommentsPanel(){this._flowItems=[...this._flowItems,"add-comment"]}async onCommentSelectFromList(t){this._selectedRelatedFeature=[t.detail],this._flowItems=[...this._flowItems,"comment-details"]}getFeatureListFlowItem(t,i){const s=this._getLayersConfig(this._selectedLayerId)?.reporting&&this._layerItemsHash[this._selectedLayerId].supportsAdd,a=this._currentLayerExpressions?.length>0;return e("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:i,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this._toggleSort(),e("calcite-action",{icon:"sort-ascending-arrow",id:"sort-popover",slot:"header-actions-end",text:this._translations.sort,title:this._translations.sort}),a&&e("calcite-action",{icon:"filter",indicator:this._filterActive,onClick:()=>{this._flowItems=[...this._flowItems,"filter-panel"]},slot:"header-actions-end",text:this._translations.filter,title:this._translations.filter}),this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&s&&e("calcite-button",{appearance:"solid",onClick:this.navigateToCreateFeature.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),e("calcite-panel",{"full-height":!0},e("feature-list",{applyLayerViewFilter:this.showMyReportsOnly,class:"height-full",highlightOnHover:!0,locale:this.locale,mapView:this.mapView,noFeaturesFoundMsg:this._translations.featureErrorMsg,onFeatureSelect:this.onFeatureSelectFromList.bind(this),pageSize:30,ref:t=>this._featureList=t,reportingOptions:this.reportingOptions,selectedLayerId:t,showFeatureSymbol:this.showFeatureSymbol,sortingInfo:this._updatedSorting})))}getFilterPanel(){return e("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._translations?.filterLayerTitle?.replace("{{title}}",this._selectedLayerName),loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromFilterPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),e("div",{class:"width-full",slot:"footer"},e("div",{class:"width-full",slot:"footer"},e("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",disabled:!this._filterActive,onClick:this.resetFilterList.bind(this),width:"full"},this._translations.resetFilter),e("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromFilterPanel.bind(this),width:"full"},this._translations.close))),e("calcite-panel",{"full-height":!0},e("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtnOnClick:()=>{},comboboxOverlayPositioning:"fixed",layerExpressions:this._currentLayerExpressions,onFilterListReset:()=>this._handleFilterListReset(),onFilterUpdate:()=>this._handleFilterUpdate(this._filterList.filterCount>0),ref:t=>this._filterList=t,resetBtn:!1,resetFiltersOnDisconnect:!1,view:this.mapView,zoomBtn:!1})))}getFeatureDetailsFlowItem(){const t=this._getLayersConfig(this._selectedLayerId)?.comment&&this._selectedLayer.relationships.length>0&&this._relatedTable;return e("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),e("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"share-node",embed:!1,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,removePopoverOffset:!0,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",slot:"header-actions-end",socialMedia:!0,view:this.mapView}),this._selectedFeature.length>1&&this.getFeaturesPagination(),e("calcite-panel",null,e("feature-details",{class:"full-height",graphics:this._selectedFeature,layerItemsHash:this._layerItemsHash,locale:this.locale,mapView:this.mapView,onAddComment:this.showAddCommentsPanel.bind(this),onCommentSelect:this.onCommentSelectFromList.bind(this),onFeatureSelectionChange:this.selectionChanged.bind(this),onLikeOrDislikeClicked:()=>{this._featureList.refresh(!0)},onLoadingStatus:t=>{this.updatingFeatureDetails(t.detail)},ref:t=>this._featureDetails=t,reportingOptions:this.reportingOptions,showUserImageInCommentsList:this.showUserImageInCommentsList}),t&&e("calcite-button",{appearance:"solid",onClick:this.showAddCommentsPanel.bind(this),slot:"footer",width:"full"},this.commentButtonText||this._translations.comment)))}getFeaturesPagination(){return e("div",{class:"feature-pagination"},e("div",null,e("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-left",id:"solutions-back",onClick:()=>{this._featureDetails.back()},scale:"s",width:"full"}),e("calcite-tooltip",{label:"",placement:"top","reference-element":"solutions-back"},e("span",null,this._translations.back))),e("calcite-button",{appearance:"transparent",onClick:()=>{this._featureDetails.toggleListView()},scale:"s"},e("span",{class:"pagination-count"},this._getCount())),e("div",null,e("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-right",id:"solutions-next",onClick:()=>{this._featureDetails.next()},scale:"s",width:"full"}),e("calcite-tooltip",{placement:"top","reference-element":"solutions-next"},e("span",null,this._translations.next))))}getCommentDetailsFlowItem(){return e("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._relatedTable.title,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),e("calcite-panel",{"full-height":!0},e("info-card",{allowEditing:!1,graphics:this._selectedRelatedFeature,highlightEnabled:!1,isLoading:!1,isMobile:!1,locale:this.locale,mapView:this.mapView,paginationEnabled:!1})))}getAddCommentFlowItem(){return e("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._relatedTable.title,onCalciteFlowItemBack:this.backFromCreateRelatedFeaturePanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),e("div",{class:"width-full",slot:"footer"},this._showSubmitCancelButton&&e("div",{class:"width-full",slot:"footer"},e("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:this.onCreateRelatedFeatureSubmitButtonClick.bind(this),width:"full"},this._translations.submit),e("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateRelatedFeaturePanel.bind(this),width:"full"},this._translations.cancel))),e("calcite-panel",null,e("create-related-feature",{customizeSubmit:!0,locale:this.locale,mapView:this.mapView,onFail:this.addCommentFailed.bind(this),onFormReady:this.onFormReady.bind(this),onIsActionPending:this.showSubmitCancelButton.bind(this),onSuccess:this.onCommentSubmitted.bind(this),ref:t=>this._createRelatedFeature=t,selectedFeature:this._currentFeature,table:this._relatedTable})))}async setSelectedFeatures(t){this._selectedFeature=t,await this.setCurrentFeature(this._selectedFeature.length?this._selectedFeature[0]:null)}async setCurrentFeature(t){if(this._currentFeature=t,t&&t.layer){const i=t.layer;this.setSelectedLayer(i.id,i.title),this._currentFeatureId=t.attributes[i.objectIdField],this._getLayersConfig(i.id)?.comment&&i.relationships.length>0&&await this.getRelatedTable()}else this._editableLayerIds.length>1&&(this.setSelectedLayer("",""),this.handlePrevLayersFilter()),this._currentFeatureId="";this._updateShareURL()}async highlightOnMap(t){if(this.clearHighlights(),t&&t.geometry&&t.layer){const i=await d(this.mapView,t.layer.id);i.highlightOptions=null,this._highlightHandle=await u([t.getObjectId()],i,this.mapView,!0,this.zoomToScale)}this.updatingFeatureDetails(!1)}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}getActionToExpandCollapsePanel(){return e("calcite-action",{icon:this._sidePanelCollapsed?"chevrons-up":"chevrons-down",onClick:this.toggleSidePanel.bind(this),slot:"header-actions-end",text:this._sidePanelCollapsed?this._translations.expand:this._translations.collapse})}async setMapView(){await this.getLayersToShowInList(),await this._updateFeatures(),1===this._editableLayerIds?.length?await this.renderFeaturesList():this._flowItems=["layer-list"],this.mapView.popupEnabled=!1,this._defaultCenter&&this._defaultLevel&&(await this.mapView.goTo({center:this._defaultCenter,zoom:this._defaultLevel}),this._defaultCenter=void 0,this._defaultLevel=void 0)}handleMapClick(){this._mapClickHandle&&this._mapClickHandle.remove(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",this.onMapClick.bind(this))}async onMapClick(t){this.mapView.popupEnabled=!1;const i=await this.mapView.hitTest(t);if(i.results.length>0){const t=[];i.results.forEach((function(i){"graphic"===i.type&&t.push(i.graphic)}));const s=t.filter((t=>this._validLayers.includes(t.layer))),e=t.filter((t=>!this._validLayers.includes(t.layer)&&t?.layer?.popupEnabled&&t?.layer?.id));if(s.length>0&&(await this.setSelectedFeatures(s),this._flowItems.length&&this._flowItems.includes("feature-details")?(this._flowItems=[...this._flowItems.slice(0,this._flowItems.indexOf("feature-details")+1)],await this.highlightOnMap(t[0])):this._flowItems=[...this._flowItems,"feature-details"]),e.length>0){this.mapView.popupEnabled=!0;const t={features:e,updateLocationEnabled:!0};await this.mapView.openPopup(t)}}}_getCount(){const t=(this._selectedFeatureIndex+1).toString(),i=this._selectedFeature.length.toString();return this._translations.indexOfTotal.replace("{{index}}",t).replace("{{total}}",i)}async _getTranslations(){const t=await o(this.el);this._translations=t[0]}_updateFloorDefinitionExpression(t){const i=`${t.floorInfo.floorField} = '${this.floorLevel}'`,s=t.definitionExpression;t.definitionExpression=s?.indexOf(this._floorExpression)>-1?s.replace(this._floorExpression,i):i,this._floorExpression=i}_getFormElements(){const t=this._selectedLayer,i=t?.floorInfo?.floorField;if(i&&this.floorLevel&&t?.formTemplate){const i=this._formElements.find((i=>i.id===t.id));0!==this._formElements.length&&i||this._formElements.push({id:t.id,orgElements:t.formTemplate.elements,orgExpressionInfos:t.formTemplate.expressionInfos})}}reduceToConfiguredLayers(t,i){return Object.keys(t).reduce(((s,e)=>{const a=this.reportingOptions?this._getLayersConfig(e)?.visible:t[e].supportsAdd;return!i.includes(e)&&a&&s.push(e),s}),[])}async _updateFeatures(){for(const t of this._editableLayerIds){const i=await d(this.mapView,t);await this._showMyFeaturesOnly(i);const s=i.layer?.floorInfo?.floorField;s&&this.floorLevel&&this._updateFloorDefinitionExpression(i.layer)}}async _showMyFeaturesOnly(t){const i=this.mapView.map.portalItem.portal?.credential?.userId;if(i){const s=t.layer.editFieldsInfo?.creatorField.toLowerCase();t.filter=this.showMyReportsOnly&&s?new this.FeatureFilter({where:s+"='"+i+"'"}):null}}async getLayersToShowInList(){const t=await p(this.mapView,!0),i=await n(this.mapView),s=[];i.forEach((i=>{"feature"===i?.type&&i?.editingEnabled&&i?.capabilities?.operations?.supportsAdd&&(t[i.id].supportsAdd=!0),i?.editingEnabled||s.push(i.id)})),this._editableLayerIds=this.reduceToConfiguredLayers(t,s),this._layerItemsHash=t}async renderFeaturesList(){this._flowItems=["feature-list"];const t={detail:this._editableLayerIds};await this.layerListLoaded(t),await this.setSelectedLayer(this._validLayers[0].id,this._validLayers[0].title),this.handleSelectedLayersFilter()}_updateShareURL(){const t=this._shareNode?.shareUrl;if(!t)return;const i=new URL(t);this._selectedLayerId?i.searchParams.set("layerid",this._selectedLayerId):i.searchParams.delete("layerid"),this._selectedFeature?.length?i.searchParams.set("oid",this._currentFeatureId):i.searchParams.delete("oid"),this._shareNode.shareUrl=i.href}async loadFeatureFromURLParams(){if(this.center&&this.level&&await this.mapView.goTo({center:this.center.split(";").map(Number),zoom:this.level}),this.layerId&&this.objectId){const t=await c(this.mapView,this.layerId);if(t){const i=await f([Number(this.objectId)],t,[],!0,this.mapView.spatialReference);i.length&&(await this.setSelectedFeatures(i),this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems])}}}async handleSelectedLayersFilter(){this._selectedLayer&&(this._currentLayerExpressions=this.layerExpressions?this.layerExpressions.filter((t=>t.id===this._selectedLayerId)):[],this.setActiveDefinitionExpressions())}async handlePrevLayersFilter(){if(this._prevSelectedLayerId){const t=await c(this.mapView,this._prevSelectedLayerId);t&&(t.definitionExpression=this._initDefExpressions[this._prevSelectedLayerId])}}resetFilterList(){this._filterList?.forceReset(),null!=this._selectedLayer&&(this._selectedLayer.definitionExpression=this._initDefExpressions[this._selectedLayerId],this._filterActive=!1)}setActiveDefinitionExpressions(){if(null==this._selectedLayer)return;const t=[];if(this._currentLayerExpressions?.length>0){const i=this._currentLayerExpressions[0];for(const s of i.expressions){const{active:i,definitionExpression:e}=s;i&&e&&t.push(`(${e})`)}this._filterActive=t.length>0,this.updateFilterLayerDefExpression(t,i.operator)}}updateFilterLayerDefExpression(t,i){const s=this._initDefExpressions[this._selectedLayerId],e=t?.length>0&&null!=s?`(${t.join(i)}) AND (${s})`:t.length>0?t.join(i):s;this._selectedLayer.definitionExpression=e}setInitExpressions(){if(this._initDefExpressions={},null==this.mapView)return;const t=this.mapView.map;t.allLayers.concat(t.allTables).forEach((t=>{"feature"===t.type&&(this._initDefExpressions[t.id]=t.definitionExpression)}))}static get watchers(){return{isMobile:["isMobileWatchHandler"],locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],floorLevel:["floorLevelWatchHandler"],showMyReportsOnly:["showMyReportsOnlyWatchHandler"]}}};m.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.notice-msg{padding:10px;width:calc(100% - 20px)}.progress-bar{padding:12px}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}.feature-pagination{background-color:var(--calcite-color-foreground-1) !important;border-block-end:1px solid var(--calcite-color-border-3);display:flex;justify-content:center;padding:5px 0}.pagination-count{color:var(--calcite-color-brand);border-bottom:1px solid var(--calcite-color-brand);font-weight:bold}.report-submitted-msg{position:absolute;z-index:1000}.share-node{display:flex}";export{m as crowdsource_reporter}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright 2022 Esri
3
- * Licensed under the Apache License, Version 2.0
4
- * http://www.apache.org/licenses/LICENSE-2.0
5
- */
6
- import{r as t,c as i,h as s,H as o,g as e}from"./p-4e6eb06e.js";import{l as n}from"./p-d001e961.js";import{b as a}from"./p-5104cc98.js";import{w as r}from"./p-04674a1e.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-ac122d9e.js";const l="instant-apps-scoreboard",d=`${l}--`,c=`${l}__`,p=r.medium[1],h={BASE:l,itemsContainer:`${c}items-container`,items:`${c}items`,item:`${c}item`,label:`${c}item-label`,value:`${c}item-value`,valuePlaceholder:`${c}item-value-placeholder`,position:{bottom:`${c}position--bottom`,side:`${c}position--side`,left:`${c}position--left`,right:`${c}position--right`},mode:{floating:`${c}mode--floating`,pinned:`${c}mode--pinned`}},b=class{constructor(s){t(this,s),this.scoreboardItemsUpdated=i(this,"scoreboardItemsUpdated",7),this.view=void 0,this.items=void 0,this.position="bottom",this.mode="floating",this.itemLimit=6,this.autoDockEnabled=!0,this.geometry=null,this.state="loading",this.messages=void 0,this.itemIndex=0,this.layers=void 0,this.layerViews=void 0,this.isMobile=!1}scoreboardItemsUpdatedHandler(){this.scoreboardItemsUpdated.emit(this.items)}generateUIDs(){this.itemIndex=0,this.items.forEach(this.generateUID())}async storeLayers(){this.state="calculating",await this.view.map.loadAll();const t=this.items.map((t=>{var i;return null===(i=null==t?void 0:t.layer)||void 0===i?void 0:i.id}));this.layers=this.view.map.allLayers.filter((i=>(i=>(t=>!t.isTable)(i)&&(t=>"feature"===t.type||"scene"===t.type)(i)&&(i=>t.indexOf(i.id)>-1)(i))(i))),this.watchLayerVisibility()}async storeLayerViews(){if(this.layers&&this.layers.length>0){this.layers.forEach((t=>t.outFields=["*"]));const t=[];this.layers.forEach((i=>{const s=this.view.whenLayerView(i);t.push(s)}));const i=(await Promise.allSettled(t)).filter((t=>"fulfilled"==t.status&&t.value)).map((t=>t.value)),s=[];i.forEach((t=>{var i;return s.push(null===(i=this.reactiveUtils)||void 0===i?void 0:i.whenOnce((()=>!t.updating)))})),await Promise.all(s),this.layerViews=new this.Collection([...i])}}calculateScoreboardItemValuesFromGeometry(){this.calculateScoreboardItemValues()}async calculateScoreboardItemValues(){if(this.layers&&0===this.layers.length||this.layerViews&&0===this.layerViews.length)return;this.state="calculating";const t=[...this.items],i=[];this.queryStatDefinitions(t,i);const s=await Promise.all(i);this.handleQueryFeaturesResponses(s,t),this.items.length=0,t.forEach((t=>this.items.push(t))),this.state="complete",this.scoreboardItemsUpdatedHandler(),this.initStationaryWatcher()}async componentWillLoad(){var t;new ResizeObserver((()=>{this.itemIndex=0,this.autoDockEnabled&&(this.isMobile=!!this.checkMobile)})).observe(null===(t=this.el)||void 0===t?void 0:t.parentElement);try{this.state="loading",await this.initMessages()}catch(t){return this.state="disabled",Promise.reject()}finally{if(!this.view||!this.items)return this.state="disabled",Promise.reject();try{return await this.initModules(),Promise.resolve()}catch(t){return this.state="disabled",Promise.reject()}}}async componentDidLoad(){var t;if("disabled"!==this.state)try{await(null===(t=this.reactiveUtils)||void 0===t?void 0:t.whenOnce((()=>{var t;return null===(t=this.view)||void 0===t?void 0:t.ready}))),this.generateUIDs(),await this.loadMapResources(),this.storeLayers(),this.initViewUpdateWatcher()}catch(t){this.state="disabled",console.error(`${l}: FAILED TO LOAD MAP RESOURCES`)}}disconnectedCallback(){var t,i,s,o,e,n;this.state="disabled",this.itemIndex=0,null===(t=this.layers)||void 0===t||t.removeAll(),null===(i=this.layers)||void 0===i||i.destroy(),this.layers=null,null===(s=this.layerViews)||void 0===s||s.removeAll(),null===(o=this.layerViews)||void 0===o||o.destroy(),this.layerViews=null,null===(e=this.handles)||void 0===e||e.removeAll(),null===(n=this.handles)||void 0===n||n.destroy(),this.handles=null}async initMessages(){let t;try{return t=(await a(this.el))[0],this.messages=Object.assign(Object.assign({},this.messages),t),Promise.resolve()}catch(t){console.error("FAILED TO LOAD MESSAGES"),Promise.reject()}}async initModules(){try{const[t,i,s,o]=await n(["esri/core/Handles","esri/core/reactiveUtils","esri/core/Collection","esri/intl"]);return this.reactiveUtils=i,this.Collection=s,this.intl=o,this.handles=new t,this.layers=new s,this.layerViews=new s,Promise.resolve()}catch(t){return console.error(t),this.state="disabled",Promise.reject()}}async loadMapResources(){const{map:t}=this.view,i=t;try{return await i.loadAll(),Promise.resolve()}catch(t){return console.error(t),this.state="disabled",Promise.reject()}}generateUID(){return t=>{const i=Math.random(),s=Math.floor(10*Math.random())+11,o=i.toString(s).replace("0.","");t.uid=o}}render(){var t,i;const{state:e}=this,n="disabled"===e,a="loading"===e||"calculating"===e||(null===(t=this.view)||void 0===t?void 0:t.updating)?this.renderProgress():null;return s(o,{key:"5fed5010f728e5d8c4866af3bc38b41ac9b5424f",class:`${this.getPositionClass} ${this.getStyleClass}`},n?null:[a,(null===(i=this.items)||void 0===i?void 0:i.length)>0?this.renderBase():null])}renderBase(){return s("div",{key:"instant-apps-scoreboard-base",class:l},this.renderContent())}renderContent(){const{state:t}=this;return"loading"===t?this.renderLoader():"calculating"===t||"complete"===t?this.renderItemsContainer():null}renderItemsContainer(){const[t,i]=this.renderPreviousNextButtons();return s("div",{class:h.itemsContainer},t,this.renderItems(),i)}renderPreviousNextButtons(){var t,i,o;const e=this.getItemLimit(),n=(null===(t=this.items.filter((t=>t.visible)))||void 0===t?void 0:t.length)<=e,a=0===this.itemIndex,r=this.isEnd,l=!!this.isMobile||"bottom"===this.position,d=l?"start":"center",c={previous:l?"chevron-left":"chevron-up",next:l?"chevron-right":"chevron-down"},p=a||n?"blank":c.previous,h=r||n?"blank":c.next,b={previous:a||n,next:r||n},u="transparent",m=this.isMobile?"s":"l",v={previous:null===(i=this.messages)||void 0===i?void 0:i.previous,next:null===(o=this.messages)||void 0===o?void 0:o.next};return[s("calcite-action",{onClick:this.previousItem.bind(this),icon:p,disabled:b.previous,alignment:d,scale:m,appearance:u,text:v.previous,label:v.previous}),s("calcite-action",{onClick:this.nextItem.bind(this),icon:h,disabled:b.next,alignment:d,scale:m,appearance:u,text:v.next,label:v.next})]}renderItems(){const{items:t}=h,i=this.getItemsToDisplay.map((t=>this.renderItem(t)));return s("ul",{class:t},i)}renderItem(t){const{label:i}=t;return s("li",{class:h.item},s("span",{class:h.label,title:i},i),this.renderValue(t))}renderValue(t){var i,o,e;const{displayValue:n}=t,a="disabled"===this.state,r=void 0===n&&"calculating"===this.state,l=n||(null===(i=this.messages)||void 0===i?void 0:i.NA),d=null===(o=this.layers)||void 0===o?void 0:o.find((i=>{var s;return(null===(s=null==t?void 0:t.layer)||void 0===s?void 0:s.id)===i.id})),c=!(null==d?void 0:d.visible),p=r?this.renderValuePlaceholder():a?"":c?s("calcite-icon",{icon:"view-hide",scale:"l",title:null===(e=this.messages)||void 0===e?void 0:e.layerVisibilityOff}):l;return s("span",{class:h.value},p)}renderValuePlaceholder(){return s("span",{class:h.valuePlaceholder})}renderProgress(){return s("calcite-progress",{key:`${d}calcite-progress`,type:"indeterminate"})}renderLoader(){var t;const i=null===(t=this.messages)||void 0===t?void 0:t.loading;return s("calcite-loader",{key:`${d}calcite-loader`,label:i,text:i,scale:"m"})}get getPositionClass(){const{bottom:t,left:i,right:s,side:o}=h.position;return this.isMobile||"bottom"===this.position?t:`${"left"===this.position?i:s} ${o}`}get getStyleClass(){const{floating:t,pinned:i}=h.mode;return this.isMobile?i:"floating"===this.mode?t:i}get checkMobile(){var t,i;const s=null===(i=null===(t=this.el)||void 0===t?void 0:t.parentElement)||void 0===i?void 0:i.offsetWidth;return!isNaN(s)&&s>0&&s<p}get getItemsToDisplay(){const t=this.getItemLimit();return this.items.filter((t=>t.visible)).slice(this.itemIndex,t+this.itemIndex)}get isEnd(){const t=this.getItemLimit(),i=this.items.slice(this.items.length-t).map((t=>t.uid)),s=this.items.slice(this.itemIndex,this.itemIndex+t).map((t=>t.uid));return i.every(((t,i)=>t===s[i]))}previousItem(){this.itemIndex=this.itemIndex-1}nextItem(){this.itemIndex=this.itemIndex+1}queryStatDefinitions(t,i){const s=(t,i)=>{var s,o,e,n,a;const r=t.createQuery(),l=this.geometry?this.geometry:this.view.extent;r.outStatistics=[i],r.geometry=l;const d=null!==(a=null!==(o=null===(s=null==t?void 0:t.filter)||void 0===s?void 0:s.timeExtent)&&void 0!==o?o:null===(n=null===(e=null==t?void 0:t.featureEffect)||void 0===e?void 0:e.filter)||void 0===n?void 0:n.timeExtent)&&void 0!==a?a:null;return d&&(r.timeExtent=d),r};t.forEach((()=>async t=>{var o;const e=null===(o=this.layerViews)||void 0===o?void 0:o.find((i=>{var s;return i.layer.id===(null===(s=null==t?void 0:t.layer)||void 0===s?void 0:s.id)}));if(!e)return;const n=(t=>{const{field:i,operation:s}=t;return{onStatisticField:i,outStatisticFieldName:`${i}_${s}`,statisticType:s}})(t),a=s(e,n),r=e.queryFeatures(a);i.push(r)})())}handleQueryFeaturesResponses(t,i){t.forEach((()=>(t,s)=>{const o=(t=>{const i=t.features[0],{attributes:s}=i;return Object.values(s)[0]})(t),e=null!==o,n=e?this.intl.formatNumber(o,{notation:"compact",compactDisplay:"short"}):null;i[s].displayValue=e?`${n}`:"",i[s].value=o})())}initStationaryWatcher(){var t,i;const s={once:!0,initial:!0},o=()=>{var t;return null===(t=this.reactiveUtils)||void 0===t?void 0:t.when((()=>{var t;return!(null===(t=this.view)||void 0===t?void 0:t.interacting)}),(()=>this.calculateScoreboardItemValues()),s)},e="stationary-watcher-key";(null===(t=this.handles)||void 0===t?void 0:t.has(e))&&this.handles.remove(e),null===(i=this.handles)||void 0===i||i.add((()=>{var t;return null===(t=this.reactiveUtils)||void 0===t?void 0:t.when((()=>{var t;return null===(t=this.view)||void 0===t?void 0:t.stationary}),(()=>o()))})(),e)}initViewUpdateWatcher(){return this.reactiveUtils.watch((()=>{var t;return null===(t=this.view)||void 0===t?void 0:t.updating}),(()=>{this.reactiveUtils.when((()=>{var t;return!(null===(t=this.view)||void 0===t?void 0:t.updating)}),(()=>this.calculateScoreboardItemValues()),{once:!0,initial:!0})}),{initial:!0})}watchLayerVisibility(){var t,i;if(!this.layers)return;const s="visbilityWatcherKey";null===(t=this.handles)||void 0===t||t.remove(s);const o=[];this.layers.forEach((t=>{const i=async()=>{const i=await this.view.whenLayerView(t);await this.reactiveUtils.whenOnce((()=>!1===(null==i?void 0:i.updating))),this.calculateScoreboardItemValues()},s=this.reactiveUtils.watch((()=>null==t?void 0:t.visible),(async()=>i()));o.push(s)})),null===(i=this.handles)||void 0===i||i.add([...o],s)}getItemLimit(){return this.itemLimit<2||this.itemLimit>6?6:this.itemLimit}get el(){return e(this)}static get watchers(){return{items:["generateUIDs","storeLayers"],layers:["storeLayerViews"],geometry:["calculateScoreboardItemValuesFromGeometry"],layerViews:["calculateScoreboardItemValues"]}}};b.style=":host{display:block;--instant-apps-scoreboard-background-color:var(--calcite-color-foreground-1);--instant-apps-scoreboard-text-color:var(--calcite-color-text-1);--instant-apps-scoreboard-mobile-position-bottom:0;background-color:var(--instant-apps-scoreboard-background-color);color:var(--instant-apps-scoreboard-text-color)}:host .instant-apps-scoreboard{box-sizing:border-box;border:1px solid var(--calcite-color-border-1);box-shadow:0px 3px 15px rgba(0, 0, 0, 0.2);border-radius:3px}:host .instant-apps-scoreboard calcite-loader{--calcite-loader-padding:1rem}:host .instant-apps-scoreboard__items-container{display:flex}:host .instant-apps-scoreboard__items-container calcite-action{height:100%}:host .instant-apps-scoreboard__items,:host .instant-apps-scoreboard__item{box-sizing:border-box;display:flex}:host .instant-apps-scoreboard__items{list-style-type:none;padding-left:0;margin:0;padding-top:1.75%;padding-bottom:1.75%;width:100%}:host .instant-apps-scoreboard__item{flex-direction:column;justify-content:flex-end;align-items:center;padding:1%}:host .instant-apps-scoreboard__item-label{box-sizing:border-box;line-height:24px;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;word-break:break-word;font-size:1rem;font-weight:400;text-align:center}:host .instant-apps-scoreboard__item-value{display:flex;justify-content:center;align-items:center;min-width:32px;min-height:32px;margin-top:5px;font-size:1.5rem;font-weight:900}:host .instant-apps-scoreboard__item-value-placeholder{display:inline-block;width:32px;height:32px;background-color:var(--calcite-color-foreground-3);border-radius:4px}:host(.instant-apps-scoreboard__position--bottom){bottom:0}:host(.instant-apps-scoreboard__position--bottom) .instant-apps-scoreboard{display:flex;justify-content:center}:host(.instant-apps-scoreboard__position--bottom) .instant-apps-scoreboard__items{display:flex;justify-content:center}:host(.instant-apps-scoreboard__position--bottom) .instant-apps-scoreboard__item{min-width:10vw;vertical-align:top}:host(.instant-apps-scoreboard__position--bottom.instant-apps-scoreboard__mode--floating){left:50%;max-width:calc(100% - 30px);transform:translate(-50%, -15px)}:host(.instant-apps-scoreboard__position--bottom.instant-apps-scoreboard__mode--floating) .instant-apps-scoreboard{min-width:25vw}:host(.instant-apps-scoreboard__position--bottom.instant-apps-scoreboard__mode--pinned){left:unset;bottom:0;transform:unset;width:100%}:host(.instant-apps-scoreboard__position--bottom.instant-apps-scoreboard__mode--pinned) .instant-apps-scoreboard{min-width:unset}:host(.instant-apps-scoreboard__position--bottom.instant-apps-scoreboard__mode--pinned) .instant-apps-scoreboard__items-container{width:100%;justify-content:space-between}:host(.instant-apps-scoreboard__position--side) .instant-apps-scoreboard{display:flex;justify-content:center;align-items:center;width:10vw;overflow-y:auto}:host(.instant-apps-scoreboard__position--side) .instant-apps-scoreboard__items-container{flex-direction:column;height:100%;box-sizing:border-box}:host(.instant-apps-scoreboard__position--side) .instant-apps-scoreboard__items-container calcite-action{height:unset;width:100%}:host(.instant-apps-scoreboard__position--side) .instant-apps-scoreboard__items{flex-direction:column;padding:10px}:host(.instant-apps-scoreboard__position--side) .instant-apps-scoreboard__item{padding-top:0.5vh;padding-bottom:0.5vh}:host(.instant-apps-scoreboard__position--side.instant-apps-scoreboard__mode--floating){top:15px;left:15px;max-height:calc(100% - 30px)}:host(.instant-apps-scoreboard__position--side.instant-apps-scoreboard__mode--floating) .instant-apps-scoreboard{min-width:10vw;min-height:35vh}:host(.instant-apps-scoreboard__position--side.instant-apps-scoreboard__mode--pinned){top:unset;left:unset;transform:unset;height:100%}:host(.instant-apps-scoreboard__position--side.instant-apps-scoreboard__mode--pinned) .instant-apps-scoreboard{height:100%}:host(.instant-apps-scoreboard__position--side.instant-apps-scoreboard__mode--pinned) .instant-apps-scoreboard__items-container{justify-content:space-between}:host(.instant-apps-scoreboard__position--left.instant-apps-scoreboard__mode--floating){left:15px}:host(.instant-apps-scoreboard__position--right.instant-apps-scoreboard__mode--floating){left:unset;right:15px}:host(.instant-apps-scoreboard__position--left.instant-apps-scoreboard__mode--pinned){left:0}:host(.instant-apps-scoreboard__position--right.instant-apps-scoreboard__mode--pinned){left:unset;right:0}@media only screen and (min-width: 992px){:host(.instant-apps-scoreboard__position--bottom.instant-apps-scoreboard__mode--pinned){bottom:var(--instant-apps-scoreboard-mobile-position-bottom)}:host(.instant-apps-scoreboard__position--bottom.instant-apps-scoreboard__mode--pinned) .instant-apps-scoreboard__item{justify-content:center;min-width:unset;flex-grow:1}}";export{b as instant_apps_scoreboard}