@arcgis/portal-components 5.1.0-next.6 → 5.1.0-next.61

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 (81) hide show
  1. package/dist/cdn/3E7HBRWO.js +2 -0
  2. package/dist/cdn/3OTUKLZI.js +2 -0
  3. package/dist/cdn/3RPSRRKF.js +2 -0
  4. package/dist/cdn/45FUZWRF.js +65 -0
  5. package/dist/cdn/5AGIR43G.js +2 -0
  6. package/dist/cdn/{ZW6M2LGB.js → 7OWT3YI3.js} +1 -1
  7. package/dist/cdn/{ENPCKCML.js → 7SJIVOZP.js} +1 -1
  8. package/dist/cdn/CQYRDCAS.js +2 -0
  9. package/dist/cdn/{E4LMIW7S.js → E5QVAI6E.js} +1 -1
  10. package/dist/cdn/{6IAW2M6I.js → FC6NJIXY.js} +1 -1
  11. package/dist/cdn/{QVXQMXLU.js → GPSI4ROI.js} +1 -1
  12. package/dist/cdn/GWHFVZ3O.js +4 -0
  13. package/dist/cdn/{GZ7GD7XY.js → IZOKWPB5.js} +1 -1
  14. package/dist/cdn/{3W2BQQUS.js → LYZ5FW6Y.js} +1 -1
  15. package/dist/cdn/N233CFSR.js +2 -0
  16. package/dist/cdn/{EJHYAMM6.js → NJ2PPMSP.js} +1 -1
  17. package/dist/cdn/RJUVIR6F.js +2 -0
  18. package/dist/cdn/S2PHM4WZ.js +2 -0
  19. package/dist/cdn/UXUVTFIJ.js +2 -0
  20. package/dist/cdn/{PRZKLMZ3.js → WTJLLIOR.js} +1 -1
  21. package/dist/cdn/{CH7DWRLT.js → WZGUYBTB.js} +1 -1
  22. package/dist/cdn/YNYDJOWH.js +2 -0
  23. package/dist/cdn/{6NKUHVR4.js → ZKL5ODDF.js} +1 -1
  24. package/dist/cdn/assets/portal-ai-assistant/t9n/messages.en.json +1 -0
  25. package/dist/cdn/assets/portal-replacement-item-redirect/t9n/messages.en.json +1 -1
  26. package/dist/cdn/index.js +1 -1
  27. package/dist/cdn/main.css +1 -1
  28. package/dist/chunks/common.js +1 -1
  29. package/dist/chunks/fieldAddDelete.js +26 -20
  30. package/dist/chunks/item.js +31 -35
  31. package/dist/chunks/portal.js +16 -0
  32. package/dist/chunks/user.js +113 -0
  33. package/dist/components/arcgis-portal-ai-assistant/customElement.d.ts +94 -0
  34. package/dist/components/arcgis-portal-ai-assistant/customElement.js +480 -0
  35. package/dist/components/arcgis-portal-ai-assistant/index.d.ts +1 -0
  36. package/dist/components/arcgis-portal-ai-assistant/index.js +9 -0
  37. package/dist/components/arcgis-portal-classification-banner/customElement.d.ts +2 -2
  38. package/dist/components/arcgis-portal-classification-config/customElement.d.ts +3 -3
  39. package/dist/components/arcgis-portal-classification-config/customElement.js +4 -4
  40. package/dist/components/arcgis-portal-classification-favorite/customElement.d.ts +3 -3
  41. package/dist/components/arcgis-portal-extent-picker-coord-field/customElement.js +2 -2
  42. package/dist/components/arcgis-portal-field-delete/customElement.d.ts +5 -3
  43. package/dist/components/arcgis-portal-field-delete/customElement.js +1 -1
  44. package/dist/components/arcgis-portal-mentionable-text-area/customElement.d.ts +73 -0
  45. package/dist/components/arcgis-portal-mentionable-text-area/customElement.js +205 -0
  46. package/dist/components/arcgis-portal-mentionable-text-area/index.d.ts +1 -0
  47. package/dist/components/arcgis-portal-mentionable-text-area/index.js +8 -0
  48. package/dist/components/arcgis-portal-mentionable-text-area/types.d.ts +5 -0
  49. package/dist/components/arcgis-portal-replacement-item-redirect/customElement.d.ts +10 -4
  50. package/dist/components/arcgis-portal-replacement-item-redirect/customElement.js +130 -92
  51. package/dist/components/arcgis-portal-voice-input/customElement.d.ts +37 -0
  52. package/dist/components/arcgis-portal-voice-input/customElement.js +82 -0
  53. package/dist/components/arcgis-portal-voice-input/index.d.ts +1 -0
  54. package/dist/components/arcgis-portal-voice-input/index.js +1 -0
  55. package/dist/components/arcgis-user-avatar/customElement.d.ts +57 -0
  56. package/dist/components/arcgis-user-avatar/customElement.js +63 -0
  57. package/dist/components/arcgis-user-avatar/index.d.ts +1 -0
  58. package/dist/components/arcgis-user-avatar/index.js +2 -0
  59. package/dist/docs/api.json +1 -1
  60. package/dist/docs/docs.json +1 -1
  61. package/dist/docs/vscode.html-custom-data.json +1 -1
  62. package/dist/docs/web-types.json +1 -1
  63. package/dist/index.d.ts +34 -0
  64. package/dist/loader.js +5 -1
  65. package/dist/types/classification.d.ts +2 -2
  66. package/dist/types/group.d.ts +51 -0
  67. package/dist/types/item.d.ts +4 -0
  68. package/dist/types/lumina.d.ts +32 -0
  69. package/dist/types/preact.d.ts +36 -0
  70. package/dist/types/react.d.ts +40 -0
  71. package/dist/types/stencil.d.ts +32 -0
  72. package/dist/types/ui.d.ts +8 -0
  73. package/dist/types/user.d.ts +74 -0
  74. package/dist/utils/fieldAddDelete.d.ts +3 -2
  75. package/dist/utils/types.d.ts +4 -3
  76. package/package.json +6 -5
  77. package/dist/cdn/EIJ3YMIH.js +0 -2
  78. package/dist/cdn/GECTIZJS.js +0 -2
  79. package/dist/cdn/GEMOAIEK.js +0 -2
  80. package/dist/cdn/SPAXWYII.js +0 -4
  81. package/dist/cdn/TUDUMVIA.js +0 -2
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import a from"./3OTUKLZI.js";import"./S2PHM4WZ.js";import{d as R}from"./3RPSRRKF.js";import{A as M,B as S,E,H as P,I as g,J as D,K as v,P as L,h as k,j as m,l as A,u as d}from"./GWHFVZ3O.js";export default $arcgis.t(([{a:x,c:q}])=>{var O=(r,e=100)=>{let s;return(...n)=>{let a=()=>{clearTimeout(s),r(...n)};clearTimeout(s),s=setTimeout(a,e)}};var U=M(class extends S{constructor(){super(...arguments),this.key=A}render(r,e){return this.key=r,e}update(r,[e,s]){return e!==this.key&&(E(r),this.key=e),s}});var $=["@","#","$"],N=400;function K(r,e){let s=null;for(let n of e){let a=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),i=new RegExp(`${a}"([^"\\n]*)"?$`,"u"),t=r.match(i);if(t){let c=t[0],l=r.length-c.length,u=t[1]??"";(!s||l>s.startIndex)&&(s={starter:n,mentionText:c,query:u,startIndex:l})}let o=new RegExp(`${a}[\\p{L}\\p{N}_-]+$`,"u"),h=r.match(o);if(h){let c=h[0],l=r.length-c.length,u=c.slice(n.length);(!s||l>s.startIndex)&&(s={starter:n,mentionText:c,query:u,startIndex:l})}}return s}async function V(r,e={}){return await r.queryGroups(e)}var Q=async(r,e,s)=>{try{return{result:await r.queryItems({...s,query:`title:${e}`})}}catch(n){return console.error(n),{error:{code:"unhandledError"}}}},_=r=>$.includes(r)?r:"@",G=R(r=>{let e=[],s=async i=>await x({requester:async()=>await Q(r.portal,i,{num:3}),key:"items",id:i}),n=async i=>await x({requester:async()=>await V(r.portal,{query:`title:${i}`,num:3}),key:"groups",id:i}),a=O(async(i,t)=>{r.isFetchingEntities=!0;let o=i.toLowerCase();switch(_(t)){case"@":r.filteredItemsInfo={type:"user",items:e.filter(l=>l.username?.toLowerCase().includes(o)||l.fullName?.toLowerCase().includes(o)).slice(0,10)};break;case"#":let{result:h}=await s(o);r.filteredItemsInfo={type:"item",items:h?.results??[]};break;case"$":let{results:c}=await n(o);r.filteredItemsInfo={type:"group",items:c};break}(r.filteredItemsInfo?.items?.length??0)===0&&await r.closePopover(),r.isFetchingEntities=!1},N);return{fetchUsers:async()=>{try{let{users:i}=await q(r.portal);e=i??[]}catch(i){e=[],console.error("error fetching org users:",i)}},filterItems:a,getItemText:(i,t)=>{let o="";switch(_(t)){case"@":o=i.username;break;case"#":o=i.title??"";break;case"$":o=i.title??"";break}return o.trim()}}}),y=({id:r,label:e,selected:s,description:n,contentStart:a,onSelect:i})=>U(r,m`<calcite-list-item class=${v({selected:s})} .label=${e} .description=${n} .selected=${s} @pointerdown=${async t=>{t.preventDefault(),t.stopPropagation(),await i()}} ${g(t=>{s&&t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})})}>${a}</calcite-list-item>`),j=k`.selected{--calcite-list-background-color: var(--calcite-color-foreground-2)}.mentionable-list{max-height:13rem;overflow-y:auto;padding:.25rem;width:min(100vw,24rem)}.mentionable-list--loading{min-height:10rem}`,w=class extends D{constructor(){super(...arguments),this.calciteTextAreaRef=P(),this.mentionableEntityController=G(this),this.handleInput=e=>{let{bubbleNewValueChange:s,checkForMention:n}=this,a=e.target.value;this._value=a,s(this._value);let i=this.nativeTextAreaRef?.selectionStart??0;n(a,i)},this.handleKeyDown=e=>{if(!this.popoverOpen){this.arcgisUserMentionableTextAreaKeyDown.emit(e),this.arcgisMentionableTextAreaKeyDown.emit(e);return}switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedItemIndex=Math.min(this.selectedItemIndex+1,this.filteredItems.length-1);break;case"ArrowUp":e.preventDefault(),this.selectedItemIndex=Math.max(this.selectedItemIndex-1,0);break;case"Enter":e.preventDefault(),this.selectItem(this.filteredItems[this.selectedItemIndex]);break;case"Escape":e.preventDefault(),this.closePopover.bind(this)();break}},this.handleClosePopover=()=>{this.popoverOpen=!1,this.currentMentionQuery="",this.selectedItemIndex=0,this.currentStarter=null},this.bubbleNewValueChange=e=>{this.arcgisUserMentionableTextAreaChange.emit(e),this.arcgisMentionableTextAreaChange.emit(e)},this.checkForMention=(e,s)=>{let n=e.substring(0,s),a=K(n,this.starters??$);if(a){let{starter:i}=a;this.currentStarter=i,this.filterMentionItems(a),this.popoverOpen=!0;return}this.handleClosePopover()},this.filterMentionItems=e=>{let{mentionText:s,query:n,starter:a,startIndex:i}=e;this.currentMentionQuery=s,this.mentionStartPosition=i;let t=n.toLowerCase();this.mentionableEntityController.filterItems(t,a),this.selectedItemIndex=0},this.popoverOpen=!1,this.currentMentionQuery="",this.mentionStartPosition=0,this.selectedItemIndex=0,this.currentStarter=null,this._value="",this.filteredItemsInfo=null,this.isFetchingEntities=!1,this.popoverPlacement="bottom-start",this.disabled=!1,this.scale="m",this.rows=3,this.starters=$,this.readOnly=!1,this.arcgisMentionableSelectedIndexChange=d(),this.arcgisMentionableTextAreaChange=d(),this.arcgisMentionableTextAreaKeyDown=d(),this.arcgisUserMentionableTextAreaChange=d(),this.arcgisUserMentionableTextAreaKeyDown=d(),this.renderItemInfo=()=>{let{filteredItemsInfo:e,selectedItemIndex:s,portal:n}=this;if(!e)return null;let{items:a,type:i}=e;switch(i){case"user":return a.map((t,o)=>y({id:t.id,label:`@${t.username}`,description:t.fullName,selected:o===s,contentStart:m`<arcgis-user-avatar slot=content-start .user=${t} .portal=${n} scale=m></arcgis-user-avatar>`,onSelect:async()=>await this.selectItem(t)}));case"item":return a.map((t,o)=>y({id:t.id??`item-${o}`,label:`#${t.title}`,description:t.id??void 0,selected:o===s,onSelect:async()=>await this.selectItem(t),contentStart:m`<calcite-avatar slot=content-start .fullName=${t.title??void 0} .thumbnail=${t.thumbnailUrl??void 0} scale=m></calcite-avatar>`}));case"group":return a.map((t,o)=>y({id:t.id??`group-${o}`,label:`${t.title}`,description:t.id??void 0,selected:o===s,onSelect:async()=>await this.selectItem(t),contentStart:m`<calcite-avatar slot=content-start .fullName=${t.title??void 0} .thumbnail=${t.thumbnailUrl??void 0} scale=m></calcite-avatar>`}))}}}static{this.properties={popoverOpen:16,currentMentionQuery:16,mentionStartPosition:16,selectedItemIndex:16,currentStarter:16,_value:16,filteredItemsInfo:16,isFetchingEntities:16,popoverListLabel:1,popoverPlacement:1,disabled:5,portal:0,user:0,scale:1,value:1,maxLength:9,rows:9,starters:0,placeholder:1,readOnly:5}}static{this.styles=j}get filteredItems(){return this.filteredItemsInfo?.items??[]}async closePopover(){this.handleClosePopover()}async focusTextArea(){await this.calciteTextAreaRef.value?.setFocus()}async selectItem(e){let{currentStarter:s,_value:n,mentionStartPosition:a,currentMentionQuery:i,handleClosePopover:t,calciteTextAreaRef:o,nativeTextAreaRef:h,bubbleNewValueChange:c}=this;if(!e||!s)return;let l=this.mentionableEntityController.getItemText(e,s).replaceAll('"',"").trim(),u=/\s/u.test(l)?`${s}"${l}"`:`${s}${l}`,f=(n??"").substring(0,a),p=(n??"").substring(a+i.length),I=`${f}${u} ${p}`;this._value=I,c(this._value);let b=a+u.length+1;t(),await this.updateComplete,o.value?.setFocus(),h&&(h.selectionEnd=b)}willUpdate(e){e.has("value")&&(this._value=this.value??""),e.has("selectedItemIndex")&&this.arcgisMentionableSelectedIndexChange.emit(this.selectedItemIndex)}loaded(){this.updateComplete.then(()=>{let e=this.calciteTextAreaRef.value?.shadowRoot?.querySelector("textarea");e&&(this.nativeTextAreaRef=e)}),this.mentionableEntityController.fetchUsers()}render(){let{popoverPlacement:e,scale:s,_value:n,maxLength:a,rows:i,placeholder:t,readOnly:o,popoverOpen:h,closePopover:c,handleInput:l,handleKeyDown:u,disabled:f,isFetchingEntities:p,filteredItemsInfo:I,renderItemInfo:b,popoverListLabel:T}=this,C=this.calciteTextAreaRef.value,F=I?.items??[];return m`<calcite-text-area .placeholder=${t} .value=${n} .maxLength=${a} .rows=${i} .scale=${s} .readOnly=${o} .disabled=${f} @blur=${c} @calciteTextAreaInput=${l} @keydown=${u} ${g(this.calciteTextAreaRef)}></calcite-text-area>${C&&m`<calcite-popover .open=${h} .placement=${e} class="mention-popover" .label=${T} .referenceElement=${C} trigger-disabled pointer-disabled focus-trap-disabled><div class=${v({"mentionable-list":!0,"mentionable-list--loading":p})}>${p&&m`<calcite-scrim .loading=${p}></calcite-scrim>`||""}${F.length>0&&m`<calcite-list .label=${T}>${b()}</calcite-list>`||""}</div></calcite-popover>`||""}`}};L("arcgis-portal-mentionable-text-area",w);return w},a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{a as u,b as g,c as k}from"./S2PHM4WZ.js";export default $arcgis.t(([q,x])=>{var c={},l={},d={};async function y({requester:t,key:r,id:o,cacheOption:a}){let e=d[r]?.[o]?.expireAt,n=!!e&&new Date().getTime()>e;if(c[r]?.[o]&&!n)return c[r][o];l[r]||(l[r]={}),(!l[r][o]||n)&&(l[r][o]=t());let i=await l[r][o];if(c[r]||(c[r]={}),d[r]||(d[r]={}),c[r][o]=i,a){let{expireAfter:m,getExpireAfterFromResult:s}=a,f=s||m?new Date().getTime()+(s?.(i)??m??0):null;d[r][o]={...d[r][o],expireAt:f}}return i}async function A({url:t,portal:r,params:o={},options:a={},method:e,abortControllerId:n,excludeJson:i}){let m=T(n)?.signal,{customToken:s,addTokenManually:f,addSSL:S,useProxy:b}=a,w={...o};if(!t.includes("f=")&&!i&&(w.f="json"),s)w.token=s;else if(f!==!1){let h=await E(r);h&&(w.token=h)}let C=S?M(t,r):t,P={query:w,method:e||"auto",...a,timeout:a.timeout||0,useProxy:b,...a?.disableIdentityLookup?{authMode:"anonymous"}:{}},$=await x(C,{signal:m,...P});return n&&(p[n]=void 0),$.data}var p={};function T(t){if(t)return p[t]&&p[t].abort(),p[t]=new AbortController,p[t]}var E=async t=>{let r=k(t);if(!t?.isPortal||!r)return g(t);let o=t?.user;if(!o&&r)return;let{token:a}=await y({requester:async()=>await I(t),key:"platformSelf",id:o?.id??t.id??"<unknown>",cacheOption:{getExpireAfterFromResult:e=>e.expires_in}});return a},I=async t=>{let r={"X-Esri-Auth-Client-Id":await L(t),"X-Esri-Auth-Redirect-Uri":window.location.href.replace(/#.*$/u,"")};return(await x(`${u(t)}/oauth2/platformSelf`,{authMode:"no-prompt",headers:r,withCredentials:!0,method:"post"})).data},L=async t=>(await y({requester:async()=>await q.getCredential(u(t),{oAuthPopupConfirmation:!1}),key:"credential",id:t.user?.id??"<unknown>"})).oAuthState?.appId??"arcgisonline";function M(t,r){return window.location.protocol==="https:"||r.allSSL?t.replace("http:","https:"):t}async function D(t,r,o){let a=`${o?"https://www.arcgis.com/sharing/rest/":u(r)}community/users/${t}`,e=a?.includes("www.arcgis.com")&&r.isPortal,n=a?.includes(".arcgis.com")&&!r.isPortal&&!r.user,i=e||n?{disableIdentityLookup:!0,addTokenManually:!1}:{};return await y({requester:async()=>{try{return await A({url:a,portal:r,options:i})}catch{return{username:t}}},key:"user",id:a})}var U=async t=>{let r=`${u(t)}/portals/${t.id}/users`;return await A({url:r,portal:t,params:{num:100,sortField:"lastlogin",sortOrder:"desc"}})};return{a:y,b:D,c:U}},"identity/IdentityManager","request")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{a as L,b as O,c as P,d as g,e as v,f as A,g as T,n as E,s as b,t as $,v as k}from"./GWHFVZ3O.js";var Q=(...t)=>{let r=[];for(let o=0;o<t.length;++o){let n=t[o];if(typeof n=="string")r.push(n);else if(Array.isArray(n))r.push.apply(r,n);else if(typeof n=="object")for(let s in n)n[s]&&r.push(s)}let e=r.join(" ");return r.length=0,e},V=(t,r)=>{let e=t;for(;e;){if(e===r)return!0;if(!e.parentNode)return!1;e.parentNode instanceof ShadowRoot?e=e.parentNode.host:e=e.parentNode}return!1},h=(t,r,e)=>{let o=U(r).subscribe;return o(n=>{n.some(i=>V(t,i.target))&&e()})},y={},U=t=>{let r=t.join(","),e=y[r];if(e!==void 0)return e;let o=new Set,n=new MutationObserver(i=>o.forEach(a=>a(i)));globalThis.document&&n.observe(document.documentElement,{attributes:!0,attributeFilter:t,subtree:!0});let s={subscribe:i=>(o.add(i),()=>{o.delete(i),o.size===0&&(n.disconnect(),y[r]=void 0)})};return y[r]=s,s},G=(t,r)=>{let e=t;for(;e;){let o=e.closest?.(r);if(o)return o;let n=e.getRootNode?.();if(n===globalThis.document)return;e=n?.host}};var f=(t,r,e)=>G(t,`[${r}]`)?.getAttribute(r)??e;var S=t=>(...r)=>{let e=v(),o=new t(...r),n=o.exports;g(e.at(-1));let s=o.component.manager;s.W(o,n),o.watchExports(s.W.bind(s,o)),A(o);let i=[o.component,...e].reverse();return b(i,a=>a===void 0?void 0:W(o,a,n),n)},W=(t,{host:r,key:e,isReactive:o},n)=>{let s=r,i=s[e]!==t.exports,a=s[e]!==n,c=n!==t.exports;if(i&&!a&&c&&(s[e]=t.exports),r===t.component){if(o){let l=t.component.manager;a&&l.W(t,s[e]),t.onUpdate(d=>{if(d.has(e)){let w=s[e];w!==t.exports&&l.W(t,w)}})}t.O=o?void 0:e}let p=t.component.constructor.elementProperties.get(e)?.readOnly;t.watchExports(()=>{s[e]!==t.exports&&(p?T(()=>{s[e]=t.exports}):s[e]=t.exports)})};var H="ar,bg,bs,ca,cs,da,de,el,en,es,et,fi,fr,he,hr,hu,id,it,ja,ko,lt,lv,nl,nb,no,pl,pt-BR,pt-PT,ro,ru,sk,sl,sr,sv,th,tr,uk,vi,zh-CN,zh-HK,zh-TW".split(","),K=new Set(H),m="en",q={pt:"pt-BR",nb:"no",nn:"no",zh:"zh-CN"},I=async(t,r,e="")=>{let o=`${r}/${e}`,n=`${o}${t}.json`;return C[n]??(C[n]=M(t,o)),await C[n]},C={},M=async(t,r)=>{let e=`${r}${t}.json`;try{let o=await fetch(e);if(o.ok)return await o.json()}catch(o){return E("error","intl",`An unknown error occurred while fetching localization strings at ${e}`,{detail:{error:o}}),{}}return t===m?{}:await M(m,r)},x=t=>{let r=f(t,"lang",globalThis.navigator?.language||m);return{lang:r,t9nLocale:_(r)}},_=t=>{let[r,e]=t.split("-"),o=r.toLowerCase(),n=o;return e&&(n=`${o}-${e.toUpperCase()}`),n=q[n]??n,K.has(n)?n:e?_(o):m},D=(t,r,e,o)=>{let n,s=()=>B(t,r(),o).then(i=>{(n?.lang!==i.lang||n.t9nLocale!==i.t9nLocale||n.t9nStrings!==i.t9nStrings)&&e(i),n=i}).catch(i=>{E("error","intl","Error updating component locale state",{detail:{error:i}})});return queueMicrotask(s),h(t,["lang"],s)},B=async(t,r,e=t.localName.split("-").slice(1).join("-"))=>{let{lang:o,t9nLocale:n}=x(t),s=`${r}/${e}/t9n`,a=e===null?{}:await I(n,s,"messages.");return{lang:o,t9nLocale:n,t9nStrings:a}};var F=t=>R(void 0,t),he=t=>r=>R(r,t),N=class extends k{constructor(r,e){super(r);let o=this.exports;try{O(this.component);let n=e(this.component,this),s=this.exports!==o;if(L(n)){s||this.setProvisionalExports(n);let i=n.then(a=>{this.exports=a,super.catchUpLifecycle()}).catch(a=>{this.P.reject(a)});this.onLoad(async()=>await i)}else(!s||n!==void 0)&&(this.exports=n),queueMicrotask(()=>super.catchUpLifecycle())}catch(n){this.P.reject(n)}}catchUpLifecycle(){}},R=S(N);var j="ltr",fe=()=>F((t,r)=>{r.exports=j,r.onLifecycle(()=>{let e=()=>{let o=f(t.el,"dir",j);r.exports=o==="rtl"?"rtl":"ltr"};return e(),h(t.el,["dir"],e)})}),me=t=>(r={})=>F((e,o)=>{let n=x(e.el),s={_lang:n.lang,_t9nLocale:n.t9nLocale,_loading:!0},i=e;o.onLifecycle(()=>D(e.el,()=>t("./assets"),({t9nLocale:c,t9nStrings:u,lang:p})=>{let l={...u,_lang:p,_t9nLocale:c,_loading:!1};o.exports=l;let d=u.componentLabel;typeof d=="string"&&"label"in e&&e.label==null&&(e.label??=d),a(i.messageOverrides)},r.name));let a=c=>{let u=o.exports,p=u._original??u,l=z(p,c);c&&(l._original=p),o.exports=l};return"messageOverrides"in i&&o.onUpdate(c=>{c.has("messageOverrides")&&a(i.messageOverrides)}),r.blocking?(o.setProvisionalExports(s,!1),o.ready):s}),z=(t,r)=>{if(!r)return t;let e={...t};return Object.entries(r).forEach(([o,n])=>{t[o]!==void 0&&(typeof n=="object"?e[o]=z(t[o],n):e[o]=n??t[o])}),e},ge=t=>X,J="arcgisPropertyChange",X=(...t)=>{let r=P(),e=$(J,void 0,r),o=!0;return r.manager.onUpdated(n=>{if(o||!r.el.isConnected){o=!1;return}for(let s of t)n.has(s)&&e.emit({name:s})}),e};export{S as a,Q as b,G as c,he as d,fe as e,me as f,ge as g};
@@ -0,0 +1,65 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{a as fe}from"./CQYRDCAS.js";import{a as ge}from"./WZGUYBTB.js";import{a as de}from"./LYZ5FW6Y.js";import{b as U}from"./3RPSRRKF.js";import{H as _,I as z,J as pe,K as q,P as ue,h as V,j as x,u as H,x as B}from"./GWHFVZ3O.js";export default $arcgis.t(([Rt])=>{function X(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R=X();function $e(t){R=t}var S={exec:()=>null};function u(t,e=""){let s=typeof t=="string"?t:t.source,n={replace:(r,a)=>{let i=typeof a=="string"?a:a.source;return i=i.replace(m.caret,"$1"),s=s.replace(r,i),n},getRegex:()=>new RegExp(s,e)};return n}var Ze=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Ne=/^(?:[ \t]*(?:\n|$))+/,je=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Qe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,C=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Oe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,J=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ve=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Se=u(ve).replace(/bull/g,J).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ve=u(ve).replace(/bull/g,J).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),K=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,He=/^[^\n]+/,Y=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ue=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Y).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ge=u(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,J).getRegex(),j="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ee=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,We=u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ee).replace("tag",j).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Te=u(K).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",j).getRegex(),Fe=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Te).getRegex(),te={blockquote:Fe,code:je,def:Ue,fences:Qe,heading:Oe,hr:C,html:We,lheading:Se,list:Ge,newline:Ne,paragraph:Te,table:S,text:He},ke=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",j).getRegex(),Xe={...te,lheading:Ve,table:ke,paragraph:u(K).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ke).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",j).getRegex()},Je={...te,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ee).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:S,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(K).replace("hr",C).replace("heading",` *#{1,6} *[^
3
+ ]`).replace("lheading",Se).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ke=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ye=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Re=/^( {2,}|\\)\n(?!\s*$)/,et=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,Q=/[\s\p{P}\p{S}]/u,se=/[^\s\p{P}\p{S}]/u,tt=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Q).getRegex(),Ae=/(?!~)[\p{P}\p{S}]/u,st=/(?!~)[\s\p{P}\p{S}]/u,rt=/(?:[^\s\p{P}\p{S}]|~)/u,nt=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ze?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ie=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,it=u(Ie,"u").replace(/punct/g,A).getRegex(),at=u(Ie,"u").replace(/punct/g,Ae).getRegex(),_e="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",lt=u(_e,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,Q).replace(/punct/g,A).getRegex(),ot=u(_e,"gu").replace(/notPunctSpace/g,rt).replace(/punctSpace/g,st).replace(/punct/g,Ae).getRegex(),ct=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,Q).replace(/punct/g,A).getRegex(),ht=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),pt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ut=u(pt,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,Q).replace(/punct/g,A).getRegex(),dt=u(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),gt=u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ft=u(ee).replace("(?:-->|$)","-->").getRegex(),kt=u("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ft).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),D=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,mt=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",D).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ze=u(/^!?\[(label)\]\[(ref)\]/).replace("label",D).replace("ref",Y).getRegex(),Ee=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",Y).getRegex(),xt=u("reflink|nolink(?!\\()","g").replace("reflink",ze).replace("nolink",Ee).getRegex(),me=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,re={_backpedal:S,anyPunctuation:dt,autolink:gt,blockSkip:nt,br:Re,code:Ye,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:it,emStrongRDelimAst:lt,emStrongRDelimUnd:ct,escape:Ke,link:mt,nolink:Ee,punctuation:tt,reflink:ze,reflinkSearch:xt,tag:kt,text:et,url:S},bt={...re,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",D).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D).getRegex()},G={...re,emStrongRDelimAst:ot,emStrongLDelim:at,delLDelim:ht,delRDelim:ut,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",me).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:u(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",me).getRegex()},wt={...G,br:u(Re).replace("{2,}","*").getRegex(),text:u(G.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},M={normal:te,gfm:Xe,pedantic:Je},E={normal:re,gfm:G,breaks:wt,pedantic:bt},yt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xe=t=>yt[t];function $(t,e){if(e){if(m.escapeTest.test(t))return t.replace(m.escapeReplace,xe)}else if(m.escapeTestNoEncode.test(t))return t.replace(m.escapeReplaceNoEncode,xe);return t}function be(t){try{t=encodeURI(t).replace(m.percentDecode,"%")}catch{return null}return t}function we(t,e){let s=t.replace(m.findPipe,(a,i,o)=>{let l=!1,h=i;for(;--h>=0&&o[h]==="\\";)l=!l;return l?"|":" |"}),n=s.split(m.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(m.slashPipe,"|");return n}function P(t,e,s){let n=t.length;if(n===0)return"";let r=0;for(;r<n;){let a=t.charAt(n-r-1);if(a===e&&!s)r++;else if(a!==e&&s)r++;else break}return t.slice(0,n-r)}function $t(t,e){if(t.indexOf(e[1])===-1)return-1;let s=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])s++;else if(t[n]===e[1]&&(s--,s<0))return n;return s>0?-2:-1}function vt(t,e=0){let s=e,n="";for(let r of t)if(r===" "){let a=4-s%4;n+=" ".repeat(a),s+=a}else n+=r,s++;return n}function ye(t,e,s,n,r){let a=e.href,i=e.title||null,o=t[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:s,href:a,title:i,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,l}function St(t,e,s){let n=t.match(s.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
4
+ `).map(a=>{let i=a.match(s.other.beginningSpace);if(i===null)return a;let[o]=i;return o.length>=r.length?a.slice(r.length):a}).join(`
5
+ `)}var Z=class{options;rules;lexer;constructor(t){this.options=t||R}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let s=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?s:P(s,`
6
+ `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let s=e[0],n=St(s,e[3]||"",this.rules);return{type:"code",raw:s,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let s=e[2].trim();if(this.rules.other.endingHash.test(s)){let n=P(s,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(s=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:P(e[0],`
7
+ `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let s=P(e[0],`
8
+ `).split(`
9
+ `),n="",r="",a=[];for(;s.length>0;){let i=!1,o=[],l;for(l=0;l<s.length;l++)if(this.rules.other.blockquoteStart.test(s[l]))o.push(s[l]),i=!0;else if(!i)o.push(s[l]);else break;s=s.slice(l);let h=o.join(`
10
+ `),c=h.replace(this.rules.other.blockquoteSetextReplace,`
11
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
12
+ ${h}`:h,r=r?`${r}
13
+ ${c}`:c;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,a,!0),this.lexer.state.top=p,s.length===0)break;let d=a.at(-1);if(d?.type==="code")break;if(d?.type==="blockquote"){let k=d,f=k.raw+`
14
+ `+s.join(`
15
+ `),v=this.blockquote(f);a[a.length-1]=v,n=n.substring(0,n.length-k.raw.length)+v.raw,r=r.substring(0,r.length-k.text.length)+v.text;break}else if(d?.type==="list"){let k=d,f=k.raw+`
16
+ `+s.join(`
17
+ `),v=this.list(f);a[a.length-1]=v,n=n.substring(0,n.length-d.raw.length)+v.raw,r=r.substring(0,r.length-k.raw.length)+v.raw,s=f.substring(a.at(-1).raw.length).split(`
18
+ `);continue}}return{type:"blockquote",raw:n,tokens:a,text:r}}}list(t){let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim(),n=s.length>1,r={type:"list",raw:"",ordered:n,start:n?+s.slice(0,-1):"",loose:!1,items:[]};s=n?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=n?s:"[*+-]");let a=this.rules.other.listItemRegex(s),i=!1;for(;t;){let l=!1,h="",c="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let p=vt(e[2].split(`
19
+ `,1)[0],e[1].length),d=t.split(`
20
+ `,1)[0],k=!p.trim(),f=0;if(this.options.pedantic?(f=2,c=p.trimStart()):k?f=e[1].length+1:(f=p.search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=p.slice(f),f+=e[1].length),k&&this.rules.other.blankLine.test(d)&&(h+=d+`
21
+ `,t=t.substring(d.length+1),l=!0),!l){let v=this.rules.other.nextBulletRegex(f),oe=this.rules.other.hrRegex(f),ce=this.rules.other.fencesBeginRegex(f),he=this.rules.other.headingBeginRegex(f),Me=this.rules.other.htmlBeginRegex(f),De=this.rules.other.blockquoteBeginRegex(f);for(;t;){let O=t.split(`
22
+ `,1)[0],I;if(d=O,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),I=d):I=d.replace(this.rules.other.tabCharGlobal," "),ce.test(d)||he.test(d)||Me.test(d)||De.test(d)||v.test(d)||oe.test(d))break;if(I.search(this.rules.other.nonSpaceChar)>=f||!d.trim())c+=`
23
+ `+I.slice(f);else{if(k||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ce.test(p)||he.test(p)||oe.test(p))break;c+=`
24
+ `+d}k=!d.trim(),h+=O+`
25
+ `,t=t.substring(O.length+1),p=I.slice(f)}}r.loose||(i?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(i=!0)),r.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=h}let o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let c=this.lexer.inlineQueue.length-1;c>=0;c--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)){this.lexer.inlineQueue[c].src=this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask,"");break}}let h=this.rules.other.listTaskCheckbox.exec(l.raw);if(h){let c={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};l.checked=c.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=c.raw+l.tokens[0].raw,l.tokens[0].text=c.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(c)):l.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):l.tokens.unshift(c)}}if(!r.loose){let h=l.tokens.filter(p=>p.type==="space"),c=h.length>0&&h.some(p=>this.rules.other.anyLine.test(p.raw));r.loose=c}}if(r.loose)for(let l of r.items){l.loose=!0;for(let h of l.tokens)h.type==="text"&&(h.type="paragraph")}return r}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let s=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:s,raw:e[0],href:n,title:r}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let s=we(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
26
+ `):[],a={type:"table",raw:e[0],header:[],align:[],rows:[]};if(s.length===n.length){for(let i of n)this.rules.other.tableAlignRight.test(i)?a.align.push("right"):this.rules.other.tableAlignCenter.test(i)?a.align.push("center"):this.rules.other.tableAlignLeft.test(i)?a.align.push("left"):a.align.push(null);for(let i=0;i<s.length;i++)a.header.push({text:s[i],tokens:this.lexer.inline(s[i]),header:!0,align:a.align[i]});for(let i of r)a.rows.push(we(i,a.header.length).map((o,l)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:a.align[l]})));return a}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let s=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:s,tokens:this.lexer.inline(s)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let s=e[1].charAt(e[1].length-1)===`
27
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:s,tokens:this.lexer.inline(s)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let s=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let a=P(s.slice(0,-1),"\\");if((s.length-a.length)%2===0)return}else{let a=$t(e[2],"()");if(a===-2)return;if(a>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let n=e[2],r="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(n);a&&(n=a[1],r=a[3])}else r=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?n=n.slice(1):n=n.slice(1,-1)),ye(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let s;if((s=this.rules.inline.reflink.exec(t))||(s=this.rules.inline.nolink.exec(t))){let n=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[n.toLowerCase()];if(!r){let a=s[0].charAt(0);return{type:"text",raw:a,text:a}}return ye(s,r,s[0],this.lexer,this.rules)}}emStrong(t,e,s=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&s.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!s||this.rules.inline.punctuation.exec(s))){let r=[...n[0]].length-1,a,i,o=r,l=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+r);(n=h.exec(e))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(i=[...a].length,n[3]||n[4]){o+=i;continue}else if((n[5]||n[6])&&r%3&&!((r+i)%3)){l+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+l);let c=[...n[0]][0].length,p=t.slice(0,r+n.index+c+i);if(Math.min(r,i)%2){let k=p.slice(1,-1);return{type:"em",raw:p,text:k,tokens:this.lexer.inlineTokens(k)}}let d=p.slice(2,-2);return{type:"strong",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let s=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(s),r=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return n&&r&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:e[0],text:s}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,s=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!s||this.rules.inline.punctuation.exec(s))){let r=[...n[0]].length-1,a,i,o=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*t.length+r);(n=l.exec(e))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a||(i=[...a].length,i!==r))continue;if(n[3]||n[4]){o+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o);let h=[...n[0]][0].length,c=t.slice(0,r+n.index+h+i),p=c.slice(r,-r);return{type:"del",raw:c,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let s,n;return e[2]==="@"?(s=e[1],n="mailto:"+s):(s=e[1],n=s),{type:"link",raw:e[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let s,n;if(e[2]==="@")s=e[0],n="mailto:"+s;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);s=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let s=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:s}}}},w=class W{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||R,this.options.tokenizer=this.options.tokenizer||new Z,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let s={other:m,block:M.normal,inline:E.normal};this.options.pedantic?(s.block=M.pedantic,s.inline=E.pedantic):this.options.gfm&&(s.block=M.gfm,this.options.breaks?s.inline=E.breaks:s.inline=E.gfm),this.tokenizer.rules=s}static get rules(){return{block:M,inline:E}}static lex(e,s){return new W(s).lex(e)}static lexInline(e,s){return new W(s).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
28
+ `),this.blockTokens(e,this.tokens);for(let s=0;s<this.inlineQueue.length;s++){let n=this.inlineQueue[s];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,s=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(i=>(r=i.call({lexer:this},e,s))?(e=e.substring(r.raw.length),s.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let i=s.at(-1);r.raw.length===1&&i!==void 0?i.raw+=`
29
+ `:s.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let i=s.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
30
+ `)?"":`
31
+ `)+r.raw,i.text+=`
32
+ `+r.text,this.inlineQueue.at(-1).src=i.text):s.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),s.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),s.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),s.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),s.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),s.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),s.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let i=s.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
33
+ `)?"":`
34
+ `)+r.raw,i.text+=`
35
+ `+r.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},s.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),s.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),s.push(r);continue}let a=e;if(this.options.extensions?.startBlock){let i=1/0,o=e.slice(1),l;this.options.extensions.startBlock.forEach(h=>{l=h.call({lexer:this},o),typeof l=="number"&&l>=0&&(i=Math.min(i,l))}),i<1/0&&i>=0&&(a=e.substring(0,i+1))}if(this.state.top&&(r=this.tokenizer.paragraph(a))){let i=s.at(-1);n&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
36
+ `)?"":`
37
+ `)+r.raw,i.text+=`
38
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):s.push(r),n=a.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let i=s.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
39
+ `)?"":`
40
+ `)+r.raw,i.text+=`
41
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):s.push(r);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,s}inline(e,s=[]){return this.inlineQueue.push({src:e,tokens:s}),s}inlineTokens(e,s=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)l.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)a=r[2]?r[2].length:0,n=n.slice(0,r.index+a)+"["+"a".repeat(r[0].length-a-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,o="";for(;e;){i||(o=""),i=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},e,s))?(e=e.substring(l.raw.length),s.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let c=s.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):s.push(l);continue}if(l=this.tokenizer.emStrong(e,n,o)){e=e.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.del(e,n,o)){e=e.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),s.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),s.push(l);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,p=e.slice(1),d;this.options.extensions.startInline.forEach(k=>{d=k.call({lexer:this},p),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(l=this.tokenizer.inlineText(h)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),i=!0;let c=s.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):s.push(l);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return s}},N=class{options;parser;constructor(t){this.options=t||R}space(t){return""}code({text:t,lang:e,escaped:s}){let n=(e||"").match(m.notSpaceStart)?.[0],r=t.replace(m.endingNewline,"")+`
42
+ `;return n?'<pre><code class="language-'+$(n)+'">'+(s?r:$(r,!0))+`</code></pre>
43
+ `:"<pre><code>"+(s?r:$(r,!0))+`</code></pre>
44
+ `}blockquote({tokens:t}){return`<blockquote>
45
+ ${this.parser.parse(t)}</blockquote>
46
+ `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
47
+ `}hr(t){return`<hr>
48
+ `}list(t){let e=t.ordered,s=t.start,n="";for(let i=0;i<t.items.length;i++){let o=t.items[i];n+=this.listitem(o)}let r=e?"ol":"ul",a=e&&s!==1?' start="'+s+'"':"";return"<"+r+a+`>
49
+ `+n+"</"+r+`>
50
+ `}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
51
+ `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
52
+ `}table(t){let e="",s="";for(let r=0;r<t.header.length;r++)s+=this.tablecell(t.header[r]);e+=this.tablerow({text:s});let n="";for(let r=0;r<t.rows.length;r++){let a=t.rows[r];s="";for(let i=0;i<a.length;i++)s+=this.tablecell(a[i]);n+=this.tablerow({text:s})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
53
+ <thead>
54
+ `+e+`</thead>
55
+ `+n+`</table>
56
+ `}tablerow({text:t}){return`<tr>
57
+ ${t}</tr>
58
+ `}tablecell(t){let e=this.parser.parseInline(t.tokens),s=t.header?"th":"td";return(t.align?`<${s} align="${t.align}">`:`<${s}>`)+e+`</${s}>
59
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${$(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:s}){let n=this.parser.parseInline(s),r=be(t);if(r===null)return n;t=r;let a='<a href="'+t+'"';return e&&(a+=' title="'+$(e)+'"'),a+=">"+n+"</a>",a}image({href:t,title:e,text:s,tokens:n}){n&&(s=this.parser.parseInline(n,this.parser.textRenderer));let r=be(t);if(r===null)return $(s);t=r;let a=`<img src="${t}" alt="${$(s)}"`;return e&&(a+=` title="${$(e)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:$(t.text)}},ne=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},y=class F{options;renderer;textRenderer;constructor(e){this.options=e||R,this.options.renderer=this.options.renderer||new N,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ne}static parse(e,s){return new F(s).parse(e)}static parseInline(e,s){return new F(s).parseInline(e)}parse(e){this.renderer.parser=this;let s="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let i=r,o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){s+=o||"";continue}}let a=r;switch(a.type){case"space":{s+=this.renderer.space(a);break}case"hr":{s+=this.renderer.hr(a);break}case"heading":{s+=this.renderer.heading(a);break}case"code":{s+=this.renderer.code(a);break}case"table":{s+=this.renderer.table(a);break}case"blockquote":{s+=this.renderer.blockquote(a);break}case"list":{s+=this.renderer.list(a);break}case"checkbox":{s+=this.renderer.checkbox(a);break}case"html":{s+=this.renderer.html(a);break}case"def":{s+=this.renderer.def(a);break}case"paragraph":{s+=this.renderer.paragraph(a);break}case"text":{s+=this.renderer.text(a);break}default:{let i='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return s}parseInline(e,s=this.renderer){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let a=e[r];if(this.options.extensions?.renderers?.[a.type]){let o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=o||"";continue}}let i=a;switch(i.type){case"escape":{n+=s.text(i);break}case"html":{n+=s.html(i);break}case"link":{n+=s.link(i);break}case"image":{n+=s.image(i);break}case"checkbox":{n+=s.checkbox(i);break}case"strong":{n+=s.strong(i);break}case"em":{n+=s.em(i);break}case"codespan":{n+=s.codespan(i);break}case"br":{n+=s.br(i);break}case"del":{n+=s.del(i);break}case"text":{n+=s.text(i);break}default:{let o='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}},L=class{options;block;constructor(t){this.options=t||R}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?w.lex:w.lexInline}provideParser(){return this.block?y.parse:y.parseInline}},Tt=class{defaults=X();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=N;TextRenderer=ne;Lexer=w;Tokenizer=Z;Hooks=L;constructor(...t){this.use(...t)}walkTokens(t,e){let s=[];for(let n of t)switch(s=s.concat(e.call(this,n)),n.type){case"table":{let r=n;for(let a of r.header)s=s.concat(this.walkTokens(a.tokens,e));for(let a of r.rows)for(let i of a)s=s.concat(this.walkTokens(i.tokens,e));break}case"list":{let r=n;s=s.concat(this.walkTokens(r.items,e));break}default:{let r=n;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(a=>{let i=r[a].flat(1/0);s=s.concat(this.walkTokens(i,e))}):r.tokens&&(s=s.concat(this.walkTokens(r.tokens,e)))}}return s}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(s=>{let n={...s};if(n.async=this.defaults.async||n.async||!1,s.extensions&&(s.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let a=e.renderers[r.name];a?e.renderers[r.name]=function(...i){let o=r.renderer.apply(this,i);return o===!1&&(o=a.apply(this,i)),o}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[r.level];a?a.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),n.extensions=e),s.renderer){let r=this.defaults.renderer||new N(this.defaults);for(let a in s.renderer){if(!(a in r))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let i=a,o=s.renderer[i],l=r[i];r[i]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c||""}}n.renderer=r}if(s.tokenizer){let r=this.defaults.tokenizer||new Z(this.defaults);for(let a in s.tokenizer){if(!(a in r))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let i=a,o=s.tokenizer[i],l=r[i];r[i]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c}}n.tokenizer=r}if(s.hooks){let r=this.defaults.hooks||new L;for(let a in s.hooks){if(!(a in r))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let i=a,o=s.hooks[i],l=r[i];L.passThroughHooks.has(a)?r[i]=h=>{if(this.defaults.async&&L.passThroughHooksRespectAsync.has(a))return(async()=>{let p=await o.call(r,h);return l.call(r,p)})();let c=o.call(r,h);return l.call(r,c)}:r[i]=(...h)=>{if(this.defaults.async)return(async()=>{let p=await o.apply(r,h);return p===!1&&(p=await l.apply(r,h)),p})();let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c}}n.hooks=r}if(s.walkTokens){let r=this.defaults.walkTokens,a=s.walkTokens;n.walkTokens=function(i){let o=[];return o.push(a.call(this,i)),r&&(o=o.concat(r.call(this,i))),o}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return w.lex(t,e??this.defaults)}parser(t,e){return y.parse(t,e??this.defaults)}parseMarkdown(t){return(e,s)=>{let n={...s},r={...this.defaults,...n},a=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=t),r.async)return(async()=>{let i=r.hooks?await r.hooks.preprocess(e):e,o=await(r.hooks?await r.hooks.provideLexer():t?w.lex:w.lexInline)(i,r),l=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let h=await(r.hooks?await r.hooks.provideParser():t?y.parse:y.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(h):h})().catch(a);try{r.hooks&&(e=r.hooks.preprocess(e));let i=(r.hooks?r.hooks.provideLexer():t?w.lex:w.lexInline)(e,r);r.hooks&&(i=r.hooks.processAllTokens(i)),r.walkTokens&&this.walkTokens(i,r.walkTokens);let o=(r.hooks?r.hooks.provideParser():t?y.parse:y.parseInline)(i,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(i){return a(i)}}}onError(t,e){return s=>{if(s.message+=`
60
+ Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+$(s.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(s);throw s}}},T=new Tt;function g(t,e){return T.parse(t,e)}g.options=g.setOptions=function(t){return T.setOptions(t),g.defaults=T.defaults,$e(g.defaults),g};g.getDefaults=X;g.defaults=R;g.use=function(...t){return T.use(...t),g.defaults=T.defaults,$e(g.defaults),g};g.walkTokens=function(t,e){return T.walkTokens(t,e)};g.parseInline=T.parseInline;g.Parser=y;g.parser=y.parse;g.Renderer=N;g.TextRenderer=ne;g.Lexer=w;g.lexer=w.lex;g.Tokenizer=Z;g.Hooks=L;g.parse=g;var Yt=g.options,es=g.setOptions,ts=g.use,ss=g.walkTokens,rs=g.parseInline;var ns=y.parse,is=w.lex;function At(t){if(!t)return"";try{return g.parse(t,{async:!1,breaks:!0})}catch{return t}}function It(t){if(t.data.type!=="navigation")return null;let e=t.data.relevantLinks||[];return!t.data.suggestedLink&&!e.length?null:x`<div class="msg-nav-links">${t.data.suggestedLink&&x`<div class="msg-link-row"><calcite-link .href=${t.data.suggestedLink} target=_blank icon-start=launch>${Pe(t.data.suggestedLink,"Suggested")}</calcite-link></div>`||""}${e.length>0&&x`<ul class="msg-links-list">${ge(e,s=>`${s}-${index}`,(s,n)=>x`<li><calcite-link .href=${s} target=_blank icon-start=launch>${Pe(s,"Relevant")}</calcite-link></li>`)}</ul>`||""}</div>`}function _t(t){let{message:e,user:s}=t,n=e.role==="user",r=e.role==="assistant",a=e.role==="assistant"?e.data.summary:e.text,i=At(a);return x`<div class=${q({"bubble-row":!0,"bubble-row__user":n,"bubble-row__assistant":r})} role=listitem aria-label=${`${e.role} message`}><div class=${q(U("avatar",n&&"avatar__user",r&&"avatar__assistant"))}>${n?x`<calcite-avatar .username=${s.username??"User"} .thumbnail=${s.thumbnailUrl||void 0} .userId=${s.id} .fullName=${s.fullName||void 0}></calcite-avatar>`:x`<calcite-chip .icon=${r?"effects":"information-letter"} label appearance=outline-fill .kind=${r?"brand":"neutral"}></calcite-chip>`}</div><div class=${q(U("msg",n&&"msg__user",r&&"msg__assistant"))}><div class="msg-text">${fe(i)}</div>${r?It(e):null}</div></div>`}function Pe(t,e){try{let s=new URL(t);return e==="Suggested"?`${e}: ${s.hostname}`:s.hostname}catch{return e}}var zt=V`.bubble-row{display:flex;flex-direction:column;gap:.5rem}.bubble-row__user{flex-direction:row-reverse;padding-left:1.5rem}.avatar__user{align-self:flex-end}calcite-avatar{overflow:clip}.msg{display:flex;flex-direction:column;gap:.75rem}.suggested-nav{display:flex;flex-direction:column;gap:.5rem}.suggested-nav>*{width:fit-content}.msg-text{word-break:break-word}.msg-text>p{margin:0}.msg__user{padding:.5rem .75rem;border-radius:16px 16px 0;background-color:var(--calcite-color-surface-highlight)}.action-results{display:flex;flex-direction:column;gap:.5rem}.action-results>p{margin:0}.action-results>ul{display:flex;flex-direction:column;gap:.5rem}`;function b(t){return typeof t=="object"&&t!==null}var ae="http://127.0.0.1:9015",Et=`${ae}/v1/turn/stream`;function Pt(t){return`${ae}/v1/users/${encodeURIComponent(t)}/threads`}function Lt(t){return`${ae}/v1/threads/${encodeURIComponent(t)}/messages`}async function Ct(t,e){let s=await fetch(Pt(t),{signal:e});if(!s.ok)throw new Error(`Thread list request failed with status ${s.status}.`);let n=await s.json();if(!b(n))throw new Error("Thread list response is invalid.");let r=n.userId,a=qe(n.threads);if(typeof r!="string"||!a)throw new Error("Thread list response is invalid.");return{userId:r,threads:a.map(qt).filter(i=>i!==null)}}async function Bt(t,e){let s=await fetch(Lt(t),{signal:e});if(!s.ok)throw new Error(`Thread messages request failed with status ${s.status}.`);let n=await s.json();if(!b(n))throw new Error("Thread messages response is invalid.");let r=n.threadId,a=qe(n.messages);if(typeof r!="string"||!a)throw new Error("Thread messages response is invalid.");return{threadId:r,messages:a.map(Mt).filter(i=>i!==null)}}function qe(t){return Array.isArray(t)?t:null}function qt(t){if(!b(t))return null;let e=t.threadId,s=t.lastActivityAtMs;return typeof e!="string"||typeof s!="number"?null:{threadId:e,lastActivityAtMs:s}}function Mt(t){if(!b(t))return null;let e=t.id,s=t.role,n=t.content,r=t.type;if(typeof e!="string"||typeof s!="string"||typeof n!="string"||typeof r!="string")return null;let a=typeof t.checkpointNs=="string"?t.checkpointNs:void 0,i=typeof t.checkpointId=="string"?t.checkpointId:void 0;return{id:e,role:s,content:n,type:r,checkpointNs:a,checkpointId:i}}function Dt(t){return b(t)?typeof t.id=="string"&&typeof t.role=="string"&&typeof t.content=="string"&&typeof t.type=="string":!1}function Zt(t){return!b(t)||typeof t.userId!="string"||!Array.isArray(t.threads)?!1:t.threads.every(e=>b(e)&&typeof e.threadId=="string"&&typeof e.lastActivityAtMs=="number")}function Nt(t){return b(t)&&typeof t.threadId=="string"&&Array.isArray(t.messages)&&t.messages.every(Dt)}function jt(t){return t.role==="assistant"?{id:t.id,role:"assistant",data:{type:t.type==="navigation"?"navigation":"analytics",summary:t.content}}:t.role==="user"?{id:t.id,role:"user",text:t.content}:{id:t.id,role:"system",text:t.content}}function Qt(t){return typeof t!="object"||t===null||!("type"in t)||!("summary"in t)?!1:(t.type==="analytics"||t.type==="navigation")&&typeof t.summary=="string"}async function Ot(t){let e=t?.id||t?.username;if(!e)return null;let s=await Ct(e);if(!Zt(s))throw new Error("User threads response is invalid.");let n=s.threads[0]?.threadId;if(!n)return null;let r=await Bt(n);if(!Nt(r))throw new Error("Thread messages response is invalid.");return{threadId:n,messages:r.messages.map(jt)}}var Vt=V`:host{border-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);display:block;height:-moz-fit-content;height:fit-content;width:100%;--tw-shadow: 0 1px 6px -1px rgba(0, 0, 0, .16), 0 1px 2px -1px rgba(0, 0, 0, .08);--tw-shadow-colored: 0 1px 6px -1px var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}:host([expanded]){height:100%}.panel__body{display:flex;flex-direction:column;height:100%}.chat-container{overflow:auto;display:flex;flex-grow:1;padding-left:1.25rem;padding-right:1.25rem}.chat-container__inner{display:flex;flex-direction:column;gap:.75rem;width:100%;padding-top:1.25rem;padding-bottom:1.25rem}.thinking-container__header{position:relative;height:2rem;width:2rem}.loader{position:absolute;top:0;left:0;height:100%;width:100%;--calcite-loader-progress-color-inline: var(--calcite-color-brand)}.composer{background-color:var(--calcite-color-foreground-1);>*:has(*){border-width:0px;border-top-width:1px;border-style:solid;border-color:var(--calcite-color-border-3)}}.composer__input{padding:.75rem}.composer__footer{display:flex;align-items:center;justify-content:end;padding:.75rem;& p{margin:0}}.composer__actions{display:flex;gap:.5rem}.avatar__user{align-self:flex-end}calcite-avatar{overflow:clip}.thinking-container{display:flex;flex-direction:column;gap:.5rem;.thinking-text{animation:pulse 2s infinite ease-in-out}}@keyframes pulse{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.spacer{visibility:hidden;height:1.25rem;width:100%}@media(prefers-reduced-motion:reduce){.hit{transition:none}.chat{scroll-behavior:auto}}.dialog{--calcite-dialog-content-space: 0;--calcite-dialog-size-x: 1080px}.stage{height:100%;overflow:hidden;--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));background-color:var(--calcite-color-background)}@media screen and (min-width:1080px){.stage{height:min(700px,60vh)}}`;function Ht(t,e,s,n){let r=t?.id||"",a=Rt.findCredential(t.url)?.token??"",i=window.location.origin||window.location.href.replace(/#.*$/u,""),o=e?.username||t?.user?.username||"";return{threadId:s,userMessage:n,portalId:r,token:a,tokenReferrer:i,username:o}}function le(t){if(!b(t)||typeof t.type!="string"||typeof t.summary!="string")throw new Error("Assistant response must include type and summary fields.");if(t.type!=="analytics"&&t.type!=="navigation")throw new Error("Assistant response type must be either analytics or navigation.");let e=t.type==="navigation"&&Array.isArray(t.relevant_links)?t.relevant_links.filter(n=>typeof n=="string"&&!!n):[],s=t.type==="navigation"&&typeof t.suggested_link=="string"&&t.suggested_link?t.suggested_link:void 0;return t.type==="analytics"?{type:"analytics",summary:t.summary}:{type:"navigation",summary:t.summary,suggestedLink:s,relevantLinks:e}}var Ut=["thinking","routing","running-analytic","running-navigation","summarizing","saving-state","completed","error"];function Gt(t){return typeof t=="string"&&Ut.includes(t)}function Wt(t){return b(t)?(t.type==="analytics"||t.type==="navigation")&&typeof t.summary=="string":!1}function Ft(t){return t.replace(/\r\n?/gu,`
61
+ `)}function Le(t,e=!1){let s=Ft(t).split(`
62
+
63
+ `),n=e?"":s.pop()??"";return{blocks:s.map(r=>r.trim()).filter(Boolean),remainder:n}}function Ce(t){if(!b(t))return null;let e=t.status;if(!Gt(e))return null;let s=t.threadId;if(typeof s!="string")return null;if(e==="completed"){let n=t.response;return Wt(n)?{status:"completed",threadId:s,response:le(n)}:null}return e==="error"?typeof t.errorCode!="string"?null:{status:e,threadId:s,errorCode:t.errorCode,message:typeof t.message=="string"||t.message===null?t.message:void 0}:{status:e,threadId:s}}function Be(t){let e=t.trim();if(!e)return null;let s="message",n=[];for(let i of e.split(`
64
+ `)){let o=i.trimEnd();if(!(!o||o.startsWith(":"))){if(o.startsWith("event:")){s=o.slice(6).trim();continue}o.startsWith("data:")&&n.push(o.slice(5).trimStart())}}if(s!=="runtime"||!n.length)return null;let r=JSON.parse(n.join(`
65
+ `)),a=null;if(b(r)&&r.event==="runtime"?a=Ce(r.data):a=Ce(r),!a)throw new Error("Assistant stream event is invalid.");return{event:"runtime",data:a}}async function*Xt(t){let e=new TextDecoder,s="";for await(let n of t){s+=e.decode(n,{stream:!0});let r=Le(s);s=r.remainder;for(let a of r.blocks){let i=Be(a);i&&(yield i)}}if(s+=e.decode(),s.trim()){let n=Le(s,!0);for(let r of n.blocks){let a=Be(r);a&&(yield a)}}}function Jt(t){let e=t.data;if(e.status==="error")throw new Error(e.message??"Assistant stream reported an error.");return e.status==="completed"?{kind:"complete",status:"completed",data:le(e.response),threadId:e.threadId}:{kind:"progress",status:e.status,payload:e,threadId:e.threadId}}async function Kt({portal:t,user:e,userMessage:s,threadId:n,onStatus:r,signal:a}){let i=Ht(t,e,n,s),o=await fetch(Et,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:i.threadId,userMessage:i.userMessage,portalId:i.portalId,username:i.username,token:i.token,tokenReferrer:i.tokenReferrer}),signal:a});if(!o.ok)throw new Error(`Assistant stream request failed with status ${o.status}.`);if(!o.body)throw new Error("Assistant stream response body is missing.");let l,h=i.threadId;for await(let c of Xt(o.body)){let p=Jt(c);if(p.kind==="progress"){r?.(p.status,p.payload),p.threadId&&(h=p.threadId);continue}r?.(p.status,void 0),l=p.data,p.threadId&&(h=p.threadId)}if(l===void 0)throw new Error("Assistant stream ended without completed event data.");if(!h)throw new Error("Assistant response is missing threadId.");return{data:le(l),threadId:h}}var ie=class extends pe{constructor(){super(...arguments),this.t9n=de({blocking:!0}),this.textAreaEl=_(),this.voiceInputEl=_(),this.formEl=_(),this.chatAnchorEl=_(),this.hasLoadedThreadMessages=!1,this.refocusInput=async()=>{await this.updateComplete,this.textAreaEl.value?.focusTextArea()},this.setPanelAttribute=()=>{this.isPanelExpanded?this.el.setAttribute("expanded",String(this.isPanelExpanded)):this.el.removeAttribute("expanded")},this.togglePanel=()=>{let e=!this.isPanelExpanded;this.isPanelExpanded=e,this.arcgisAiAssistantPanelToggle.emit(e),this.setPanelAttribute()},this.initializeThreadMessages=async()=>{if(!(this.hasLoadedThreadMessages||!(this.user?.id||this.user?.username))){this.hasLoadedThreadMessages=!0;try{let e=await Ot(this.user);if(!e?.threadId)return;this.threadId=e.threadId,this.messages=e.messages}catch(e){this.hasLoadedThreadMessages=!1,console.error("Failed to initialize assistant threads.",e)}}},this.getStatusLabel=e=>{let{t9n:{status:s}}=this;switch(e){case"thinking":return s.thinking;case"routing":return s.routing;case"running-analytic":return s.runningAnalytic;case"running-navigation":return s.runningNavigation;case"summarizing":return s.summarizing;case"saving-state":return s.savingState;case"completed":return s.completed;case"error":return this.t9n.streamErrorOccurred;default:return s.waitingForResponse}},this.onSend=async()=>{let e=this.inputText.trim();if(!(!e||this.isSending)){this.isListening&&await this.voiceInputEl.value?.stopListening(),this.arcgisAiAssistantSend.emit({text:e}),this.messages=[...this.messages,{id:B(),role:"user",text:e}],this.inputText="",this.isSending=!0,this.isThinking=!0,this.streamStatus=this.t9n.status.waitingForResponse;try{let{portal:s,user:n,threadId:r}=this,a=await Kt({portal:s,user:n,userMessage:e,threadId:r,onStatus:o=>{this.streamStatus=this.getStatusLabel(o)}});if(typeof a!="object"||a===null||!("data"in a)||!Qt(a.data))throw new Error("Assistant response is invalid.");let i="threadId"in a&&typeof a.threadId=="string"?a.threadId:void 0;i&&(this.threadId=i),this.messages=[...this.messages,{id:B(),role:"assistant",data:a.data}]}catch(s){console.error(this.t9n.errorSendingTurn,s),this.messages=[...this.messages,{id:B(),role:"system",text:this.t9n.somethingWentWrong,error:!0}]}finally{this.isSending=!1,this.isThinking=!1,this.streamStatus=null,this.refocusInput()}}},this.isSending=!1,this.isThinking=!1,this.streamStatus=null,this.messages=[],this.inputText="",this.showVoiceInput=!0,this.isListening=!1,this.isVoiceInputDisabled=!1,this.isPanelExpanded=!1,this.defaultClosed=!1,this.openEntitiesInNewTab=!1,this.arcgisAiAssistantPanelToggle=H(),this.arcgisAiAssistantSend=H()}static{this.properties={isSending:16,isThinking:16,streamStatus:16,messages:16,inputText:16,showVoiceInput:16,isListening:16,isVoiceInputDisabled:16,isPanelExpanded:16,threadId:16,portal:0,user:0,config:0,defaultClosed:5,openEntitiesInNewTab:5}}static{this.styles=[Vt,zt]}load(){this.setPanelAttribute(),this.initializeThreadMessages()}connectedCallback(){super.connectedCallback(),this.isPanelExpanded=!this.defaultClosed}willUpdate(e){e.has("user")&&this.initializeThreadMessages(),e.has("messages")&&requestAnimationFrame(()=>this.scrollToBottom(!0))}scrollToBottom(e=!0){let s=this.chatAnchorEl.value;s&&this.updateComplete.then(()=>{s.scrollIntoView({behavior:e?"smooth":"auto",block:"end"})})}renderBubble(e){return _t({message:e,user:this.user})}renderComposer(){let{onSend:e,showVoiceInput:s,isListening:n,isVoiceInputDisabled:r,isSending:a,formEl:i,inputText:o,portal:l,user:h,t9n:c}=this;return x`<form class="composer" @submit=${p=>{p.preventDefault(),e()}} ${z(this.formEl)}><div class="composer__input"><arcgis-portal-mentionable-text-area .popoverListLabel=${c.mentionEntities} .portal=${l} .user=${h} @arcgisUserMentionableTextAreaKeyDown=${({detail:p})=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),i.value?.requestSubmit())}} .value=${o} .placeholder=${c.askMeAQuestionPlaceholder} @arcgisUserMentionableTextAreaChange=${p=>{this.inputText=p.detail??""}} .disabled=${a} rows=3 ${z(this.textAreaEl)}></arcgis-portal-mentionable-text-area></div><div class="composer__footer"><div class="composer__actions"><arcgis-portal-voice-input @arcgisVoiceInputStart=${()=>{this.isListening=!0,this.isVoiceInputDisabled=!1}} @arcgisVoiceInputStop=${()=>{this.isListening=!1,this.isVoiceInputDisabled=!1}} @arcgisVoiceInputError=${p=>{p.detail.errorCode==="not-supported"&&(this.showVoiceInput=!1)}} @arcgisVoiceInputInterimTranscription=${p=>{this.inputText=p.detail.text}} ${z(this.voiceInputEl)}></arcgis-portal-voice-input>${s&&x`<calcite-button icon-start=microphone .label=${c.voiceInput} round .disabled=${r||a} .appearance=${n?"solid":"outline-fill"} @click=${async()=>{this.isVoiceInputDisabled=!0;let p=this.voiceInputEl.value;n?await p?.stopListening():await p?.startListening()}}></calcite-button>`||""}<calcite-button type=submit appearance=solid round icon-start=send .disabled=${!this.inputText?.trim()||a} .label=${this.isSending?c.status.sending:c.send}></calcite-button></div></div></form>`}render(){let{isPanelExpanded:e,messages:s,isThinking:n,streamStatus:r,t9n:a}=this;return x`<calcite-panel icon=effects collapsible .collapsed=${!e} collapse-direction=up .heading=${a.heading} @calcitePanelToggle=${this.togglePanel}><div class="panel__body"><div class="chat-container"><div class="chat-container__inner">${s.map(i=>this.renderBubble(i))}${n&&x`<div class="thinking-container"><div class="thinking-container__header"><calcite-loader .label=${r??a.status.waitingForResponse} inline scale=l class="loader"></calcite-loader><calcite-chip icon=effects .label=${a.status.thinking} appearance=outline kind=neutral></calcite-chip></div><div class="thinking-text">${r}</div></div>`||""}<div class="spacer" ${z(this.chatAnchorEl)}></div></div></div><div slot=footer>${this.renderComposer()}</div></div></calcite-panel>`}};ue("arcgis-portal-ai-assistant",ie);return ie},"identity/IdentityManager")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import a from"./3OTUKLZI.js";import{a as f,b as w}from"./S2PHM4WZ.js";import{a as v}from"./LYZ5FW6Y.js";import"./3RPSRRKF.js";import{J as p,K as l,P as g,h as d,j as i}from"./GWHFVZ3O.js";export default $arcgis.t(([,{b:x}])=>{function A(s,e){let{fullName:r,firstName:a,lastName:t,username:n}=s;return r||(a&&t?e==="ja"?`${t} ${a}`:`${a} ${t}`:n)}var j=d`:host{max-width:100%;display:flex;align-items:center;min-width:0}.skeleton{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite;display:flex;align-items:center}.skeleton-avatar{border-radius:100%;background-color:var(--calcite-color-foreground-3);width:var(--arcgis-user-avatar-size);height:var(--arcgis-user-avatar-size)}.skeleton-name{background-color:var(--calcite-color-foreground-3);border-radius:var(--calcite-border-radius);width:var(--arcgis-user-avatar-skeleton-width);border-radius:var(--arcgis-user-avatar-spacing);height:var(--arcgis-user-avatar-spacing);margin-inline-start:var(--arcgis-user-avatar-spacing)}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.avatar{display:block;flex-grow:0;flex-shrink:0;border-radius:100%;background-color:var(--calcite-color-foreground-3);width:var(--arcgis-user-avatar-size);height:var(--arcgis-user-avatar-size)}.text{color:var(--calcite-color-text-2);display:flex;flex-direction:column;justify-content:center;min-width:0;text-align:start;margin-inline-start:var(--arcgis-user-avatar-spacing);line-height:calc(var(--arcgis-user-avatar-size) / 2)}.text--no-avatar{margin-inline-start:0}.-text-underline .title{text-decoration:underline}.text--clamp{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.text--ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.has-description{font-weight:500}.description{font-weight:400;color:var(--calcite-color-text-2)}:host([scale="xs"]){font-size:.75rem;--arcgis-user-avatar-size: 18px;--arcgis-user-avatar-spacing: .25rem ;.description{font-size:.625rem;margin-top:-.125rem}.text{line-height:1.35}}:host([scale="s"]){font-size:.75rem;--arcgis-user-avatar-size: 1.5rem ;--arcgis-user-avatar-spacing: .5rem ;--arcgis-user-avatar-skeleton-width: 4rem ;.description{font-size:.625rem}}:host([scale="m"]){font-size:.875rem;--arcgis-user-avatar-size: 2rem ;--arcgis-user-avatar-spacing: .75rem ;--arcgis-user-avatar-skeleton-width: 5rem ;.description{font-size:.75rem}}:host([scale="l"]){font-size:1rem;--arcgis-user-avatar-size: 2.5rem ;--arcgis-user-avatar-spacing: 1rem ;--arcgis-user-avatar-skeleton-width: 6rem ;.description{font-size:.875rem}}`,O=s=>s.thumbnailUrl!==void 0;function k(s,e,r=!1){if(O(s))return s.thumbnailUrl;let a=s.thumbnail;if(!a)return null;if(a.startsWith("http"))return a;let t=w(e);return`${r?"https://www.arcgis.com/sharing/rest/":f(e)}community/users/${s.username}/info/${a}${t&&!r?`?token=${t}`:""}`}var c=class extends p{constructor(){super(...arguments),this.messages=v({name:null}),this.thumbnailUrl=null,this.scale="m",this.showAvatar=!0}static{this.properties={user:0,portal:0,scale:3,showName:5,showAvatar:5,heading:1,description:1,underline:5,username:1,wrap:5,checkOnline:5}}static{this.styles=j}async load(){let{username:e,checkOnline:r,portal:a,user:t}=this;e&&a?this.user=await x(e,a,r):t&&a&&(this.thumbnailUrl=k(t,a,r))}updated(e){let r=e.get("user");r&&this.portal&&(this.thumbnailUrl=k(r,this.portal,this.checkOnline))}renderSkeleton(){return i`<div class="skeleton">${this.showAvatar&&i`<div class="skeleton-avatar"></div>`||""}${this.showName&&i`<div class="skeleton-name"></div>`||""}</div>`}renderUser(){let{user:e,messages:r,thumbnailUrl:a,showAvatar:t,showName:n,description:u,scale:m,underline:b,heading:$}=this;if(!e)return[];let{fullName:z,username:y,id:U}=e,o=!!u,N=(z?.split(" ")||[]).slice(0,2).join(" "),h=this.wrap?"text--clamp":"text--ellipsis";return[t&&i`<calcite-avatar class="avatar" .scale=${m==="xs"?"s":m} .fullName=${N} .username=${y} .userId=${U} .thumbnail=${a||void 0} .inert=${n||o?!0:void 0}></calcite-avatar>`||"",(n||o)&&i`<span class=${l({text:!0,"text--underline":b,"text--no-avatar":!t})}>${n&&i`<span class=${l({title:!0,"has-description":o,[h]:!0})}>${$||A(e,r._lang)}</span>`||""}${o&&i`<span class=${l({description:!0,[h]:!0})}>${u}</span>`||""}</span>`||""]}render(){return this.user&&this.messages._lang?this.renderUser():this.renderSkeleton()}};g("arcgis-user-avatar",c);return c},"portal/PortalUser",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import b from"./PRZKLMZ3.js";import a from"./PBZ25RYU.js";import"./E4LMIW7S.js";import{a as h}from"./3W2BQQUS.js";import"./EIJ3YMIH.js";import{I as n,K as c,O as l,h as e,j as s,o}from"./SPAXWYII.js";export default $arcgis.t(([,{a:f,b:d}])=>{var p=e`.banner{box-sizing:border-box;width:100%;left:0;text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);text-transform:uppercase;overflow-wrap:break-word}.invalid-container{background-color:#fff;color:#000;display:flex;align-items:center;justify-content:center;gap:8px}.invalid-icon{--calcite-icon-color: var(--calcite-color-status-danger)}.invalid-message{text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);overflow-wrap:break-word}`,r=class extends n{constructor(){super(...arguments),this.classificationModel=f(this),this.messages=h(),this._classificationDataTask=d(this),this.portalClassificationSchema=this.classificationModel.portalClassificationSchema,this.status=this.classificationModel.status,this.missingExistingClassification=!1,this.variant="full",this.autoDestroyDisabled=!1,this.validationErrors=""}static{this.properties={portalClassificationSchema:16,status:16,itemClassification:16,portalItem:0,missingExistingClassification:5,variant:1,autoDestroyDisabled:5,validationErrors:1}}static{this.styles=p}async destroy(){await this.manager.destroy()}willUpdate(a){if(a.has("portalItem")){let{portalItem:i}=this;i?.load().then(()=>{i?.id&&i?.loaded&&i?.classification&&!this.missingExistingClassification?this.classificationModel.validateClassification(this.variant==="preview"?null:i.id,i.classification,i?.portal.restUrl).catch(o(this)).then(t=>{this.validationErrors=t??""}):this.validationErrors=""}).catch(o(this))}}getStyle(){let a={};if(this.variant==="preview"&&(a.fontSize="var(--calcite-font-size-sm)",a.padding="var(--calcite-spacing-xs)"),this.itemClassification&&this.portalClassificationSchema){let i=this.itemClassification.classification,t=this.portalClassificationSchema.classificationMetadata.classificationValueProperties.find(({value:m})=>m===i);t?.backgroundColor&&(a.backgroundColor=t.backgroundColor),t?.textColor&&(a.color=t.textColor)}return a}render(){return this._classificationDataTask.render({pending:void 0,error:void 0,complete:()=>this.portalClassificationSchema&&this.portalItem?.portal.authMode!=="anonymous"?this.validationErrors&&this.variant==="full"?s`<div class="invalid-container"><calcite-icon class="invalid-icon" scale=s icon=exclamation-mark-triangle .textLabel=${this.messages.invalidclassificationerror}></calcite-icon><span class="invalid-message">${this.messages.invalidclassificationerror}</span></div>`:s`<div class="banner" style=${c(this.getStyle())}>${this.itemClassification?.banner??this.messages.notyetclassified??"Not yet classified"}</div>`:""})}};l("arcgis-portal-classification-banner",r);return r},a,b)
2
+ import b from"./WTJLLIOR.js";import"./E5QVAI6E.js";import a from"./PBZ25RYU.js";import{a as f}from"./LYZ5FW6Y.js";import"./3RPSRRKF.js";import{J as n,L as c,P as l,h as e,j as s,o}from"./GWHFVZ3O.js";export default $arcgis.t(([,{a:d,b:h}])=>{var p=e`.banner{box-sizing:border-box;width:100%;left:0;text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);text-transform:uppercase;overflow-wrap:break-word}.invalid-container{background-color:#fff;color:#000;display:flex;align-items:center;justify-content:center;gap:8px}.invalid-icon{--calcite-icon-color: var(--calcite-color-status-danger)}.invalid-message{text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);overflow-wrap:break-word}`,r=class extends n{constructor(){super(...arguments),this.classificationModel=d(this),this.messages=f(),this._classificationDataTask=h(this),this.portalClassificationSchema=this.classificationModel.portalClassificationSchema,this.status=this.classificationModel.status,this.missingExistingClassification=!1,this.variant="full",this.autoDestroyDisabled=!1,this.validationErrors=""}static{this.properties={portalClassificationSchema:16,status:16,itemClassification:16,portalItem:0,missingExistingClassification:5,variant:1,autoDestroyDisabled:5,validationErrors:1}}static{this.styles=p}async destroy(){await this.manager.destroy()}willUpdate(a){if(a.has("portalItem")){let{portalItem:i}=this;i?.load().then(()=>{i?.id&&i?.loaded&&i?.classification&&!this.missingExistingClassification?this.classificationModel.validateClassification(this.variant==="preview"?null:i.id,i.classification,i?.portal.restUrl).catch(o(this)).then(t=>{this.validationErrors=t??""}):this.validationErrors=""}).catch(o(this))}}getStyle(){let a={};if(this.variant==="preview"&&(a.fontSize="var(--calcite-font-size-sm)",a.padding="var(--calcite-spacing-xs)"),this.itemClassification&&this.portalClassificationSchema){let i=this.itemClassification.classification,t=this.portalClassificationSchema.classificationMetadata.classificationValueProperties.find(({value:m})=>m===i);t?.backgroundColor&&(a.backgroundColor=t.backgroundColor),t?.textColor&&(a.color=t.textColor)}return a}render(){return this._classificationDataTask.render({pending:void 0,error:void 0,complete:()=>this.portalClassificationSchema&&this.portalItem?.portal.authMode!=="anonymous"?this.validationErrors&&this.variant==="full"?s`<div class="invalid-container"><calcite-icon class="invalid-icon" scale=s icon=exclamation-mark-triangle .textLabel=${this.messages.invalidclassificationerror}></calcite-icon><span class="invalid-message">${this.messages.invalidclassificationerror}</span></div>`:s`<div class="banner" style=${c(this.getStyle())}>${this.itemClassification?.banner??this.messages.notyetclassified??"Not yet classified"}</div>`:""})}};l("arcgis-portal-classification-banner",r);return r},a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as m}from"./CH7DWRLT.js";import{a as h}from"./3W2BQQUS.js";import"./EIJ3YMIH.js";import{I as b,L as a,O as d,h as c,j as i,u}from"./SPAXWYII.js";var g=c`.spacing-y{margin:var(--calcite-spacing-md) 0}.portal-classification-form-element-tooltip{display:flex;justify-content:space-between;align-items:center}`;function s(o,e){return o.uiElement===e}var n=class extends b{constructor(){super(...arguments),this.messages=h(),this.isRequiredErrors=new Set,this.arcgisAttributeValueChange=u()}static{this.properties={validationMsg:16,attributeKey:1,attribute:0,value:0,renderingInfo:0,isRequiredErrors:0}}static{this.styles=g}willUpdate(e){(e.has("renderingInfo")||e.has("isRequiredErrors"))&&(this.validationMsg=this._getValidationMessage())}_getValidationMessage(){if(this.renderingInfo?.attributeValidationResult)return this.renderingInfo.attributeValidationResult;if(this.isRequiredErrors.has(this.attributeKey))return this.messages.requiredfield??"This is a required field."}renderCheckbox(){return s(this.attribute,"checkbox")?i`<calcite-label class="spacing-y" .for=${this.attributeKey} layout=inline><calcite-checkbox .checked=${this.value} id=${this.attributeKey??a} @calciteCheckboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.checked})} .required=${this.attribute.isRequired??!1} .status=${this.validationMsg?"invalid":"valid"}></calcite-checkbox>${this.attribute.label}</calcite-label>`:null}renderDateInput(){return s(this.attribute,"date")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-input-date-picker id=${this.attributeKey??a} .name=${this.attribute.label} @calciteInputDatePickerChange=${e=>this.isConnected&&this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} overlay-positioning=fixed .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-date-picker></calcite-label>`:null}renderTextInput(){if(!s(this.attribute,"text"))return null;let e=this.attribute.label,t=this.attribute.description;return i`<calcite-label .for=${this.attributeKey}><div class="portal-classification-form-element-tooltip">${e}${this.attribute.labelTooltip&&i`<div><calcite-icon scale=s icon=information .id=${`tooltip-button-${this.attribute.bannerLabel}`} text-label=${this.messages.information??"Information"??a}></calcite-icon><calcite-tooltip .referenceElement=${`tooltip-button-${this.attribute.bannerLabel}`} placement=right>${this.attribute.labelTooltip}</calcite-tooltip></div>`||""}</div><calcite-input-text id=${this.attributeKey??a} .label=${e} .name=${this.attributeKey} @calciteInputTextChange=${r=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:r.target.value})} .placeholder=${t} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-text></calcite-label>`}renderSingleSelect(){return s(this.attribute,"single-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox selection-mode=single id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} .placeholder=${this.attribute.description??this.messages.selectanoption} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} overlay-positioning=fixed validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value} data-testid=${`single-select-${this.attributeKey}`}>${this._renderSingleSelectComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderSingleSelectComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return m(this.renderingInfo?.valueExpressionResult,t=>t.label,t=>i`<calcite-combobox-item .selected=${e===t.value} .heading=${t.label} .value=${t.value} data-testid=${`single-combobox-item-${t.value}`}></calcite-combobox-item>`)}_renderComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return this.renderingInfo?.valueExpressionResult.map(t=>i`<calcite-combobox-item .selected=${e?.includes(t.value)} .heading=${t.label} .value=${t.value} data-testid=${`combobox-item-${t.value}`}></calcite-combobox-item>`)}renderMultiSelect(){return s(this.attribute,"multi-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderGroupedComboboxOptions(){if(!this.renderingInfo?.valueExpressionResult||Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return Object.entries(this.renderingInfo?.valueExpressionResult).map(([t,r])=>i`<calcite-combobox-item .selected=${e?.includes(t)} .heading=${t} .value=${t}>${r.map(l=>i`<calcite-combobox-item .selected=${e?.includes(l.value)} .heading=${l.label} .value=${l.value} data-testid=${`grouped-combobox-item-${l.value}`}></calcite-combobox-item>`)}</calcite-combobox-item>`)}renderMultiGroupedSelectNested(){return s(this.attribute,"multi-grouped-select-nested")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderGroupedComboboxOptions()}</calcite-combobox></calcite-label>`:null}render(){switch(this.attribute.uiElement){case"checkbox":return this.renderCheckbox();case"date":return this.renderDateInput();case"multi-select":return this.renderMultiSelect();case"multi-grouped-select-nested":return this.renderMultiGroupedSelectNested();case"single-select":return this.renderSingleSelect();case"text":return this.renderTextInput();default:return i`<div>Not Implemented Yet.</div>`}}};d("arcgis-portal-classification-form-element",n);export{n as ArcgisPortalClassificationFormElement};
2
+ import{a as m}from"./WZGUYBTB.js";import{a as h}from"./LYZ5FW6Y.js";import"./3RPSRRKF.js";import{J as b,M as a,P as d,h as c,j as i,u}from"./GWHFVZ3O.js";var g=c`.spacing-y{margin:var(--calcite-spacing-md) 0}.portal-classification-form-element-tooltip{display:flex;justify-content:space-between;align-items:center}`;function s(o,e){return o.uiElement===e}var n=class extends b{constructor(){super(...arguments),this.messages=h(),this.isRequiredErrors=new Set,this.arcgisAttributeValueChange=u()}static{this.properties={validationMsg:16,attributeKey:1,attribute:0,value:0,renderingInfo:0,isRequiredErrors:0}}static{this.styles=g}willUpdate(e){(e.has("renderingInfo")||e.has("isRequiredErrors"))&&(this.validationMsg=this._getValidationMessage())}_getValidationMessage(){if(this.renderingInfo?.attributeValidationResult)return this.renderingInfo.attributeValidationResult;if(this.isRequiredErrors.has(this.attributeKey))return this.messages.requiredfield??"This is a required field."}renderCheckbox(){return s(this.attribute,"checkbox")?i`<calcite-label class="spacing-y" .for=${this.attributeKey} layout=inline><calcite-checkbox .checked=${this.value} id=${this.attributeKey??a} @calciteCheckboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.checked})} .required=${this.attribute.isRequired??!1} .status=${this.validationMsg?"invalid":"valid"}></calcite-checkbox>${this.attribute.label}</calcite-label>`:null}renderDateInput(){return s(this.attribute,"date")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-input-date-picker id=${this.attributeKey??a} .name=${this.attribute.label} @calciteInputDatePickerChange=${e=>this.isConnected&&this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} overlay-positioning=fixed .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-date-picker></calcite-label>`:null}renderTextInput(){if(!s(this.attribute,"text"))return null;let e=this.attribute.label,t=this.attribute.description;return i`<calcite-label .for=${this.attributeKey}><div class="portal-classification-form-element-tooltip">${e}${this.attribute.labelTooltip&&i`<div><calcite-icon scale=s icon=information .id=${`tooltip-button-${this.attribute.bannerLabel}`} text-label=${this.messages.information??"Information"??a}></calcite-icon><calcite-tooltip .referenceElement=${`tooltip-button-${this.attribute.bannerLabel}`} placement=right>${this.attribute.labelTooltip}</calcite-tooltip></div>`||""}</div><calcite-input-text id=${this.attributeKey??a} .label=${e} .name=${this.attributeKey} @calciteInputTextChange=${r=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:r.target.value})} .placeholder=${t} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-text></calcite-label>`}renderSingleSelect(){return s(this.attribute,"single-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox selection-mode=single id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} .placeholder=${this.attribute.description??this.messages.selectanoption} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} overlay-positioning=fixed validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value} data-testid=${`single-select-${this.attributeKey}`}>${this._renderSingleSelectComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderSingleSelectComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return m(this.renderingInfo?.valueExpressionResult,t=>t.label,t=>i`<calcite-combobox-item .selected=${e===t.value} .heading=${t.label} .value=${t.value} data-testid=${`single-combobox-item-${t.value}`}></calcite-combobox-item>`)}_renderComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return this.renderingInfo?.valueExpressionResult.map(t=>i`<calcite-combobox-item .selected=${e?.includes(t.value)} .heading=${t.label} .value=${t.value} data-testid=${`combobox-item-${t.value}`}></calcite-combobox-item>`)}renderMultiSelect(){return s(this.attribute,"multi-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderGroupedComboboxOptions(){if(!this.renderingInfo?.valueExpressionResult||Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return Object.entries(this.renderingInfo?.valueExpressionResult).map(([t,r])=>i`<calcite-combobox-item .selected=${e?.includes(t)} .heading=${t} .value=${t}>${r.map(l=>i`<calcite-combobox-item .selected=${e?.includes(l.value)} .heading=${l.label} .value=${l.value} data-testid=${`grouped-combobox-item-${l.value}`}></calcite-combobox-item>`)}</calcite-combobox-item>`)}renderMultiGroupedSelectNested(){return s(this.attribute,"multi-grouped-select-nested")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderGroupedComboboxOptions()}</calcite-combobox></calcite-label>`:null}render(){switch(this.attribute.uiElement){case"checkbox":return this.renderCheckbox();case"date":return this.renderDateInput();case"multi-select":return this.renderMultiSelect();case"multi-grouped-select-nested":return this.renderMultiGroupedSelectNested();case"single-select":return this.renderSingleSelect();case"text":return this.renderTextInput();default:return i`<div>Not Implemented Yet.</div>`}}};d("arcgis-portal-classification-form-element",n);export{n as ArcgisPortalClassificationFormElement};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{A as o,B as a,k as r,l as s,z as n}from"./GWHFVZ3O.js";var i=class extends a{constructor(t){if(super(t),this.it=s,t.type!==n.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===s||t==null)return this._t=void 0,this.it=t;if(t===r)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};i.directiveName="unsafeHTML",i.resultType=1;var f=o(i);export{f as a};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{i as o}from"./SPAXWYII.js";var c={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},n=Symbol(),e=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,s)=>{this.o=t,this.h=s})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,s,r){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof s=="object"?s:{task:s,args:r};this.v=i.task,this.j=i.args,this.m=i.argsEqual??u,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),s=this.O;this.O=t,t===s||t===void 0||s!==void 0&&this.m(s,t)||await this.run(t)}async run(t){let s,r;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let a=!1;try{s=await this.v(t,{signal:this.q.signal})}catch(l){a=!0,r=l}if(this.p===i){if(s===n)this.i=0;else{if(a===!1){try{this.k?.(s)}catch{}this.i=2,this.o?.(s)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=s,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},u=(h,t)=>h===t||h.length===t.length&&h.every(((s,r)=>!o(s,t[r])));export{c as a,e as b};
2
+ import{i as o}from"./GWHFVZ3O.js";var c={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},n=Symbol(),e=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,s)=>{this.o=t,this.h=s})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,s,r){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof s=="object"?s:{task:s,args:r};this.v=i.task,this.j=i.args,this.m=i.argsEqual??u,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),s=this.O;this.O=t,t===s||t===void 0||s!==void 0&&this.m(s,t)||await this.run(t)}async run(t){let s,r;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let a=!1;try{s=await this.v(t,{signal:this.q.signal})}catch(l){a=!0,r=l}if(this.p===i){if(s===n)this.i=0;else{if(a===!1){try{this.k?.(s)}catch{}this.i=2,this.o?.(s)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=s,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},u=(h,t)=>h===t||h.length===t.length&&h.every(((s,r)=>!o(s,t[r])));export{c as a,e as b};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as R}from"./3W2BQQUS.js";import"./EIJ3YMIH.js";import{G as c,H as d,I as S,J as F,K as V,O as M,h as C,j as l,u as y}from"./SPAXWYII.js";export default $arcgis.t(([T,I,b,x,P,g,h,N,m,u,w,v,D,O,G,z,j,k,W,B,J])=>{var U=C`.extent-picker-modal{z-index:1001}.extent-picker-content{display:flex;min-height:100%;height:100%}.side-panel{padding:var(--calcite-spacing-lg);display:flex;flex-direction:column;overflow-y:auto;max-height:100%;width:420px}.extent-button{margin-top:var(--calcite-spacing-lg)}.use-location-header{margin-top:var(--calcite-spacing-xxxl);margin-bottom:var(--calcite-spacing-lg)}.search-container,.search-container .esri-search{width:100%}.search-container calcite-autocomplete{width:100%}.map-panel{flex:1 1 0%;position:relative;display:flex}.map-loader{position:absolute;z-index:var(--calcite-z-index-1);top:50%;left:50%;transform:translate(-50%,-50%)}.map-container{flex:1 1 0%;opacity:0;transition:opacity .3s ease}.loader-container{flex:1 1 0%}.map-container--loaded{opacity:1}.coordinates-section{margin-top:var(--calcite-spacing-lg)}`,L=class{constructor(e){this.outerRing=[[180,-90],[-180,-90],[-180,90],[180,90],[180,-90]],this.map=e}init(){this.maskSymbol=new k({color:[0,0,0,.5],outline:{color:[128,128,128,.5],width:"0px"}}),this.maskLayer=new v({id:"maskLayer "}),this.overlapLayer=new v({id:"overlapLayer"}),this.map?.add(this.maskLayer),this.map?.add(this.overlapLayer)}hide(){this.maskLayer.visible=!1}show(){this.maskLayer.visible=!0}add(e,t){let i=this.buildGraphic(e,t);if(i)return i.graphic&&this.maskLayer?.add(i.graphic),i}update(e,t,i){i?this.remove(null,i):this.clear();let a=this.buildGraphic(e,t);if(a)return a.graphic&&this.maskLayer?.add(a.graphic),a}clear(){this.maskLayer?.removeAll()}remove(e,t){!e&&!t||(t&&!e&&(e=this.maskLayer?.graphics.getItemAt(t)),e&&this.maskLayer?.remove(e))}buildGraphic(e,t=this.maskSymbol){let i={};if(!e)return i;if(e.type==="extent"&&e.xmax===e.xmin){let o=new h({rings:[this.outerRing]});return i.graphic=new u({geometry:o,symbol:t}),i}e=this.toWGS84(e);let a,s;if(e.type==="extent"){let o=this.checkPolyOverlap(e);o?(a=o?.ring?.reverse(),s=o?.oring?.reverse()):a=[[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin],[e.xmin,e.ymax]]}let r=[];e.xmin===e.xmax?r=[this.outerRing]:r=[this.outerRing,a?.reverse()||[[]]];let n=new h({rings:r});return s&&(i.overlap=s),i.graphic=new u({geometry:n,symbol:t}),i}checkPolyOverlap(e){let t={};if(e.xmax<=e.xmin){let i=[[e.xmin,e.ymin],[180,e.ymin],[180,e.ymax],[e.xmin,e.ymax],[e.xmin,e.ymin]],a=[[-180,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax],[-180,e.ymax],[-180,e.ymin]],s=180-Math.abs(e.xmax),r=180-Math.abs(e.xmin);return s>r?(t.ring=a,t.oring=i):(t.ring=i,t.oring=a),t}else return}toWGS84(e){let t=new N({wkid:4326});return m.canProject(e,t)?m.project(e,t):e}};function q(p){if(!p)return;let e=b.assetsPath;e.endsWith("/")||(e+="/"),p?.firstElementChild?.insertAdjacentHTML("beforebegin",`<link rel="stylesheet" href="${e}esri/themes/light/main.css" />`)}var $=class extends S{constructor(){super(...arguments),this.polygonSymbol=new k({style:"solid",color:new I([227,139,79,0]),outline:{color:new I([65,105,255]),width:0}}),this.dlOverlapSymbol=new k({style:"solid",color:[255,0,0,.5],outline:{color:[65,105,255],width:0}}),this.messages=R(),this.searchContainer=c(),this.mapContainer=c(),this.topCoordField=c(),this.bottomCoordField=c(),this.leftCoordField=c(),this.rightCoordField=c(),this.minLatLabel="",this.maxLatLabel="",this.minLngLabel="",this.maxLngLabel="",this.ymax="0",this.ymin="0",this.xmin="0",this.xmax="0",this.isDrawStart=!1,this.loading=!0,this.active=!1,this.contentOnly=!1,this.isArea=!1,this.arcgisExtentPickerChange=y(),this.arcgisExtentPickerClose=y(),this.arcgisExtentPickerSave=y()}static{this.properties={ymax:16,ymin:16,xmin:16,xmax:16,isDrawStart:16,loading:16,featureExtent:16,initialValue:16,active:5,extentValue:0,itemId:1,portal:0,extentService:1,contentOnly:5,isArea:5}}static{this.styles=U}getExtent(){return this.getExtentValue()}async load(){if(this.itemId){if(this.portal){let t=this.portal.url.replace("/sharing/rest/","");t!==b.portalUrl&&(b.portalUrl=t)}let e=new Intl.NumberFormat(w.getLocale(),{minimumFractionDigits:1,maximumFractionDigits:1});this.minLatLabel=e.format(-90),this.maxLatLabel=e.format(90),this.minLngLabel=e.format(-180),this.maxLngLabel=e.format(180),this.item=new z({id:this.itemId,portal:this.portal}),await this.item.load()}if(this.portal&&(this.orgExtent=this.portal.defaultExtent?.toJSON()),this.portal?.region){let e=this.portal.region,t=await j(`${this.portal.url.replace("/sharing/rest/","")}/sharing/rest/portals/self?region=${e}&default=true&f=pjson`,{responseType:"json"});this.orgRegionExtent=t.data.defaultExtent}}async loaded(){q(this.el.shadowRoot),await this.initMap()}convertToNumber(e){return this.parseNumber(e)}setFeatureExtent(e){let t;e.spatialReference.isGeographic?t=new x({xmax:e.xmax,xmin:e.xmin,ymax:e.ymax,ymin:e.ymin,spatialReference:{wkid:4326}}):t=this.toWGS84(e),this.featureExtent?(this.featureExtent.xmin=Math.min(t.xmin,this.featureExtent.xmin),this.featureExtent.ymin=Math.min(t.ymin,this.featureExtent.ymin),this.featureExtent.xmax=Math.max(t.xmax,this.featureExtent.xmax),this.featureExtent.ymax=Math.max(t.ymax,this.featureExtent.ymax)):this.featureExtent=t}async initMap(){let e=new G({basemap:"streets-vector"});if(this.extentService){let t=new O({url:this.extentService}),i=new T({baseLayers:[t],id:"org_basemap"});e.basemap=i}if(this.mask=new L(e),this.mask.init(),this.dateLineLayer=new v({id:"dateLineLayer"}),e.add(this.dateLineLayer),this.areasLayer=new v({id:"areaGraphics"}),e.add(this.areasLayer),this.item?.type==="Feature Service"||this.item?.type==="Map Service"){let t=await D.fromPortalItem({portalItem:this.item});t.visible=!1,e.add(t),t.when(i=>{if("layers"in i)for(let a=0;a<i.layers.length;a++)i.layers.getItemAt(a).queryExtent().then(s=>{s.extent&&this.setFeatureExtent(s.extent)});else i.queryExtent().then(a=>{a.extent&&this.setFeatureExtent(a.extent)})})}this.view=new W({map:e,popup:{dockEnabled:!0,dockOptions:{buttonEnabled:!1,breakpoint:!1,position:"bottom-center"}},zoom:2,center:[0,0],container:this.mapContainer.value}),this.view.when(async()=>{if(this.basemapExtent=this.getBasemapExtent(),this.itemExtent=this.item?.extent,this.extentValue?.xmax!==void 0&&this.extentValue?.xmin!==void 0&&this.extentValue?.ymax!==void 0&&this.extentValue?.ymin!==void 0)this.ymin=this.extentValue?.ymin||"0",this.ymax=this.extentValue?.ymax||"0",this.xmax=this.extentValue?.xmax||"0",this.xmin=this.extentValue?.xmin||"0",this.handleInputChange(),this.initialValue=this.currentExtent;else if(this.itemExtent)await this.drawExtent(this.itemExtent),this.initialValue=this.itemExtent;else if(this.featureExtent)await this.drawExtent(this.featureExtent),this.initialValue=this.featureExtent;else if(this.portal?.defaultExtent){let t=this.portal.defaultExtent.toJSON();await this.drawExtent(t),this.initialValue=t}this.initSearchWidget(),this.loading=!1})}getBasemapExtent(){try{let e,t,i,a;if(this.view?.map?.basemap?.hasOwnProperty("baseLayers")){let s=this.view.map.basemap.baseLayers;if(s.length>0){for(let r of s){let n=r.fullExtent||{xmin:0,ymin:0,xmax:0,ymax:0};e=e!==void 0&&e>n?.xmin?e:n.xmin,i=i!==void 0&&i>n?.ymin?i:n.ymin,t=t!==void 0&&t<n.xmax?t:n.xmax,a=a!==void 0&&a<n.ymax?a:n.ymax}return new x({xmin:e,xmax:t,ymin:i,ymax:a,spatialReference:this.view.spatialReference})}}return new x({ymin:-90,ymax:90,xmin:-180,xmax:180,spatialReference:{wkid:4326}})}catch{return new x({ymin:-90,ymax:90,xmin:-180,xmax:180,spatialReference:{wkid:4326}})}}async drawExtent(e){if(!e||!e.xmin&&e.xmin!==0||!e.xmax&&e.xmax!==0||!e.ymin&&e.ymin!==0||!e.ymax&&e.ymax!==0)return;let t=new h;t.spatialReference=e.spatialReference,t.addRing([new g({x:e.xmin,y:e.ymin}),new g({x:e.xmin,y:e.ymax}),new g({x:e.xmax,y:e.ymax}),new g({x:e.xmax,y:e.ymin}),new g({x:e.xmin,y:e.ymin})]),await this.addInitialExtentPicker({geometry:t})}toWGS84(e){let t=new N({wkid:4326});return m.canProject(e,t)?m.project(e,t):e}formatNum(e){return w.formatNumber(e,{minimumFractionDigits:6,maximumFractionDigits:6})}strippedInvalidChars(e){let t=Array.from({length:10},(i,a)=>a.toString()).join("");return Array.from(e).filter(i=>t.includes(i)||i==="."||i==="-").join("")}parseNumber(e){let t=e.replace(",",".");return t=this.strippedInvalidChars(t),parseFloat(t)}async startupSketching(e,t){if(e&&(e=this.toMap(e)),this.sketchViewModel=new J({updateOnGraphicClick:!1,layer:this.areasLayer,view:this.view,polygonSymbol:this.polygonSymbol}),this.clearAllGraphics(),!t)if(e){e.type==="extent"&&(e=h.fromExtent(e)),this.currentExtent=this.toWGS84(e?.extent?.toJSON()),this.ymax=this.formatNum(this.currentExtent.ymax),this.ymin=this.formatNum(this.currentExtent.ymin),this.xmin=this.formatNum(this.currentExtent.xmin),this.xmax=this.formatNum(this.currentExtent.xmax),this.arcgisExtentPickerChange.emit(this.getExtentValue()),e=P.intersect(e,this.basemapExtent);let i=new u({symbol:this.polygonSymbol,geometry:e});i.geometry&&(this.fallbackExtent=i.geometry.extent,this.areasLayer?.add(i),this.mask?.clear(),this.mask?.update(i.geometry.extent),await this.zoomTo(),setTimeout(async()=>{try{i.layer&&await this.sketchViewModel?.update([i],{tool:"transform",enableRotation:!1,toggleToolOnClick:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!1}})}catch{}},0))}else this.sketchViewModel.create("rectangle");this.addSketchListeners()}addSketchListeners(){this.sketchViewModel?.on("update",async e=>{if(!e.toolEventInfo)return;let t=e?.graphics?.[0]?.geometry?.extent,i=t&&this.mask?.update(t);if(e.toolEventInfo.type==="scale-stop"||e.toolEventInfo.type==="move-stop"){let a,s=parseFloat(`${t?.xmax??"0"}`).toFixed(6),r=parseFloat(`${t?.xmin??"0"}`).toFixed(6),n=parseFloat(`${t?.ymax??"0"}`).toFixed(6),o=parseFloat(`${t?.ymin??"0"}`).toFixed(6);if(s===r||n===o?(a=t,s===r&&(a.xmax+=1),n===o&&(a.ymax+=1)):a=e?.graphics?.[0]?.geometry?.extent,i?.overlap){let E=i.graphic?.geometry,A=new h({rings:[E?.rings[1]]});await this.addInitialExtentPicker({geometry:A.extent})}else await this.startupSketching(a);this.isDrawStart=!1}else if(this.dateLineLayer?.removeAll(),i?.overlap){let a=new u({geometry:new h({rings:[i.overlap]}),symbol:this.dlOverlapSymbol});this.dateLineLayer?.add(a)}}),this.sketchViewModel?.on("create",async e=>{if(this.dateLineLayer?.removeAll(),!e.graphic)return;this.mask?.clear();let t=e?.graphic?.geometry?.extent,i=this.mask?.add(t);if(i?.overlap?(this.remainderPoly=new u({geometry:new h({rings:[i.overlap]}),symbol:this.dlOverlapSymbol}),this.dateLineLayer?.add(this.remainderPoly)):this.remainderPoly=null,e.state==="complete"){let a,s=e.graphic?.geometry?.extent?.xmin||0,r=e.graphic?.geometry?.extent?.xmax||0,n=e.graphic?.geometry?.extent?.ymin||0,o=e.graphic?.geometry?.extent?.ymax||0;if(s===r||n===o)s===r&&(r=r+1),n===o&&(o=o+1),a=new x({xmin:s,xmax:r,ymin:n,ymax:o,spatialReference:e.graphic?.geometry?.extent?.spatialReference});else{let E=i?.graphic?.geometry;a=new h({rings:[E?.rings[1]]}).extent}this.remainderPoly?await this.addInitialExtentPicker({geometry:a}):await this.startupSketching(a),this.isDrawStart=!1,this.mapContainer.value.focus()}})}async addInitialExtentPicker(e){if(!e.geometry){await this.startupSketching(null,!0);return}let t=this.toMap(e.geometry);await this.startupSketching(t)}async zoomTo(){if(this.areasLayer?.graphics){let e;if(this.areasLayer.graphics.forEach(i=>{let a=i?.geometry?.extent;e=e?e.union(a):a}),!e)return;let t=this.toMap(x.fromJSON(e.toJSON()).expand(1.35));t&&await this.view?.goTo(t)}}clearAllGraphics(){this.sketchViewModel?.cancel(),this.view?.map?.layers?.forEach(e=>{e.type==="graphics"&&e.removeAll()})}toMap(e){return this.view&&m.canProject(e,this.view)?m.project(e,this.view.spatialReference):e}initSearchWidget(){let e=new B({view:this.view,popupEnabled:!1,resultGraphicEnabled:!1,container:this.searchContainer.value}),t=e.viewModel;e.viewModel.allSources.on("change",()=>{t.allSources.forEach(i=>{i.zoomScale=null})}),e.on("select-result",i=>{this.startupSketching(i.result.extent)})}getExtentValue(){return{extent:{ymin:this.normalizeDecimal(this.ymin),ymax:this.normalizeDecimal(this.ymax),xmin:this.normalizeDecimal(this.xmin),xmax:this.normalizeDecimal(this.xmax)}}}handleInputChange(){let e=this.parseNumber(this.ymin),t=this.parseNumber(this.ymax),i=this.parseNumber(this.xmin),a=this.parseNumber(this.xmax),s=new x({spatialReference:{wkid:4326},xmin:i,xmax:a,ymin:e,ymax:t});this.currentExtent=s,this.drawExtent(s)}handleSave(){if(!this.topCoordField.value.isValid()){this.topCoordField.value.setFocus();return}if(!this.bottomCoordField.value.isValid()){this.bottomCoordField.value.setFocus();return}if(!this.leftCoordField.value.isValid()){this.leftCoordField.value.setFocus();return}if(!this.rightCoordField.value.isValid()){this.rightCoordField.value.setFocus();return}this.arcgisExtentPickerSave.emit(this.getExtentValue())}normalizeDecimal(e){return e.replace(",",".")}formatLongitudeError(e){return e.replace("${minLng}",this.minLngLabel).replace("${maxLng}",this.maxLngLabel)}formatLatitudeError(e){return e.replace("${minLat}",this.minLatLabel).replace("${maxLat}",this.maxLatLabel)}async timeout(e){return await new Promise(t=>setTimeout(t,e))}renderModal(){return l`<calcite-dialog class="extent-picker-modal" role=dialog scale=l outside-close-disabled .open=${this.active} placement=cover @calciteDialogClose=${()=>{this.arcgisExtentPickerClose.emit()}} style=${V({"--calcite-dialog-content-space":"0"})} .heading=${this.isArea?this.messages.setArea:this.messages.setExtent} heading-level=3><div class="extent-picker-content">${this.renderContent()}</div>${this.initialValue&&l`<calcite-button appearance=outline slot=footer-start icon-start=reset @click=${async()=>{if(this.initialValue){let e=+this.ymin===f(this.initialValue.ymin)&&+this.ymax===f(this.initialValue.ymax);+this.xmin===f(this.initialValue.xmin)&&+this.xmax===f(this.initialValue.xmax)&&e&&(this.ymin="0",this.ymax="0",this.xmin="0",this.xmax="0",await this.timeout(100)),this.drawExtent(this.initialValue)}}}>${this.messages.revert}</calcite-button>`||""}<calcite-button appearance=outline slot=footer-end @click=${()=>this.arcgisExtentPickerClose.emit()}>${this.messages.cancel}</calcite-button><calcite-button slot=footer-end @click=${async()=>this.handleSave()}>${this.messages.save}</calcite-button></calcite-dialog>`}renderContent(){let e=!!(this.portal&&!this.portal.id),t=!!(this.orgExtent&&!e),i=!!(this.orgRegionExtent&&!e),a=!!this.featureExtent;return l`<div class="side-panel">${!(!t&&!i&&!a)&&l`<div>${this.isArea?this.messages.areaBasedOn:this.messages.extentBasedOn}</div>${t&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=organization @click=${()=>{this.drawExtent(this.orgExtent)}}>${this.messages.orgExtent}</calcite-button>`||""}${i&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=organization @click=${()=>{this.drawExtent(this.orgRegionExtent)}}>${this.messages.orgRegion}</calcite-button>`||""}${a&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=feature-layer @click=${()=>{this.drawExtent(this.featureExtent)}}>${this.messages.currentFeatures}</calcite-button>`||""}`||""}<div class="use-location-header">${this.messages.useLocation}</div><div class="search-container"><div ${d(this.searchContainer)}></div></div><div><div class="use-location-header">${this.isArea?this.messages.drawAreaTitle:this.messages.drawExtentTitle}</div><calcite-action .text=${(this.isArea?this.messages.drawArea:this.messages.drawExtent)||""} text-enabled icon=rectangle-plus .active=${this.isDrawStart} .indicator=${this.isDrawStart} @click=${async()=>{this.isDrawStart=!this.isDrawStart,this.isDrawStart?(this.sketchViewModel||await this.startupSketching(),this.clearAllGraphics(),this.sketchViewModel?.create("rectangle")):(this.sketchViewModel?.cancel(),this.startupSketching(this.fallbackExtent))}}></calcite-action></div><div class="coordinates-section"><calcite-accordion appearance=transparent icon-position=start scale=l><calcite-accordion-item .heading=${this.messages.coordinates}><p>${this.messages.coordinatesDescription}</p><arcgis-portal-extent-picker-coord-field input-id=top-coord .label=${this.messages.top} .value=${this.strippedInvalidChars(this.ymax)} .errorMessage=${this.formatLatitudeError(this.messages.invalidTop||"")} min=-90 max=90 @arcgisCoordChange=${s=>{this.ymax=s.detail;let r=this.bottomCoordField.value.checkRelatedField();r&&(this.ymin=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.topGreaterThanBottom} .validateRelated=${s=>s>this.convertToNumber(this.ymin)} ${d(this.topCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=bottom-coord .label=${this.messages.bottom} .value=${this.strippedInvalidChars(this.ymin)} .errorMessage=${this.formatLatitudeError(this.messages.invalidBottom||"")} min=-90 max=90 @arcgisCoordChange=${s=>{this.ymin=s.detail;let r=this.topCoordField.value.checkRelatedField();r&&(this.ymax=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.bottomLessThanTop} .validateRelated=${s=>s<this.convertToNumber(this.ymax)} ${d(this.bottomCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=left-coord .label=${this.messages.left} .value=${this.strippedInvalidChars(this.xmin)} .errorMessage=${this.formatLongitudeError(this.messages.invalidLeft||"")} min=-180 max=180 @arcgisCoordChange=${s=>{this.xmin=s.detail;let r=this.rightCoordField.value.checkRelatedField();r&&(this.xmax=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.leftLessThanRight} .validateRelated=${s=>s<this.convertToNumber(this.xmax)} ${d(this.leftCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=right-coord .label=${this.messages.right} .value=${this.strippedInvalidChars(this.xmax)} .errorMessage=${this.formatLongitudeError(this.messages.invalidRight||"")} min=-180 max=180 @arcgisCoordChange=${s=>{this.xmax=s.detail;let r=this.leftCoordField.value.checkRelatedField();r&&(this.xmin=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.rightGreaterThanLeft} .validateRelated=${s=>s>this.convertToNumber(this.xmin)} ${d(this.rightCoordField)}></arcgis-portal-extent-picker-coord-field></calcite-accordion-item></calcite-accordion></div></div><div class="map-panel">${this.loading&&l`<calcite-loader class="map-loader" label="Loading the application"></calcite-loader>`||""}<div class=${F({"map-container":!0,"map-container--loaded":!this.loading})} ${d(this.mapContainer)}></div></div>`}render(){return this.contentOnly?l`<div class="extent-picker-content">${this.renderContent()}</div>`:this.renderModal()}};function f(p){return Math.round(p*1e6)/1e6}M("arcgis-portal-extent-picker",$);return $},"Basemap","Color","config","geometry/Extent","geometry/geometryEngine","geometry/Point","geometry/Polygon","geometry/SpatialReference","geometry/support/webMercatorUtils","Graphic","intl","layers/GraphicsLayer","layers/Layer","layers/TileLayer","Map","portal/PortalItem","request","symbols/SimpleFillSymbol","views/MapView","widgets/Search","widgets/Sketch/SketchViewModel")
2
+ import{a as R}from"./LYZ5FW6Y.js";import"./3RPSRRKF.js";import{H as c,I as d,J as S,K as F,L as V,P as M,h as C,j as l,u as y}from"./GWHFVZ3O.js";export default $arcgis.t(([T,I,b,x,P,g,h,N,m,u,w,v,D,O,G,z,j,k,W,B,J])=>{var U=C`.extent-picker-modal{z-index:1001}.extent-picker-content{display:flex;min-height:100%;height:100%}.side-panel{padding:var(--calcite-spacing-lg);display:flex;flex-direction:column;overflow-y:auto;max-height:100%;width:420px}.extent-button{margin-top:var(--calcite-spacing-lg)}.use-location-header{margin-top:var(--calcite-spacing-xxxl);margin-bottom:var(--calcite-spacing-lg)}.search-container,.search-container .esri-search{width:100%}.search-container calcite-autocomplete{width:100%}.map-panel{flex:1 1 0%;position:relative;display:flex}.map-loader{position:absolute;z-index:var(--calcite-z-index-1);top:50%;left:50%;transform:translate(-50%,-50%)}.map-container{flex:1 1 0%;opacity:0;transition:opacity .3s ease}.loader-container{flex:1 1 0%}.map-container--loaded{opacity:1}.coordinates-section{margin-top:var(--calcite-spacing-lg)}`,L=class{constructor(e){this.outerRing=[[180,-90],[-180,-90],[-180,90],[180,90],[180,-90]],this.map=e}init(){this.maskSymbol=new k({color:[0,0,0,.5],outline:{color:[128,128,128,.5],width:"0px"}}),this.maskLayer=new v({id:"maskLayer "}),this.overlapLayer=new v({id:"overlapLayer"}),this.map?.add(this.maskLayer),this.map?.add(this.overlapLayer)}hide(){this.maskLayer.visible=!1}show(){this.maskLayer.visible=!0}add(e,t){let i=this.buildGraphic(e,t);if(i)return i.graphic&&this.maskLayer?.add(i.graphic),i}update(e,t,i){i?this.remove(null,i):this.clear();let a=this.buildGraphic(e,t);if(a)return a.graphic&&this.maskLayer?.add(a.graphic),a}clear(){this.maskLayer?.removeAll()}remove(e,t){!e&&!t||(t&&!e&&(e=this.maskLayer?.graphics.getItemAt(t)),e&&this.maskLayer?.remove(e))}buildGraphic(e,t=this.maskSymbol){let i={};if(!e)return i;if(e.type==="extent"&&e.xmax===e.xmin){let o=new h({rings:[this.outerRing]});return i.graphic=new u({geometry:o,symbol:t}),i}e=this.toWGS84(e);let a,s;if(e.type==="extent"){let o=this.checkPolyOverlap(e);o?(a=o?.ring?.reverse(),s=o?.oring?.reverse()):a=[[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin],[e.xmin,e.ymax]]}let r=[];e.xmin===e.xmax?r=[this.outerRing]:r=[this.outerRing,a?.reverse()||[[]]];let n=new h({rings:r});return s&&(i.overlap=s),i.graphic=new u({geometry:n,symbol:t}),i}checkPolyOverlap(e){let t={};if(e.xmax<=e.xmin){let i=[[e.xmin,e.ymin],[180,e.ymin],[180,e.ymax],[e.xmin,e.ymax],[e.xmin,e.ymin]],a=[[-180,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax],[-180,e.ymax],[-180,e.ymin]],s=180-Math.abs(e.xmax),r=180-Math.abs(e.xmin);return s>r?(t.ring=a,t.oring=i):(t.ring=i,t.oring=a),t}else return}toWGS84(e){let t=new N({wkid:4326});return m.canProject(e,t)?m.project(e,t):e}};function q(p){if(!p)return;let e=b.assetsPath;e.endsWith("/")||(e+="/"),p?.firstElementChild?.insertAdjacentHTML("beforebegin",`<link rel="stylesheet" href="${e}esri/themes/light/main.css" />`)}var $=class extends S{constructor(){super(...arguments),this.polygonSymbol=new k({style:"solid",color:new I([227,139,79,0]),outline:{color:new I([65,105,255]),width:0}}),this.dlOverlapSymbol=new k({style:"solid",color:[255,0,0,.5],outline:{color:[65,105,255],width:0}}),this.messages=R(),this.searchContainer=c(),this.mapContainer=c(),this.topCoordField=c(),this.bottomCoordField=c(),this.leftCoordField=c(),this.rightCoordField=c(),this.minLatLabel="",this.maxLatLabel="",this.minLngLabel="",this.maxLngLabel="",this.ymax="0",this.ymin="0",this.xmin="0",this.xmax="0",this.isDrawStart=!1,this.loading=!0,this.active=!1,this.contentOnly=!1,this.isArea=!1,this.arcgisExtentPickerChange=y(),this.arcgisExtentPickerClose=y(),this.arcgisExtentPickerSave=y()}static{this.properties={ymax:16,ymin:16,xmin:16,xmax:16,isDrawStart:16,loading:16,featureExtent:16,initialValue:16,active:5,extentValue:0,itemId:1,portal:0,extentService:1,contentOnly:5,isArea:5}}static{this.styles=U}getExtent(){return this.getExtentValue()}async load(){if(this.itemId){if(this.portal){let t=this.portal.url.replace("/sharing/rest/","");t!==b.portalUrl&&(b.portalUrl=t)}let e=new Intl.NumberFormat(w.getLocale(),{minimumFractionDigits:1,maximumFractionDigits:1});this.minLatLabel=e.format(-90),this.maxLatLabel=e.format(90),this.minLngLabel=e.format(-180),this.maxLngLabel=e.format(180),this.item=new z({id:this.itemId,portal:this.portal}),await this.item.load()}if(this.portal&&(this.orgExtent=this.portal.defaultExtent?.toJSON()),this.portal?.region){let e=this.portal.region,t=await j(`${this.portal.url.replace("/sharing/rest/","")}/sharing/rest/portals/self?region=${e}&default=true&f=pjson`,{responseType:"json"});this.orgRegionExtent=t.data.defaultExtent}}async loaded(){q(this.el.shadowRoot),await this.initMap()}convertToNumber(e){return this.parseNumber(e)}setFeatureExtent(e){let t;e.spatialReference.isGeographic?t=new x({xmax:e.xmax,xmin:e.xmin,ymax:e.ymax,ymin:e.ymin,spatialReference:{wkid:4326}}):t=this.toWGS84(e),this.featureExtent?(this.featureExtent.xmin=Math.min(t.xmin,this.featureExtent.xmin),this.featureExtent.ymin=Math.min(t.ymin,this.featureExtent.ymin),this.featureExtent.xmax=Math.max(t.xmax,this.featureExtent.xmax),this.featureExtent.ymax=Math.max(t.ymax,this.featureExtent.ymax)):this.featureExtent=t}async initMap(){let e=new G({basemap:"streets-vector"});if(this.extentService){let t=new O({url:this.extentService}),i=new T({baseLayers:[t],id:"org_basemap"});e.basemap=i}if(this.mask=new L(e),this.mask.init(),this.dateLineLayer=new v({id:"dateLineLayer"}),e.add(this.dateLineLayer),this.areasLayer=new v({id:"areaGraphics"}),e.add(this.areasLayer),this.item?.type==="Feature Service"||this.item?.type==="Map Service"){let t=await D.fromPortalItem({portalItem:this.item});t.visible=!1,e.add(t),t.when(i=>{if("layers"in i)for(let a=0;a<i.layers.length;a++)i.layers.getItemAt(a).queryExtent().then(s=>{s.extent&&this.setFeatureExtent(s.extent)});else i.queryExtent().then(a=>{a.extent&&this.setFeatureExtent(a.extent)})})}this.view=new W({map:e,popup:{dockEnabled:!0,dockOptions:{buttonEnabled:!1,breakpoint:!1,position:"bottom-center"}},zoom:2,center:[0,0],container:this.mapContainer.value}),this.view.when(async()=>{if(this.basemapExtent=this.getBasemapExtent(),this.itemExtent=this.item?.extent,this.extentValue?.xmax!==void 0&&this.extentValue?.xmin!==void 0&&this.extentValue?.ymax!==void 0&&this.extentValue?.ymin!==void 0)this.ymin=this.extentValue?.ymin||"0",this.ymax=this.extentValue?.ymax||"0",this.xmax=this.extentValue?.xmax||"0",this.xmin=this.extentValue?.xmin||"0",this.handleInputChange(),this.initialValue=this.currentExtent;else if(this.itemExtent)await this.drawExtent(this.itemExtent),this.initialValue=this.itemExtent;else if(this.featureExtent)await this.drawExtent(this.featureExtent),this.initialValue=this.featureExtent;else if(this.portal?.defaultExtent){let t=this.portal.defaultExtent.toJSON();await this.drawExtent(t),this.initialValue=t}this.initSearchWidget(),this.loading=!1})}getBasemapExtent(){try{let e,t,i,a;if(this.view?.map?.basemap?.hasOwnProperty("baseLayers")){let s=this.view.map.basemap.baseLayers;if(s.length>0){for(let r of s){let n=r.fullExtent||{xmin:0,ymin:0,xmax:0,ymax:0};e=e!==void 0&&e>n?.xmin?e:n.xmin,i=i!==void 0&&i>n?.ymin?i:n.ymin,t=t!==void 0&&t<n.xmax?t:n.xmax,a=a!==void 0&&a<n.ymax?a:n.ymax}return new x({xmin:e,xmax:t,ymin:i,ymax:a,spatialReference:this.view.spatialReference})}}return new x({ymin:-90,ymax:90,xmin:-180,xmax:180,spatialReference:{wkid:4326}})}catch{return new x({ymin:-90,ymax:90,xmin:-180,xmax:180,spatialReference:{wkid:4326}})}}async drawExtent(e){if(!e||!e.xmin&&e.xmin!==0||!e.xmax&&e.xmax!==0||!e.ymin&&e.ymin!==0||!e.ymax&&e.ymax!==0)return;let t=new h;t.spatialReference=e.spatialReference,t.addRing([new g({x:e.xmin,y:e.ymin}),new g({x:e.xmin,y:e.ymax}),new g({x:e.xmax,y:e.ymax}),new g({x:e.xmax,y:e.ymin}),new g({x:e.xmin,y:e.ymin})]),await this.addInitialExtentPicker({geometry:t})}toWGS84(e){let t=new N({wkid:4326});return m.canProject(e,t)?m.project(e,t):e}formatNum(e){return w.formatNumber(e,{minimumFractionDigits:6,maximumFractionDigits:6})}strippedInvalidChars(e){let t=Array.from({length:10},(i,a)=>a.toString()).join("");return Array.from(e).filter(i=>t.includes(i)||i==="."||i==="-").join("")}parseNumber(e){let t=e.replace(",",".");return t=this.strippedInvalidChars(t),parseFloat(t)}async startupSketching(e,t){if(e&&(e=this.toMap(e)),this.sketchViewModel=new J({updateOnGraphicClick:!1,layer:this.areasLayer,view:this.view,polygonSymbol:this.polygonSymbol}),this.clearAllGraphics(),!t)if(e){e.type==="extent"&&(e=h.fromExtent(e)),this.currentExtent=this.toWGS84(e?.extent?.toJSON()),this.ymax=this.formatNum(this.currentExtent.ymax),this.ymin=this.formatNum(this.currentExtent.ymin),this.xmin=this.formatNum(this.currentExtent.xmin),this.xmax=this.formatNum(this.currentExtent.xmax),this.arcgisExtentPickerChange.emit(this.getExtentValue()),e=P.intersect(e,this.basemapExtent);let i=new u({symbol:this.polygonSymbol,geometry:e});i.geometry&&(this.fallbackExtent=i.geometry.extent,this.areasLayer?.add(i),this.mask?.clear(),this.mask?.update(i.geometry.extent),await this.zoomTo(),setTimeout(async()=>{try{i.layer&&await this.sketchViewModel?.update([i],{tool:"transform",enableRotation:!1,toggleToolOnClick:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!1}})}catch{}},0))}else this.sketchViewModel.create("rectangle");this.addSketchListeners()}addSketchListeners(){this.sketchViewModel?.on("update",async e=>{if(!e.toolEventInfo)return;let t=e?.graphics?.[0]?.geometry?.extent,i=t&&this.mask?.update(t);if(e.toolEventInfo.type==="scale-stop"||e.toolEventInfo.type==="move-stop"){let a,s=parseFloat(`${t?.xmax??"0"}`).toFixed(6),r=parseFloat(`${t?.xmin??"0"}`).toFixed(6),n=parseFloat(`${t?.ymax??"0"}`).toFixed(6),o=parseFloat(`${t?.ymin??"0"}`).toFixed(6);if(s===r||n===o?(a=t,s===r&&(a.xmax+=1),n===o&&(a.ymax+=1)):a=e?.graphics?.[0]?.geometry?.extent,i?.overlap){let E=i.graphic?.geometry,A=new h({rings:[E?.rings[1]]});await this.addInitialExtentPicker({geometry:A.extent})}else await this.startupSketching(a);this.isDrawStart=!1}else if(this.dateLineLayer?.removeAll(),i?.overlap){let a=new u({geometry:new h({rings:[i.overlap]}),symbol:this.dlOverlapSymbol});this.dateLineLayer?.add(a)}}),this.sketchViewModel?.on("create",async e=>{if(this.dateLineLayer?.removeAll(),!e.graphic)return;this.mask?.clear();let t=e?.graphic?.geometry?.extent,i=this.mask?.add(t);if(i?.overlap?(this.remainderPoly=new u({geometry:new h({rings:[i.overlap]}),symbol:this.dlOverlapSymbol}),this.dateLineLayer?.add(this.remainderPoly)):this.remainderPoly=null,e.state==="complete"){let a,s=e.graphic?.geometry?.extent?.xmin||0,r=e.graphic?.geometry?.extent?.xmax||0,n=e.graphic?.geometry?.extent?.ymin||0,o=e.graphic?.geometry?.extent?.ymax||0;if(s===r||n===o)s===r&&(r=r+1),n===o&&(o=o+1),a=new x({xmin:s,xmax:r,ymin:n,ymax:o,spatialReference:e.graphic?.geometry?.extent?.spatialReference});else{let E=i?.graphic?.geometry;a=new h({rings:[E?.rings[1]]}).extent}this.remainderPoly?await this.addInitialExtentPicker({geometry:a}):await this.startupSketching(a),this.isDrawStart=!1,this.mapContainer.value.focus()}})}async addInitialExtentPicker(e){if(!e.geometry){await this.startupSketching(null,!0);return}let t=this.toMap(e.geometry);await this.startupSketching(t)}async zoomTo(){if(this.areasLayer?.graphics){let e;if(this.areasLayer.graphics.forEach(i=>{let a=i?.geometry?.extent;e=e?e.union(a):a}),!e)return;let t=this.toMap(x.fromJSON(e.toJSON()).expand(1.35));t&&await this.view?.goTo(t)}}clearAllGraphics(){this.sketchViewModel?.cancel(),this.view?.map?.layers?.forEach(e=>{e.type==="graphics"&&e.removeAll()})}toMap(e){return this.view&&m.canProject(e,this.view)?m.project(e,this.view.spatialReference):e}initSearchWidget(){let e=new B({view:this.view,popupEnabled:!1,resultGraphicEnabled:!1,container:this.searchContainer.value}),t=e.viewModel;e.viewModel.allSources.on("change",()=>{t.allSources.forEach(i=>{i.zoomScale=null})}),e.on("select-result",i=>{this.startupSketching(i.result.extent)})}getExtentValue(){return{extent:{ymin:this.normalizeDecimal(this.ymin),ymax:this.normalizeDecimal(this.ymax),xmin:this.normalizeDecimal(this.xmin),xmax:this.normalizeDecimal(this.xmax)}}}handleInputChange(){let e=this.parseNumber(this.ymin),t=this.parseNumber(this.ymax),i=this.parseNumber(this.xmin),a=this.parseNumber(this.xmax),s=new x({spatialReference:{wkid:4326},xmin:i,xmax:a,ymin:e,ymax:t});this.currentExtent=s,this.drawExtent(s)}handleSave(){if(!this.topCoordField.value.isValid()){this.topCoordField.value.setFocus();return}if(!this.bottomCoordField.value.isValid()){this.bottomCoordField.value.setFocus();return}if(!this.leftCoordField.value.isValid()){this.leftCoordField.value.setFocus();return}if(!this.rightCoordField.value.isValid()){this.rightCoordField.value.setFocus();return}this.arcgisExtentPickerSave.emit(this.getExtentValue())}normalizeDecimal(e){return e.replace(",",".")}formatLongitudeError(e){return e.replace("${minLng}",this.minLngLabel).replace("${maxLng}",this.maxLngLabel)}formatLatitudeError(e){return e.replace("${minLat}",this.minLatLabel).replace("${maxLat}",this.maxLatLabel)}async timeout(e){return await new Promise(t=>setTimeout(t,e))}renderModal(){return l`<calcite-dialog class="extent-picker-modal" role=dialog scale=l outside-close-disabled .open=${this.active} placement=cover @calciteDialogClose=${()=>{this.arcgisExtentPickerClose.emit()}} style=${V({"--calcite-dialog-content-space":"0"})} .heading=${this.isArea?this.messages.setArea:this.messages.setExtent} heading-level=3><div class="extent-picker-content">${this.renderContent()}</div>${this.initialValue&&l`<calcite-button appearance=outline slot=footer-start icon-start=reset @click=${async()=>{if(this.initialValue){let e=+this.ymin===f(this.initialValue.ymin)&&+this.ymax===f(this.initialValue.ymax);+this.xmin===f(this.initialValue.xmin)&&+this.xmax===f(this.initialValue.xmax)&&e&&(this.ymin="0",this.ymax="0",this.xmin="0",this.xmax="0",await this.timeout(100)),this.drawExtent(this.initialValue)}}}>${this.messages.revert}</calcite-button>`||""}<calcite-button appearance=outline slot=footer-end @click=${()=>this.arcgisExtentPickerClose.emit()}>${this.messages.cancel}</calcite-button><calcite-button slot=footer-end @click=${async()=>this.handleSave()}>${this.messages.save}</calcite-button></calcite-dialog>`}renderContent(){let e=!!(this.portal&&!this.portal.id),t=!!(this.orgExtent&&!e),i=!!(this.orgRegionExtent&&!e),a=!!this.featureExtent;return l`<div class="side-panel">${!(!t&&!i&&!a)&&l`<div>${this.isArea?this.messages.areaBasedOn:this.messages.extentBasedOn}</div>${t&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=organization @click=${()=>{this.drawExtent(this.orgExtent)}}>${this.messages.orgExtent}</calcite-button>`||""}${i&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=organization @click=${()=>{this.drawExtent(this.orgRegionExtent)}}>${this.messages.orgRegion}</calcite-button>`||""}${a&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=feature-layer @click=${()=>{this.drawExtent(this.featureExtent)}}>${this.messages.currentFeatures}</calcite-button>`||""}`||""}<div class="use-location-header">${this.messages.useLocation}</div><div class="search-container"><div ${d(this.searchContainer)}></div></div><div><div class="use-location-header">${this.isArea?this.messages.drawAreaTitle:this.messages.drawExtentTitle}</div><calcite-action .text=${(this.isArea?this.messages.drawArea:this.messages.drawExtent)||""} text-enabled icon=rectangle-plus .active=${this.isDrawStart} .indicator=${this.isDrawStart} @click=${async()=>{this.isDrawStart=!this.isDrawStart,this.isDrawStart?(this.sketchViewModel||await this.startupSketching(),this.clearAllGraphics(),this.sketchViewModel?.create("rectangle")):(this.sketchViewModel?.cancel(),this.startupSketching(this.fallbackExtent))}}></calcite-action></div><div class="coordinates-section"><calcite-accordion appearance=transparent icon-position=start scale=l><calcite-accordion-item .heading=${this.messages.coordinates}><p>${this.messages.coordinatesDescription}</p><arcgis-portal-extent-picker-coord-field input-id=top-coord .label=${this.messages.top} .value=${this.strippedInvalidChars(this.ymax)} .errorMessage=${this.formatLatitudeError(this.messages.invalidTop||"")} min=-90 max=90 @arcgisCoordChange=${s=>{this.ymax=s.detail;let r=this.bottomCoordField.value.checkRelatedField();r&&(this.ymin=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.topGreaterThanBottom} .validateRelated=${s=>s>this.convertToNumber(this.ymin)} ${d(this.topCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=bottom-coord .label=${this.messages.bottom} .value=${this.strippedInvalidChars(this.ymin)} .errorMessage=${this.formatLatitudeError(this.messages.invalidBottom||"")} min=-90 max=90 @arcgisCoordChange=${s=>{this.ymin=s.detail;let r=this.topCoordField.value.checkRelatedField();r&&(this.ymax=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.bottomLessThanTop} .validateRelated=${s=>s<this.convertToNumber(this.ymax)} ${d(this.bottomCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=left-coord .label=${this.messages.left} .value=${this.strippedInvalidChars(this.xmin)} .errorMessage=${this.formatLongitudeError(this.messages.invalidLeft||"")} min=-180 max=180 @arcgisCoordChange=${s=>{this.xmin=s.detail;let r=this.rightCoordField.value.checkRelatedField();r&&(this.xmax=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.leftLessThanRight} .validateRelated=${s=>s<this.convertToNumber(this.xmax)} ${d(this.leftCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=right-coord .label=${this.messages.right} .value=${this.strippedInvalidChars(this.xmax)} .errorMessage=${this.formatLongitudeError(this.messages.invalidRight||"")} min=-180 max=180 @arcgisCoordChange=${s=>{this.xmax=s.detail;let r=this.leftCoordField.value.checkRelatedField();r&&(this.xmin=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.rightGreaterThanLeft} .validateRelated=${s=>s>this.convertToNumber(this.xmin)} ${d(this.rightCoordField)}></arcgis-portal-extent-picker-coord-field></calcite-accordion-item></calcite-accordion></div></div><div class="map-panel">${this.loading&&l`<calcite-loader class="map-loader" label="Loading the application"></calcite-loader>`||""}<div class=${F({"map-container":!0,"map-container--loaded":!this.loading})} ${d(this.mapContainer)}></div></div>`}render(){return this.contentOnly?l`<div class="extent-picker-content">${this.renderContent()}</div>`:this.renderModal()}};function f(p){return Math.round(p*1e6)/1e6}M("arcgis-portal-extent-picker",$);return $},"Basemap","Color","config","geometry/Extent","geometry/geometryEngine","geometry/Point","geometry/Polygon","geometry/SpatialReference","geometry/support/webMercatorUtils","Graphic","intl","layers/GraphicsLayer","layers/Layer","layers/TileLayer","Map","portal/PortalItem","request","symbols/SimpleFillSymbol","views/MapView","widgets/Search","widgets/Sketch/SketchViewModel")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- export default $arcgis.t(([c,{once:l}])=>{var D=(t,e,r)=>{let a=d(t,e,r);return a=m(r,a),a},d=(t,e,r)=>{let a=r.classificationMetadata.defaultValue,s=structuredClone(t)??{[e]:a};return s[e]??=a,s},$=(t,e)=>t&&Object.fromEntries(Object.entries(t).filter(([r])=>e.get(r)?.enabled!==!1)),m=(t,e)=>{let r=structuredClone(e);return Object.entries(t.attributes).forEach(([a,s])=>{if(r?.[a])return;let{uiElement:o,defaultValue:n}=s;switch(o){case"date":r&&(r[a]=p(s));break;case"multi-select":case"multi-grouped-select-nested":n&&r&&(r[a]=[n]);break;case"checkbox":n&&r&&(r[a]=n==="true");break;case"single-select":case"text":n&&r&&(r[a]=n);break}}),r?.fgi||delete r?.fgiOptions,r},p=t=>{let e=new Date,{type:r,defaultDateTimeline:a,defaultDateTimelineUnits:s}=t;if(r==="date"&&a&&s)switch(s.toLowerCase()){case"years":e.setFullYear(e.getFullYear()+a);break;case"months":e.setMonth(e.getMonth()+a);break;case"days":e.setDate(e.getDate()+a);break}let o=(e.getMonth()+1).toString(),n=e.getDate().toString();return`${e.getFullYear()}-${o.length===1?`0${o}`:o}-${n.length===1?`0${n}`:n}`},k=(t,e,r)=>{let a=e?.createdUser,s=e?.createdDate;return e={[r]:t,...a?{createdUser:a}:{},...s?{createdDate:s}:{}},e},U=async t=>{try{if(!t)return!1;t.loaded||await t.load();let e=t.portal.user??await l(()=>t?.portal.user);if(!e)return!1;let r=e.privileges.includes("portal:admin:updateItems");return i(t,e)||g(t,e)||r||t.access==="shared"&&await f(t,e)}catch(e){return console.error(e),!1}};function i(t,e){return t.owner===e.username}function g(t,e){let r=t.owner,a=t.itemControl==="admin",s=["esri_livingatlas","esri_demographics","esri_boundaries"];return t.portal?.isPortal&&!i(t,e)&&a&&r?.includes("esri_")&&!s.includes(r)?!1:a}var f=async(t,e)=>{let r=t.portal.restUrl,a=(await h(e,r)).result??[],s=(await b(t,r)).result??[];return a?.some(o=>s?.some(n=>o.id===n.id&&o.capabilities.includes("updateitemcontrol")))},h=async(t,e)=>{let r=`${e}/community/users/${t.username}`;try{return{result:(await c(r,{query:{f:"json"},responseType:"json"})).data?.groups??[]}}catch{return{error:{code:"unhandledError"}}}},b=async(t,e)=>{let r=t.id,a=`${e}/content/items/${r}/groups`;try{let s=await c(a,{query:{f:"json",method:"post"},responseType:"json"}),o=s.data?.admin??[],n=s.data?.member??[],u=s.data?.other??[];return{result:[...o,...n,...u]}}catch{return{error:{code:"unhandledError"}}}},j=(t,e)=>{let r=Date.now(),a=t?.portal.user?.username??"",{createdUser:s=a,createdDate:o=r}=e??{};return{createdUser:s,createdDate:o,lastEditedUser:a,lastEditedDate:r}};return{a:D,b:$,c:m,d:k,e:U,f:j}},"request","core/reactiveUtils")
2
+ export default $arcgis.t(([{once:l},c])=>{var D=(t,e,r)=>{let a=d(t,e,r);return a=m(r,a),a},d=(t,e,r)=>{let a=r.classificationMetadata.defaultValue,s=structuredClone(t)??{[e]:a};return s[e]??=a,s},$=(t,e)=>t&&Object.fromEntries(Object.entries(t).filter(([r])=>e.get(r)?.enabled!==!1)),m=(t,e)=>{let r=structuredClone(e);return Object.entries(t.attributes).forEach(([a,s])=>{if(r?.[a])return;let{uiElement:o,defaultValue:n}=s;switch(o){case"date":r&&(r[a]=p(s));break;case"multi-select":case"multi-grouped-select-nested":n&&r&&(r[a]=[n]);break;case"checkbox":n&&r&&(r[a]=n==="true");break;case"single-select":case"text":n&&r&&(r[a]=n);break}}),r?.fgi||delete r?.fgiOptions,r},p=t=>{let e=new Date,{type:r,defaultDateTimeline:a,defaultDateTimelineUnits:s}=t;if(r==="date"&&a&&s)switch(s.toLowerCase()){case"years":e.setFullYear(e.getFullYear()+a);break;case"months":e.setMonth(e.getMonth()+a);break;case"days":e.setDate(e.getDate()+a);break}let o=(e.getMonth()+1).toString(),n=e.getDate().toString();return`${e.getFullYear()}-${o.length===1?`0${o}`:o}-${n.length===1?`0${n}`:n}`},k=(t,e,r)=>{let a=e?.createdUser,s=e?.createdDate;return e={[r]:t,...a?{createdUser:a}:{},...s?{createdDate:s}:{}},e},U=async t=>{try{if(!t)return!1;t.loaded||await t.load();let e=t.portal.user??await l(()=>t?.portal.user);if(!e)return!1;let r=e.privileges.includes("portal:admin:updateItems");return i(t,e)||g(t,e)||r||t.access==="shared"&&await f(t,e)}catch(e){return console.error(e),!1}};function i(t,e){return t.owner===e.username}function g(t,e){let r=t.owner,a=t.itemControl==="admin",s=["esri_livingatlas","esri_demographics","esri_boundaries"];return t.portal?.isPortal&&!i(t,e)&&a&&r?.includes("esri_")&&!s.includes(r)?!1:a}var f=async(t,e)=>{let r=t.portal.restUrl,a=(await h(e,r)).result??[],s=(await b(t,r)).result??[];return a?.some(o=>s?.some(n=>o.id===n.id&&o.capabilities.includes("updateitemcontrol")))},h=async(t,e)=>{let r=`${e}/community/users/${t.username}`;try{return{result:(await c(r,{query:{f:"json"},responseType:"json"})).data?.groups??[]}}catch{return{error:{code:"unhandledError"}}}},b=async(t,e)=>{let r=t.id,a=`${e}/content/items/${r}/groups`;try{let s=await c(a,{query:{f:"json",method:"post"},responseType:"json"}),o=s.data?.admin??[],n=s.data?.member??[],u=s.data?.other??[];return{result:[...o,...n,...u]}}catch{return{error:{code:"unhandledError"}}}},j=(t,e)=>{let r=Date.now(),a=t?.portal.user?.username??"",{createdUser:s=a,createdDate:o=r}=e??{};return{createdUser:s,createdDate:o,lastEditedUser:a,lastEditedDate:r}};return{a:D,b:$,c:m,d:k,e:U,f:j}},"core/reactiveUtils","request")
@@ -0,0 +1,4 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ var Y=globalThis,Z=Y.ShadowRoot&&(Y.ShadyCSS===void 0||Y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vt=Symbol(),Mt=new WeakMap,M=class{constructor(t,e,o){if(this._$cssResult$=!0,o!==vt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Z&&t===void 0){let o=e!==void 0&&e.length===1;o&&(t=Mt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&Mt.set(e,t))}return t}toString(){return this.cssText}},kt=s=>new M(typeof s=="string"?s:s+"",void 0,vt),Ce=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((o,r,n)=>o+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new M(e,s,vt)},jt=(s,t)=>{if(Z)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let o=document.createElement("style"),r=Y.litNonce;r!==void 0&&o.setAttribute("nonce",r),o.textContent=e.cssText,s.appendChild(o)}},Et=Z?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let o of t.cssRules)e+=o.cssText;return kt(e)})(s):s;var{is:we,defineProperty:Oe,getOwnPropertyDescriptor:Te,getOwnPropertyNames:Se,getOwnPropertySymbols:Pe,getPrototypeOf:Ne}=Object,tt=globalThis,Ht=tt.trustedTypes,De=Ht?Ht.emptyScript:"",xe=tt.reactiveElementPolyfillSupport,k=(s,t)=>s,X={toAttribute(s,t){switch(t){case Boolean:s=s?De:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},j=(s,t)=>!we(s,t),zt={attribute:!0,type:String,converter:X,reflect:!1,useDefault:!1,hasChanged:j};Symbol.metadata??=Symbol("metadata"),tt.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=zt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let o=Symbol(),r=this.getPropertyDescriptor(t,o,e);r!==void 0&&Oe(this.prototype,t,r)}}static getPropertyDescriptor(t,e,o){let{get:r,set:n}=Te(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:r,set(i){let a=r?.call(this);n?.call(this,i),this.requestUpdate(t,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??zt}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;let t=Ne(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){let e=this.properties,o=[...Se(e),...Pe(e)];for(let r of o)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[o,r]of e)this.elementProperties.set(o,r)}this._$Eh=new Map;for(let[e,o]of this.elementProperties){let r=this._$Eu(e,o);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let o=new Set(t.flat(1/0).reverse());for(let r of o)e.unshift(Et(r))}else t!==void 0&&e.push(Et(t));return e}static _$Eu(t,e){let o=e.attribute;return o===!1?void 0:typeof o=="string"?o:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let o of e.keys())this.hasOwnProperty(o)&&(t.set(o,this[o]),delete this[o]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return jt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,o){this._$AK(t,o)}_$ET(t,e){let o=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,o);if(r!==void 0&&o.reflect===!0){let n=(o.converter?.toAttribute!==void 0?o.converter:X).toAttribute(e,o.type);this._$Em=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){let o=this.constructor,r=o._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let n=o.getPropertyOptions(r),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:X;this._$Em=r;let a=i.fromAttribute(e,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,e,o,r=!1,n){if(t!==void 0){let i=this.constructor;if(r===!1&&(n=this[t]),o??=i.getPropertyOptions(t),!((o.hasChanged??j)(n,e)||o.useDefault&&o.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,o))))return;this.C(t,e,o)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:o,reflect:r,wrapped:n},i){o&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||o||(e=void 0),this._$AL.set(t,e)),r===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[r,n]of o){let{wrapped:i}=n,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(o=>o.hostUpdate?.()),this.update(e)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[k("elementProperties")]=new Map,_[k("finalized")]=new Map,xe?.({ReactiveElement:_}),(tt.reactiveElementVersions??=[]).push("2.1.2");var bt=globalThis,Vt=s=>s,et=bt.trustedTypes,Bt=et?et.createPolicy("lit-html",{createHTML:s=>s}):void 0,_t="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,At="?"+A,Le=`<${At}>`,T=document,z=()=>T.createComment(""),V=s=>s===null||typeof s!="object"&&typeof s!="function",Ct=Array.isArray,Qt=s=>Ct(s)||typeof s?.[Symbol.iterator]=="function",$t=`[
3
+ \f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Wt=/-->/g,Ft=/>/g,w=RegExp(`>|${$t}(?:([^\\s"'>=/]+)(${$t}*=${$t}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),qt=/'/g,Gt=/"/g,Jt=/^(?:script|style|textarea|title)$/i,wt=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),ys=wt(1),gs=wt(2),vs=wt(3),f=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Kt=new WeakMap,O=T.createTreeWalker(T,129);function Yt(s,t){if(!Ct(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bt!==void 0?Bt.createHTML(t):t}var Zt=(s,t)=>{let e=s.length-1,o=[],r,n=t===2?"<svg>":t===3?"<math>":"",i=H;for(let a=0;a<e;a++){let c=s[a],l,u,h=-1,m=0;for(;m<c.length&&(i.lastIndex=m,u=i.exec(c),u!==null);)m=i.lastIndex,i===H?u[1]==="!--"?i=Wt:u[1]!==void 0?i=Ft:u[2]!==void 0?(Jt.test(u[2])&&(r=RegExp("</"+u[2],"g")),i=w):u[3]!==void 0&&(i=w):i===w?u[0]===">"?(i=r??H,h=-1):u[1]===void 0?h=-2:(h=i.lastIndex-u[2].length,l=u[1],i=u[3]===void 0?w:u[3]==='"'?Gt:qt):i===Gt||i===qt?i=w:i===Wt||i===Ft?i=H:(i=w,r=void 0);let v=i===w&&s[a+1].startsWith("/>")?" ":"";n+=i===H?c+Le:h>=0?(o.push(l),c.slice(0,h)+_t+c.slice(h)+A+v):c+A+(h===-2?a:v)}return[Yt(s,n+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),o]},B=class s{constructor({strings:t,_$litType$:e},o){let r;this.parts=[];let n=0,i=0,a=t.length-1,c=this.parts,[l,u]=Zt(t,e);if(this.el=s.createElement(l,o),O.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=O.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(_t)){let m=u[i++],v=r.getAttribute(h).split(A),C=/([.?@])?(.*)/.exec(m);c.push({type:1,index:n,name:C[2],strings:v,ctor:C[1]==="."?ot:C[1]==="?"?rt:C[1]==="@"?nt:P}),r.removeAttribute(h)}else h.startsWith(A)&&(c.push({type:6,index:n}),r.removeAttribute(h));if(Jt.test(r.tagName)){let h=r.textContent.split(A),m=h.length-1;if(m>0){r.textContent=et?et.emptyScript:"";for(let v=0;v<m;v++)r.append(h[v],z()),O.nextNode(),c.push({type:2,index:++n});r.append(h[m],z())}}}else if(r.nodeType===8)if(r.data===At)c.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(A,h+1))!==-1;)c.push({type:7,index:n}),h+=A.length-1}n++}}static createElement(t,e){let o=T.createElement("template");return o.innerHTML=t,o}};function S(s,t,e=s,o){if(t===f)return t;let r=o!==void 0?e._$Co?.[o]:e._$Cl,n=V(t)?void 0:t._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,e,o)),o!==void 0?(e._$Co??=[])[o]=r:e._$Cl=r),r!==void 0&&(t=S(s,r._$AS(s,t.values),r,o)),t}var st=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:o}=this._$AD,r=(t?.creationScope??T).importNode(e,!0);O.currentNode=r;let n=O.nextNode(),i=0,a=0,c=o[0];for(;c!==void 0;){if(i===c.index){let l;c.type===2?l=new L(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new it(n,this,t)),this._$AV.push(l),c=o[++a]}i!==c?.index&&(n=O.nextNode(),i++)}return O.currentNode=T,r}p(t){let e=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(t,o,e),e+=o.strings.length-2):o._$AI(t[e])),e++}},L=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,o,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=o,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=S(this,t,e),V(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==f&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Qt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&V(this._$AH)?this._$AA.nextSibling.data=t:this.T(T.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:o}=t,r=typeof o=="number"?this._$AC(t):(o.el===void 0&&(o.el=B.createElement(Yt(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===r)this._$AH.p(e);else{let n=new st(r,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Kt.get(t.strings);return e===void 0&&Kt.set(t.strings,e=new B(t)),e}k(t){Ct(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,o,r=0;for(let n of t)r===e.length?e.push(o=new s(this.O(z()),this.O(z()),this,this.options)):o=e[r],o._$AI(n),r++;r<e.length&&(this._$AR(o&&o._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let o=Vt(t).nextSibling;Vt(t).remove(),t=o}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,o,r,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=d}_$AI(t,e=this,o,r){let n=this.strings,i=!1;if(n===void 0)t=S(this,t,e,0),i=!V(t)||t!==this._$AH&&t!==f,i&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=S(this,a[o+c],e,c),l===f&&(l=this._$AH[c]),i||=!V(l)||l!==this._$AH[c],l===d?t=d:t!==d&&(t+=(l??"")+n[c+1]),this._$AH[c]=l}i&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ot=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},rt=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},nt=class extends P{constructor(t,e,o,r,n){super(t,e,o,r,n),this.type=5}_$AI(t,e=this){if((t=S(this,t,e,0)??d)===f)return;let o=this._$AH,r=t===d&&o!==d||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==d&&(o===d||r);r&&this.element.removeEventListener(this.name,this,o),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},it=class{constructor(t,e,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}},Xt={M:_t,P:A,A:At,C:1,L:Zt,R:st,D:Qt,V:S,I:L,H:P,N:rt,U:nt,B:ot,F:it},Ue=bt.litHtmlPolyfillSupport;Ue?.(B,L),(bt.litHtmlVersions??=[]).push("3.3.2");var at=(s,t,e)=>{let o=e?.renderBefore??t,r=o._$litPart$;if(r===void 0){let n=e?.renderBefore??null;o._$litPart$=r=new L(t.insertBefore(z(),n),n,void 0,e??{})}return r._$AI(s),r};var Ot=globalThis,E=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=at(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return f}};E._$litElement$=!0,E.finalized=!0,Ot.litElementHydrateSupport?.({LitElement:E});var Re=Ot.litElementPolyfillSupport;Re?.({LitElement:E});(Ot.litElementVersions??=[]).push("4.2.2");var te=new Set,ee;var se=s=>typeof s=="string"?s:"el"in s?s.el.localName:"localName"in s?s.localName:s.declaredClass,Ds=(s,t,e,o)=>{let r=se(t);if(o?.once){let i=`${s}${r}${e}`;if(te.has(i))return;te.add(i)}let n;if(o?.detail){n={};for(let[i,a]of Object.entries(o.detail))if((typeof a=="object"||typeof a=="function")&&a!==null){let c=new WeakRef(a);Object.defineProperty(n,i,{get(){return c.deref()}})}else n[i]=a;ee?.log.interceptors?.forEach(i=>i(s,r,e,n)),console[s](`[${r}]: ${e}`,n)}else ee?.log.interceptors?.forEach(i=>i(s,r,e)),console[s](`[${r}]: ${e}`)},oe=s=>{let t=`[${se(s)}] `;return e=>{let o=e instanceof Error&&e.message?e:new Error(String(e));o.message=`${t}${o.message}`,setTimeout(()=>{throw e})}},xs=s=>`The property \`${s.toString()}\` is required but missing.`,Ls=s=>`The property \`${s.toString()}\` is empty but must have at least one element.`;var p=(s,t,...e)=>{try{return s?.call(t,...e)}catch(o){console.error(o,s)}},W=async(s,t,...e)=>{try{return await s?.call(t,...e)}catch(o){console.error(o,s)}};var q=Symbol.for("controller"),Ie=s=>typeof s=="object"&&s!==null&&(q in s||"hostConnected"in s||"hostDisconnected"in s||"hostUpdate"in s||"hostUpdated"in s),Is=s=>typeof s?.then=="function";var F,D=s=>{F!==s&&(F=s,queueMicrotask(()=>F===s?F=void 0:0))},G=s=>F,N=[],re=s=>{if(s===void 0){N=[];return}let t=N.indexOf(s);N=t===-1?[...N,s]:N.slice(0,t+1),queueMicrotask(()=>N=[])},ne=()=>N,U,Ms=s=>{U!==s&&(U=s,queueMicrotask(()=>U===s?U=void 0:0))},Me=()=>{let s=U;return U=void 0,s},ie=async(s,t)=>{let e=lt(s);if(e===void 0)return s;if(await e.ready,typeof t=="function"){let o=e.watchExports(r=>t(r,o))}return e.exports},ae=async s=>{let t=lt(s);return await t.ready,t},lt=s=>{let e=G().manager.X(s);if(e!==void 0)return e;if(Ie(s))return s;let o=Me();if(o!==void 0)return o},ct=!1,ks=s=>{ct=!0;try{return s()}finally{ct=!1}};var b=class{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}},ce=(s,t)=>{let e=t>ke?je:t/He,o=0,r=setInterval(()=>{o+=e,o>=t&&(clearInterval(r),s())},e);return r},ke=4e3,je=2e3,He=4;var ze=(s,t,e)=>{let o=Object.keys(s),r=o.length;R===void 0&&queueMicrotask(I),R??=new Map;let n=R.get(s);return n===void 0&&(n={callbacks:[],keyCount:r},R.set(s,n)),n.keyCount!==r&&(n.callbacks.forEach(i=>i(o)),n.callbacks=[],n.keyCount=r),n.callbacks.push(i=>{let a=l=>p(t,null,l),c=i[r];c===void 0?a(void 0):s[c]===e?a(c):a(void 0)}),e},R,I=()=>{R?.forEach(({callbacks:s},t)=>{let e=Object.keys(t);s.forEach(o=>o(e))}),R=void 0},Ve=(s,t,e)=>{let o=s.manager;return o.V!==d&&o.V!==e&&o.S(void 0,void 0),o.T.length===0&&queueMicrotask(()=>o.S(void 0,void 0)),o.V=e,o.T.push((r,n)=>p(t,void 0,e===n?r:void 0)),e},Be=(s=[G(),...ne()],t,e)=>{let o=Array.isArray(s)?s:[s],r=o.length+1,n=i=>{r-=1,i!==void 0&&(r=Math.min(r,0)),r===0&&t(i)};o.forEach(i=>ze(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!1}),e));for(let i of o)if("manager"in i&&i.manager.component===i){Ve(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!0}),e);break}return e},We=(s="",t={},e=G())=>{let o={emit:r=>{s===""&&I();let n=new CustomEvent(s,{detail:r,cancelable:!0,bubbles:!0,composed:!0,...t});return e.el.dispatchEvent(n),n}};return s===""&&Be(void 0,r=>s=r.key,o),o},Fe=We.bind(null,""),de;de=q;var Tt=class{constructor(t){this.#t=[],this.#e=[],this.#s=[],this.#r=[],this.#n=[],this.#c=[],this.#l=[],this.#d=[],this.#i=[],this.#p=!1,this.P=new b,this.connectedCalled=!1,this.loadedCalled=!1,this[de]=!0,this.#h=[];let e=this,o=t??G(new.target.name);e.#o=o,e.ready=e.P.promise,e.#a=he(e),e.component=o,e.#o.addController(e),e.#o.manager===void 0||(re(e),queueMicrotask(()=>e.catchUpLifecycle()))}#t;#e;#s;#r;#n;#c;#l;#d;#i;#p;#o;catchUpLifecycle(){let{manager:t}=this.#o;t.connectedCalled&&!this.connectedCalled&&this.triggerConnected(),t.#p&&this.triggerLoad().then(()=>t.loadedCalled&&this.triggerLoaded()).catch(oe(this.#o))}#a;get exports(){return this.#a}set exports(t){let e=this.#a;e!==t&&(this.#a=t,this.#h.forEach(p),this.connectedCalled&&this.O!==!1&&this.#o.requestUpdate(this.O,e)),this.P.resolve(t)}setProvisionalExports(t,e=!0){this.#a=e?he(t):t,this.#h.forEach(p)}#h;watchExports(t){let e=()=>t(this.#a);return this.#h.push(e),()=>void this.#h.splice(this.#h.indexOf(e),1)}get use(){return D(this.#o),ie}get useRef(){return D(this.#o),ae}get useRefSync(){return D(this.#o),lt}controllerRemoved(){this.#o.el.isConnected&&this.triggerDisconnected(),this.triggerDestroy()}onConnected(t){this.#t.push(t)}onDisconnected(t){this.#e.push(t)}onLoad(t){this.#s.push(t)}onLoaded(t){this.#r.push(t)}onUpdate(t){this.#n.push(t)}onUpdated(t){this.#c.push(t)}onDestroy(t){this.#l.push(t)}onLifecycle(t){this.#d.push(t),this.connectedCalled&&this.#o.el.isConnected&&this.#u(t)}triggerConnected(){let t=this;t.hostConnected&&p(t.hostConnected,t),t.#t.forEach(p),t.triggerLifecycle(),t.connectedCalled=!0}triggerDisconnected(){let t=this;t.hostDisconnected&&p(t.hostDisconnected,t),t.#e.forEach(p),t.#i.forEach(p),t.#i=[]}async triggerLoad(){if(this.#p)return;this.#p=!0;let t=this;t.hostLoad&&await W(t.hostLoad,t),this.#s.length>0&&await Promise.allSettled(this.#s.map(W)),this.P.resolve(this.#a)}triggerLoaded(){this.loadedCalled||(this.hostLoaded&&p(this.hostLoaded,this),this.#r.forEach(p),this.loadedCalled=!0)}triggerUpdate(t){this.hostUpdate&&p(this.hostUpdate,this,t),this.#n.forEach(le,t)}triggerUpdated(t){this.hostUpdated&&p(this.hostUpdated,this,t),this.#c.forEach(le,t)}triggerDestroy(){this.hostDestroy&&p(this.hostDestroy,this),this.#l.forEach(p)}triggerLifecycle(){this.hostLifecycle&&this.#u(()=>this.hostLifecycle()),this.#d.forEach(this.#u,this)}#u(t){D(this.#o);let e=p(t);(Array.isArray(e)?e:[e]).forEach(r=>{typeof r=="function"?this.#i.push(r):typeof r=="object"&&typeof r.remove=="function"&&this.#i.push(r.remove)})}};function le(s){p(s,void 0,this)}var pe=Tt,he=s=>{if(typeof s!="object"&&typeof s!="function"||s===null)return s;let t={get(o,r,n){if(!((r==="exports"||r==="_exports")&&r in o&&o[r]===e)&&(r in o||r in Promise.prototype||typeof r=="symbol"))return typeof o=="function"?o[r]:Reflect.get(o,r,n)}},e=new Proxy(s,t);return e};var ht=s=>s.replace(qe,(t,e)=>`${e===0?"":"-"}${t.toLowerCase()}`),qe=/[A-Z]+(?![a-z])|[A-Z]/gu;var Ge="randomUUID"in crypto,Ks=()=>{if(Ge)return crypto.randomUUID();let s=crypto.getRandomValues(new Uint16Array(8));s[3]=s[3]&4095|16384,s[4]=s[4]&16383|32768;let t=e=>s[e].toString(16).padStart(4,"0");return`${t(0)+t(1)}-${t(2)}-${t(3)}-${t(4)}-${t(5)}${t(6)}${t(7)}`};var{I:Ke}=Xt,ue=s=>s;var dt=s=>s.strings===void 0,fe=()=>document.createComment(""),Ys=(s,t,e)=>{let o=s._$AA.parentNode,r=t===void 0?s._$AB:t._$AA;if(e===void 0){let n=o.insertBefore(fe(),r),i=o.insertBefore(fe(),r);e=new Ke(n,i,s,s.options)}else{let n=e._$AB.nextSibling,i=e._$AM,a=i!==s;if(a){let c;e._$AQ?.(s),e._$AM=s,e._$AP!==void 0&&(c=s._$AU)!==i._$AU&&e._$AP(c)}if(n!==r||a){let c=e._$AA;for(;c!==n;){let l=ue(c).nextSibling;ue(o).insertBefore(c,r),c=l}}}return e},Zs=(s,t,e=s)=>(s._$AI(t,e),s),Qe={},me=(s,t=Qe)=>s._$AH=t,Xs=s=>s._$AH,to=s=>{s._$AR(),s._$AA.remove()};var y={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$=s=>(...t)=>({_$litDirective$:s,values:t}),g=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,o){this._$Ct=t,this._$AM=e,this._$Ci=o}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var K=(s,t)=>{let e=s._$AN;if(e===void 0)return!1;for(let o of e)o._$AO?.(t,!1),K(o,t);return!0},pt=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while(e?.size===0)},ye=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),Ze(t)}};function Je(s){this._$AN!==void 0?(pt(this),this._$AM=s,ye(this)):this._$AM=s}function Ye(s,t=!1,e=0){let o=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(o))for(let n=e;n<o.length;n++)K(o[n],!1),pt(o[n]);else o!=null&&(K(o,!1),pt(o));else K(this,s)}var Ze=s=>{s.type==y.CHILD&&(s._$AP??=Ye,s._$AQ??=Je)},ut=class extends g{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,o){super._$AT(t,e,o),ye(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(K(this,t),pt(this))}setValue(t){if(dt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ho=()=>new Pt,Pt=class{},St=new WeakMap,Nt=$(class extends ut{render(s){return d}update(s,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=s.options?.host,this.rt(this.ct=s.element)),d}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=St.get(t);e===void 0&&(e=new WeakMap,St.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){return typeof this.G=="function"?St.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var xt=s=>{let t=s;for(;t=t.parentNode??t.host;)if(t?.constructor?.lumina){let e=t;return e.manager?.loadedCalled||(e.J??e._offspring).push(s),(e.I??e._postLoad).promise}return!1},Lt={};function Ut(){}function Rt(s){for(let t of["Associated","Disabled","Reset","StateRestore"]){let e=`orm${t}Callback`;s.prototype["f"+e]=async function(...o){await this.componentOnReady(),(this.el??this).dispatchEvent(new CustomEvent(`luminaF${e}`,{detail:o}))}}}var ts=(s,t)=>function(o,r){if(!globalThis.customElements)return;let i=(r??o??{}).resourcesUrl;i&&s.setAssetPath(i);for(let[a,[c,l="",u=0]]of Object.entries(t)){if(customElements.get(a))continue;let[h,m,v]=l.split(";"),C=h?h?.split(",").map(es):void 0,gt=C?.map(([x])=>x),J=class extends Dt{static{this.formAssociated=u===1}static{this.observedAttributes=C?.map(([,x])=>x).filter(x=>x!=="")}static{this.C=gt}static{this.E=m?m?.split(","):void 0}static{this.D=v?.split(",")}static{this.L=a}static{this.K=s}constructor(){!J.B&&(J.B=c(),J.F()),super()}};customElements.define(a,J)}},ft=Object.defineProperty,es=s=>{let t=s.split(":");return t.length===1?[t[0],ht(t[0])]:t},ss=globalThis.HTMLElement??Ut,Dt=class extends ss{constructor(){super(),this.#e={},this.#s=[],this.I=new b,this.H=new b,this.J=[];let t=this,e=t.constructor;t._offspring=t.J,t._postLoad=t.I,e.C?.forEach(o=>{Object.hasOwn(t,o)&&(t.#e[o]=t[o],delete t[o])}),e.A?t.#r({a:e.A}):e.B.then(async o=>{await e.K.p,t.#r(await(o.default?.then(r=>typeof r=="function"?{a:r}:r)??o))}).catch(o=>{t.H.reject(o),setTimeout(()=>{throw o})})}static{this.lumina=!0}static F(){for(let t of this.C??[])ft(this.prototype,t,{configurable:!0,enumerable:!0,get(){return this.#e[t]},set(e){this.#e[t]=e}});for(let t of this.E??[])ft(this.prototype,t,{async value(...e){return this.#t||await this.H.promise,await this.#t[t](...e)},configurable:!0});for(let t of this.D??[])ft(this.prototype,t,{value(...e){return this.#t[t](...e)},configurable:!0})}static{Rt(this)}#t;#e;#s;get manager(){return this.#t?.manager}attributeChangedCallback(t,e,o){this.#t?.attributeChangedCallback(t,e,o),this.#t||this.#s.push(t)}connectedCallback(){this.#t?this.#t.connectedCallback?.():queueMicrotask(()=>this.G=xt(this))}disconnectedCallback(){this.#t?.disconnectedCallback?.()}async componentOnReady(){return await this.H.promise,this}#r(t){let e=this.constructor,o=e.L,r=this.#e,n=Object.values(t).find(h=>h.L===o),i=`${o}--lazy`,a=n;for(;a&&!Object.hasOwn(a,"lumina");)a=Object.getPrototypeOf(a);rs(a),!e.A&&(e.A=n,customElements.define(i,n)),n.N=this;let l=document.createElement(i);n.N=void 0,this.#t=l,this.#e=l,this.#s.forEach(h=>l.attributeChangedCallback(h,null,this.getAttribute(h))),Object.entries(r).forEach(os,l);let u=this.isConnected;(u||this.G)&&(l.connectedCallback?.(),u||l.disconnectedCallback())}addController(){}requestUpdate(){this.#t?.requestUpdate()}};function os([s,t]){this[s]=t}var rs=s=>{let t=s.prototype,e=Element.prototype;Object.hasOwn(t,"isConnected")||(t.setAttribute=function(r,n){e.setAttribute.call(this.el,r,n)},t.removeAttribute=function(r){e.removeAttribute.call(this.el,r)},t.hasAttribute=function(r){return e.hasAttribute.call(this.el,r)},ft(t,"isConnected",{get(){return Reflect.get(e,"isConnected",this.el)}}))};var mt=class extends pe{constructor(t){super(t),this.destroyed=!1,this.R=!1,this.V=d,this.T=[],this.#s=new WeakMap,this.#e=t,this.exports=void 0,this.hasDestroy=yt in t&&typeof t.destroy=="function",E.prototype.addController.call(t,{hostConnected:()=>{if(this.destroyed){let e=t.el.localName;throw t.el.remove(),new Error(`The ${e} component has already been destroyed. It cannot be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${yt} prop.`)}this.#t!==void 0&&clearTimeout(this.#t),I();for(let e of t.M)"triggerConnected"in e?e.triggerConnected():p(e.hostConnected,e)},hostDisconnected:()=>{for(let e of t.M)"triggerDisconnected"in e?e.triggerDisconnected():p(e.hostDisconnected,e);this.hasDestroy&&!this.destroyed&&this.U()},hostUpdate:()=>{for(let e of t.M)"triggerUpdate"in e?e.triggerUpdate(this.Q):p(e.hostUpdate,e,this.Q)},hostUpdated:()=>{for(let e of t.M)"triggerUpdated"in e?e.triggerUpdated(this.Q):p(e.hostUpdated,e,this.Q);this.Q=void 0}}),queueMicrotask(()=>this.R=!0),D(t)}#t;#e;async destroy(){if(!this.destroyed){this.#e.el.isConnected&&(this.hasDestroy=!1,this.#e.el.remove()),this.#t=void 0,this.destroyed=!0;for(let t of this.#e.M)"triggerDestroy"in t?t.triggerDestroy():p(t.hostDestroy,t);this.#e.M.splice(0)}}U(){if(this.#t!==void 0&&clearTimeout(this.#t),!this.#e.el.isConnected&&!this.#e.autoDestroyDisabled){let t=()=>void this.#e.destroy();this.#t=ce(t,ns)}}S(t,e){let o=this.T;this.V=d,this.T=[],o.forEach(r=>r(t,e))}#s;W(t,e){(typeof e=="object"&&e!==null||typeof e=="function")&&this.#s.set(e,t)}X(t){if(typeof t=="object"&&t!==null||typeof t=="function")return this.#s.get(t)}},ns=1e3,yt="autoDestroyDisabled";var ve=$(class extends g{constructor(s){if(super(s),s.type!==y.ATTRIBUTE||s.name!=="class"||s.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(t=>s[t]).join(" ")+" "}update(s,[t]){if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(let o in t)t[o]&&!this.nt?.has(o)&&this.st.add(o);return this.render(t)}let e=s.element.classList;for(let o of this.st)o in t||(e.remove(o),this.st.delete(o));for(let o in t){let r=!!t[o];r===this.st.has(o)||this.nt?.has(o)||(r?(e.add(o),this.st.add(o)):(e.remove(o),this.st.delete(o)))}return f}});var Ee="important",is=" !"+Ee,$e=$(class extends g{constructor(s){if(super(s),s.type!==y.ATTRIBUTE||s.name!=="style"||s.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((t,e)=>{let o=s[e];return o==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`},"")}update(s,[t]){let{style:e}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let o of this.ft)t[o]==null&&(this.ft.delete(o),o.includes("-")?e.removeProperty(o):e[o]=null);for(let o in t){let r=t[o];if(r!=null){this.ft.add(o);let n=typeof r=="string"&&r.endsWith(is);o.includes("-")||n?e.setProperty(o,n?r.slice(0,-11):r,n?Ee:""):e[o]=r}}return f}});var as=$(class extends g{constructor(s){if(super(s),s.type!==y.PROPERTY&&s.type!==y.ATTRIBUTE&&s.type!==y.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!dt(s))throw Error("`live` bindings can only contain a single expression")}render(s){return s}update(s,[t]){if(t===f||t===d)return t;let e=s.element,o=s.name;if(s.type===y.PROPERTY){if(t===e[o])return f}else if(s.type===y.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(o))return f}else if(s.type===y.ATTRIBUTE&&e.getAttribute(o)===t+"")return f;return me(s),t}});var be=class s extends E{constructor(){super(),this.M=[],this.manager=new mt(this);let t=this,e=t.constructor,o=e.N,r=e.K.o,n=s.prototype.shouldUpdate;t.#r=o?.H??new b,t.I=o?.I??new b,t.J=o?.J??[],t._offspring=t.J,t._postLoad=t.I,t.el=o??t,t.#s=t.enableUpdating,t.enableUpdating=Ut,t.shouldUpdate!==n&&(t.#e=t.shouldUpdate,t.shouldUpdate=n),r&&(t.#t=new Map,e.elementProperties.forEach((i,a)=>t.#t.set(a,r()))),!1}static finalizeStyles(t){let e=super.finalizeStyles(t),o=this.shadowRootOptions===Lt;return this.K?.commonStyles===void 0||o?e:[this.K.commonStyles,...e]}static createProperty(t,e){let o=typeof e=="number"?e:Array.isArray(e)?e[0]:0,r=Array.isArray(e)?e[1]:void 0,n=r?.hasChanged??j,i={attribute:o&1&&typeof t=="string"?ht(t):!1,reflect:!!(o&2),type:o&4?Boolean:o&8?Number:void 0,state:!!(o&16),readOnly:!!(o&32),noAccessor:!!(o&64),c:!1,...r,hasChanged(a,c){let l=n(a,c);return i.c=l,l}};super.createProperty(t,i)}static getPropertyDescriptor(t,e,o){let r=this.K,n=super.getPropertyDescriptor(t,e,o);return o.d=n,{...n,get(){return r.t?.(this.#t.get(t)),n.get?.call(this)},set(i){let a=this.manager;if(o.readOnly&&!ct&&(a.R||a.connectedCalled))throw Error(`Cannot assign to read-only property "${t}" of ${this.el.localName}. Trying to assign "${i}"`);n.set.call(this,i??void 0),o.c&&this.#t?.get(t)?.notify(),a.T.length>0&&(I(),a?.S(t,i))}}}static{this.lumina=!0}static{Rt(this)}#t;#e;#s;#r;#n;#c;get elementInternals(){return this.#c??=this.el.attachInternals(),this.#c}connectedCallback(){this.hasAttribute("defer-hydration")||this.#l(!0)}#l(t){let e=this.constructor.K.c?.(()=>this.requestUpdate());this.#n=e;let o=!this.manager.connectedCalled;t&&super.connectedCallback(),o?queueMicrotask(()=>this.#i().catch(r=>{this.#r.reject(r),setTimeout(()=>{throw r})})):e&&this.requestUpdate()}#d(t){try{this.#n.clear(),this.constructor.K.r(this.#n,()=>super.update(t))}catch(e){throw this.#n.clear(),e}}disconnectedCallback(){super.disconnectedCallback(),this.#n?.destroy(),this.#n=void 0}createRenderRoot(){let t=this.el.shadowRoot,e=this.constructor,o=e.shadowRootOptions,n=t??(o===Lt?this.el:this.el.attachShadow(o));if(t)return this.manager.connectedCalled||this.#l(!1),E.prototype.createRenderRoot.call(this),t;if(this.isConnected){let i=n.getRootNode();i.adoptedStyleSheets=[...i.adoptedStyleSheets,...e.elementStyles.map(a=>"styleSheet"in a?a.styleSheet:a)]}return n}async#i(){let t=this.el.G??xt(this.el);t&&await t;let e=[];for(let r of this.M)"triggerLoad"in r?e.push(r.triggerLoad()):e.push(W(r.hostLoad,r));await Promise.all(e),await this.load?.(),this.manager.hasDestroy&&this.manager.onUpdate(r=>r.has(yt)&&this.manager.U()),this.#s(!0),this.performUpdate(),this.I.resolve(),await 0;let o=this.J.filter(r=>!r.manager?.loadedCalled);o.length&&await Promise.allSettled(o.map(async r=>await r.componentOnReady())),this.J.length=0,this.el.setAttribute(this.constructor.K.hydratedAttribute,"");for(let r of this.M)"triggerLoaded"in r?r.triggerLoaded():p(r.hostLoaded,r);this.loaded?.(),this.#r.resolve()}shouldUpdate(t){return this.manager.Q=t,this.#e?.(t)??!0}update(t){this.#n?this.#d(t):super.update(t)}listen(t,e,o){let r=e?.bind(this)??e;this.manager.onLifecycle(()=>(this.el.addEventListener(t,r,o),()=>this.el.removeEventListener(t,r,o)))}listenOn(t,e,o,r){let n=o?.bind(this)??o;this.manager.onLifecycle(()=>(t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)))}async componentOnReady(){return await this.#r.promise,this}addController(t){this.M.push(t),!(q in t)&&this.renderRoot&&this.el.isConnected&&t.hostConnected?.()}removeController(t){this.M.splice(this.M.indexOf(t),1),t.controllerRemoved?.()}};var Ae=s=>{let t,e=r=>{t=new URL(r,globalThis.location?.href||void 0).href},o={...s,getAssetPath(r){let n=new URL(r,t);return n.origin!==globalThis.location?.origin?n.href:n.pathname},setAssetPath:e,customElement(r,n){n.K=o,n.L=r,customElements.get(r)||customElements.define(r,n)}};return e(s.defaultAssetPath),o};var Dr=s=>typeof s=="object"&&s!=null?ve(s):s,xr=s=>typeof s=="object"&&s!=null?$e(s):s;var It=class extends g{#t;#e;constructor(t){super(t);let e=this;this.#e=function(r){return e.#t.call(this,r)}}render(t){return typeof t=="function"?(this.#t=t,Nt(this.#e)):Nt(t)}},Lr=$(It);var Ur=d;var Rr=s=>{let t=document.createElement("div");return at(s,t),t.firstElementChild};var Q=Ae({defaultAssetPath:"https://jsdev.arcgis.com/5.1.0-next/portal-components/",hydratedAttribute:"hydrated"}),{customElement:Hr,getAssetPath:zr,setAssetPath:Vr}=Q;Q.t=void 0;Q.o=void 0;Q.c=void 0;Q.r=void 0;export{Is as a,D as b,G as c,re as d,ne as e,Ms as f,ks as g,Ce as h,j as i,ys as j,f as k,d as l,b as m,Ds as n,oe as o,xs as p,Ls as q,Ve as r,Be as s,We as t,Fe as u,Tt as v,pe as w,Ks as x,ts as y,y as z,$ as A,g as B,Ys as C,Zs as D,me as E,Xs as F,to as G,ho as H,Nt as I,be as J,Dr as K,xr as L,Ur as M,Rr as N,Q as O,Hr as P,zr as Q};