@esri/solutions-components 0.11.22 → 0.11.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/cjs/basemap-gallery_7.cjs.entry.js +6 -6
  2. package/dist/cjs/buffer-tools_2.cjs.entry.js +1 -1
  3. package/dist/cjs/card-manager_3.cjs.entry.js +10 -6
  4. package/dist/cjs/consent-manager.cjs.entry.js +1 -1
  5. package/dist/cjs/create-feature_4.cjs.entry.js +22 -11
  6. package/dist/cjs/create-related-feature_3.cjs.entry.js +25 -19
  7. package/dist/cjs/crowdsource-manager.cjs.entry.js +3 -2
  8. package/dist/cjs/crowdsource-reporter.cjs.entry.js +7 -6
  9. package/dist/cjs/deduct-calculator.cjs.entry.js +1 -1
  10. package/dist/cjs/delete-dialog.cjs.entry.js +1 -1
  11. package/dist/cjs/feature-list.cjs.entry.js +4 -4
  12. package/dist/cjs/json-editor_7.cjs.entry.js +7 -7
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/cjs/map-layer-picker.cjs.entry.js +1 -1
  15. package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
  16. package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
  17. package/dist/cjs/public-notification.cjs.entry.js +1 -1
  18. package/dist/cjs/solution-configuration.cjs.entry.js +3 -3
  19. package/dist/cjs/solution-contents_3.cjs.entry.js +3 -3
  20. package/dist/cjs/solution-item-accordion.cjs.entry.js +1 -1
  21. package/dist/cjs/solution-item-icon.cjs.entry.js +1 -1
  22. package/dist/cjs/solutions-components.cjs.js +1 -1
  23. package/dist/cjs/spatial-ref.cjs.entry.js +1 -1
  24. package/dist/collection/assets/t9n/layer-table/resources.json +4 -1
  25. package/dist/collection/assets/t9n/layer-table/resources_en.json +4 -1
  26. package/dist/collection/components/card-manager/card-manager.js +23 -2
  27. package/dist/collection/components/consent-manager/consent-manager.js +1 -1
  28. package/dist/collection/components/create-feature/create-feature.css +1 -1
  29. package/dist/collection/components/create-feature/create-feature.js +28 -3
  30. package/dist/collection/components/create-related-feature/create-related-feature.css +1 -1
  31. package/dist/collection/components/create-related-feature/create-related-feature.js +74 -49
  32. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +23 -2
  33. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +27 -6
  34. package/dist/collection/components/deduct-calculator/deduct-calculator.js +1 -1
  35. package/dist/collection/components/delete-button/delete-button.js +1 -1
  36. package/dist/collection/components/delete-dialog/delete-dialog.js +1 -1
  37. package/dist/collection/components/edit-card/edit-card.css +1 -1
  38. package/dist/collection/components/edit-card/edit-card.js +48 -23
  39. package/dist/collection/components/feature-details/feature-details.js +27 -6
  40. package/dist/collection/components/feature-list/feature-list.js +4 -4
  41. package/dist/collection/components/floor-filter/floor-filter.js +1 -1
  42. package/dist/collection/components/info-card/info-card.js +23 -2
  43. package/dist/collection/components/json-editor/json-editor.js +1 -1
  44. package/dist/collection/components/layer-table/layer-table.js +6 -3
  45. package/dist/collection/components/map-card/map-card.js +1 -1
  46. package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
  47. package/dist/collection/components/map-fullscreen/map-fullscreen.js +1 -1
  48. package/dist/collection/components/map-layer-picker/map-layer-picker.js +1 -1
  49. package/dist/collection/components/map-legend/map-legend.js +1 -1
  50. package/dist/collection/components/map-picker/map-picker.js +1 -1
  51. package/dist/collection/components/map-search/map-search.js +1 -1
  52. package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
  53. package/dist/collection/components/map-tools/map-tools.js +1 -1
  54. package/dist/collection/components/pci-calculator/pci-calculator.js +1 -1
  55. package/dist/collection/components/pdf-download/pdf-download.js +1 -1
  56. package/dist/collection/components/public-notification/public-notification.js +1 -1
  57. package/dist/collection/components/refine-selection/refine-selection.js +1 -1
  58. package/dist/collection/components/solution-configuration/solution-configuration.js +3 -3
  59. package/dist/collection/components/solution-contents/solution-contents.js +1 -1
  60. package/dist/collection/components/solution-item/solution-item.js +1 -1
  61. package/dist/collection/components/solution-item-accordion/solution-item-accordion.js +1 -1
  62. package/dist/collection/components/solution-item-details/solution-item-details.js +1 -1
  63. package/dist/collection/components/solution-item-icon/solution-item-icon.js +1 -1
  64. package/dist/collection/components/solution-item-sharing/solution-item-sharing.js +1 -1
  65. package/dist/collection/components/solution-organization-variables/solution-organization-variables.js +1 -1
  66. package/dist/collection/components/solution-resource-item/solution-resource-item.js +1 -1
  67. package/dist/collection/components/solution-spatial-ref/solution-spatial-ref.js +1 -1
  68. package/dist/collection/components/solution-template-data/solution-template-data.js +1 -1
  69. package/dist/collection/components/solution-variables/solution-variables.js +1 -1
  70. package/dist/collection/components/spatial-ref/spatial-ref.js +1 -1
  71. package/dist/components/card-manager2.js +4 -2
  72. package/dist/components/consent-manager.js +1 -1
  73. package/dist/components/create-feature2.js +10 -4
  74. package/dist/components/create-related-feature2.js +21 -15
  75. package/dist/components/crowdsource-manager.js +4 -2
  76. package/dist/components/crowdsource-reporter.js +8 -6
  77. package/dist/components/deduct-calculator2.js +1 -1
  78. package/dist/components/delete-button2.js +1 -1
  79. package/dist/components/delete-dialog2.js +1 -1
  80. package/dist/components/edit-card2.js +11 -5
  81. package/dist/components/feature-details2.js +8 -6
  82. package/dist/components/feature-list2.js +4 -4
  83. package/dist/components/floor-filter2.js +1 -1
  84. package/dist/components/info-card2.js +4 -2
  85. package/dist/components/json-editor2.js +1 -1
  86. package/dist/components/layer-table2.js +6 -3
  87. package/dist/components/map-card2.js +1 -1
  88. package/dist/components/map-draw-tools2.js +1 -1
  89. package/dist/components/map-fullscreen2.js +1 -1
  90. package/dist/components/map-layer-picker2.js +1 -1
  91. package/dist/components/map-legend2.js +1 -1
  92. package/dist/components/map-picker2.js +1 -1
  93. package/dist/components/map-search2.js +1 -1
  94. package/dist/components/map-select-tools2.js +1 -1
  95. package/dist/components/map-tools2.js +1 -1
  96. package/dist/components/pci-calculator.js +1 -1
  97. package/dist/components/pdf-download2.js +1 -1
  98. package/dist/components/public-notification.js +1 -1
  99. package/dist/components/refine-selection2.js +1 -1
  100. package/dist/components/solution-configuration.js +3 -3
  101. package/dist/components/solution-contents2.js +1 -1
  102. package/dist/components/solution-item-accordion.js +1 -1
  103. package/dist/components/solution-item-details2.js +1 -1
  104. package/dist/components/solution-item-icon2.js +1 -1
  105. package/dist/components/solution-item-sharing2.js +1 -1
  106. package/dist/components/solution-item2.js +1 -1
  107. package/dist/components/solution-organization-variables2.js +1 -1
  108. package/dist/components/solution-resource-item2.js +1 -1
  109. package/dist/components/solution-spatial-ref2.js +1 -1
  110. package/dist/components/solution-template-data2.js +1 -1
  111. package/dist/components/solution-variables2.js +1 -1
  112. package/dist/components/spatial-ref.js +1 -1
  113. package/dist/esm/basemap-gallery_7.entry.js +6 -6
  114. package/dist/esm/buffer-tools_2.entry.js +1 -1
  115. package/dist/esm/card-manager_3.entry.js +10 -6
  116. package/dist/esm/consent-manager.entry.js +1 -1
  117. package/dist/esm/create-feature_4.entry.js +22 -11
  118. package/dist/esm/create-related-feature_3.entry.js +25 -19
  119. package/dist/esm/crowdsource-manager.entry.js +3 -2
  120. package/dist/esm/crowdsource-reporter.entry.js +7 -6
  121. package/dist/esm/deduct-calculator.entry.js +1 -1
  122. package/dist/esm/delete-dialog.entry.js +1 -1
  123. package/dist/esm/feature-list.entry.js +4 -4
  124. package/dist/esm/json-editor_7.entry.js +7 -7
  125. package/dist/esm/loader.js +1 -1
  126. package/dist/esm/map-layer-picker.entry.js +1 -1
  127. package/dist/esm/map-select-tools_3.entry.js +3 -3
  128. package/dist/esm/pci-calculator.entry.js +1 -1
  129. package/dist/esm/public-notification.entry.js +1 -1
  130. package/dist/esm/solution-configuration.entry.js +3 -3
  131. package/dist/esm/solution-contents_3.entry.js +3 -3
  132. package/dist/esm/solution-item-accordion.entry.js +1 -1
  133. package/dist/esm/solution-item-icon.entry.js +1 -1
  134. package/dist/esm/solutions-components.js +1 -1
  135. package/dist/esm/spatial-ref.entry.js +1 -1
  136. package/dist/solutions-components/assets/t9n/layer-table/resources.json +4 -1
  137. package/dist/solutions-components/assets/t9n/layer-table/resources_en.json +4 -1
  138. package/dist/solutions-components/{p-7e233b70.entry.js → p-0bc11bac.entry.js} +1 -1
  139. package/dist/solutions-components/{p-e3e35c14.entry.js → p-0efb117f.entry.js} +1 -1
  140. package/dist/solutions-components/p-12f91837.entry.js +6 -0
  141. package/dist/solutions-components/p-16c5c285.entry.js +6 -0
  142. package/dist/solutions-components/p-1dc077ec.entry.js +6 -0
  143. package/dist/solutions-components/{p-5e4e0f84.entry.js → p-281cc2b2.entry.js} +1 -1
  144. package/dist/solutions-components/{p-b636a8b4.entry.js → p-48ff9d90.entry.js} +1 -1
  145. package/dist/solutions-components/{p-832707fd.entry.js → p-505a2880.entry.js} +1 -1
  146. package/dist/solutions-components/{p-72d04c7a.entry.js → p-70fbbe26.entry.js} +1 -1
  147. package/dist/solutions-components/{p-837e0939.entry.js → p-7b9f3c85.entry.js} +1 -1
  148. package/dist/solutions-components/p-84976ab1.entry.js +6 -0
  149. package/dist/solutions-components/{p-698656b8.entry.js → p-8ef447cc.entry.js} +1 -1
  150. package/dist/solutions-components/{p-ed1ecb5b.entry.js → p-922e704c.entry.js} +1 -1
  151. package/dist/solutions-components/p-a2e356f8.entry.js +6 -0
  152. package/dist/solutions-components/{p-6d20da19.entry.js → p-a9b81651.entry.js} +1 -1
  153. package/dist/solutions-components/p-abcdbba6.entry.js +6 -0
  154. package/dist/solutions-components/{p-09041307.entry.js → p-c117b7f7.entry.js} +1 -1
  155. package/dist/solutions-components/{p-a5eaf7fe.entry.js → p-df018eb2.entry.js} +1 -1
  156. package/dist/solutions-components/{p-ee3bb943.entry.js → p-e806feda.entry.js} +1 -1
  157. package/dist/solutions-components/{p-244316dd.entry.js → p-e8df7a70.entry.js} +1 -1
  158. package/dist/solutions-components/{p-0326f1f4.entry.js → p-fd106abf.entry.js} +1 -1
  159. package/dist/solutions-components/solutions-components.esm.js +1 -1
  160. package/dist/solutions-components_commit.txt +6 -6
  161. package/dist/types/components/card-manager/card-manager.d.ts +4 -0
  162. package/dist/types/components/create-feature/create-feature.d.ts +4 -0
  163. package/dist/types/components/create-related-feature/create-related-feature.d.ts +23 -19
  164. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +4 -0
  165. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +4 -0
  166. package/dist/types/components/edit-card/edit-card.d.ts +8 -4
  167. package/dist/types/components/feature-details/feature-details.d.ts +4 -0
  168. package/dist/types/components/info-card/info-card.d.ts +4 -0
  169. package/dist/types/components.d.ts +64 -0
  170. package/package.json +1 -1
  171. package/dist/solutions-components/p-1ac20964.entry.js +0 -6
  172. package/dist/solutions-components/p-541eb93a.entry.js +0 -6
  173. package/dist/solutions-components/p-892b42be.entry.js +0 -6
  174. package/dist/solutions-components/p-9161beb0.entry.js +0 -6
  175. package/dist/solutions-components/p-decfd5fc.entry.js +0 -6
  176. package/dist/solutions-components/p-eba271dd.entry.js +0 -6
@@ -8,4 +8,4 @@ import{r as t,c as n,g as e,h as r,H as i}from"./p-e996c38f.js";import{g as o}fr
8
8
  * @license MIT <https://opensource.org/licenses/MIT>
9
9
  * @copyright Michael Hart 2024
10
10
  */
11
- const n=new TextEncoder,e={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},r=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class i{constructor({method:t,url:n,headers:i,body:o,accessKeyId:u,secretAccessKey:a,sessionToken:c,service:f,region:l,cache:d,datetime:h,signQuery:v,appendSessionToken:p,allHeaders:w,singleEncode:m}){if(null==n)throw new TypeError("url is a required option");if(null==u)throw new TypeError("accessKeyId is a required option");if(null==a)throw new TypeError("secretAccessKey is a required option");let b,y;this.method=t||(o?"POST":"GET"),this.url=new URL(n),this.headers=new Headers(i||{}),this.body=o,this.accessKeyId=u,this.secretAccessKey=a,this.sessionToken=c,f&&l||([b,y]=function(t,n){const{hostname:r,pathname:i}=t;if(r.endsWith(".on.aws")){const t=r.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return null!=t?["lambda",t[1]||""]:["",""]}if(r.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(r.endsWith(".backblazeb2.com")){const t=r.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return null!=t?["s3",t[1]||""]:["",""]}const o=r.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/);let u=o&&o[1]||"",a=o&&o[2];if("us-gov"===a)a="us-gov-west-1";else if("s3"===a||"s3-accelerate"===a)a="us-east-1",u="s3";else if("iot"===u)u=r.startsWith("iot.")?"execute-api":r.startsWith("data.jobs.iot.")?"iot-jobs-data":"/mqtt"===i?"iotdevicegateway":"iotdata";else if("autoscaling"===u){const t=(n.get("X-Amz-Target")||"").split(".")[0];"AnyScaleFrontendService"===t?u="application-autoscaling":"AnyScaleScalingPlannerFrontendService"===t&&(u="autoscaling-plans")}else null==a&&u.startsWith("s3-")?(a=u.slice(3).replace(/^fips-|^external-1/,""),u="s3"):u.endsWith("-fips")?u=u.slice(0,-5):a&&/-\d$/.test(u)&&!/-\d$/.test(a)&&([u,a]=[a,u]);return[e[u]||u,a||""]}(this.url,this.headers)),this.service=f||b||"",this.region=l||y||"us-east-1",this.cache=d||new Map,this.datetime=h||(new Date).toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=v,this.appendSessionToken=p||"iotdevicegateway"===this.service,this.headers.delete("Host"),"s3"!==this.service||this.signQuery||this.headers.has("X-Amz-Content-Sha256")||this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");const g=this.signQuery?this.url.searchParams:this.headers;if(g.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&g.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter((t=>w||!r.has(t))).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((t=>t+":"+("host"===t?this.url.host:(this.headers.get(t)||"").replace(/\s+/g," ")))).join("\n"),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&("s3"!==this.service||g.has("X-Amz-Expires")||g.set("X-Amz-Expires","86400"),g.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),g.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),g.set("X-Amz-SignedHeaders",this.signedHeaders)),"s3"===this.service)try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(t){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");m||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=s(this.encodedPath);const j=new Set;this.encodedSearch=[...this.url.searchParams].filter((([t])=>{if(!t)return!1;if("s3"===this.service){if(j.has(t))return!1;j.add(t)}return!0})).map((t=>t.map((t=>s(encodeURIComponent(t)))))).sort((([t,n],[e,r])=>t<e?-1:t>e?1:n<r?-1:n>r?1:0)).map((t=>t.join("="))).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){const t=this.datetime.slice(0,8),n=[this.secretAccessKey,t,this.region,this.service].join();let e=this.cache.get(n);if(!e){const r=await o("AWS4"+this.secretAccessKey,t),i=await o(r,this.region),u=await o(i,this.service);e=await o(u,"aws4_request"),this.cache.set(n,e)}return c(await o(e,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,c(await u(await this.canonicalString()))].join("\n")}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+"\n",this.signedHeaders,await this.hexBodyHash()].join("\n")}async hexBodyHash(){let t=this.headers.get("X-Amz-Content-Sha256")||("s3"===this.service&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(null==t){if(this.body&&"string"!=typeof this.body&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");t=c(await u(this.body||""))}return t}}async function o(t,e){const r=await crypto.subtle.importKey("raw","string"==typeof t?n.encode(t):t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",r,n.encode(e))}async function u(t){return crypto.subtle.digest("SHA-256","string"==typeof t?n.encode(t):t)}const a=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function c(t){const n=new Uint8Array(t);let e="";for(let t=0;t<n.length;t++){const r=n[t];e+=a[r>>>4&15],e+=a[15&r]}return e}function s(t){return t.replace(/[!'()*]/g,(t=>"%"+t.charCodeAt(0).toString(16).toUpperCase()))}t.AwsClient=class{constructor({accessKeyId:t,secretAccessKey:n,sessionToken:e,service:r,region:i,cache:o,retries:u,initRetryMs:a}){if(null==t)throw new TypeError("accessKeyId is a required option");if(null==n)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=t,this.secretAccessKey=n,this.sessionToken=e,this.service=r,this.region=i,this.cache=o||new Map,this.retries=null!=u?u:10,this.initRetryMs=a||50}async sign(t,n){if(t instanceof Request){const{method:e,url:r,headers:i,body:o}=t;null==(n=Object.assign({method:e,url:r,headers:i},n)).body&&i.has("Content-Type")&&(n.body=null!=o&&i.has("X-Amz-Content-Sha256")?o:await t.clone().arrayBuffer()),t=r}const e=new i(Object.assign({url:t.toString()},n,this,n&&n.aws)),r=Object.assign({},n,await e.sign());delete r.aws;try{return new Request(r.url.toString(),r)}catch(t){if(t instanceof TypeError)return new Request(r.url.toString(),Object.assign({duplex:"half"},r));throw t}}async fetch(t,n){for(let e=0;e<=this.retries;e++){const r=fetch(await this.sign(t,n));if(e===this.retries)return r;const i=await r;if(i.status<500&&429!==i.status)return i;await new Promise((t=>setTimeout(t,Math.random()*this.initRetryMs*Math.pow(2,e))))}throw new Error("An unknown error occurred, ensure retries is not negative")}},t.AwsV4Signer=i,Object.defineProperty(t,"__esModule",{value:!0})}(Tr.exports);var Nr=function(){};"undefined"==typeof process||process;var _r="undefined"!=typeof document;function Pr(t,n){return n.charAt(0)[t]()+n.slice(1)}"undefined"!=typeof Deno&&Deno,_r&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var Mr=Pr.bind(null,"toUpperCase"),Cr=Pr.bind(null,"toLowerCase");function Dr(t,n){void 0===n&&(n=!0);var e=function(t){return Ur(t)?Mr("null"):"object"==typeof t?function(t){return zr(t.constructor)?t.constructor.name:null}(t):Object.prototype.toString.call(t).slice(8,-1)}(t);return n?Cr(e):e}function Lr(t,n){return typeof n===t}var zr=Lr.bind(null,"function"),$r=Lr.bind(null,"string");function Ur(t){return null===t}function Rr(t,n){if("object"!=typeof n||Ur(n))return!1;if(n instanceof t)return!0;var e=Dr(new t(""));if(function(t){return t instanceof Error||$r(t.message)&&t.constructor&&function(t){return"number"===Dr(t)&&!isNaN(t)}(t.constructor.stackTraceLimit)}(n))for(;n;){if(Dr(n)===e)return!0;n=Object.getPrototypeOf(n)}return!1}function Wr(t,n){var e=t instanceof Element||t instanceof HTMLDocument;return e&&n?function(t,n){return void 0===n&&(n=""),t&&t.nodeName===n.toUpperCase()}(t,n):e}function Hr(t){var n=[].slice.call(arguments,1);return function(){return t.apply(void 0,[].slice.call(arguments).concat(n))}}Lr.bind(null,"undefined"),Lr.bind(null,"boolean"),Lr.bind(null,"symbol"),Rr.bind(null,TypeError),Rr.bind(null,SyntaxError),Hr(Wr,"form"),Hr(Wr,"button"),Hr(Wr,"input"),Hr(Wr,"select");var qr="EventListener";function Vr(t,n){if($r(t))return n?Vr(document.querySelectorAll(t)):(e=t).split(e.indexOf(",")>-1?",":" ").map((function(t){return t.trim()}));var e;if(NodeList.prototype.isPrototypeOf(t)){for(var r=[],i=t.length>>>0;i--;)r[i]=t[i];return r}var o=function(t){return t?function(t){return"array"===Dr(t)}(t)?t:[t]:[]}(t);return n?o.map((function(t){return $r(t)?Vr(t,!0):t})).flat():o}function Fr(t,n){var e;return function(){return t&&(e=t.apply(n||this,arguments),t=null),e}}var Gr=function(t,n,e,r){var i=e||Nr,o=r||!1;if(!_r)return i;var u=Vr(n),a=Vr(t,!0);if(!a.length)throw new Error("noElements");if(!u.length)throw new Error("noEvent");var c=[];return function t(n){n&&(c=[]);for(var e=n?"add"+qr:"remove"+qr,r=0;r<a.length;r++){var s=a[r];c[r]=n?o&&o.once?Fr(i):i:c[r]||i;for(var f=0;f<u.length;f++)s[e]?s["on"+u[f]]=n?c[r]:null:s[e](u[f],c[r],o)}return t.bind(null,!n)}("Event")};function Jr(t,n){return _r&&zr(window[t])?(e=window[t],r=n,void 0===(i=window)&&(i=null),zr(e)?function(){e.apply(i,arguments),r.apply(i,arguments)}:r):window[t]=n;var e,r,i}Jr.bind(null,"onerror"),Jr.bind(null,"onload");var Xr="undefined"==typeof window,Kr="hidden";var Br=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function Yr(t,n){void 0===n&&(n={});var e=function(t,n){var e=this,r=!1;return function(i){r||(t.call(e,i),r=!0,setTimeout((function(){return r=!1}),n))}}(t,n.throttle||1e4),r=[];function i(){var t=function(t){if(Xr)return!1;var n=Xr||Kr in document?Kr:["webkit","moz","ms","o"].reduce((function(t,n){var e=n+"Hidden";return!t&&e in document?e:t}),null),e="".concat(n.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return t(Boolean(document[n]))},i=function(){return document.addEventListener(e,r)};return i(),function(){return document.removeEventListener(e,r),i}}((function(t){t||e({type:"tabVisible"})}));return r=[t].concat(Br.map((function(t){return Gr(document,t,e)}))).concat(Gr(window,"load",e)).concat(Gr(window,"scroll",e,{capture:!0,passive:!0})),o}function o(){r.map((function(t){return t()}))}return i(),function(){return o(),i}}function Zr(t,n){return n?0:Math.round((new Date-t)/1e3)}var Qr="object",ti="string",ni="name",ei="version",ri="",ii="function",oi="undefined",ui={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ai=[[/microsoft (windows) (vista|xp)/i],[ni,ei],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[ni,[ei,si,ui]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[ni,"Windows"],[ei,si,ui]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[ei,/_/g,"."],[ni,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[ni,"MacOS"],[ei,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[ei,ni],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[ni,ei],[/\(bb(10);/i],[ei,[ni,"BlackBerry"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[ei,[ni,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[ei,[ni,"webOS"]],[/crkey\/([\d\.]+)/i],[ei,[ni,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[ni,"Chromium OS"],ei],[/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/(unix) ?([\w\.]*)/i],[ni,ei]];function ci(t,n){for(var e,r,i,o,u,a,c=0;c<n.length&&!u;){var s=n[c],f=n[c+1];for(e=r=0;e<s.length&&!u;)if(u=s[e++].exec(t))for(i=0;i<f.length;i++)a=u[++r],d(o=f[i])===Qr&&o.length>0?2==o.length?this[o[0]]=d(o[1])==ii?o[1].call(this,a):o[1]:3==o.length?this[o[0]]=d(o[1])!==ii||o[1].exec&&o[1].test?a?a.replace(o[1],o[2]):void 0:a?o[1].call(this,a,o[2]):void 0:4==o.length&&(this[o[0]]=a?o[3].call(this,a.replace(o[1],o[2])):void 0):this[o]=a||void 0;c+=2}}function si(t,n){for(var e in n)if(d(n[e])===Qr&&n[e].length>0){for(var r=0;r<n[e].length;r++)if(fi(n[e][r],t))return"?"===e?void 0:e}else if(fi(n[e],t))return"?"===e?void 0:e;return t}function fi(t,n){return d(t)===ti&&-1!==li(n).indexOf(li(t))}function li(t){return t.toLowerCase()}function di(t){var n=t||(("undefined"==typeof window?"undefined":d(window))!==oi&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:ri),e={};return e[ni]=void 0,e[ei]=void 0,ci.call(e,n,ai),e}var hi="Brave";function vi(){if("undefined"==typeof window)return{};if(!window.navigator)return{};var t,n,e,r,i,o=window.navigator,u=o.platform,a=o.product,c=o.vendor,s=function(t){var n=t.userAgent,e=/.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(n);if(e)return{type:e[1],version:e[2]};var r=/.+(Trident|Edge)\/([0-9\.]+).*/i.exec(n);if(r)return{type:r[1],version:r[2]};var i=/(headlesschrome)(?:\/([\w\.]+)| )/i.exec(n);if(i)return{type:i[1],version:i[2]};var o=/.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(n);if(o)return{type:t.brave&&t.brave.isBrave?hi:o[1],version:o[2]};var u=/.+(Safari)\/([0-9\.]+).*/i.exec(n);if(u)return{type:u[1],version:u[2]};var a=/.+(AppleWebKit)\/([0-9\.]+).*/i.exec(n);if(a)return{type:a[1],version:a[2]};var c=/.*([A-Z]+)\/([0-9\.]+).*/i.exec(n)||["","NA","0.0.0"];return{type:c[1],version:c[2]}}(window.navigator),f=s.type,l=s.version,d=f===hi?f:(c||"").split(" ")[0];return{platform:u,os:di(),make:d||a,model:f,version:l,name:[f,l].join("/"),language:(n=window.navigator,e=n.language,r=n.browserLanguage,i=n.languages,(e||r||(i||["en_US"])[0]).toLowerCase().replace("-","_")),timezone:(t=/\(([A-Za-z\s].*)\)/.exec((new Date).toString()),t&&t[1]||"")}}function pi(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})[t]||t}function wi(t){return mi.apply(this,arguments)}function mi(){return mi=s(er.mark((function t(n){var e,r,i,o,u,a,c=arguments;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=c.length>1&&void 0!==c[1]&&c[1],r={},t.t0=er.keys(n);case 3:if((t.t1=t.t0()).done){t.next=13;break}return i=t.t1.value,o=Array.isArray(n[i])?n[i]:[n[i]],u=e?o:o[0],t.next=9,gi(u,Oi);case 9:Ei(a=t.sent)||(r[i]=a),t.next=3;break;case 13:return t.abrupt("return",r);case 14:case"end":return t.stop()}}),t)}))),mi.apply(this,arguments)}function bi(t){return yi.apply(this,arguments)}function yi(){return(yi=s(er.mark((function t(n){var e,r;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e={},t.t0=er.keys(n);case 2:if((t.t1=t.t0()).done){t.next=9;break}return r=t.t1.value,t.next=6,gi(n[r],Si);case 6:e[r]=t.sent,t.next=2;break;case 9:return t.abrupt("return",e);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function gi(t,n){return ji.apply(this,arguments)}function ji(){return(ji=s(er.mark((function t(n,e){return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("function"!=typeof n){t.next=4;break}return t.next=3,n();case 3:n=t.sent;case 4:return t.abrupt("return",e(n));case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Oi(t){if(null!=t)return Array.isArray(t)?t.filter(ki).map((function(t){return t.toString()})):Ei(t)?t:t.toString()}function Si(t){return parseFloat(Number(Array.isArray(t)?t[0]:t))}function ki(t){return null!=t}function Ei(t){return null==t}var Ai="_session.start",Ii="_session.stop",xi="pageView";function Ti(t){return Ni.apply(this,arguments)}function Ni(){return Ni=s(er.mark((function t(n){var e,r,i,o,u,a,c,s,l,d,h,v,p,w,m,b,y,g,j,O,S,k,E,A,I,x,T,N,_,P=arguments;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=P.length>1&&void 0!==P[1]?P[1]:{},i=(r=P.length>2&&void 0!==P[2]?P[2]:{}).appTitle,o=r.appPackageName,u=r.appVersionCode,a=r.enrichEventAttributes,c=r.enrichEventMetrics,s=r.debug?console.log:function(){},l=pi(n,r.eventMapping),d=hr(),h=e.sessionId||d.id,v=e.sessionStart||d.createdAt,p=e.sessionStart?new Date(e.sessionStart).getTime():d.created,s("event sessionData ",JSON.stringify(d)),yr&&(w=mr(),m=pr(),s("event pageSessionInfo",JSON.stringify(w)),s("event tabSessionData ",JSON.stringify(m))),b=e.attributes||{},y=e.eventId||J(),g=e.time?new Date(e.time):new Date,j=g.toISOString(),O=g.getTime()-p,S=Qe({date:j,sessionId:h},yr?{pageSession:w.id}:{}),!a){t.next=23;break}return t.next=20,a();case 20:t.t0=t.sent,t.next=24;break;case 23:t.t0={};case 24:if(k=t.t0,E=Qe(Qe(Qe({},S),k),b),A=e.metrics||{},I={sessionTime:d.elapsed||O,hour:g.getHours(),day:g.getDay()+1,month:g.getMonth()+1,year:g.getFullYear()},!c){t.next=34;break}return t.next=31,c();case 31:t.t1=t.sent,t.next=35;break;case 34:t.t1={};case 35:return x=t.t1,T=Qe(Qe(Qe({},I),x),A),t.next=39,wi(E);case 39:return t.t2=t.sent,t.next=42,bi(T);case 42:return t.t3=t.sent,N={attributes:t.t2,metrics:t.t3},s("".concat(y,":").concat(l)),s("eventAttributes",N.attributes),s("eventMetrics",N.metrics),yr&&s("clientInfo",vi()),_=f({},y,Qe(Qe({EventType:l,Timestamp:j,AppPackageName:o,AppTitle:i},u?{AppVersionCode:u}:{}),{},{Attributes:N.attributes,Metrics:N.metrics,Session:{Id:h,StartTimestamp:v}})),n===Ii&&(_[y].Session.Duration=O,_[y].Session.StopTimestamp=j),t.abrupt("return",_);case 51:case"end":return t.stop()}}),t)}))),Ni.apply(this,arguments)}var _i="__endpoint";function Pi(t){return"".concat(_i,".").concat(t)}var Mi,Ci="__endpoint",Di=!1;function Li(){return zi.apply(this,arguments)}function zi(){return zi=s(er.mark((function t(){var n,e,r,i,o,u,a,c,s,f,l,d,h,v,p,w,m,b,y,g,j,O=arguments;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=O.length>0&&void 0!==O[0]?O[0]:{},r=(e=O.length>1&&void 0!==O[1]?O[1]:{}).getUserId,i=e.getEndpointId,o=e.endpointMigration,u=qi(e),a=u.sessionKey?u.sessionKey():"sessions",c=u.pageViewKey?u.pageViewKey():"pageViews",yr&&(l=vi(),s=mr(),f=s.id),d=hr(),t.next=10,i();case 10:if(h=t.sent,Di||(Di=!0,(v=ke(Ci))&&($i(h,v),Ae(Ci))),p=Ui(h),w=Wi(e),m=Ri(w,l),b={Attributes:{},Demographic:m,Location:{},Metrics:{}},yr&&(l.device&&l.device.vendor&&(b.Attributes.DeviceMake=[l.device.vendor]),l.device&&l.device.model&&(b.Attributes.DeviceModel=[l.device.model]),l.device&&l.device.type&&(b.Attributes.DeviceType=[l.device.type])),!(n=xr.all([p,b,n],{arrayMerge:Hi})).User||!n.User.UserId){t.next=23;break}return t.next=21,r();case 21:n.User.UserId!==(y=t.sent)&&(n.User.UserId=y);case 23:if(n.User&&n.User.UserId){t.next=28;break}return t.next=26,r();case 26:(g=t.sent)&&(n.User=n.User||{},n.User.UserId=g);case 28:if(!n.User||!n.User.UserAttributes){t.next=32;break}return t.next=31,wi(n.User.UserAttributes,!0);case 31:n.User.UserAttributes=t.sent;case 32:return t.next=34,wi(n.Attributes,!0);case 34:return n.Attributes=t.sent,t.next=37,bi(n.Metrics);case 37:if(n.Metrics=t.sent,n.Metrics[a]||(n.Metrics[a]=1),n.Metrics[c]||(n.Metrics[c]=1),o&&(n=o(h,n)),j=n.Attributes.lastSession){t.next=47;break}return n.Attributes.lastSessionDate=[d.createdAt],n.Attributes.lastSession=[d.id],f&&(n.Attributes.lastPageSession=[f]),t.abrupt("return",$i(h,n));case 47:return j&&j[0]!==d.id&&(n.Attributes.lastSessionDate=[d.createdAt],n.Attributes.lastSession=[d.id],n.Metrics[a]+=1),n.Attributes&&n.Attributes.lastPageSession&&Array.isArray(n.Attributes.lastPageSession)&&n.Attributes.lastPageSession.length>0&&n.Attributes.lastPageSession[0]!==f&&(n.Attributes.lastPageSession=[f],n.Metrics[c]+=1),t.abrupt("return",$i(h,n));case 50:case"end":return t.stop()}}),t)}))),zi.apply(this,arguments)}function $i(t,n){var e=Pi(t),r="string"==typeof n?n:JSON.stringify(n);return Ee(e,r),n}function Ui(t){try{return JSON.parse(ke(Pi(t)))||{}}catch(t){}return{}}function Ri(t,n){return yr?function(t,n){var e={AppVersion:t,Locale:n.language,Make:n.make,Model:n.model,ModelVersion:n.version,Platform:n.os.name||n.platform};return n.os&&n.os.version&&(e.PlatformVersion=n.os.version),e}(t,n):function(t){return{AppVersion:t,Make:"generic server",Platform:"Node.js",PlatformVersion:process.version}}(t)}function Wi(t){var n=t.appTitle||t.appPackageName||"",e=t.appVersionCode||"0.0.0";return n?"".concat(n,"@").concat(e):e}function Hi(t,n){return n}function qi(t){var n=t.getContext;return"function"==typeof n?n():n}var Vi=[429,500],Fi=[202],Gi=400;function Ji(t,n){return Xi.apply(this,arguments)}function Xi(){return Xi=s(er.mark((function t(n,e){var r,i,o,u,a,c,s,f,l,d,h,v,p,w,m,b,y;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.pinpointRegion,i=e.pinpointAppId,o=e.lambdaArn,u=e.lambdaRegion,a=e.credentials,c=e.getCredentials,s=e.debug,t.next=3,Ki(a,c);case 3:return f=t.sent,s&&console.log("pinpoint auth",f),l=r||u,d=!0===e.fips?"-fips":"",h="https://lambda.".concat(u||r,".amazonaws.com/2015-03-31/functions/").concat(o,"/invocations"),v="https://pinpoint".concat(d,".").concat(l,".amazonaws.com/v1/apps/").concat(i,"/events"),p=o?h:v,b={body:JSON.stringify(n)},w=new Tr.exports.AwsClient(f),t.next=16,w.fetch(p,b).then((function(t){return t.json()}));case 16:m=t.sent,t.next=24;break;case 19:return w=new Mi.PinpointClient({credentials:f,region:r}),y=new Mi.PutEventsCommand({ApplicationId:i,EventsRequest:n}),t.next=23,w.send(y);case 23:m=t.sent;case 24:return m&&m.Results&&Object.keys(m.Results).map((function(t){return m.Results[t]})).forEach((function(t){var n=t.EndpointItemResponse||{},e=t.EventsItemResponse||{};Object.keys(n).length&&(Fi.includes(n.StatusCode)||Vi.includes(n.StatusCode)||Yi(n,Endpoint));var r=Object.keys(e);r.length&&r.forEach((function(){}))})),t.abrupt("return",m);case 26:case"end":return t.stop()}}),t)}))),Xi.apply(this,arguments)}function Ki(t,n){return Bi.apply(this,arguments)}function Bi(){return(Bi=s(er.mark((function t(n,e){var r;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=n,Object.keys(r).length||!e){t.next=11;break}return t.prev=2,t.next=5,e();case 5:r=t.sent,t.next=11;break;case 8:throw t.prev=8,t.t0=t.catch(2),new Error(t.t0);case 11:return t.abrupt("return",{accessKeyId:r.accessKeyId||r.AccessKeyId,secretAccessKey:r.secretAccessKey||r.SecretKey,sessionToken:r.sessionToken||r.SessionToken,retries:5});case 13:case"end":return t.stop()}}),t,null,[[2,8]])})))).apply(this,arguments)}function Yi(t){var n=t.Message;if(t.StatusCode===Gi){if(n.startsWith("Missing ChannelType"))throw new Error("Missing ChannelType");if(n.startsWith("Exceeded maximum endpoint per user count"))throw new Error("Exceeded maximum endpoint per user count")}}var Zi=["PUSH","GCM","APNS","APNS_SANDBOX","APNS_VOIP","APNS_VOIP_SANDBOX","ADM","SMS","VOICE","EMAIL","BAIDU","CUSTOM"].reduce((function(t,n){return t[n]=n,t}),{}),Qi=vi(),to=Ai,no=Ii,eo=/.+\@.+\..+/;function ro(t){try{return JSON.parse(ke(Pi(t)))||{}}catch(t){}return{}}function io(t){return t.sort((function(t,n){var e=t.EventType,r=n.EventType;return e==to?-1:r==to||e==no?1:r==no?-1:void 0})).reduce((function(t,n){return Qe(Qe({},n),t)}),{})}function oo(t,n,e){return{BatchItem:f({},t,{Endpoint:n,Events:e})}}var uo=Ii;function ao(){return{}}function co(){throw new Error("Pinpoint not loaded")}function so(t){var n=t.config,e=t.instance;n&&n.disableAnonymousTraffic&&!e.user("userId")&&e.once("identifyStart",(function(t){t.plugins["aws-pinpoint"].loaded()||e.loadPlugin("aws-pinpoint")}))}var fo={disableAnonymousTraffic:!1,pinpointRegion:"us-east-1",eventMapping:{}},lo=function(){var t,n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=!1;return{name:"aws-pinpoint",config:Qe(Qe({},fo),e),bootstrap:so,initialize:function(r){var i=r.config,o=r.instance,u=i.disableAnonymousTraffic,a=i.debug?console.log:function(){},c=o.getState(),f=c.user||{},l=f.userId,h=f.anonymousId,v=c.context||{},p=v.app,w=v.version,m=v.campaign,b=mr(),y=pr(),g=hr();if(a("initPageSession",b),a("initTabSession",y),a("initSessionData",g),g&&g.anonId&&g.anonId!==h){a("anonId different refresh session details"),br(),wr();var j=vr(30,{anonId:h,userId:l});a("newSessionForNewUser",j)}if(!l&&u)return!1;var O=Object.keys(m).reduce((function(t,n){return t["utm_".concat(n)]=m[n],t}),{}),S=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Qe({getContext:t.getContext||ao,credentials:t.credentials||{},getEndpointId:t.getEndpointId},t),e=n.debug?console.log:function(){},r=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.getEndpointId,e=t.debug;return function(){var r=s(er.mark((function r(){var i,o,u,a,c,s,f,l,h,v=arguments;return er.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=v.length>0&&void 0!==v[0]?v[0]:[],o=v.length>1&&void 0!==v[1]?v[1]:{},r.next=4,n();case 4:if(u=r.sent){r.next=8;break}return console.error("No endpoint id. check getEndpointId()"),r.abrupt("return");case 8:if("object"===d(o)&&Object.keys(o).length){r.next=13;break}r.t0=ro(u),r.next=16;break;case 13:return r.next=15,Li(o,t);case 15:r.t0=r.sent;case 16:return c=(a=r.t0).ChannelType,a.Address&&eo.test(a.Address)&&(c=Zi.EMAIL),!c&&a.Address&&(c="android"===Qi.platform?c||Zi.GCM:c||Zi.APNS),e&&(console.log("Endpoint",a),console.log("CHANNEL_TYPE",c)),a.RequestId=J(),a.ChannelType=c,a.Address&&(a.OptOut=a.OptOut||"NONE"),s=io(i),f=oo(u,a,s),r.prev=26,r.next=29,Ji(f,t);case 29:l=r.sent,r.next=36;break;case 32:r.prev=32,r.t1=r.catch(26),console.log("Error calling AWS",r.t1),h=r.t1;case 36:return r.abrupt("return",{endpoint:a,response:l,error:h,events:i});case 37:case"end":return r.stop()}}),r,null,[[26,32]])})));return function(){return r.apply(this,arguments)}}()}(n),i=function(t,n){var e,r,i,o=(n=n||{}).initial||[],u=n.max||1/0,a=n.interval||1e4,c=n.onEmpty||rr,s=n.onPause||rr;function f(n){clearInterval(e);var r=o.splice(0,u);return r.length&&t(r,o),o.length?n?f():l():(i=!1,c(o))}function l(){i=!0,e=setInterval(f,a)}return o.length&&l(),{flush:function(t){f(t)},resume:f,push:function(t){return(r=o.push(t))>=u&&!n.throttle&&f(),i||l(),r},size:function(){return o.length},pause:function(t){t&&f(),clearInterval(e),i=!1,s(o)}}}(function(){var t=s(er.mark((function t(n){return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.forEach((function(t){return e("> Queue event",t)})),t.next=3,r(n,{});case 3:e("> Queue response",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(n,e){return t.apply(this,arguments)}}(),{max:10,interval:t.flushInterval||3e3,throttle:!0}),o=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(){var e=s(er.mark((function e(r){var i,o,u,a,c=arguments;return er.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=c.length>2&&void 0!==c[2]?c[2]:{},u=c.length>3&&void 0!==c[3]&&c[3],gr(i=c.length>1&&void 0!==c[1]?c[1]:{})&&(u=i={}),gr(o)&&(u=o={}),e.next=7,Ti(r,i,n);case 7:if(a=e.sent,!Object.entries(o).length&&r!==xi){e.next=12;break}return e.next=11,Li(o,n);case 11:o=e.sent;case 12:if(t.push(a),!u){e.next=17;break}return e.abrupt("return",t.flush());case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}(i,n);Li({},t);var u=function(t){if(!yr)return ao;var n=function(t){return function(){t(uo,!0)}}(t);return window.addEventListener("beforeunload",n),function(){return window.removeEventListener("beforeunload",n)}}(o);return{updateEndpoint:function(t){return r([],t)},recordEvent:o,disable:function(){u()}}}(Qe(Qe({},i),{},{appTitle:i.appTitle||p,appPackageName:i.appPackageName||p,appVersionCode:i.appVersionCode||w,eventMapping:i.eventMapping,getEndpointId:function(){return o.user("anonymousId")},getUserId:function(){return o.user("userId")},getContext:function(){return{sessionKey:i.sessionKey,pageViewKey:i.pageViewKey,initialSession:g}},enrichEventAttributes:function(){return Qe({anonId:o.user("anonymousId"),userId:o.user("userId"),hash:window.location.hash,path:window.location.pathname,referrer:document.referrer,search:window.location.search,title:document.title,host:window.location.hostname,url:window.location.origin+window.location.pathname},O)},enrichUserAttributes:i.enrichUserAttributes,enrichEventMetrics:function(){return{}}}));t=S.recordEvent,n=S.updateEndpoint,g&&g.isNew&&(a("Start brand new session because cookie not found"),t(Ai)),function(t){var n,e,r=t.onIdle,i=t.onWakeUp,o=t.onHeartbeat,u=t.timeout,a=void 0===u?1e4:u,c=t.throttle,s=void 0===c?2e3:c,f=!1,l=new Date;Yr((function(t){clearTimeout(n),o&&!f&&o(Zr(l),t),i&&f&&(f=!1,i(Zr(e),t),l=new Date),n=setTimeout((function(){f=!0,r&&(e=new Date,r(Zr(l),t))}),a)}),{throttle:s})}({timeout:18e5,throttle:2e4,onIdle:function(n){var r;a("Session idle. Active ".concat(n," seconds")),r=hr(),e.debug&&console.log("Stop session",r),t(Ii,!0)},onWakeUp:function(n){var r;a("Session wakeup. Idle ".concat(n," seconds")),r=vr(30),e.debug&&console.log("START SESSION",r),t(Ai)},onHeartbeat:function(t){a("ping session",new Date),a("total active time",t);var n=o.user();!function(t,n){void 0===t&&(t=30),vr(t||1,n,!0)}(30,{anonId:n.anonymousId,userId:n.userId})}})},page:function(){if(!t)return co();r&&br(),t(xi),r=!0},track:function(n){var e=n.payload,r=n.config;if(!t)return co();if(!r.disableAnonymousTraffic||e.userId){var i,o=(i=e.properties,Object.keys(i).reduce((function(t,n){var e=i[n];return"number"==typeof e&&(t.metrics[n]=e),"string"!=typeof e&&"boolean"!=typeof e||(t.attributes[n]=e),t}),{attributes:{},metrics:{}}));t(e.event,o)}},identify:function(t){var e=t.payload,r=e.userId,i=e.traits;if(!n)return co();var o={},u={};r&&(u.UserId=r),i&&Object.keys(i).length&&(u.UserAttributes=i),Object.keys(u).length&&(o.User=u),n(o,!0)},reset:function(t){var n=Pi(t.instance.user("anonymousId"));Ae(n)},loaded:function(){return!!t}}};function ho(t,n){var e=vo(t,n),r=v({httpMethod:"GET"},n);return h(e,r)}var vo=function(t,n){return("string"==typeof n?n:p(n))+"/content/items/"+t};class po{constructor(t){this.name="amazon";const{app:n={},fips:e,userPoolID:r}=t;this.analytics=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return de(Ye(Ye({},{storage:Xe}),t))}({app:n.name,version:n.version,plugins:[lo({fips:e,pinpointAppId:n.id,getCredentials:()=>function(t,n={}){const e=`https://cognito-identity${!0===n.fips?"-fips":""}.us-east-1.amazonaws.com/`;let r=m.get(k);if(r&&Date.now()/1e3<r.Expiration)return Promise.resolve(r);const i={method:"POST",headers:{"Content-type":"application/x-amz-json-1.1","X-Amz-Target":"AWSCognitoIdentityService.GetId"},body:JSON.stringify({IdentityPoolId:t})};return fetch(e,i).then((t=>{if(!t.ok)throw new Error(t.statusText);return t.json()})).then((t=>{const{IdentityId:n}=t,r={method:"POST",headers:{"Content-type":"application/x-amz-json-1.1","X-Amz-Target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},body:JSON.stringify({IdentityId:n})};return fetch(e,r)})).then((t=>{if(!t.ok)throw new Error(t.statusText);return t.json()})).then((({Credentials:t})=>(m.set(k,t),t)))}(r,{fips:e})})]}),Object.assign(this,t)}init(){return Promise.resolve()}static async setAccessPermissions({id:t,authentication:n,username:e,accessChangeset:r}){return async function({id:t,authentication:n,username:e,accessChangeset:r}){const{properties:i={}}=await ho(t,{authentication:n}),o=i.telemetry,u=void 0===o?{}:o,{arcgis:{access:a={}}={}}=u,c=O(u,["arcgis"]),s=function(t,n,e){return e.reduce(((n,e)=>{const{action:r,targetProperty:i}=e;return"add"===r?n[i]={updatedAt:new Date,updatedBy:t}:"remove"===r&&delete n[i],n}),n)}(e,a,r);return w({item:{id:t,properties:Object.assign(Object.assign({},i),{telemetry:Object.assign(Object.assign({},c),{arcgis:{access:Object.assign({},s)}})})},authentication:n})}({id:t,authentication:n,username:e,accessChangeset:r})}static async getAccessPermissions({id:t,authentication:n}){return async function({id:t,authentication:n}){const{properties:{telemetry:{arcgis:{access:e={}}={}}={}}}=await ho(t,{authentication:n});return{access:e}}({id:t,authentication:n})}logPageView(t,n){const e=function({page:t,previousPage:n={},options:e={},dimensionLookup:r={},metricLookup:i={}}){const o=T(e,i),u=E({telemetryData:e,dimensionLookup:r,excludeKeys:["workflow",...Object.keys(o),...Object.keys(i)]}),{referrer:a,title:c}=document||{},{hostname:s,pathname:f}=window&&window.location?window.location:{};return Object.assign(Object.assign({name:"pageView",referrer:a,hostname:s,path:t||f,pageUrl:t||f,pageName:c,previousPageUrl:n.pageUrl,previousPageName:n.pageName},u),o)}({page:t,previousPage:this.previousPage,options:n,dimensionLookup:this.dimensions,metricLookup:this.metrics}),{pageUrl:r,pageName:i}=e;this.previousPage={pageUrl:r,pageName:i},this.analytics.track("pageView",e)}logEvent(t={}){const n=function({event:t={},dimensionLookup:n={},metricLookup:e={}}){var r,i;const{pathname:o,eventType:u="other"}=t,a=T(t,e),c=E({telemetryData:Object.assign({eventType:u},t),dimensionLookup:n,excludeKeys:["workflow","pathname",...Object.keys(a),...Object.keys(e)]}),s=Object.assign(Object.assign({name:u},c),a);return"undefined"!=typeof document&&document.referrer&&(s.referrer=document.referrer),"undefined"==typeof window||s.hostname||(s.hostname=null===(r=window.location)||void 0===r?void 0:r.hostname),s.path="undefined"!=typeof window&&window.location.pathname?null===(i=window.location)||void 0===i?void 0:i.pathname:o,s}({event:t,dimensionLookup:this.dimensions,metricLookup:this.metrics}),{name:e}=n;this.analytics.track(e,n)}}const wo=class{constructor(e){t(this,e),this.consentGranted=n(this,"consentGranted",7),this.amazonAppId=void 0,this.amazonAppName=void 0,this.amazonUserPoolID=void 0,this.amazonVersion=void 0,this.firstUseVar=void 0,this.locale=void 0,this.measurementIds=void 0,this.portal=void 0,this._open=void 0,this._translations=void 0}get el(){return e(this)}_loaded=!1;_telemetryInstance;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async getInstance(){return"true"===localStorage.getItem(this.firstUseVar)||this.portal.eueiEnabled?(await this._init(),this._telemetryInstance):void 0}consentGranted;async componentWillLoad(){await this._getTranslations(),this._open=null===localStorage.getItem(this.firstUseVar)}render(){return r(i,{key:"6b5a4571e972d6d79948cbf186119372456b5e1e"},r("calcite-alert",{key:"93eaac2efe214be10c0b5a0ff511404e74861bd0",kind:"brand",label:this._translations.trackingAlertLabel,onCalciteAlertClose:()=>this._alertClosed(),open:this._open},r("div",{key:"791bf8851d3f7fd5cec537afcd369071127701a4",slot:"message"},this._translations.message),r("calcite-button",{key:"a3708023545b76ab30fc085d6de8c853a986a5a6",alignment:"center",appearance:"solid",kind:"brand",onClick:()=>this._accept(),scale:"m",slot:"actions-end",style:{margin:"auto"},type:"button"},this._translations.accept)))}async componentDidLoad(){this.consentGranted.emit({granted:"true"===localStorage.getItem(this.firstUseVar)})}async _init(){if(!this._loaded){const t={plugins:[],portal:this.portal};if(this.measurementIds?.length>0){const n=new S({measurementIds:this.measurementIds});t.plugins.push(n)}if(this.amazonUserPoolID){const n=new po({userPoolID:this.amazonUserPoolID,app:{name:this.amazonAppName,id:this.amazonAppId,version:this.amazonVersion}});t.plugins.push(n)}this._telemetryInstance=new j(t),await this._telemetryInstance.init(),this._loaded=!0}}_alertClosed(){this._open=!1,"true"!==localStorage.getItem(this.firstUseVar)&&localStorage.setItem(this.firstUseVar,"false")}_accept(){localStorage.setItem(this.firstUseVar,"true"),this.consentGranted.emit({granted:!0}),this._open=!1}async _getTranslations(){const t=await o(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"]}}};wo.style=":host{display:block}.consent-panel{position:fixed;display:block;z-index:5000;bottom:0;left:0;width:100%;height:auto;text-align:center}.cookie-consent-popup-container{position:relative;display:block;bottom:0;left:0;width:100%;margin:0;padding-top:1rem;padding-bottom:1rem;transition:transform 0.5s ease-out 0s;background-color:rgba(51, 51, 51, 0.95);color:#fff}.button-container{position:static;margin-bottom:1rem;display:flex;justify-content:center;flex-wrap:wrap}.padding-end-1{padding-inline-end:1rem}.link-text{--calcite-ui-text-link:var(--calcite-color-text-inverse);--calcite-ui-brand:var(--calcite-color-text-inverse);--calcite-color-text-link:var(--calcite-color-text-inverse);--calcite-color-brand-underline:var(--calcite-color-text-inverse);--calcite-color-brand:var(--calcite-color-text-inverse)}";export{wo as consent_manager}
11
+ const n=new TextEncoder,e={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},r=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class i{constructor({method:t,url:n,headers:i,body:o,accessKeyId:u,secretAccessKey:a,sessionToken:c,service:f,region:l,cache:d,datetime:h,signQuery:v,appendSessionToken:p,allHeaders:w,singleEncode:m}){if(null==n)throw new TypeError("url is a required option");if(null==u)throw new TypeError("accessKeyId is a required option");if(null==a)throw new TypeError("secretAccessKey is a required option");let b,y;this.method=t||(o?"POST":"GET"),this.url=new URL(n),this.headers=new Headers(i||{}),this.body=o,this.accessKeyId=u,this.secretAccessKey=a,this.sessionToken=c,f&&l||([b,y]=function(t,n){const{hostname:r,pathname:i}=t;if(r.endsWith(".on.aws")){const t=r.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return null!=t?["lambda",t[1]||""]:["",""]}if(r.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(r.endsWith(".backblazeb2.com")){const t=r.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return null!=t?["s3",t[1]||""]:["",""]}const o=r.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/);let u=o&&o[1]||"",a=o&&o[2];if("us-gov"===a)a="us-gov-west-1";else if("s3"===a||"s3-accelerate"===a)a="us-east-1",u="s3";else if("iot"===u)u=r.startsWith("iot.")?"execute-api":r.startsWith("data.jobs.iot.")?"iot-jobs-data":"/mqtt"===i?"iotdevicegateway":"iotdata";else if("autoscaling"===u){const t=(n.get("X-Amz-Target")||"").split(".")[0];"AnyScaleFrontendService"===t?u="application-autoscaling":"AnyScaleScalingPlannerFrontendService"===t&&(u="autoscaling-plans")}else null==a&&u.startsWith("s3-")?(a=u.slice(3).replace(/^fips-|^external-1/,""),u="s3"):u.endsWith("-fips")?u=u.slice(0,-5):a&&/-\d$/.test(u)&&!/-\d$/.test(a)&&([u,a]=[a,u]);return[e[u]||u,a||""]}(this.url,this.headers)),this.service=f||b||"",this.region=l||y||"us-east-1",this.cache=d||new Map,this.datetime=h||(new Date).toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=v,this.appendSessionToken=p||"iotdevicegateway"===this.service,this.headers.delete("Host"),"s3"!==this.service||this.signQuery||this.headers.has("X-Amz-Content-Sha256")||this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");const g=this.signQuery?this.url.searchParams:this.headers;if(g.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&g.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter((t=>w||!r.has(t))).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((t=>t+":"+("host"===t?this.url.host:(this.headers.get(t)||"").replace(/\s+/g," ")))).join("\n"),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&("s3"!==this.service||g.has("X-Amz-Expires")||g.set("X-Amz-Expires","86400"),g.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),g.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),g.set("X-Amz-SignedHeaders",this.signedHeaders)),"s3"===this.service)try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(t){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");m||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=s(this.encodedPath);const j=new Set;this.encodedSearch=[...this.url.searchParams].filter((([t])=>{if(!t)return!1;if("s3"===this.service){if(j.has(t))return!1;j.add(t)}return!0})).map((t=>t.map((t=>s(encodeURIComponent(t)))))).sort((([t,n],[e,r])=>t<e?-1:t>e?1:n<r?-1:n>r?1:0)).map((t=>t.join("="))).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){const t=this.datetime.slice(0,8),n=[this.secretAccessKey,t,this.region,this.service].join();let e=this.cache.get(n);if(!e){const r=await o("AWS4"+this.secretAccessKey,t),i=await o(r,this.region),u=await o(i,this.service);e=await o(u,"aws4_request"),this.cache.set(n,e)}return c(await o(e,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,c(await u(await this.canonicalString()))].join("\n")}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+"\n",this.signedHeaders,await this.hexBodyHash()].join("\n")}async hexBodyHash(){let t=this.headers.get("X-Amz-Content-Sha256")||("s3"===this.service&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(null==t){if(this.body&&"string"!=typeof this.body&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");t=c(await u(this.body||""))}return t}}async function o(t,e){const r=await crypto.subtle.importKey("raw","string"==typeof t?n.encode(t):t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",r,n.encode(e))}async function u(t){return crypto.subtle.digest("SHA-256","string"==typeof t?n.encode(t):t)}const a=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function c(t){const n=new Uint8Array(t);let e="";for(let t=0;t<n.length;t++){const r=n[t];e+=a[r>>>4&15],e+=a[15&r]}return e}function s(t){return t.replace(/[!'()*]/g,(t=>"%"+t.charCodeAt(0).toString(16).toUpperCase()))}t.AwsClient=class{constructor({accessKeyId:t,secretAccessKey:n,sessionToken:e,service:r,region:i,cache:o,retries:u,initRetryMs:a}){if(null==t)throw new TypeError("accessKeyId is a required option");if(null==n)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=t,this.secretAccessKey=n,this.sessionToken=e,this.service=r,this.region=i,this.cache=o||new Map,this.retries=null!=u?u:10,this.initRetryMs=a||50}async sign(t,n){if(t instanceof Request){const{method:e,url:r,headers:i,body:o}=t;null==(n=Object.assign({method:e,url:r,headers:i},n)).body&&i.has("Content-Type")&&(n.body=null!=o&&i.has("X-Amz-Content-Sha256")?o:await t.clone().arrayBuffer()),t=r}const e=new i(Object.assign({url:t.toString()},n,this,n&&n.aws)),r=Object.assign({},n,await e.sign());delete r.aws;try{return new Request(r.url.toString(),r)}catch(t){if(t instanceof TypeError)return new Request(r.url.toString(),Object.assign({duplex:"half"},r));throw t}}async fetch(t,n){for(let e=0;e<=this.retries;e++){const r=fetch(await this.sign(t,n));if(e===this.retries)return r;const i=await r;if(i.status<500&&429!==i.status)return i;await new Promise((t=>setTimeout(t,Math.random()*this.initRetryMs*Math.pow(2,e))))}throw new Error("An unknown error occurred, ensure retries is not negative")}},t.AwsV4Signer=i,Object.defineProperty(t,"__esModule",{value:!0})}(Tr.exports);var Nr=function(){};"undefined"==typeof process||process;var _r="undefined"!=typeof document;function Pr(t,n){return n.charAt(0)[t]()+n.slice(1)}"undefined"!=typeof Deno&&Deno,_r&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var Mr=Pr.bind(null,"toUpperCase"),Cr=Pr.bind(null,"toLowerCase");function Dr(t,n){void 0===n&&(n=!0);var e=function(t){return Ur(t)?Mr("null"):"object"==typeof t?function(t){return zr(t.constructor)?t.constructor.name:null}(t):Object.prototype.toString.call(t).slice(8,-1)}(t);return n?Cr(e):e}function Lr(t,n){return typeof n===t}var zr=Lr.bind(null,"function"),$r=Lr.bind(null,"string");function Ur(t){return null===t}function Rr(t,n){if("object"!=typeof n||Ur(n))return!1;if(n instanceof t)return!0;var e=Dr(new t(""));if(function(t){return t instanceof Error||$r(t.message)&&t.constructor&&function(t){return"number"===Dr(t)&&!isNaN(t)}(t.constructor.stackTraceLimit)}(n))for(;n;){if(Dr(n)===e)return!0;n=Object.getPrototypeOf(n)}return!1}function Wr(t,n){var e=t instanceof Element||t instanceof HTMLDocument;return e&&n?function(t,n){return void 0===n&&(n=""),t&&t.nodeName===n.toUpperCase()}(t,n):e}function Hr(t){var n=[].slice.call(arguments,1);return function(){return t.apply(void 0,[].slice.call(arguments).concat(n))}}Lr.bind(null,"undefined"),Lr.bind(null,"boolean"),Lr.bind(null,"symbol"),Rr.bind(null,TypeError),Rr.bind(null,SyntaxError),Hr(Wr,"form"),Hr(Wr,"button"),Hr(Wr,"input"),Hr(Wr,"select");var qr="EventListener";function Vr(t,n){if($r(t))return n?Vr(document.querySelectorAll(t)):(e=t).split(e.indexOf(",")>-1?",":" ").map((function(t){return t.trim()}));var e;if(NodeList.prototype.isPrototypeOf(t)){for(var r=[],i=t.length>>>0;i--;)r[i]=t[i];return r}var o=function(t){return t?function(t){return"array"===Dr(t)}(t)?t:[t]:[]}(t);return n?o.map((function(t){return $r(t)?Vr(t,!0):t})).flat():o}function Fr(t,n){var e;return function(){return t&&(e=t.apply(n||this,arguments),t=null),e}}var Gr=function(t,n,e,r){var i=e||Nr,o=r||!1;if(!_r)return i;var u=Vr(n),a=Vr(t,!0);if(!a.length)throw new Error("noElements");if(!u.length)throw new Error("noEvent");var c=[];return function t(n){n&&(c=[]);for(var e=n?"add"+qr:"remove"+qr,r=0;r<a.length;r++){var s=a[r];c[r]=n?o&&o.once?Fr(i):i:c[r]||i;for(var f=0;f<u.length;f++)s[e]?s["on"+u[f]]=n?c[r]:null:s[e](u[f],c[r],o)}return t.bind(null,!n)}("Event")};function Jr(t,n){return _r&&zr(window[t])?(e=window[t],r=n,void 0===(i=window)&&(i=null),zr(e)?function(){e.apply(i,arguments),r.apply(i,arguments)}:r):window[t]=n;var e,r,i}Jr.bind(null,"onerror"),Jr.bind(null,"onload");var Xr="undefined"==typeof window,Kr="hidden";var Br=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function Yr(t,n){void 0===n&&(n={});var e=function(t,n){var e=this,r=!1;return function(i){r||(t.call(e,i),r=!0,setTimeout((function(){return r=!1}),n))}}(t,n.throttle||1e4),r=[];function i(){var t=function(t){if(Xr)return!1;var n=Xr||Kr in document?Kr:["webkit","moz","ms","o"].reduce((function(t,n){var e=n+"Hidden";return!t&&e in document?e:t}),null),e="".concat(n.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return t(Boolean(document[n]))},i=function(){return document.addEventListener(e,r)};return i(),function(){return document.removeEventListener(e,r),i}}((function(t){t||e({type:"tabVisible"})}));return r=[t].concat(Br.map((function(t){return Gr(document,t,e)}))).concat(Gr(window,"load",e)).concat(Gr(window,"scroll",e,{capture:!0,passive:!0})),o}function o(){r.map((function(t){return t()}))}return i(),function(){return o(),i}}function Zr(t,n){return n?0:Math.round((new Date-t)/1e3)}var Qr="object",ti="string",ni="name",ei="version",ri="",ii="function",oi="undefined",ui={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ai=[[/microsoft (windows) (vista|xp)/i],[ni,ei],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[ni,[ei,si,ui]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[ni,"Windows"],[ei,si,ui]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[ei,/_/g,"."],[ni,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[ni,"MacOS"],[ei,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[ei,ni],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[ni,ei],[/\(bb(10);/i],[ei,[ni,"BlackBerry"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[ei,[ni,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[ei,[ni,"webOS"]],[/crkey\/([\d\.]+)/i],[ei,[ni,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[ni,"Chromium OS"],ei],[/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/(unix) ?([\w\.]*)/i],[ni,ei]];function ci(t,n){for(var e,r,i,o,u,a,c=0;c<n.length&&!u;){var s=n[c],f=n[c+1];for(e=r=0;e<s.length&&!u;)if(u=s[e++].exec(t))for(i=0;i<f.length;i++)a=u[++r],d(o=f[i])===Qr&&o.length>0?2==o.length?this[o[0]]=d(o[1])==ii?o[1].call(this,a):o[1]:3==o.length?this[o[0]]=d(o[1])!==ii||o[1].exec&&o[1].test?a?a.replace(o[1],o[2]):void 0:a?o[1].call(this,a,o[2]):void 0:4==o.length&&(this[o[0]]=a?o[3].call(this,a.replace(o[1],o[2])):void 0):this[o]=a||void 0;c+=2}}function si(t,n){for(var e in n)if(d(n[e])===Qr&&n[e].length>0){for(var r=0;r<n[e].length;r++)if(fi(n[e][r],t))return"?"===e?void 0:e}else if(fi(n[e],t))return"?"===e?void 0:e;return t}function fi(t,n){return d(t)===ti&&-1!==li(n).indexOf(li(t))}function li(t){return t.toLowerCase()}function di(t){var n=t||(("undefined"==typeof window?"undefined":d(window))!==oi&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:ri),e={};return e[ni]=void 0,e[ei]=void 0,ci.call(e,n,ai),e}var hi="Brave";function vi(){if("undefined"==typeof window)return{};if(!window.navigator)return{};var t,n,e,r,i,o=window.navigator,u=o.platform,a=o.product,c=o.vendor,s=function(t){var n=t.userAgent,e=/.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(n);if(e)return{type:e[1],version:e[2]};var r=/.+(Trident|Edge)\/([0-9\.]+).*/i.exec(n);if(r)return{type:r[1],version:r[2]};var i=/(headlesschrome)(?:\/([\w\.]+)| )/i.exec(n);if(i)return{type:i[1],version:i[2]};var o=/.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(n);if(o)return{type:t.brave&&t.brave.isBrave?hi:o[1],version:o[2]};var u=/.+(Safari)\/([0-9\.]+).*/i.exec(n);if(u)return{type:u[1],version:u[2]};var a=/.+(AppleWebKit)\/([0-9\.]+).*/i.exec(n);if(a)return{type:a[1],version:a[2]};var c=/.*([A-Z]+)\/([0-9\.]+).*/i.exec(n)||["","NA","0.0.0"];return{type:c[1],version:c[2]}}(window.navigator),f=s.type,l=s.version,d=f===hi?f:(c||"").split(" ")[0];return{platform:u,os:di(),make:d||a,model:f,version:l,name:[f,l].join("/"),language:(n=window.navigator,e=n.language,r=n.browserLanguage,i=n.languages,(e||r||(i||["en_US"])[0]).toLowerCase().replace("-","_")),timezone:(t=/\(([A-Za-z\s].*)\)/.exec((new Date).toString()),t&&t[1]||"")}}function pi(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})[t]||t}function wi(t){return mi.apply(this,arguments)}function mi(){return mi=s(er.mark((function t(n){var e,r,i,o,u,a,c=arguments;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=c.length>1&&void 0!==c[1]&&c[1],r={},t.t0=er.keys(n);case 3:if((t.t1=t.t0()).done){t.next=13;break}return i=t.t1.value,o=Array.isArray(n[i])?n[i]:[n[i]],u=e?o:o[0],t.next=9,gi(u,Oi);case 9:Ei(a=t.sent)||(r[i]=a),t.next=3;break;case 13:return t.abrupt("return",r);case 14:case"end":return t.stop()}}),t)}))),mi.apply(this,arguments)}function bi(t){return yi.apply(this,arguments)}function yi(){return(yi=s(er.mark((function t(n){var e,r;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e={},t.t0=er.keys(n);case 2:if((t.t1=t.t0()).done){t.next=9;break}return r=t.t1.value,t.next=6,gi(n[r],Si);case 6:e[r]=t.sent,t.next=2;break;case 9:return t.abrupt("return",e);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function gi(t,n){return ji.apply(this,arguments)}function ji(){return(ji=s(er.mark((function t(n,e){return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("function"!=typeof n){t.next=4;break}return t.next=3,n();case 3:n=t.sent;case 4:return t.abrupt("return",e(n));case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Oi(t){if(null!=t)return Array.isArray(t)?t.filter(ki).map((function(t){return t.toString()})):Ei(t)?t:t.toString()}function Si(t){return parseFloat(Number(Array.isArray(t)?t[0]:t))}function ki(t){return null!=t}function Ei(t){return null==t}var Ai="_session.start",Ii="_session.stop",xi="pageView";function Ti(t){return Ni.apply(this,arguments)}function Ni(){return Ni=s(er.mark((function t(n){var e,r,i,o,u,a,c,s,l,d,h,v,p,w,m,b,y,g,j,O,S,k,E,A,I,x,T,N,_,P=arguments;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=P.length>1&&void 0!==P[1]?P[1]:{},i=(r=P.length>2&&void 0!==P[2]?P[2]:{}).appTitle,o=r.appPackageName,u=r.appVersionCode,a=r.enrichEventAttributes,c=r.enrichEventMetrics,s=r.debug?console.log:function(){},l=pi(n,r.eventMapping),d=hr(),h=e.sessionId||d.id,v=e.sessionStart||d.createdAt,p=e.sessionStart?new Date(e.sessionStart).getTime():d.created,s("event sessionData ",JSON.stringify(d)),yr&&(w=mr(),m=pr(),s("event pageSessionInfo",JSON.stringify(w)),s("event tabSessionData ",JSON.stringify(m))),b=e.attributes||{},y=e.eventId||J(),g=e.time?new Date(e.time):new Date,j=g.toISOString(),O=g.getTime()-p,S=Qe({date:j,sessionId:h},yr?{pageSession:w.id}:{}),!a){t.next=23;break}return t.next=20,a();case 20:t.t0=t.sent,t.next=24;break;case 23:t.t0={};case 24:if(k=t.t0,E=Qe(Qe(Qe({},S),k),b),A=e.metrics||{},I={sessionTime:d.elapsed||O,hour:g.getHours(),day:g.getDay()+1,month:g.getMonth()+1,year:g.getFullYear()},!c){t.next=34;break}return t.next=31,c();case 31:t.t1=t.sent,t.next=35;break;case 34:t.t1={};case 35:return x=t.t1,T=Qe(Qe(Qe({},I),x),A),t.next=39,wi(E);case 39:return t.t2=t.sent,t.next=42,bi(T);case 42:return t.t3=t.sent,N={attributes:t.t2,metrics:t.t3},s("".concat(y,":").concat(l)),s("eventAttributes",N.attributes),s("eventMetrics",N.metrics),yr&&s("clientInfo",vi()),_=f({},y,Qe(Qe({EventType:l,Timestamp:j,AppPackageName:o,AppTitle:i},u?{AppVersionCode:u}:{}),{},{Attributes:N.attributes,Metrics:N.metrics,Session:{Id:h,StartTimestamp:v}})),n===Ii&&(_[y].Session.Duration=O,_[y].Session.StopTimestamp=j),t.abrupt("return",_);case 51:case"end":return t.stop()}}),t)}))),Ni.apply(this,arguments)}var _i="__endpoint";function Pi(t){return"".concat(_i,".").concat(t)}var Mi,Ci="__endpoint",Di=!1;function Li(){return zi.apply(this,arguments)}function zi(){return zi=s(er.mark((function t(){var n,e,r,i,o,u,a,c,s,f,l,d,h,v,p,w,m,b,y,g,j,O=arguments;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=O.length>0&&void 0!==O[0]?O[0]:{},r=(e=O.length>1&&void 0!==O[1]?O[1]:{}).getUserId,i=e.getEndpointId,o=e.endpointMigration,u=qi(e),a=u.sessionKey?u.sessionKey():"sessions",c=u.pageViewKey?u.pageViewKey():"pageViews",yr&&(l=vi(),s=mr(),f=s.id),d=hr(),t.next=10,i();case 10:if(h=t.sent,Di||(Di=!0,(v=ke(Ci))&&($i(h,v),Ae(Ci))),p=Ui(h),w=Wi(e),m=Ri(w,l),b={Attributes:{},Demographic:m,Location:{},Metrics:{}},yr&&(l.device&&l.device.vendor&&(b.Attributes.DeviceMake=[l.device.vendor]),l.device&&l.device.model&&(b.Attributes.DeviceModel=[l.device.model]),l.device&&l.device.type&&(b.Attributes.DeviceType=[l.device.type])),!(n=xr.all([p,b,n],{arrayMerge:Hi})).User||!n.User.UserId){t.next=23;break}return t.next=21,r();case 21:n.User.UserId!==(y=t.sent)&&(n.User.UserId=y);case 23:if(n.User&&n.User.UserId){t.next=28;break}return t.next=26,r();case 26:(g=t.sent)&&(n.User=n.User||{},n.User.UserId=g);case 28:if(!n.User||!n.User.UserAttributes){t.next=32;break}return t.next=31,wi(n.User.UserAttributes,!0);case 31:n.User.UserAttributes=t.sent;case 32:return t.next=34,wi(n.Attributes,!0);case 34:return n.Attributes=t.sent,t.next=37,bi(n.Metrics);case 37:if(n.Metrics=t.sent,n.Metrics[a]||(n.Metrics[a]=1),n.Metrics[c]||(n.Metrics[c]=1),o&&(n=o(h,n)),j=n.Attributes.lastSession){t.next=47;break}return n.Attributes.lastSessionDate=[d.createdAt],n.Attributes.lastSession=[d.id],f&&(n.Attributes.lastPageSession=[f]),t.abrupt("return",$i(h,n));case 47:return j&&j[0]!==d.id&&(n.Attributes.lastSessionDate=[d.createdAt],n.Attributes.lastSession=[d.id],n.Metrics[a]+=1),n.Attributes&&n.Attributes.lastPageSession&&Array.isArray(n.Attributes.lastPageSession)&&n.Attributes.lastPageSession.length>0&&n.Attributes.lastPageSession[0]!==f&&(n.Attributes.lastPageSession=[f],n.Metrics[c]+=1),t.abrupt("return",$i(h,n));case 50:case"end":return t.stop()}}),t)}))),zi.apply(this,arguments)}function $i(t,n){var e=Pi(t),r="string"==typeof n?n:JSON.stringify(n);return Ee(e,r),n}function Ui(t){try{return JSON.parse(ke(Pi(t)))||{}}catch(t){}return{}}function Ri(t,n){return yr?function(t,n){var e={AppVersion:t,Locale:n.language,Make:n.make,Model:n.model,ModelVersion:n.version,Platform:n.os.name||n.platform};return n.os&&n.os.version&&(e.PlatformVersion=n.os.version),e}(t,n):function(t){return{AppVersion:t,Make:"generic server",Platform:"Node.js",PlatformVersion:process.version}}(t)}function Wi(t){var n=t.appTitle||t.appPackageName||"",e=t.appVersionCode||"0.0.0";return n?"".concat(n,"@").concat(e):e}function Hi(t,n){return n}function qi(t){var n=t.getContext;return"function"==typeof n?n():n}var Vi=[429,500],Fi=[202],Gi=400;function Ji(t,n){return Xi.apply(this,arguments)}function Xi(){return Xi=s(er.mark((function t(n,e){var r,i,o,u,a,c,s,f,l,d,h,v,p,w,m,b,y;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.pinpointRegion,i=e.pinpointAppId,o=e.lambdaArn,u=e.lambdaRegion,a=e.credentials,c=e.getCredentials,s=e.debug,t.next=3,Ki(a,c);case 3:return f=t.sent,s&&console.log("pinpoint auth",f),l=r||u,d=!0===e.fips?"-fips":"",h="https://lambda.".concat(u||r,".amazonaws.com/2015-03-31/functions/").concat(o,"/invocations"),v="https://pinpoint".concat(d,".").concat(l,".amazonaws.com/v1/apps/").concat(i,"/events"),p=o?h:v,b={body:JSON.stringify(n)},w=new Tr.exports.AwsClient(f),t.next=16,w.fetch(p,b).then((function(t){return t.json()}));case 16:m=t.sent,t.next=24;break;case 19:return w=new Mi.PinpointClient({credentials:f,region:r}),y=new Mi.PutEventsCommand({ApplicationId:i,EventsRequest:n}),t.next=23,w.send(y);case 23:m=t.sent;case 24:return m&&m.Results&&Object.keys(m.Results).map((function(t){return m.Results[t]})).forEach((function(t){var n=t.EndpointItemResponse||{},e=t.EventsItemResponse||{};Object.keys(n).length&&(Fi.includes(n.StatusCode)||Vi.includes(n.StatusCode)||Yi(n,Endpoint));var r=Object.keys(e);r.length&&r.forEach((function(){}))})),t.abrupt("return",m);case 26:case"end":return t.stop()}}),t)}))),Xi.apply(this,arguments)}function Ki(t,n){return Bi.apply(this,arguments)}function Bi(){return(Bi=s(er.mark((function t(n,e){var r;return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=n,Object.keys(r).length||!e){t.next=11;break}return t.prev=2,t.next=5,e();case 5:r=t.sent,t.next=11;break;case 8:throw t.prev=8,t.t0=t.catch(2),new Error(t.t0);case 11:return t.abrupt("return",{accessKeyId:r.accessKeyId||r.AccessKeyId,secretAccessKey:r.secretAccessKey||r.SecretKey,sessionToken:r.sessionToken||r.SessionToken,retries:5});case 13:case"end":return t.stop()}}),t,null,[[2,8]])})))).apply(this,arguments)}function Yi(t){var n=t.Message;if(t.StatusCode===Gi){if(n.startsWith("Missing ChannelType"))throw new Error("Missing ChannelType");if(n.startsWith("Exceeded maximum endpoint per user count"))throw new Error("Exceeded maximum endpoint per user count")}}var Zi=["PUSH","GCM","APNS","APNS_SANDBOX","APNS_VOIP","APNS_VOIP_SANDBOX","ADM","SMS","VOICE","EMAIL","BAIDU","CUSTOM"].reduce((function(t,n){return t[n]=n,t}),{}),Qi=vi(),to=Ai,no=Ii,eo=/.+\@.+\..+/;function ro(t){try{return JSON.parse(ke(Pi(t)))||{}}catch(t){}return{}}function io(t){return t.sort((function(t,n){var e=t.EventType,r=n.EventType;return e==to?-1:r==to||e==no?1:r==no?-1:void 0})).reduce((function(t,n){return Qe(Qe({},n),t)}),{})}function oo(t,n,e){return{BatchItem:f({},t,{Endpoint:n,Events:e})}}var uo=Ii;function ao(){return{}}function co(){throw new Error("Pinpoint not loaded")}function so(t){var n=t.config,e=t.instance;n&&n.disableAnonymousTraffic&&!e.user("userId")&&e.once("identifyStart",(function(t){t.plugins["aws-pinpoint"].loaded()||e.loadPlugin("aws-pinpoint")}))}var fo={disableAnonymousTraffic:!1,pinpointRegion:"us-east-1",eventMapping:{}},lo=function(){var t,n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=!1;return{name:"aws-pinpoint",config:Qe(Qe({},fo),e),bootstrap:so,initialize:function(r){var i=r.config,o=r.instance,u=i.disableAnonymousTraffic,a=i.debug?console.log:function(){},c=o.getState(),f=c.user||{},l=f.userId,h=f.anonymousId,v=c.context||{},p=v.app,w=v.version,m=v.campaign,b=mr(),y=pr(),g=hr();if(a("initPageSession",b),a("initTabSession",y),a("initSessionData",g),g&&g.anonId&&g.anonId!==h){a("anonId different refresh session details"),br(),wr();var j=vr(30,{anonId:h,userId:l});a("newSessionForNewUser",j)}if(!l&&u)return!1;var O=Object.keys(m).reduce((function(t,n){return t["utm_".concat(n)]=m[n],t}),{}),S=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Qe({getContext:t.getContext||ao,credentials:t.credentials||{},getEndpointId:t.getEndpointId},t),e=n.debug?console.log:function(){},r=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.getEndpointId,e=t.debug;return function(){var r=s(er.mark((function r(){var i,o,u,a,c,s,f,l,h,v=arguments;return er.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=v.length>0&&void 0!==v[0]?v[0]:[],o=v.length>1&&void 0!==v[1]?v[1]:{},r.next=4,n();case 4:if(u=r.sent){r.next=8;break}return console.error("No endpoint id. check getEndpointId()"),r.abrupt("return");case 8:if("object"===d(o)&&Object.keys(o).length){r.next=13;break}r.t0=ro(u),r.next=16;break;case 13:return r.next=15,Li(o,t);case 15:r.t0=r.sent;case 16:return c=(a=r.t0).ChannelType,a.Address&&eo.test(a.Address)&&(c=Zi.EMAIL),!c&&a.Address&&(c="android"===Qi.platform?c||Zi.GCM:c||Zi.APNS),e&&(console.log("Endpoint",a),console.log("CHANNEL_TYPE",c)),a.RequestId=J(),a.ChannelType=c,a.Address&&(a.OptOut=a.OptOut||"NONE"),s=io(i),f=oo(u,a,s),r.prev=26,r.next=29,Ji(f,t);case 29:l=r.sent,r.next=36;break;case 32:r.prev=32,r.t1=r.catch(26),console.log("Error calling AWS",r.t1),h=r.t1;case 36:return r.abrupt("return",{endpoint:a,response:l,error:h,events:i});case 37:case"end":return r.stop()}}),r,null,[[26,32]])})));return function(){return r.apply(this,arguments)}}()}(n),i=function(t,n){var e,r,i,o=(n=n||{}).initial||[],u=n.max||1/0,a=n.interval||1e4,c=n.onEmpty||rr,s=n.onPause||rr;function f(n){clearInterval(e);var r=o.splice(0,u);return r.length&&t(r,o),o.length?n?f():l():(i=!1,c(o))}function l(){i=!0,e=setInterval(f,a)}return o.length&&l(),{flush:function(t){f(t)},resume:f,push:function(t){return(r=o.push(t))>=u&&!n.throttle&&f(),i||l(),r},size:function(){return o.length},pause:function(t){t&&f(),clearInterval(e),i=!1,s(o)}}}(function(){var t=s(er.mark((function t(n){return er.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.forEach((function(t){return e("> Queue event",t)})),t.next=3,r(n,{});case 3:e("> Queue response",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(n,e){return t.apply(this,arguments)}}(),{max:10,interval:t.flushInterval||3e3,throttle:!0}),o=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(){var e=s(er.mark((function e(r){var i,o,u,a,c=arguments;return er.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=c.length>2&&void 0!==c[2]?c[2]:{},u=c.length>3&&void 0!==c[3]&&c[3],gr(i=c.length>1&&void 0!==c[1]?c[1]:{})&&(u=i={}),gr(o)&&(u=o={}),e.next=7,Ti(r,i,n);case 7:if(a=e.sent,!Object.entries(o).length&&r!==xi){e.next=12;break}return e.next=11,Li(o,n);case 11:o=e.sent;case 12:if(t.push(a),!u){e.next=17;break}return e.abrupt("return",t.flush());case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}(i,n);Li({},t);var u=function(t){if(!yr)return ao;var n=function(t){return function(){t(uo,!0)}}(t);return window.addEventListener("beforeunload",n),function(){return window.removeEventListener("beforeunload",n)}}(o);return{updateEndpoint:function(t){return r([],t)},recordEvent:o,disable:function(){u()}}}(Qe(Qe({},i),{},{appTitle:i.appTitle||p,appPackageName:i.appPackageName||p,appVersionCode:i.appVersionCode||w,eventMapping:i.eventMapping,getEndpointId:function(){return o.user("anonymousId")},getUserId:function(){return o.user("userId")},getContext:function(){return{sessionKey:i.sessionKey,pageViewKey:i.pageViewKey,initialSession:g}},enrichEventAttributes:function(){return Qe({anonId:o.user("anonymousId"),userId:o.user("userId"),hash:window.location.hash,path:window.location.pathname,referrer:document.referrer,search:window.location.search,title:document.title,host:window.location.hostname,url:window.location.origin+window.location.pathname},O)},enrichUserAttributes:i.enrichUserAttributes,enrichEventMetrics:function(){return{}}}));t=S.recordEvent,n=S.updateEndpoint,g&&g.isNew&&(a("Start brand new session because cookie not found"),t(Ai)),function(t){var n,e,r=t.onIdle,i=t.onWakeUp,o=t.onHeartbeat,u=t.timeout,a=void 0===u?1e4:u,c=t.throttle,s=void 0===c?2e3:c,f=!1,l=new Date;Yr((function(t){clearTimeout(n),o&&!f&&o(Zr(l),t),i&&f&&(f=!1,i(Zr(e),t),l=new Date),n=setTimeout((function(){f=!0,r&&(e=new Date,r(Zr(l),t))}),a)}),{throttle:s})}({timeout:18e5,throttle:2e4,onIdle:function(n){var r;a("Session idle. Active ".concat(n," seconds")),r=hr(),e.debug&&console.log("Stop session",r),t(Ii,!0)},onWakeUp:function(n){var r;a("Session wakeup. Idle ".concat(n," seconds")),r=vr(30),e.debug&&console.log("START SESSION",r),t(Ai)},onHeartbeat:function(t){a("ping session",new Date),a("total active time",t);var n=o.user();!function(t,n){void 0===t&&(t=30),vr(t||1,n,!0)}(30,{anonId:n.anonymousId,userId:n.userId})}})},page:function(){if(!t)return co();r&&br(),t(xi),r=!0},track:function(n){var e=n.payload,r=n.config;if(!t)return co();if(!r.disableAnonymousTraffic||e.userId){var i,o=(i=e.properties,Object.keys(i).reduce((function(t,n){var e=i[n];return"number"==typeof e&&(t.metrics[n]=e),"string"!=typeof e&&"boolean"!=typeof e||(t.attributes[n]=e),t}),{attributes:{},metrics:{}}));t(e.event,o)}},identify:function(t){var e=t.payload,r=e.userId,i=e.traits;if(!n)return co();var o={},u={};r&&(u.UserId=r),i&&Object.keys(i).length&&(u.UserAttributes=i),Object.keys(u).length&&(o.User=u),n(o,!0)},reset:function(t){var n=Pi(t.instance.user("anonymousId"));Ae(n)},loaded:function(){return!!t}}};function ho(t,n){var e=vo(t,n),r=v({httpMethod:"GET"},n);return h(e,r)}var vo=function(t,n){return("string"==typeof n?n:p(n))+"/content/items/"+t};class po{constructor(t){this.name="amazon";const{app:n={},fips:e,userPoolID:r}=t;this.analytics=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return de(Ye(Ye({},{storage:Xe}),t))}({app:n.name,version:n.version,plugins:[lo({fips:e,pinpointAppId:n.id,getCredentials:()=>function(t,n={}){const e=`https://cognito-identity${!0===n.fips?"-fips":""}.us-east-1.amazonaws.com/`;let r=m.get(k);if(r&&Date.now()/1e3<r.Expiration)return Promise.resolve(r);const i={method:"POST",headers:{"Content-type":"application/x-amz-json-1.1","X-Amz-Target":"AWSCognitoIdentityService.GetId"},body:JSON.stringify({IdentityPoolId:t})};return fetch(e,i).then((t=>{if(!t.ok)throw new Error(t.statusText);return t.json()})).then((t=>{const{IdentityId:n}=t,r={method:"POST",headers:{"Content-type":"application/x-amz-json-1.1","X-Amz-Target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},body:JSON.stringify({IdentityId:n})};return fetch(e,r)})).then((t=>{if(!t.ok)throw new Error(t.statusText);return t.json()})).then((({Credentials:t})=>(m.set(k,t),t)))}(r,{fips:e})})]}),Object.assign(this,t)}init(){return Promise.resolve()}static async setAccessPermissions({id:t,authentication:n,username:e,accessChangeset:r}){return async function({id:t,authentication:n,username:e,accessChangeset:r}){const{properties:i={}}=await ho(t,{authentication:n}),o=i.telemetry,u=void 0===o?{}:o,{arcgis:{access:a={}}={}}=u,c=O(u,["arcgis"]),s=function(t,n,e){return e.reduce(((n,e)=>{const{action:r,targetProperty:i}=e;return"add"===r?n[i]={updatedAt:new Date,updatedBy:t}:"remove"===r&&delete n[i],n}),n)}(e,a,r);return w({item:{id:t,properties:Object.assign(Object.assign({},i),{telemetry:Object.assign(Object.assign({},c),{arcgis:{access:Object.assign({},s)}})})},authentication:n})}({id:t,authentication:n,username:e,accessChangeset:r})}static async getAccessPermissions({id:t,authentication:n}){return async function({id:t,authentication:n}){const{properties:{telemetry:{arcgis:{access:e={}}={}}={}}}=await ho(t,{authentication:n});return{access:e}}({id:t,authentication:n})}logPageView(t,n){const e=function({page:t,previousPage:n={},options:e={},dimensionLookup:r={},metricLookup:i={}}){const o=T(e,i),u=E({telemetryData:e,dimensionLookup:r,excludeKeys:["workflow",...Object.keys(o),...Object.keys(i)]}),{referrer:a,title:c}=document||{},{hostname:s,pathname:f}=window&&window.location?window.location:{};return Object.assign(Object.assign({name:"pageView",referrer:a,hostname:s,path:t||f,pageUrl:t||f,pageName:c,previousPageUrl:n.pageUrl,previousPageName:n.pageName},u),o)}({page:t,previousPage:this.previousPage,options:n,dimensionLookup:this.dimensions,metricLookup:this.metrics}),{pageUrl:r,pageName:i}=e;this.previousPage={pageUrl:r,pageName:i},this.analytics.track("pageView",e)}logEvent(t={}){const n=function({event:t={},dimensionLookup:n={},metricLookup:e={}}){var r,i;const{pathname:o,eventType:u="other"}=t,a=T(t,e),c=E({telemetryData:Object.assign({eventType:u},t),dimensionLookup:n,excludeKeys:["workflow","pathname",...Object.keys(a),...Object.keys(e)]}),s=Object.assign(Object.assign({name:u},c),a);return"undefined"!=typeof document&&document.referrer&&(s.referrer=document.referrer),"undefined"==typeof window||s.hostname||(s.hostname=null===(r=window.location)||void 0===r?void 0:r.hostname),s.path="undefined"!=typeof window&&window.location.pathname?null===(i=window.location)||void 0===i?void 0:i.pathname:o,s}({event:t,dimensionLookup:this.dimensions,metricLookup:this.metrics}),{name:e}=n;this.analytics.track(e,n)}}const wo=class{constructor(e){t(this,e),this.consentGranted=n(this,"consentGranted",7),this.amazonAppId=void 0,this.amazonAppName=void 0,this.amazonUserPoolID=void 0,this.amazonVersion=void 0,this.firstUseVar=void 0,this.locale=void 0,this.measurementIds=void 0,this.portal=void 0,this._open=void 0,this._translations=void 0}get el(){return e(this)}_loaded=!1;_telemetryInstance;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async getInstance(){return"true"===localStorage.getItem(this.firstUseVar)||this.portal.eueiEnabled?(await this._init(),this._telemetryInstance):void 0}consentGranted;async componentWillLoad(){await this._getTranslations(),this._open=null===localStorage.getItem(this.firstUseVar)}render(){return r(i,{key:"6b5a4571e972d6d79948cbf186119372456b5e1e"})}async componentDidLoad(){this.consentGranted.emit({granted:"true"===localStorage.getItem(this.firstUseVar)})}async _init(){if(!this._loaded){const t={plugins:[],portal:this.portal};if(this.measurementIds?.length>0){const n=new S({measurementIds:this.measurementIds});t.plugins.push(n)}if(this.amazonUserPoolID){const n=new po({userPoolID:this.amazonUserPoolID,app:{name:this.amazonAppName,id:this.amazonAppId,version:this.amazonVersion}});t.plugins.push(n)}this._telemetryInstance=new j(t),await this._telemetryInstance.init(),this._loaded=!0}}_alertClosed(){this._open=!1,"true"!==localStorage.getItem(this.firstUseVar)&&localStorage.setItem(this.firstUseVar,"false")}_accept(){localStorage.setItem(this.firstUseVar,"true"),this.consentGranted.emit({granted:!0}),this._open=!1}async _getTranslations(){const t=await o(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"]}}};wo.style=":host{display:block}.consent-panel{position:fixed;display:block;z-index:5000;bottom:0;left:0;width:100%;height:auto;text-align:center}.cookie-consent-popup-container{position:relative;display:block;bottom:0;left:0;width:100%;margin:0;padding-top:1rem;padding-bottom:1rem;transition:transform 0.5s ease-out 0s;background-color:rgba(51, 51, 51, 0.95);color:#fff}.button-container{position:static;margin-bottom:1rem;display:flex;justify-content:center;flex-wrap:wrap}.padding-end-1{padding-inline-end:1rem}.link-text{--calcite-ui-text-link:var(--calcite-color-text-inverse);--calcite-ui-brand:var(--calcite-color-text-inverse);--calcite-color-text-link:var(--calcite-color-text-inverse);--calcite-color-brand-underline:var(--calcite-color-text-inverse);--calcite-color-brand:var(--calcite-color-text-inverse)}";export{wo as consent_manager}
@@ -18,4 +18,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
18
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
19
  PERFORMANCE OF THIS SOFTWARE.
20
20
  ***************************************************************************** */
21
- var p=function(){return p=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},p.apply(this,arguments)};function w(t,e){var i=e;return i.rawResponse=!1,c(t,i).then((function(t){var e={token:t.access_token,username:t.username,expires:new Date(Date.now()+(1e3*t.expires_in-1e3)),ssl:!0===t.ssl};return t.refresh_token&&(e.refreshToken=t.refresh_token),e}))}function m(t,e){var i=e;return i.params.referer="undefined"!=typeof window&&window.location&&window.location.host?window.location.host:u,c(t,i)}var g=/^https?:\/\/(\S+)\.arcgis\.com.+/;function v(t){return g.test(t)}function b(t){if(!g.test(t))return null;var e=t.match(g)[1].split(".").pop();return e.includes("dev")?"dev":e.includes("qa")?"qa":"production"}var k=function(){function t(t){if(this.clientId=t.clientId,this._refreshToken=t.refreshToken,this._refreshTokenExpires=t.refreshTokenExpires,this.username=t.username,this.password=t.password,this._token=t.token,this._tokenExpires=t.tokenExpires,this.portal=t.portal?l(t.portal):"https://www.arcgis.com/sharing/rest",this.ssl=t.ssl,this.provider=t.provider||"arcgis",this.tokenDuration=t.tokenDuration||20160,this.redirectUri=t.redirectUri,this.refreshTokenTTL=t.refreshTokenTTL||20160,this.server=t.server,this.federatedServers={},this.trustedDomains=[],t.server){var e=this.getServerRootUrl(t.server);this.federatedServers[e]={token:t.token,expires:t.tokenExpires}}this._pendingTokenRequests={}}return Object.defineProperty(t.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tokenExpires",{get:function(){return this._tokenExpires},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refreshToken",{get:function(){return this._refreshToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refreshTokenExpires",{get:function(){return this._refreshTokenExpires},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trustedServers",{get:function(){return console.log("DEPRECATED: use federatedServers instead"),this.federatedServers},enumerable:!1,configurable:!0}),t.beginOAuth2=function(e,i){void 0===i&&(i=window),e.duration&&console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");var n,s=p({portal:"https://www.arcgis.com/sharing/rest",provider:"arcgis",expiration:20160,popup:!0,popupWindowFeatures:"height=400,width=600,menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes",state:e.clientId,locale:""},e),r=s.portal,o=s.provider,a=s.clientId,h=s.expiration,c=s.redirectUri,u=s.popup,l=s.popupWindowFeatures,w=s.state,m=s.locale,g=s.params;if(n="arcgis"===o?r+"/oauth2/authorize?client_id="+a+"&response_type=token&expiration="+(e.duration||h)+"&redirect_uri="+encodeURIComponent(c)+"&state="+w+"&locale="+m:r+"/oauth2/social/authorize?client_id="+a+"&socialLoginProviderName="+o+"&autoAccountCreateForSocial=true&response_type=token&expiration="+(e.duration||h)+"&redirect_uri="+encodeURIComponent(c)+"&state="+w+"&locale="+m,g&&(n=n+"&"+f(g)),u){var v,b=((v={promise:null,resolve:null,reject:null}).promise=new Promise((function(t,e){v.resolve=t,v.reject=e})),v);return i["__ESRI_REST_AUTH_HANDLER_"+a]=function(e,i){if(e){var n=JSON.parse(e);b.reject(new d(n.errorMessage,n.error))}else if(i){var s=JSON.parse(i);b.resolve(new t({clientId:a,portal:r,ssl:s.ssl,token:s.token,tokenExpires:new Date(s.expires),username:s.username}))}},i.open(n,"oauth-window",l),b.promise}i.location.href=n},t.completeOAuth2=function(e,i){void 0===i&&(i=window);var n=p({portal:"https://www.arcgis.com/sharing/rest",popup:!0},e),s=n.portal,r=n.clientId,o=n.popup;function a(e,n){try{var a=void 0,h="__ESRI_REST_AUTH_HANDLER_"+r;if(o&&(i.opener?i.opener.parent&&i.opener.parent[h]?a=i.opener.parent[h]:i.opener&&i.opener[h]&&(a=i.opener[h]):i!==i.parent&&i.parent&&i.parent[h]&&(a=i.parent[h]),a))return a(e?JSON.stringify(e):void 0,JSON.stringify(n)),void i.close()}catch(t){throw new d('Unable to complete authentication. It\'s possible you specified popup based oAuth2 but no handler from "beginOAuth2()" present. This generally happens because the "popup" option differs between "beginOAuth2()" and "completeOAuth2()".')}if(e)throw new d(e.errorMessage,e.error);return new t({clientId:r,portal:s,ssl:n.ssl,token:n.token,tokenExpires:n.expires,username:n.username})}var h=i.location.hash.replace(/^#/,"").split("&").reduce((function(t,e){var i=function(t){var e=t.split("="),i=e[1];return{key:decodeURIComponent(e[0]),value:decodeURIComponent(i)}}(e);return t[i.key]=i.value,t}),{});if(!h.access_token){var c=void 0,u="Unknown error";return h.error&&(c=h.error,u=h.error_description),a({error:c,errorMessage:u})}return a(void 0,{token:h.access_token,expires:new Date(Date.now()+1e3*parseInt(h.expires_in,10)-6e4),ssl:"true"===h.ssl,username:h.username})},t.fromParent=function(e,i){var n;return!i&&window&&(i=window),new Promise((function(s,r){i.addEventListener("message",n=function(e){if(e.source===i.parent&&e.data)try{return s(t.parentMessageHandler(e))}catch(t){return r(t)}},!1),i.parent.postMessage({type:"arcgis:auth:requestCredential"},e)})).then((function(t){return i.removeEventListener("message",n,!1),t}))},t.authorize=function(t,e){t.duration&&console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");var i=p({portal:"https://arcgis.com/sharing/rest",expiration:20160},t);e.writeHead(301,{Location:i.portal+"/oauth2/authorize?client_id="+i.clientId+"&expiration="+(t.duration||i.expiration)+"&response_type=code&redirect_uri="+encodeURIComponent(i.redirectUri)}),e.end()},t.exchangeAuthorizationCode=function(e,i){var n=p({portal:"https://www.arcgis.com/sharing/rest",refreshTokenTTL:20160},e),s=n.portal,r=n.clientId,o=n.redirectUri,a=n.refreshTokenTTL;return w(s+"/oauth2/token",{params:{grant_type:"authorization_code",client_id:r,redirect_uri:o,code:i}}).then((function(e){return new t({clientId:r,portal:s,ssl:e.ssl,redirectUri:o,refreshToken:e.refreshToken,refreshTokenTTL:a,refreshTokenExpires:new Date(Date.now()+60*(a-1)*1e3),token:e.token,tokenExpires:e.expires,username:e.username})}))},t.deserialize=function(e){var i=JSON.parse(e);return new t({clientId:i.clientId,refreshToken:i.refreshToken,refreshTokenExpires:new Date(i.refreshTokenExpires),username:i.username,password:i.password,token:i.token,tokenExpires:new Date(i.tokenExpires),portal:i.portal,ssl:i.ssl,tokenDuration:i.tokenDuration,redirectUri:i.redirectUri,refreshTokenTTL:i.refreshTokenTTL})},t.fromCredential=function(e){var i=void 0===e.ssl||e.ssl,n=e.expires||Date.now()+72e5;return new t({portal:e.server.includes("sharing/rest")?e.server:e.server+"/sharing/rest",ssl:i,token:e.token,username:e.userId,tokenExpires:new Date(n)})},t.parentMessageHandler=function(e){if("arcgis:auth:credential"===e.data.type)return t.fromCredential(e.data.credential);if("arcgis:auth:error"===e.data.type){var i=new Error(e.data.error.message);throw i.name=e.data.error.name,i}throw new Error("Unknown message type.")},t.prototype.toCredential=function(){return{expires:this.tokenExpires.getTime(),server:this.portal,ssl:this.ssl,token:this.token,userId:this.username}},t.prototype.getUser=function(t){var e=this;if(this._pendingUserRequest)return this._pendingUserRequest;if(this._user)return Promise.resolve(this._user);var i=this.portal+"/community/self",n=p(p({httpMethod:"GET",authentication:this},t),{rawResponse:!1});return this._pendingUserRequest=c(i,n).then((function(t){return e._user=t,e._pendingUserRequest=null,t})),this._pendingUserRequest},t.prototype.getPortal=function(t){var e=this;if(this._pendingPortalRequest)return this._pendingPortalRequest;if(this._portalInfo)return Promise.resolve(this._portalInfo);var i=this.portal+"/portals/self",n=p(p({httpMethod:"GET",authentication:this},t),{rawResponse:!1});return this._pendingPortalRequest=c(i,n).then((function(t){return e._portalInfo=t,e._pendingPortalRequest=null,t})),this._pendingPortalRequest},t.prototype.getUsername=function(){return this.username?Promise.resolve(this.username):this._user?Promise.resolve(this._user.username):this.getUser().then((function(t){return t.username}))},t.prototype.getToken=function(t,e){return n=t,s=v(i=this.portal),r=v(n),o=b(i),a=b(n),s&&r&&o===a||new RegExp(this.portal,"i").test(t)?this.getFreshToken(e):this.getTokenForServer(t,e);var i,n,s,r,o,a},t.prototype.validateAppAccess=function(t){return this.getToken(this.portal).then((function(e){return function(t,e,i){return void 0===i&&(i="https://www.arcgis.com/sharing/rest"),c(i+"/oauth2/validateAppAccess",{method:"POST",params:{f:"json",client_id:e,token:t}})}(e,t)}))},t.prototype.toJSON=function(){return{clientId:this.clientId,refreshToken:this.refreshToken,refreshTokenExpires:this.refreshTokenExpires,username:this.username,password:this.password,token:this.token,tokenExpires:this.tokenExpires,portal:this.portal,ssl:this.ssl,tokenDuration:this.tokenDuration,redirectUri:this.redirectUri,refreshTokenTTL:this.refreshTokenTTL}},t.prototype.serialize=function(){return JSON.stringify(this)},t.prototype.enablePostMessageAuth=function(t,e){!e&&window&&(e=window),this._hostHandler=this.createPostMessageHandler(t),e.addEventListener("message",this._hostHandler,!1)},t.prototype.disablePostMessageAuth=function(t){!t&&window&&(t=window),t.removeEventListener("message",this._hostHandler,!1)},t.prototype.refreshSession=function(t){return this._user=null,this.username&&this.password?this.refreshWithUsernameAndPassword(t):this.clientId&&this.refreshToken?this.refreshWithRefreshToken():Promise.reject(new d("Unable to refresh token."))},t.prototype.getServerRootUrl=function(t){var e=l(t).split(/\/rest(\/admin)?\/services(?:\/|#|\?|$)/)[0].match(/(https?:\/\/)(.+)/),i=e[1],n=e[2].split("/"),s=n[0],r=n.slice(1);return""+i+s.toLowerCase()+"/"+r.join("/")},t.prototype.getDomainCredentials=function(t){return this.trustedDomains&&this.trustedDomains.length&&this.trustedDomains.some((function(e){return t.startsWith(e)}))?"include":"same-origin"},t.prototype.createPostMessageHandler=function(t){var e=this;return function(i){var n=t.indexOf(i.origin)>-1,s="arcgis:auth:requestCredential"===i.data.type,r=e.tokenExpires.getTime()>Date.now();if(n&&s){var o={};if(r){var a=e.toCredential();a.server=a.server.replace("/sharing/rest",""),o={type:"arcgis:auth:credential",credential:a}}else o={type:"arcgis:auth:error",error:{name:"tokenExpiredError",message:"Session token was expired, and not returned to the child application"}};i.source.postMessage(o,i.origin)}}},t.prototype.getTokenForServer=function(t,e){var i=this,n=this.getServerRootUrl(t),s=this.federatedServers[n];return s&&s.expires&&s.expires.getTime()>Date.now()?Promise.resolve(s.token):(this._pendingTokenRequests[n]||(this._pendingTokenRequests[n]=this.fetchAuthorizedDomains().then((function(){return c(n+"/rest/info",{credentials:i.getDomainCredentials(t)}).then((function(s){if(s.owningSystemUrl){if(r=s.owningSystemUrl,o=l(function(t){if(!g.test(t))return t;switch(b(t)){case"dev":return"https://devext.arcgis.com/sharing/rest";case"qa":return"https://qaext.arcgis.com/sharing/rest";default:return"https://www.arcgis.com/sharing/rest"}}(i.portal)).replace(/https?:\/\//,""),a=l(r).replace(/https?:\/\//,""),new RegExp(a,"i").test(o))return c(s.owningSystemUrl+"/sharing/rest/info",e);throw new d(t+" is not federated with "+i.portal+".","NOT_FEDERATED")}var r,o,a;if(s.authInfo&&void 0!==i.federatedServers[n])return Promise.resolve({authInfo:s.authInfo});throw new d(t+" is not federated with any portal and is not explicitly trusted.","NOT_FEDERATED")})).then((function(t){return t.authInfo.tokenServicesUrl})).then((function(e){return i.token&&i.tokenExpires.getTime()>Date.now()?m(e,{params:{token:i.token,serverUrl:t,expiration:i.tokenDuration,client:"referer"}}):m(e,{params:{username:i.username,password:i.password,expiration:i.tokenDuration,client:"referer"}}).then((function(t){return i._token=t.token,i._tokenExpires=new Date(t.expires),t}))})).then((function(t){return i.federatedServers[n]={expires:new Date(t.expires),token:t.token},delete i._pendingTokenRequests[n],t.token}))}))),this._pendingTokenRequests[n])},t.prototype.getFreshToken=function(t){var e=this;return this.token&&!this.tokenExpires||this.token&&this.tokenExpires&&this.tokenExpires.getTime()>Date.now()?Promise.resolve(this.token):(this._pendingTokenRequests[this.portal]||(this._pendingTokenRequests[this.portal]=this.refreshSession(t).then((function(t){return e._pendingTokenRequests[e.portal]=null,t.token}))),this._pendingTokenRequests[this.portal])},t.prototype.refreshWithUsernameAndPassword=function(t){var e=this,i=p({params:{username:this.username,password:this.password,expiration:this.tokenDuration}},t);return m(this.portal+"/generateToken",i).then((function(t){return e._token=t.token,e._tokenExpires=new Date(t.expires),e}))},t.prototype.refreshWithRefreshToken=function(t){var e=this;if(this.refreshToken&&this.refreshTokenExpires&&this.refreshTokenExpires.getTime()<Date.now())return this.refreshRefreshToken(t);var i=p({params:{client_id:this.clientId,refresh_token:this.refreshToken,grant_type:"refresh_token"}},t);return w(this.portal+"/oauth2/token",i).then((function(t){return e._token=t.token,e._tokenExpires=t.expires,e}))},t.prototype.refreshRefreshToken=function(t){var e=this,i=p({params:{client_id:this.clientId,refresh_token:this.refreshToken,redirect_uri:this.redirectUri,grant_type:"exchange_refresh_token"}},t);return w(this.portal+"/oauth2/token",i).then((function(t){return e._token=t.token,e._tokenExpires=t.expires,e._refreshToken=t.refreshToken,e._refreshTokenExpires=new Date(Date.now()+60*(e.refreshTokenTTL-1)*1e3),e}))},t.prototype.fetchAuthorizedDomains=function(){var t=this;return this.server||!this.portal?Promise.resolve(this):this.getPortal().then((function(e){return e.authorizedCrossOriginDomains&&e.authorizedCrossOriginDomains.length&&(t.trustedDomains=e.authorizedCrossOriginDomains.filter((function(t){return!t.startsWith("http://")})).map((function(t){return t.startsWith("https://")?t:"https://"+t}))),t}))},t}();const y=class{get el(){return t(this)}async serializedAuthenticationWatchHandler(){this.authentication=this.serializedAuthentication?k.deserialize(this.serializedAuthentication):new k({})}async valueWatchHandler(){await this._loadSolution(this.solutionItemId)}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}constructor(t){e(this,t),this.authentication=new k({}),this.locale=void 0,this.serializedAuthentication="",this.solutionItemId="",this.showLoading=!1,this._currentEditItemId="",this._organizationVariables="",this._solutionContentsComponent=void 0,this._solutionIsLoaded=!1,this._solutionVariables="",this._templateHierarchy=[],this._translations=void 0,this._treeOpen=!0,this.serializedAuthentication&&(this.authentication=k.deserialize(this.serializedAuthentication)),this._loadSolution(this.solutionItemId),window.addEventListener("solutionStoreHasChanges",(t=>{this._updateSaveability(this._solutionStoreHasChanges=t.detail,this._solutionEditorHasChanges,this._solutionEditorHasErrors)})),window.addEventListener("solutionEditorHasChanges",(t=>{this._updateSaveability(this._solutionStoreHasChanges,this._solutionEditorHasChanges=t.detail,this._solutionEditorHasErrors)})),window.addEventListener("solutionEditorHasErrors",(t=>{this._updateSaveability(this._solutionStoreHasChanges,this._solutionEditorHasChanges,this._solutionEditorHasErrors=t.detail)}))}async componentWillLoad(){return this._getTranslations()}render(){const t=a.getStoreInfo("spatialReferenceInfo"),e=a.getStoreInfo("featureServices").length>0,o=a.getStoreInfo("solutionData");return this._solutionVariables=JSON.stringify(s(o.templates,this._translations)),this._organizationVariables=JSON.stringify(r(this._translations)),i(n,{key:"dd68b412fe4fbf053491eb1a7ec6a3c1703ceb17"},this._solutionIsLoaded?null:i("calcite-loader",{label:""}),i("div",{key:"b36eee569f4ca90453f0c3eca215576f8e98b95a",class:"configuration-container"},i("div",{key:"653f75751fc960cce09cbb653504600dbe6f01c7",class:"configuration"},i("calcite-tabs",{key:"de3dd520000f03cada90e7bb7964583e62adf229",class:"config-tabs"},i("calcite-tab-nav",{key:"846d714f94a2476314f7843682483e4cda407a7c",slot:"tab-nav"},i("calcite-tab-title",{key:"7146aced1bd7dd4928e2bd6c49d52ef3003aabc1"},this._translations.definitionTab),e?i("calcite-tab-title",null,this._translations.spatialReferenceTab):null),i("calcite-tab",{key:"5b8672dd8089a21a49139c2bedc4a9ab91d2b2e2",class:"config-tab",selected:!0},i("div",{key:"1bf9bf03f6418212807afc5657e807faa45557d6",class:"config-solution"},i("div",{key:"718a6a90a39844562d547e4e08abc4b133945a68",class:this._treeOpen?"config-inventory":"config-inventory-hide"},i("solution-contents",{id:"configInventory",key:`${this.solutionItemId}-contents`,ref:t=>this._solutionContentsComponent=t})),i("calcite-button",{key:"25039c4b3c3e97d587fd3d3aec4791f53875d9bf",appearance:"transparent",class:"collapse-btn","icon-start":this._treeOpen?"chevrons-left":"chevrons-right",id:"collapse-vars",onClick:()=>this._toggleTree(),scale:"s",title:this._treeOpen?this._translations.collapse:this._translations.expand}),i("div",{key:"5970c8ed59c6cb9fa02c574c3c1a3949940dfec6",class:"config-item"},i("solution-item",{authentication:this.authentication,"item-id":this._currentEditItemId,key:`${this.solutionItemId}-item`,locale:this.locale,"organization-variables":this._organizationVariables,"solution-item-id":this.solutionItemId,"solution-variables":this._solutionVariables})))),e?i("calcite-tab",{class:"config-tab"},i("div",{class:"config-solution"},i("solution-spatial-ref",{enableDefault:!!t.default,enabled:t?.enabled,featureServices:a.getStoreInfo("featureServices").map((t=>t.name)),id:"configure-solution-spatial-ref",key:`${this.solutionItemId}-spatial-ref`,locale:this.locale}))):null))))}_solutionStoreHasChanges=!1;_solutionEditorHasChanges=!1;_solutionEditorHasErrors=!1;_canSave=!1;_solutionItemSelected(t){this._currentEditItemId=t.detail}async getSpatialReferenceInfo(){return Promise.resolve(a.getStoreInfo("spatialReferenceInfo"))}async saveSolution(){this._solutionIsLoaded=!1,await a.saveSolution(),this._solutionIsLoaded=!0,this.solutionItemId=null}async unloadSolution(){this.solutionItemId=null}_initProps(){const t=a.getStoreInfo("solutionData");let e;this._templateHierarchy=[...o(t.templates)],this._solutionContentsComponent&&(this._solutionContentsComponent.templateHierarchy=this._templateHierarchy),this._templateHierarchy.length>0&&(e=a.getItemInfo(this._templateHierarchy[0].id)),this._currentEditItemId=e?e.itemId:""}async _loadSolution(t){return t?(this._solutionIsLoaded=!1,await a.loadSolution(t,this.authentication),this._initProps(),this._solutionIsLoaded=!0):this._reset(),Promise.resolve()}_reset(){this._currentEditItemId="",this._organizationVariables="",this._solutionVariables="",this._templateHierarchy=[]}_toggleTree(){this._treeOpen=!this._treeOpen}_updateSaveability(t,e,i){const n=(t||e)&&!i;this._canSave!==n&&window.dispatchEvent(new CustomEvent("solutionCanSave",{detail:n,bubbles:!0,cancelable:!1,composed:!0})),this._canSave=n}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}static get watchers(){return{serializedAuthentication:["serializedAuthenticationWatchHandler"],solutionItemId:["valueWatchHandler"],locale:["localeWatchHandler"]}}};y.style=".configuration-container{position:relative;height:100%;width:100%}.configuration{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:flex;padding:0.5rem;border:1px #808080 solid}.config-tabs{width:100%}.config-tab{width:100%}.config-solution{position:absolute;top:3.5rem;right:-1px;bottom:-1px;left:-1px;display:flex;padding:0.5rem}.config-inventory{display:inline;max-width:-moz-min-content;max-width:min-content;flex-grow:0;overflow-y:auto}.config-inventory-hide{display:none;max-width:-moz-min-content;max-width:min-content;flex-grow:0;overflow-y:auto}.config-item{position:relative;display:inline;flex-grow:1;overflow-y:auto;margin-inline-start:0.5rem}solution-contents{position:relative;height:100%}solution-item{position:relative;height:100%}solution-spatial-ref{position:relative;height:100%;width:100%;overflow-y:auto}";export{y as solution_configuration}
21
+ var p=function(){return p=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},p.apply(this,arguments)};function w(t,e){var i=e;return i.rawResponse=!1,c(t,i).then((function(t){var e={token:t.access_token,username:t.username,expires:new Date(Date.now()+(1e3*t.expires_in-1e3)),ssl:!0===t.ssl};return t.refresh_token&&(e.refreshToken=t.refresh_token),e}))}function m(t,e){var i=e;return i.params.referer="undefined"!=typeof window&&window.location&&window.location.host?window.location.host:u,c(t,i)}var g=/^https?:\/\/(\S+)\.arcgis\.com.+/;function v(t){return g.test(t)}function b(t){if(!g.test(t))return null;var e=t.match(g)[1].split(".").pop();return e.includes("dev")?"dev":e.includes("qa")?"qa":"production"}var k=function(){function t(t){if(this.clientId=t.clientId,this._refreshToken=t.refreshToken,this._refreshTokenExpires=t.refreshTokenExpires,this.username=t.username,this.password=t.password,this._token=t.token,this._tokenExpires=t.tokenExpires,this.portal=t.portal?l(t.portal):"https://www.arcgis.com/sharing/rest",this.ssl=t.ssl,this.provider=t.provider||"arcgis",this.tokenDuration=t.tokenDuration||20160,this.redirectUri=t.redirectUri,this.refreshTokenTTL=t.refreshTokenTTL||20160,this.server=t.server,this.federatedServers={},this.trustedDomains=[],t.server){var e=this.getServerRootUrl(t.server);this.federatedServers[e]={token:t.token,expires:t.tokenExpires}}this._pendingTokenRequests={}}return Object.defineProperty(t.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tokenExpires",{get:function(){return this._tokenExpires},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refreshToken",{get:function(){return this._refreshToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refreshTokenExpires",{get:function(){return this._refreshTokenExpires},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trustedServers",{get:function(){return console.log("DEPRECATED: use federatedServers instead"),this.federatedServers},enumerable:!1,configurable:!0}),t.beginOAuth2=function(e,i){void 0===i&&(i=window),e.duration&&console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");var n,s=p({portal:"https://www.arcgis.com/sharing/rest",provider:"arcgis",expiration:20160,popup:!0,popupWindowFeatures:"height=400,width=600,menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes",state:e.clientId,locale:""},e),r=s.portal,o=s.provider,a=s.clientId,h=s.expiration,c=s.redirectUri,u=s.popup,l=s.popupWindowFeatures,w=s.state,m=s.locale,g=s.params;if(n="arcgis"===o?r+"/oauth2/authorize?client_id="+a+"&response_type=token&expiration="+(e.duration||h)+"&redirect_uri="+encodeURIComponent(c)+"&state="+w+"&locale="+m:r+"/oauth2/social/authorize?client_id="+a+"&socialLoginProviderName="+o+"&autoAccountCreateForSocial=true&response_type=token&expiration="+(e.duration||h)+"&redirect_uri="+encodeURIComponent(c)+"&state="+w+"&locale="+m,g&&(n=n+"&"+f(g)),u){var v,b=((v={promise:null,resolve:null,reject:null}).promise=new Promise((function(t,e){v.resolve=t,v.reject=e})),v);return i["__ESRI_REST_AUTH_HANDLER_"+a]=function(e,i){if(e){var n=JSON.parse(e);b.reject(new d(n.errorMessage,n.error))}else if(i){var s=JSON.parse(i);b.resolve(new t({clientId:a,portal:r,ssl:s.ssl,token:s.token,tokenExpires:new Date(s.expires),username:s.username}))}},i.open(n,"oauth-window",l),b.promise}i.location.href=n},t.completeOAuth2=function(e,i){void 0===i&&(i=window);var n=p({portal:"https://www.arcgis.com/sharing/rest",popup:!0},e),s=n.portal,r=n.clientId,o=n.popup;function a(e,n){try{var a=void 0,h="__ESRI_REST_AUTH_HANDLER_"+r;if(o&&(i.opener?i.opener.parent&&i.opener.parent[h]?a=i.opener.parent[h]:i.opener&&i.opener[h]&&(a=i.opener[h]):i!==i.parent&&i.parent&&i.parent[h]&&(a=i.parent[h]),a))return a(e?JSON.stringify(e):void 0,JSON.stringify(n)),void i.close()}catch(t){throw new d('Unable to complete authentication. It\'s possible you specified popup based oAuth2 but no handler from "beginOAuth2()" present. This generally happens because the "popup" option differs between "beginOAuth2()" and "completeOAuth2()".')}if(e)throw new d(e.errorMessage,e.error);return new t({clientId:r,portal:s,ssl:n.ssl,token:n.token,tokenExpires:n.expires,username:n.username})}var h=i.location.hash.replace(/^#/,"").split("&").reduce((function(t,e){var i=function(t){var e=t.split("="),i=e[1];return{key:decodeURIComponent(e[0]),value:decodeURIComponent(i)}}(e);return t[i.key]=i.value,t}),{});if(!h.access_token){var c=void 0,u="Unknown error";return h.error&&(c=h.error,u=h.error_description),a({error:c,errorMessage:u})}return a(void 0,{token:h.access_token,expires:new Date(Date.now()+1e3*parseInt(h.expires_in,10)-6e4),ssl:"true"===h.ssl,username:h.username})},t.fromParent=function(e,i){var n;return!i&&window&&(i=window),new Promise((function(s,r){i.addEventListener("message",n=function(e){if(e.source===i.parent&&e.data)try{return s(t.parentMessageHandler(e))}catch(t){return r(t)}},!1),i.parent.postMessage({type:"arcgis:auth:requestCredential"},e)})).then((function(t){return i.removeEventListener("message",n,!1),t}))},t.authorize=function(t,e){t.duration&&console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");var i=p({portal:"https://arcgis.com/sharing/rest",expiration:20160},t);e.writeHead(301,{Location:i.portal+"/oauth2/authorize?client_id="+i.clientId+"&expiration="+(t.duration||i.expiration)+"&response_type=code&redirect_uri="+encodeURIComponent(i.redirectUri)}),e.end()},t.exchangeAuthorizationCode=function(e,i){var n=p({portal:"https://www.arcgis.com/sharing/rest",refreshTokenTTL:20160},e),s=n.portal,r=n.clientId,o=n.redirectUri,a=n.refreshTokenTTL;return w(s+"/oauth2/token",{params:{grant_type:"authorization_code",client_id:r,redirect_uri:o,code:i}}).then((function(e){return new t({clientId:r,portal:s,ssl:e.ssl,redirectUri:o,refreshToken:e.refreshToken,refreshTokenTTL:a,refreshTokenExpires:new Date(Date.now()+60*(a-1)*1e3),token:e.token,tokenExpires:e.expires,username:e.username})}))},t.deserialize=function(e){var i=JSON.parse(e);return new t({clientId:i.clientId,refreshToken:i.refreshToken,refreshTokenExpires:new Date(i.refreshTokenExpires),username:i.username,password:i.password,token:i.token,tokenExpires:new Date(i.tokenExpires),portal:i.portal,ssl:i.ssl,tokenDuration:i.tokenDuration,redirectUri:i.redirectUri,refreshTokenTTL:i.refreshTokenTTL})},t.fromCredential=function(e){var i=void 0===e.ssl||e.ssl,n=e.expires||Date.now()+72e5;return new t({portal:e.server.includes("sharing/rest")?e.server:e.server+"/sharing/rest",ssl:i,token:e.token,username:e.userId,tokenExpires:new Date(n)})},t.parentMessageHandler=function(e){if("arcgis:auth:credential"===e.data.type)return t.fromCredential(e.data.credential);if("arcgis:auth:error"===e.data.type){var i=new Error(e.data.error.message);throw i.name=e.data.error.name,i}throw new Error("Unknown message type.")},t.prototype.toCredential=function(){return{expires:this.tokenExpires.getTime(),server:this.portal,ssl:this.ssl,token:this.token,userId:this.username}},t.prototype.getUser=function(t){var e=this;if(this._pendingUserRequest)return this._pendingUserRequest;if(this._user)return Promise.resolve(this._user);var i=this.portal+"/community/self",n=p(p({httpMethod:"GET",authentication:this},t),{rawResponse:!1});return this._pendingUserRequest=c(i,n).then((function(t){return e._user=t,e._pendingUserRequest=null,t})),this._pendingUserRequest},t.prototype.getPortal=function(t){var e=this;if(this._pendingPortalRequest)return this._pendingPortalRequest;if(this._portalInfo)return Promise.resolve(this._portalInfo);var i=this.portal+"/portals/self",n=p(p({httpMethod:"GET",authentication:this},t),{rawResponse:!1});return this._pendingPortalRequest=c(i,n).then((function(t){return e._portalInfo=t,e._pendingPortalRequest=null,t})),this._pendingPortalRequest},t.prototype.getUsername=function(){return this.username?Promise.resolve(this.username):this._user?Promise.resolve(this._user.username):this.getUser().then((function(t){return t.username}))},t.prototype.getToken=function(t,e){return n=t,s=v(i=this.portal),r=v(n),o=b(i),a=b(n),s&&r&&o===a||new RegExp(this.portal,"i").test(t)?this.getFreshToken(e):this.getTokenForServer(t,e);var i,n,s,r,o,a},t.prototype.validateAppAccess=function(t){return this.getToken(this.portal).then((function(e){return function(t,e,i){return void 0===i&&(i="https://www.arcgis.com/sharing/rest"),c(i+"/oauth2/validateAppAccess",{method:"POST",params:{f:"json",client_id:e,token:t}})}(e,t)}))},t.prototype.toJSON=function(){return{clientId:this.clientId,refreshToken:this.refreshToken,refreshTokenExpires:this.refreshTokenExpires,username:this.username,password:this.password,token:this.token,tokenExpires:this.tokenExpires,portal:this.portal,ssl:this.ssl,tokenDuration:this.tokenDuration,redirectUri:this.redirectUri,refreshTokenTTL:this.refreshTokenTTL}},t.prototype.serialize=function(){return JSON.stringify(this)},t.prototype.enablePostMessageAuth=function(t,e){!e&&window&&(e=window),this._hostHandler=this.createPostMessageHandler(t),e.addEventListener("message",this._hostHandler,!1)},t.prototype.disablePostMessageAuth=function(t){!t&&window&&(t=window),t.removeEventListener("message",this._hostHandler,!1)},t.prototype.refreshSession=function(t){return this._user=null,this.username&&this.password?this.refreshWithUsernameAndPassword(t):this.clientId&&this.refreshToken?this.refreshWithRefreshToken():Promise.reject(new d("Unable to refresh token."))},t.prototype.getServerRootUrl=function(t){var e=l(t).split(/\/rest(\/admin)?\/services(?:\/|#|\?|$)/)[0].match(/(https?:\/\/)(.+)/),i=e[1],n=e[2].split("/"),s=n[0],r=n.slice(1);return""+i+s.toLowerCase()+"/"+r.join("/")},t.prototype.getDomainCredentials=function(t){return this.trustedDomains&&this.trustedDomains.length&&this.trustedDomains.some((function(e){return t.startsWith(e)}))?"include":"same-origin"},t.prototype.createPostMessageHandler=function(t){var e=this;return function(i){var n=t.indexOf(i.origin)>-1,s="arcgis:auth:requestCredential"===i.data.type,r=e.tokenExpires.getTime()>Date.now();if(n&&s){var o={};if(r){var a=e.toCredential();a.server=a.server.replace("/sharing/rest",""),o={type:"arcgis:auth:credential",credential:a}}else o={type:"arcgis:auth:error",error:{name:"tokenExpiredError",message:"Session token was expired, and not returned to the child application"}};i.source.postMessage(o,i.origin)}}},t.prototype.getTokenForServer=function(t,e){var i=this,n=this.getServerRootUrl(t),s=this.federatedServers[n];return s&&s.expires&&s.expires.getTime()>Date.now()?Promise.resolve(s.token):(this._pendingTokenRequests[n]||(this._pendingTokenRequests[n]=this.fetchAuthorizedDomains().then((function(){return c(n+"/rest/info",{credentials:i.getDomainCredentials(t)}).then((function(s){if(s.owningSystemUrl){if(r=s.owningSystemUrl,o=l(function(t){if(!g.test(t))return t;switch(b(t)){case"dev":return"https://devext.arcgis.com/sharing/rest";case"qa":return"https://qaext.arcgis.com/sharing/rest";default:return"https://www.arcgis.com/sharing/rest"}}(i.portal)).replace(/https?:\/\//,""),a=l(r).replace(/https?:\/\//,""),new RegExp(a,"i").test(o))return c(s.owningSystemUrl+"/sharing/rest/info",e);throw new d(t+" is not federated with "+i.portal+".","NOT_FEDERATED")}var r,o,a;if(s.authInfo&&void 0!==i.federatedServers[n])return Promise.resolve({authInfo:s.authInfo});throw new d(t+" is not federated with any portal and is not explicitly trusted.","NOT_FEDERATED")})).then((function(t){return t.authInfo.tokenServicesUrl})).then((function(e){return i.token&&i.tokenExpires.getTime()>Date.now()?m(e,{params:{token:i.token,serverUrl:t,expiration:i.tokenDuration,client:"referer"}}):m(e,{params:{username:i.username,password:i.password,expiration:i.tokenDuration,client:"referer"}}).then((function(t){return i._token=t.token,i._tokenExpires=new Date(t.expires),t}))})).then((function(t){return i.federatedServers[n]={expires:new Date(t.expires),token:t.token},delete i._pendingTokenRequests[n],t.token}))}))),this._pendingTokenRequests[n])},t.prototype.getFreshToken=function(t){var e=this;return this.token&&!this.tokenExpires||this.token&&this.tokenExpires&&this.tokenExpires.getTime()>Date.now()?Promise.resolve(this.token):(this._pendingTokenRequests[this.portal]||(this._pendingTokenRequests[this.portal]=this.refreshSession(t).then((function(t){return e._pendingTokenRequests[e.portal]=null,t.token}))),this._pendingTokenRequests[this.portal])},t.prototype.refreshWithUsernameAndPassword=function(t){var e=this,i=p({params:{username:this.username,password:this.password,expiration:this.tokenDuration}},t);return m(this.portal+"/generateToken",i).then((function(t){return e._token=t.token,e._tokenExpires=new Date(t.expires),e}))},t.prototype.refreshWithRefreshToken=function(t){var e=this;if(this.refreshToken&&this.refreshTokenExpires&&this.refreshTokenExpires.getTime()<Date.now())return this.refreshRefreshToken(t);var i=p({params:{client_id:this.clientId,refresh_token:this.refreshToken,grant_type:"refresh_token"}},t);return w(this.portal+"/oauth2/token",i).then((function(t){return e._token=t.token,e._tokenExpires=t.expires,e}))},t.prototype.refreshRefreshToken=function(t){var e=this,i=p({params:{client_id:this.clientId,refresh_token:this.refreshToken,redirect_uri:this.redirectUri,grant_type:"exchange_refresh_token"}},t);return w(this.portal+"/oauth2/token",i).then((function(t){return e._token=t.token,e._tokenExpires=t.expires,e._refreshToken=t.refreshToken,e._refreshTokenExpires=new Date(Date.now()+60*(e.refreshTokenTTL-1)*1e3),e}))},t.prototype.fetchAuthorizedDomains=function(){var t=this;return this.server||!this.portal?Promise.resolve(this):this.getPortal().then((function(e){return e.authorizedCrossOriginDomains&&e.authorizedCrossOriginDomains.length&&(t.trustedDomains=e.authorizedCrossOriginDomains.filter((function(t){return!t.startsWith("http://")})).map((function(t){return t.startsWith("https://")?t:"https://"+t}))),t}))},t}();const y=class{get el(){return t(this)}async serializedAuthenticationWatchHandler(){this.authentication=this.serializedAuthentication?k.deserialize(this.serializedAuthentication):new k({})}async valueWatchHandler(){await this._loadSolution(this.solutionItemId)}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}constructor(t){e(this,t),this.authentication=new k({}),this.locale=void 0,this.serializedAuthentication="",this.solutionItemId="",this.showLoading=!1,this._currentEditItemId="",this._organizationVariables="",this._solutionContentsComponent=void 0,this._solutionIsLoaded=!1,this._solutionVariables="",this._templateHierarchy=[],this._translations=void 0,this._treeOpen=!0,this.serializedAuthentication&&(this.authentication=k.deserialize(this.serializedAuthentication)),this._loadSolution(this.solutionItemId),window.addEventListener("solutionStoreHasChanges",(t=>{this._updateSaveability(this._solutionStoreHasChanges=t.detail,this._solutionEditorHasChanges,this._solutionEditorHasErrors)})),window.addEventListener("solutionEditorHasChanges",(t=>{this._updateSaveability(this._solutionStoreHasChanges,this._solutionEditorHasChanges=t.detail,this._solutionEditorHasErrors)})),window.addEventListener("solutionEditorHasErrors",(t=>{this._updateSaveability(this._solutionStoreHasChanges,this._solutionEditorHasChanges,this._solutionEditorHasErrors=t.detail)}))}async componentWillLoad(){return this._getTranslations()}render(){const t=a.getStoreInfo("spatialReferenceInfo"),e=a.getStoreInfo("featureServices").length>0,o=a.getStoreInfo("solutionData");return this._solutionVariables=JSON.stringify(s(o.templates,this._translations)),this._organizationVariables=JSON.stringify(r(this._translations)),i(n,{key:"c3119f5d0485eacbbd1380db442ef9c28f772dec"},this._solutionIsLoaded?null:i("calcite-loader",{label:""}),i("div",{key:"f363b65e521bde0dff7290ec7345b95cd61a6d75",class:"configuration-container"},i("div",{key:"bcc9dac3ec183cb36da61bca5c1718395ff76efd",class:"configuration"},i("calcite-tabs",{key:"76d8e022c66e2d9157ecd44d26d080f5bfbfee4e",class:"config-tabs"},i("calcite-tab-nav",{key:"1b40a68e10b69189496325bfea5116655d715c97",slot:"tab-nav"},i("calcite-tab-title",{key:"2c729b8fe2a3fd3a0ac0964d2b825e9fc113f51f"},this._translations.definitionTab),e?i("calcite-tab-title",null,this._translations.spatialReferenceTab):null),i("calcite-tab",{key:"99c4e95166fa304a16efac7261888bbbc970b66a",class:"config-tab",selected:!0},i("div",{key:"ec17e4d65348b3e6d496f7a7564f6a771b0d051b",class:"config-solution"},i("div",{key:"2f2e72b5fd3a9137e9c6edae9d2a4f2a1b12f826",class:this._treeOpen?"config-inventory":"config-inventory-hide"},i("solution-contents",{id:"configInventory",key:`${this.solutionItemId}-contents`,ref:t=>this._solutionContentsComponent=t})),i("calcite-button",{key:"696f310d8a8e1c1cb37b738f0a5a6f38003aef39",appearance:"transparent",class:"collapse-btn","icon-start":this._treeOpen?"chevrons-left":"chevrons-right",id:"collapse-vars",onClick:()=>this._toggleTree(),scale:"s",title:this._treeOpen?this._translations.collapse:this._translations.expand}),i("div",{key:"e6d9a56d72753ce4d625b547adbe8991a8697f54",class:"config-item"},i("solution-item",{authentication:this.authentication,"item-id":this._currentEditItemId,key:`${this.solutionItemId}-item`,locale:this.locale,"organization-variables":this._organizationVariables,"solution-item-id":this.solutionItemId,"solution-variables":this._solutionVariables})))),e?i("calcite-tab",{class:"config-tab"},i("div",{class:"config-solution"},i("solution-spatial-ref",{enableDefault:!!t.default,enabled:t?.enabled,featureServices:a.getStoreInfo("featureServices").map((t=>t.name)),id:"configure-solution-spatial-ref",key:`${this.solutionItemId}-spatial-ref`,locale:this.locale}))):null))))}_solutionStoreHasChanges=!1;_solutionEditorHasChanges=!1;_solutionEditorHasErrors=!1;_canSave=!1;_solutionItemSelected(t){this._currentEditItemId=t.detail}async getSpatialReferenceInfo(){return Promise.resolve(a.getStoreInfo("spatialReferenceInfo"))}async saveSolution(){this._solutionIsLoaded=!1,await a.saveSolution(),this._solutionIsLoaded=!0,this.solutionItemId=null}async unloadSolution(){this.solutionItemId=null}_initProps(){const t=a.getStoreInfo("solutionData");let e;this._templateHierarchy=[...o(t.templates)],this._solutionContentsComponent&&(this._solutionContentsComponent.templateHierarchy=this._templateHierarchy),this._templateHierarchy.length>0&&(e=a.getItemInfo(this._templateHierarchy[0].id)),this._currentEditItemId=e?e.itemId:""}async _loadSolution(t){return t?(this._solutionIsLoaded=!1,await a.loadSolution(t,this.authentication),this._initProps(),this._solutionIsLoaded=!0):this._reset(),Promise.resolve()}_reset(){this._currentEditItemId="",this._organizationVariables="",this._solutionVariables="",this._templateHierarchy=[]}_toggleTree(){this._treeOpen=!this._treeOpen}_updateSaveability(t,e,i){const n=(t||e)&&!i;this._canSave!==n&&window.dispatchEvent(new CustomEvent("solutionCanSave",{detail:n,bubbles:!0,cancelable:!1,composed:!0})),this._canSave=n}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}static get watchers(){return{serializedAuthentication:["serializedAuthenticationWatchHandler"],solutionItemId:["valueWatchHandler"],locale:["localeWatchHandler"]}}};y.style=".configuration-container{position:relative;height:100%;width:100%}.configuration{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:flex;padding:0.5rem;border:1px #808080 solid}.config-tabs{width:100%}.config-tab{width:100%}.config-solution{position:absolute;top:3.5rem;right:-1px;bottom:-1px;left:-1px;display:flex;padding:0.5rem}.config-inventory{display:inline;max-width:-moz-min-content;max-width:min-content;flex-grow:0;overflow-y:auto}.config-inventory-hide{display:none;max-width:-moz-min-content;max-width:min-content;flex-grow:0;overflow-y:auto}.config-item{position:relative;display:inline;flex-grow:1;overflow-y:auto;margin-inline-start:0.5rem}solution-contents{position:relative;height:100%}solution-item{position:relative;height:100%}solution-spatial-ref{position:relative;height:100%;width:100%;overflow-y:auto}";export{y as solution_configuration}
@@ -0,0 +1,6 @@
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-e996c38f.js";import{l,g as o}from"./p-404cbf48.js";import{g as n,a as c,b as r,c as d,h as u,d as p,q as f}from"./p-dcd2f00b.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.enableSnapping=!1,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.submitNewReportsMessage=void 0,this.theme="light",this.zoomToScale=void 0,this.floorLevel=void 0,this.showFullCommentTitle=!0,this.filterByMapExtent=!1,this.sortOption="newest",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="newest",this._commentSubmitted=!1,this._addingCommentFailed=!1,this._filterOpen=!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;_t9nLayerExpressions;async isMobileWatchHandler(t){this.updatePanelState(!1,this._showFullPanel),t&&"filter-panel"===this._flowItems[this._flowItems.length-1]?(await this.backFromFilterPanel(),this._filterOpen=!0):!t&&this._filterOpen&&(await this._closeFilter(),this._flowItems=[...this._flowItems,"filter-panel"])}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 n(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(),this.refreshLists())}filterByMapExtentChangeWatchHandler(){this.refreshLists()}async layerExpressionsWatchHandler(){this.resetFilterList(),await this.handleSelectedLayersFilter(),await(this._featureList?.refresh())}async showFeatureSymbolWatchHandler(){await(this._featureList?.refresh())}async updateLayerExpressionsT9n(t){if(this._t9nLayerExpressions=t||this.layerExpressions,null!=this._filterList)await this._filterList.handleUpdatingT9nData(this._t9nLayerExpressions);else if(null!=this._currentLayerExpressions){const t=structuredClone(this._currentLayerExpressions);this.handleLayerExpressionsT9n(t,this._t9nLayerExpressions),this._currentLayerExpressions=t}return Promise.resolve()}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._filterOpen)&&this._filterList?.updateInitDefExpressions({initDefExpressions:this._initDefExpressions})}render(){const t="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return e(a,{key:"b262a653d9af3a8f332f416af7f297cc15ac3355"},this._reportSubmitted&&e("calcite-alert",{key:"efe33e5ec3ed708d21f8464aa70eb7ce9a258035","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:"6c6a35bc84da9a13241313dd15dc4a5905f59866",slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&e("calcite-alert",{key:"21d8064c4bf5c0dd118cd012d9d30d2998011a00","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},e("div",{key:"93e68814f1f3cf62d9ed4d6673aec8124cfa0a4f",slot:"title"},this._translations.error),e("div",{key:"156cd9169dbcbeafa605620938ba9aeccd0f9401",slot:"message"},this._featureCreationFailedErrorMsg)),this._commentSubmitted&&e("calcite-alert",{key:"2cb152fe6734f80f6d9714c3597aaf064ffffd57","auto-close":!0,class:"report-submitted "+t,icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._commentSubmitted=!1},open:!0,placement:"top"},e("div",{key:"33369e8086740651ef26bfc765448fb6bded03fe",slot:"message"},this.commentSubmittedMessage||this._translations.commentSubmittedMsg)),this._addingCommentFailed&&e("calcite-alert",{key:"5b4fbac03c85e82e2bb11611772186140d0419e9","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._addingCommentFailed=!1},open:!0,placement:"top"},e("div",{key:"31bd9f781304d1493dcbbee5914369742c8c0e03",slot:"title"},this._translations.error),e("div",{key:"7844073654d79069fe7e54c72ec7bc85a1e77436",slot:"message"},this._translations.addingCommentFailedMsg)),e("div",{key:"17eca819f0141e4945deb8013aa662d5b3c27626"},e("calcite-shell",{key:"c07f28fa3733f6be3a22d813a267e77a05038f3e","content-behind":!0},this._getReporter())),this.isMobile&&this.filterModal())}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 n(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"}))}filterModal(){return(this.layerExpressions?this.layerExpressions.filter((t=>t.id===this._selectedLayerId)):[]).length>0&&e("calcite-modal",{"aria-labelledby":"modal-title",class:"modal",kind:"brand",onCalciteModalClose:()=>{this._closeFilter()},open:this._filterOpen,widthScale:"s"},e("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations?.filterLayerTitle?.replace("{{title}}",this._selectedLayerName)),e("div",{slot:"content"},e("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtn:!0,closeBtnOnClick:()=>{this._closeFilter()},comboboxOverlayPositioning:"fixed",layerExpressions:this._currentLayerExpressions,onFilterListReset:()=>{this._filterActive=!1,this._featureList.refresh()},onFilterUpdate:()=>this._handleFilterUpdate(this._filterList?.filterCount>0),ref:t=>this._filterList=t,resetBtn:!0,resetFiltersOnDisconnect:!1,view:this.mapView,zoomBtn:!1})))}_toggleFilter(){this._filterOpen=!this._filterOpen}async _closeFilter(){this._filterOpen=!1,null!=this._filterList&&(this._currentLayerExpressions=await this._filterList.getCurrentLayerExpressions())}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",{label:"","selection-mode":"single-persist"},e("calcite-list-item",{label:this._translations.sortNewest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"desc","newest")},selected:"newest"===this._updatedSortOption,value:"newest"}),e("calcite-list-item",{label:this._translations.sortOldest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"asc","oldest")},selected:"oldest"===this._updatedSortOption,value:"oldest"}),t&&e(h,null,e("calcite-list-item",{label:this._translations.sortHighestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"desc","highestVoted")},selected:"highestVoted"===this._updatedSortOption,value:"highestVoted"}),e("calcite-list-item",{label:this._translations.sortLowestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"asc","lowestVoted")},selected:"lowestVoted"===this._updatedSortOption,value:"lowestVoted"}))))}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,selected:"layer-list"===this._flowItems[this._flowItems.length-1]},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",filterByMapExtent:this.filterByMapExtent,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),selected:"reporting-layer-list"===this._flowItems[this._flowItems.length-1]},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),selected:"feature-create"===this._flowItems[this._flowItems.length-1]},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,enableSnapping:this.enableSnapping,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,submitNewReportsMessage:this.submitNewReportsMessage})))}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){if(this._layerList&&"layer-list"===this._flowItems[this._flowItems.length-1]||"feature-list"===this._flowItems[0]){const i=t.detail,s=await c(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){await this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this.updateSortingOptions(),this.handleSelectedLayersFilter(),this._flowItems=[...this._flowItems,"feature-list"],this._prevSelectedLayerId=this._selectedLayerId}updateSortingOptions(){const t=""===this.sortOption?"newest":this.sortOption,i="oldest"===t||"lowestVoted"===t?"asc":"desc",s=this.reportingOptions?.[this._selectedLayerId]?.like?this.reportingOptions?.[this._selectedLayerId]?.likeField:"";this._updatedSorting={field:"newest"===t||"oldest"===t?this._selectedLayer.objectIdField:s,order:i},this._updatedSortOption=s||"highestVoted"!==t&&"lowestVoted"!==t?t:"newest"}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.isMobile&&this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this),selected:"feature-list"===this._flowItems[this._flowItems.length-1]},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.isMobile?this._toggleFilter():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",filterByMapExtent:this.filterByMapExtent,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),selected:"filter-panel"===this._flowItems[this._flowItems.length-1]},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),selected:"feature-details"===this._flowItems[this._flowItems.length-1]},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",enableSnapping:this.enableSnapping,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,showFullCommentTitle:this.showFullCommentTitle,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),selected:"comment-details"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),e("calcite-panel",{"full-height":!0},e("info-card",{allowEditing:!1,enableSnapping:this.enableSnapping,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),selected:"add-comment"===this._flowItems[this._flowItems.length-1]},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,enableSnapping:this.enableSnapping,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}),[])}refreshLists(){setTimeout((()=>{this._layerList&&"layer-list"===this._flowItems[this._flowItems.length-1]&&this._layerList.refresh(),this._featureList&&this._featureList.refresh()}),50)}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 c(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.updateSortingOptions(),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 n(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(){if(this._selectedLayer){const t=this.layerExpressions?structuredClone(this.layerExpressions.filter((t=>t.id===this._selectedLayerId))):[];null!=this._t9nLayerExpressions&&this.handleLayerExpressionsT9n(t,this._t9nLayerExpressions),this._currentLayerExpressions=t,this.setActiveDefinitionExpressions()}}async handlePrevLayersFilter(){if(this._prevSelectedLayerId){const t=await n(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)}))}handleLayerExpressionsT9n(t,i){t?.forEach((t=>{const s=i?.find((i=>i.id===t.id));null!=s&&(t.title=s.title,t.expressions?.forEach((t=>{const i=s.expressions?.find((i=>i.id===t.id));null!=i&&(t.name=i.name)})))}))}static get watchers(){return{isMobile:["isMobileWatchHandler"],locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],floorLevel:["floorLevelWatchHandler"],showMyReportsOnly:["showMyReportsOnlyWatchHandler"],filterByMapExtent:["filterByMapExtentChangeWatchHandler"],layerExpressions:["layerExpressionsWatchHandler"],showFeatureSymbol:["showFeatureSymbolWatchHandler"]}}};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}
@@ -3,4 +3,4 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as e,c as t,g as i,h as a,H as s}from"./p-e996c38f.js";import{s as l}from"./p-da1e098c.js";import{g as c}from"./p-404cbf48.js";import{n}from"./p-8850bd21.js";import{C as r,g as o}from"./p-80cb7c73.js";import"./p-8717729a.js";import"./p-4f236b5d.js";import"./p-d4056c1c.js";import"./p-570b13d9.js";import"./p-0668e30d.js";import"./p-0a24ad5f.js";const h=class{constructor(i){e(this,i),this.solutionItemSelected=t(this,"solutionItemSelected",7),this.selectedItemId=void 0,this.templateHierarchy=[]}get el(){return i(this)}valueWatchHandler(e,t){e&&e!==t&&Array.isArray(e)&&e.length>0&&this._treeItemSelected(e[0].id)}componentWillLoad(){this.valueWatchHandler(this.templateHierarchy,[])}render(){return a(s,{key:"cf80f637e998eda76162eb1cf3fe94dfb2aeae3e"},a("calcite-tree",{key:"3bb27819fff1f63b28ed70c360fe8f7a63619d3c"},this.renderHierarchy(this.templateHierarchy)))}renderHierarchy(e){return e.map((e=>{const t=this.selectedItemId&&this.selectedItemId===e.id;return e.dependencies&&e.dependencies.length>0?a("calcite-tree-item",{onClick:t=>this._treeItemSelected(e.id,t),selected:t},a("solution-item-icon",{type:e.type,typeKeywords:e.typeKeywords}),a("span",{class:"icon-text",title:e.title},e.title),a("calcite-tree",{slot:"children"},this.renderHierarchy(e.dependencies))):a("calcite-tree-item",{onClick:t=>this._treeItemSelected(e.id,t),selected:t},a("solution-item-icon",{type:e.type,typeKeywords:e.typeKeywords}),a("span",{class:"icon-text",title:e.title},e.title))}))}solutionItemSelected;_treeItemSelected(e,t){const i=t?.target?.closest("calcite-tree-item");i&&(i.expanded=!i?.expanded),this.selectedItemId=e,this.solutionItemSelected.emit(e)}static get assetsDirs(){return["item-type-icons"]}static get watchers(){return{templateHierarchy:["valueWatchHandler"]}}};h.style=".icon-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";const d=class{constructor(t){e(this,t),this.authentication=void 0,this.itemId="",this.locale=void 0,this.solutionVariables="",this.organizationVariables="",this.itemType=void 0,this._translations=void 0}get el(){return i(this)}itemIdWatchHandler(){const e=l.getItemInfo(this.itemId);this.itemType=e.type}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async componentWillLoad(){return this._getTranslations()}render(){return a(s,{key:"8213c164dbfc2f9d897bcd2dbb732d1029e7bc9a"},a("div",{key:"252091fa803626400a22295d6a9d148d207c84e6",class:"configuration-container"},a("div",{key:"b30bcfd2bec082f8248584749e6d98a2c9331bdf",class:"configuration"},this._showGroupTabs("Group"===this.itemType),this._showItemTabs("Group"!==this.itemType))))}_showGroupTabs(e){return a("calcite-tabs",{class:"config-tabs",style:{display:e?"inherit":"none"}},a("calcite-tab-nav",{slot:"tab-nav"},a("calcite-tab-title",null,this._translations.groupDetailsTab),a("calcite-tab-title",null,this._translations.sharingTab)),a("calcite-tab",{class:"config-tab",id:"group-tab",selected:!0},a("solution-item-details",{"item-id":this.itemId,locale:this.locale})),a("calcite-tab",{class:"config-tab",id:"share-tab"},a("solution-item-sharing",{"group-id":this.itemId,locale:this.locale})))}_showItemTabs(e){return a("calcite-tabs",{class:"config-tabs",style:{display:e?"inherit":"none"}},a("calcite-tab-nav",{slot:"tab-nav"},a("calcite-tab-title",null,this._translations.itemDetailsTab),a("calcite-tab-title",null,this._translations.dataTab),a("calcite-tab-title",null,this._translations.propertiesTab),a("calcite-tab-title",null,this._translations.resourcesTab)),a("calcite-tab",{class:"config-tab",selected:!0},a("solution-item-details",{"item-id":this.itemId,locale:this.locale})),a("calcite-tab",{class:"config-tab",id:"data-tab"},a("solution-template-data",{instanceid:"data","item-id":this.itemId,locale:this.locale,"organization-variables":this.organizationVariables,"solution-variables":this.solutionVariables})),a("calcite-tab",{class:"config-tab",id:"props-tab"},a("solution-template-data",{instanceid:"properties","item-id":this.itemId,locale:this.locale,"organization-variables":this.organizationVariables,"solution-variables":this.solutionVariables})),a("calcite-tab",{class:"config-tab",id:"resources-tab"},a("solution-resource-item",{authentication:this.authentication,class:"solutions-resource-container","item-id":this.itemId,locale:this.locale})))}async _getTranslations(){const e=await c(this.el);this._translations=e[0]}static get watchers(){return{itemId:["itemIdWatchHandler"],locale:["localeWatchHandler"]}}};d.style=".configuration-container{position:relative;height:100%;width:100%}.configuration{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:flex;padding:0.5rem;border:1px #808080 solid}.config-tabs{width:100%}.config-tab{width:100%;overflow-y:auto;height:inherit}";const f="3857",b=class{constructor(i){e(this,i),this.featureServiceSpatialReferenceChange=t(this,"featureServiceSpatialReferenceChange",7),this.enableDefaultSpatialReferenceChange=t(this,"enableDefaultSpatialReferenceChange",7),this.enabledSpatialReferenceChange=t(this,"enabledSpatialReferenceChange",7),this.enabled=!1,this.enableDefault=!1,this.featureServices=[],this.locale=void 0,this._translations=void 0}get el(){return i(this)}enabledChanged(){this._handleSpatialRefParamChange()}enableDefaultChanged(){this._handleDefaultSpatialRefParamChange()}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}componentWillLoad(){return this._updateUIFromStore(),this._getTranslations()}render(){return this._updateUIFromStore(),a(s,{key:"7f273e4ac344e1ee0caf40e7d1b7f939ecabda20"},a("label",{key:"06de012379cbfc355a9ace954b1dffffa9ce8c83",class:"switch-label"},a("calcite-switch",{key:"81660a69b2ac46824e2b929e13362f5ab9260c54",checked:this.enabled,class:"spatial-ref-switch",onCalciteSwitchChange:e=>this.enabled=e.target.checked,scale:"m"}),this._translations.enableSpatialReference),a("br",{key:"361d2d822ddad721842b806e4ee1e04ff313a19b"}),a("div",{key:"a211f2f6f55191a9ae9b4e94eae7a998b7bc8e35",class:"spatial-ref-component",id:"spatialRefDefn"},this._renderFeatureServicesList(this.featureServices)),a("label",{key:"9fc52be401af098888688636168b6742e92ce939",class:"switch-label spatial-ref-component"},a("calcite-switch",{key:"138644a57bd5c159e9f7f219f8956f0ed1af5bf1",checked:this.enableDefault,class:"spatial-ref-switch",disabled:!this.enabled,onCalciteSwitchChange:e=>this.enableDefault=e.target.checked,scale:"m"}),this._translations.enableDefaultSpatialReference))}featureServiceSpatialReferenceChange;enableDefaultSpatialReferenceChange;enabledSpatialReferenceChange;solutionStoreHasChanges(){this.featureServices=l.getStoreInfo("featureServices")}async _testAccess(e,t,i,a){switch(e){case"_parameterizeWkid":return Promise.resolve(this._parameterizeWkid(t));case"_unparameterizeWkid":return Promise.resolve(this._unparameterizeWkid(t))}return Promise.resolve(null)}_clearFeatureServiceDefaults(e){n(this.el.getElementsByClassName("spatial-ref-item-switch")).forEach((e=>e.checked=!1)),e.forEach((e=>this._updateEnabledServices({detail:{switched:!1}},e)))}_handleDefaultSpatialRefParamChange(){this._updateStore(),this.enableDefaultSpatialReferenceChange.emit({defaultWkid:this.enableDefault?f:""})}_handleSpatialRefParamChange(){this.enabled||(this.enableDefault=!1,this._clearFeatureServiceDefaults(this.featureServices)),this._updateStore(),this.enabledSpatialReferenceChange.emit({enabled:this.enabled})}_parameterizeWkid(e){return e?e.toString().startsWith(r)?e:`${r}${e}${o}`:e}_renderFeatureServicesList(e){const t=l.getStoreInfo("spatialReferenceInfo"),i=e.filter((e=>Object.keys(t.services).some((t=>t===e.id))));return i.length>0?a("div",null,a("label",{class:"spatial-ref-item-title"},this._translations.featureServicesHeading),a("ul",{class:"spatial-ref-services-list"},i.map((e=>a("li",{class:"spatial-ref-services-list-item"},a("label",{class:"switch-label"},a("calcite-switch",{checked:t.services[e.id],class:"spatial-ref-item-switch",disabled:!this.enabled,onCalciteSwitchChange:t=>this._updateEnabledServices(t,e),scale:"m"}),e.name)))))):null}_updateEnabledServices(e,t){const i=l.getStoreInfo("spatialReferenceInfo");i.services[t.id]=void 0!==e.detail?.switched?e.detail.switched:void 0===e.target?.checked||e.target.checked,l.setStoreInfo("spatialReferenceInfo",i),this._updateStore(),this.featureServiceSpatialReferenceChange.emit(t)}_unparameterizeWkid(e){return e&&e.toString().startsWith(r)?e.substring(r.length,e.length-o.length):e}_updateFeatureServices(e){e.enabled||Object.keys(e.services).forEach((t=>{e.services[t]=!1})),this.featureServices.forEach((t=>{t.enabled=e.services[t.id],t.wkid=t.enabled?this._parameterizeWkid(t.wkid):this._unparameterizeWkid(t.wkid)})),l.setStoreInfo("featureServices",this.featureServices)}_updateStore(){const e=l.getStoreInfo("spatialReferenceInfo");e.enabled=this.enabled,this.enabled&&this.enableDefault?e.default=f:e.hasOwnProperty("default")&&delete e.default,l.setStoreInfo("spatialReferenceInfo",e),this._updateFeatureServices(e)}_updateUIFromStore(){const e=l.getStoreInfo("spatialReferenceInfo");this.enabled=e.enabled,this.enableDefault=!!e.default,this.featureServices=l.getStoreInfo("featureServices")}async _getTranslations(){const e=await c(this.el);this._translations=e[0]}static get watchers(){return{enabled:["enabledChanged"],enableDefault:["enableDefaultChanged"],locale:["localeWatchHandler"]}}};b.style=".spatial-ref-switch{margin-inline-end:0.5rem}.spatial-ref-component{margin-top:0.625rem;margin-inline-start:2.5rem}#spatialRefDefn .sc-calcite-label-h label.sc-calcite-label{margin:0px;background-color:#CBC3E3}.spatial-ref-item-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.spatial-ref-item-switch{margin-inline-end:0.5rem}.switch-label{font-size:0.875rem;line-height:1.25rem}.spatial-ref-services-list{margin-block-start:0.5em;margin-block-end:0.5em;list-style-type:none;padding-inline-start:2em}.spatial-ref-services-list-item{margin-top:0.25rem}";export{h as solution_contents,d as solution_item,b as solution_spatial_ref}
6
+ import{r as t,c as e,g as i,h as a,H as s}from"./p-e996c38f.js";import{s as l}from"./p-da1e098c.js";import{g as c}from"./p-404cbf48.js";import{n}from"./p-8850bd21.js";import{C as r,g as o}from"./p-80cb7c73.js";import"./p-8717729a.js";import"./p-4f236b5d.js";import"./p-d4056c1c.js";import"./p-570b13d9.js";import"./p-0668e30d.js";import"./p-0a24ad5f.js";const h=class{constructor(i){t(this,i),this.solutionItemSelected=e(this,"solutionItemSelected",7),this.selectedItemId=void 0,this.templateHierarchy=[]}get el(){return i(this)}valueWatchHandler(t,e){t&&t!==e&&Array.isArray(t)&&t.length>0&&this._treeItemSelected(t[0].id)}componentWillLoad(){this.valueWatchHandler(this.templateHierarchy,[])}render(){return a(s,{key:"7ad948b5b3cd3610c1cc3fef3ae745151115f4fb"},a("calcite-tree",{key:"8352f4878695b764a7bd0ff4cd9457784bc02687"},this.renderHierarchy(this.templateHierarchy)))}renderHierarchy(t){return t.map((t=>{const e=this.selectedItemId&&this.selectedItemId===t.id;return t.dependencies&&t.dependencies.length>0?a("calcite-tree-item",{onClick:e=>this._treeItemSelected(t.id,e),selected:e},a("solution-item-icon",{type:t.type,typeKeywords:t.typeKeywords}),a("span",{class:"icon-text",title:t.title},t.title),a("calcite-tree",{slot:"children"},this.renderHierarchy(t.dependencies))):a("calcite-tree-item",{onClick:e=>this._treeItemSelected(t.id,e),selected:e},a("solution-item-icon",{type:t.type,typeKeywords:t.typeKeywords}),a("span",{class:"icon-text",title:t.title},t.title))}))}solutionItemSelected;_treeItemSelected(t,e){const i=e?.target?.closest("calcite-tree-item");i&&(i.expanded=!i?.expanded),this.selectedItemId=t,this.solutionItemSelected.emit(t)}static get assetsDirs(){return["item-type-icons"]}static get watchers(){return{templateHierarchy:["valueWatchHandler"]}}};h.style=".icon-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";const d=class{constructor(e){t(this,e),this.authentication=void 0,this.itemId="",this.locale=void 0,this.solutionVariables="",this.organizationVariables="",this.itemType=void 0,this._translations=void 0}get el(){return i(this)}itemIdWatchHandler(){const t=l.getItemInfo(this.itemId);this.itemType=t.type}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async componentWillLoad(){return this._getTranslations()}render(){return a(s,{key:"7f309120b815365553cd0da7418b3748cf2eea89"},a("div",{key:"543d5208d617d76e7983349303b433d23547ac8b",class:"configuration-container"},a("div",{key:"bd13f67b70d9fa4f46f7f67f68046b7ecd7eb7f2",class:"configuration"},this._showGroupTabs("Group"===this.itemType),this._showItemTabs("Group"!==this.itemType))))}_showGroupTabs(t){return a("calcite-tabs",{class:"config-tabs",style:{display:t?"inherit":"none"}},a("calcite-tab-nav",{slot:"tab-nav"},a("calcite-tab-title",null,this._translations.groupDetailsTab),a("calcite-tab-title",null,this._translations.sharingTab)),a("calcite-tab",{class:"config-tab",id:"group-tab",selected:!0},a("solution-item-details",{"item-id":this.itemId,locale:this.locale})),a("calcite-tab",{class:"config-tab",id:"share-tab"},a("solution-item-sharing",{"group-id":this.itemId,locale:this.locale})))}_showItemTabs(t){return a("calcite-tabs",{class:"config-tabs",style:{display:t?"inherit":"none"}},a("calcite-tab-nav",{slot:"tab-nav"},a("calcite-tab-title",null,this._translations.itemDetailsTab),a("calcite-tab-title",null,this._translations.dataTab),a("calcite-tab-title",null,this._translations.propertiesTab),a("calcite-tab-title",null,this._translations.resourcesTab)),a("calcite-tab",{class:"config-tab",selected:!0},a("solution-item-details",{"item-id":this.itemId,locale:this.locale})),a("calcite-tab",{class:"config-tab",id:"data-tab"},a("solution-template-data",{instanceid:"data","item-id":this.itemId,locale:this.locale,"organization-variables":this.organizationVariables,"solution-variables":this.solutionVariables})),a("calcite-tab",{class:"config-tab",id:"props-tab"},a("solution-template-data",{instanceid:"properties","item-id":this.itemId,locale:this.locale,"organization-variables":this.organizationVariables,"solution-variables":this.solutionVariables})),a("calcite-tab",{class:"config-tab",id:"resources-tab"},a("solution-resource-item",{authentication:this.authentication,class:"solutions-resource-container","item-id":this.itemId,locale:this.locale})))}async _getTranslations(){const t=await c(this.el);this._translations=t[0]}static get watchers(){return{itemId:["itemIdWatchHandler"],locale:["localeWatchHandler"]}}};d.style=".configuration-container{position:relative;height:100%;width:100%}.configuration{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:flex;padding:0.5rem;border:1px #808080 solid}.config-tabs{width:100%}.config-tab{width:100%;overflow-y:auto;height:inherit}";const f="3857",b=class{constructor(i){t(this,i),this.featureServiceSpatialReferenceChange=e(this,"featureServiceSpatialReferenceChange",7),this.enableDefaultSpatialReferenceChange=e(this,"enableDefaultSpatialReferenceChange",7),this.enabledSpatialReferenceChange=e(this,"enabledSpatialReferenceChange",7),this.enabled=!1,this.enableDefault=!1,this.featureServices=[],this.locale=void 0,this._translations=void 0}get el(){return i(this)}enabledChanged(){this._handleSpatialRefParamChange()}enableDefaultChanged(){this._handleDefaultSpatialRefParamChange()}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}componentWillLoad(){return this._updateUIFromStore(),this._getTranslations()}render(){return this._updateUIFromStore(),a(s,{key:"102d0df259f9cb116389ff05680e62515a1ee232"},a("label",{key:"95373549163385b3ed84a3997d5fb63ccca0945b",class:"switch-label"},a("calcite-switch",{key:"9430142bc9146348f40c72aedd64c7d8e3bac61b",checked:this.enabled,class:"spatial-ref-switch",onCalciteSwitchChange:t=>this.enabled=t.target.checked,scale:"m"}),this._translations.enableSpatialReference),a("br",{key:"91c034b58499fbee49e57bc3ba5913f09baa2728"}),a("div",{key:"0394d2f031f163b1e3b0c278568f23a0c7f7c0f5",class:"spatial-ref-component",id:"spatialRefDefn"},this._renderFeatureServicesList(this.featureServices)),a("label",{key:"41591a9be82c20350df4dc1812c7f749ca080194",class:"switch-label spatial-ref-component"},a("calcite-switch",{key:"65399800bf22df3b38e3d71f210216547f7474a0",checked:this.enableDefault,class:"spatial-ref-switch",disabled:!this.enabled,onCalciteSwitchChange:t=>this.enableDefault=t.target.checked,scale:"m"}),this._translations.enableDefaultSpatialReference))}featureServiceSpatialReferenceChange;enableDefaultSpatialReferenceChange;enabledSpatialReferenceChange;solutionStoreHasChanges(){this.featureServices=l.getStoreInfo("featureServices")}async _testAccess(t,e,i,a){switch(t){case"_parameterizeWkid":return Promise.resolve(this._parameterizeWkid(e));case"_unparameterizeWkid":return Promise.resolve(this._unparameterizeWkid(e))}return Promise.resolve(null)}_clearFeatureServiceDefaults(t){n(this.el.getElementsByClassName("spatial-ref-item-switch")).forEach((t=>t.checked=!1)),t.forEach((t=>this._updateEnabledServices({detail:{switched:!1}},t)))}_handleDefaultSpatialRefParamChange(){this._updateStore(),this.enableDefaultSpatialReferenceChange.emit({defaultWkid:this.enableDefault?f:""})}_handleSpatialRefParamChange(){this.enabled||(this.enableDefault=!1,this._clearFeatureServiceDefaults(this.featureServices)),this._updateStore(),this.enabledSpatialReferenceChange.emit({enabled:this.enabled})}_parameterizeWkid(t){return t?t.toString().startsWith(r)?t:`${r}${t}${o}`:t}_renderFeatureServicesList(t){const e=l.getStoreInfo("spatialReferenceInfo"),i=t.filter((t=>Object.keys(e.services).some((e=>e===t.id))));return i.length>0?a("div",null,a("label",{class:"spatial-ref-item-title"},this._translations.featureServicesHeading),a("ul",{class:"spatial-ref-services-list"},i.map((t=>a("li",{class:"spatial-ref-services-list-item"},a("label",{class:"switch-label"},a("calcite-switch",{checked:e.services[t.id],class:"spatial-ref-item-switch",disabled:!this.enabled,onCalciteSwitchChange:e=>this._updateEnabledServices(e,t),scale:"m"}),t.name)))))):null}_updateEnabledServices(t,e){const i=l.getStoreInfo("spatialReferenceInfo");i.services[e.id]=void 0!==t.detail?.switched?t.detail.switched:void 0===t.target?.checked||t.target.checked,l.setStoreInfo("spatialReferenceInfo",i),this._updateStore(),this.featureServiceSpatialReferenceChange.emit(e)}_unparameterizeWkid(t){return t&&t.toString().startsWith(r)?t.substring(r.length,t.length-o.length):t}_updateFeatureServices(t){t.enabled||Object.keys(t.services).forEach((e=>{t.services[e]=!1})),this.featureServices.forEach((e=>{e.enabled=t.services[e.id],e.wkid=e.enabled?this._parameterizeWkid(e.wkid):this._unparameterizeWkid(e.wkid)})),l.setStoreInfo("featureServices",this.featureServices)}_updateStore(){const t=l.getStoreInfo("spatialReferenceInfo");t.enabled=this.enabled,this.enabled&&this.enableDefault?t.default=f:t.hasOwnProperty("default")&&delete t.default,l.setStoreInfo("spatialReferenceInfo",t),this._updateFeatureServices(t)}_updateUIFromStore(){const t=l.getStoreInfo("spatialReferenceInfo");this.enabled=t.enabled,this.enableDefault=!!t.default,this.featureServices=l.getStoreInfo("featureServices")}async _getTranslations(){const t=await c(this.el);this._translations=t[0]}static get watchers(){return{enabled:["enabledChanged"],enableDefault:["enableDefaultChanged"],locale:["localeWatchHandler"]}}};b.style=".spatial-ref-switch{margin-inline-end:0.5rem}.spatial-ref-component{margin-top:0.625rem;margin-inline-start:2.5rem}#spatialRefDefn .sc-calcite-label-h label.sc-calcite-label{margin:0px;background-color:#CBC3E3}.spatial-ref-item-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.spatial-ref-item-switch{margin-inline-end:0.5rem}.switch-label{font-size:0.875rem;line-height:1.25rem}.spatial-ref-services-list{margin-block-start:0.5em;margin-block-end:0.5em;list-style-type:none;padding-inline-start:2em}.spatial-ref-services-list-item{margin-top:0.25rem}";export{h as solution_contents,d as solution_item,b as solution_spatial_ref}