@arcgis/coding-components 6.0.0-next.20 → 6.0.0-next.22

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 (37) hide show
  1. package/dist/cdn/{MDIIPLU5.js → 33G24YP5.js} +1 -1
  2. package/dist/cdn/{DZNOLQ6O.js → 4APBBNML.js} +1 -1
  3. package/dist/cdn/{J4PXAJBC.js → 4MR4EZL5.js} +1 -1
  4. package/dist/cdn/{B6OREAMO.js → 5ETXQTFV.js} +1 -1
  5. package/dist/cdn/{5HAYP3VQ.js → 65O2GRVU.js} +1 -1
  6. package/dist/cdn/{TPXFLFZD.js → 6X5E2FQY.js} +1 -1
  7. package/dist/cdn/{6MGL32M7.js → 7BYBL64S.js} +1 -1
  8. package/dist/cdn/7QDUGUGM.js +70 -0
  9. package/dist/cdn/{5OQYLBVK.js → AOSAUASU.js} +1 -1
  10. package/dist/cdn/{V777ZB4K.js → BOPEWHCY.js} +1 -1
  11. package/dist/cdn/{HLS4EXQ3.js → EDIKES26.js} +1 -1
  12. package/dist/cdn/{PW4TXRN3.js → ELFZ2HPG.js} +1 -1
  13. package/dist/cdn/{UM5Z3H7G.js → H4EXVF6I.js} +1 -1
  14. package/dist/cdn/{YCWNDWGN.js → HJQELFBQ.js} +1 -1
  15. package/dist/cdn/HNY5HG5D.js +2 -0
  16. package/dist/cdn/{ZJBODKQ7.js → LRDZSZW3.js} +1 -1
  17. package/dist/cdn/{3TGVJQW5.js → OXS6MSEY.js} +1 -1
  18. package/dist/cdn/{EDYXZAU6.js → PPJNRBSZ.js} +1 -1
  19. package/dist/cdn/{BZQJZCPB.js → PVLAI7SG.js} +1 -1
  20. package/dist/cdn/{UMAIWLBR.js → Q65ZQT4X.js} +1 -1
  21. package/dist/cdn/{76HVXPMS.js → QDGDDIZG.js} +1 -1
  22. package/dist/cdn/{4NEBLIMF.js → QJ7TXVL7.js} +1 -1
  23. package/dist/cdn/{P5WKPF5G.js → T7TLTXT2.js} +1 -1
  24. package/dist/cdn/{D2L2N3NG.js → U4RRLHUQ.js} +1 -1
  25. package/dist/cdn/{FNPRMNHX.js → UDIKBS5V.js} +1 -1
  26. package/dist/cdn/{4DNCN3UL.js → UWA7I2DG.js} +1 -1
  27. package/dist/cdn/{BBRNPEPV.js → VHRD4SVJ.js} +1 -1
  28. package/dist/cdn/{TIKMETVM.js → WQYP2QLK.js} +1 -1
  29. package/dist/cdn/{MVSNHZVB.js → XEH5I4IM.js} +1 -1
  30. package/dist/cdn/index.js +1 -1
  31. package/dist/docs/api.json +1 -1
  32. package/dist/docs/docs.json +1 -1
  33. package/dist/docs/web-types.json +1 -1
  34. package/package.json +8 -8
  35. package/dist/cdn/55CDQLX6.js +0 -2
  36. package/dist/cdn/FJUNA7R5.js +0 -66
  37. /package/dist/cdn/{ZQPJGC6V.js → O7IT7ZNK.js} +0 -0
@@ -1,4 +1,4 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{f as g}from"./BQAEB2CG.js";import{r as d}from"./ZQPJGC6V.js";import{a as c}from"./C3LWMJ56.js";var b=300;function h(){let t=null,u=null;return o=>{if(o.key)return!1;let n=Date.now(),e=o.currentTarget??o.target,i=u===e&&t!==null&&n-t<b;return t=n,u=e,i}}function x(t,u,o,n){if(!u)return[];let e=Array.isArray(u)?u:[u];if(!e.length)return[];let i=d(o);return t.filter(s=>e.some(l=>i.test(String(s[l]??""))))}function $(t){return t?`${t.portal.url}/home/item.html?id=${t.id}`:""}function y(t,u,o="add",n){if(!t)return;let e=t.getSelection(),i=e&&(e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn),s=[],l=t.getValue()??"";if(o==="replace"){let r=n?`${n}
2
+ import{f as g}from"./BQAEB2CG.js";import{r as d}from"./O7IT7ZNK.js";import{a as c}from"./C3LWMJ56.js";var b=300;function h(){let t=null,u=null;return o=>{if(o.key)return!1;let n=Date.now(),e=o.currentTarget??o.target,i=u===e&&t!==null&&n-t<b;return t=n,u=e,i}}function x(t,u,o,n){if(!u)return[];let e=Array.isArray(u)?u:[u];if(!e.length)return[];let i=d(o);return t.filter(s=>e.some(l=>i.test(String(s[l]??""))))}function $(t){return t?`${t.portal.url}/home/item.html?id=${t.id}`:""}function y(t,u,o="add",n){if(!t)return;let e=t.getSelection(),i=e&&(e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn),s=[],l=t.getValue()??"";if(o==="replace"){let r=n?`${n}
3
3
  ${u}`:u,m=t.getModel(),a=m?.getLineCount()??1,f=m?.getLineMaxColumn(a)??1;s=[{range:{startLineNumber:1,startColumn:1,endLineNumber:a,endColumn:f},text:r}]}else{let r=i?{startLineNumber:e.startLineNumber,startColumn:e.startColumn,endLineNumber:e.endLineNumber,endColumn:e.endColumn}:(()=>{let a=t.getPosition();return{startLineNumber:a?.lineNumber??1,startColumn:a?.column??1,endLineNumber:a?.lineNumber??1,endColumn:a?.column??1}})(),m=!1;if(n){let a=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");m=!new RegExp(`^\\s*${a}\\s*$`,"mu").test(l)}m&&s.push({range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:`${n}
4
4
  `}),s.push({range:r,text:u})}try{t.pushUndoStop(),t.executeEdits("insertText",s),t.pushUndoStop(),t.focus()}catch(r){c("error","arcgis-code-editor","Failed to edit model",{detail:{error:r}})}}function S(t){try{return g(t)}catch{return t}}var L=t=>t.split(/\r\n|\r|\n/u).length-1,M=(t,u)=>[...u].sort((o,n)=>n.range.startLineNumber-o.range.startLineNumber||n.range.startColumn-o.range.startColumn).reduce((o,n)=>{let e=n.range.startLineNumber,i=n.range.endLineNumber,s=i-e,l=L(n.text)-s;return o.flatMap(r=>r<e?[r]:s===0?[r>=e?r+l:r]:r>i?[r+l]:r===e?[r]:[])},[...t]);export{h as a,x as b,$ as c,y as d,S as e,M as f};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import h from"./D2L2N3NG.js";import{a as b}from"./3TGVJQW5.js";import e from"./B6OREAMO.js";import d from"./BZQJZCPB.js";import"./JPCKFSCN.js";import c from"./FXTQDR6G.js";import"./A3VKXFUZ.js";import a from"./TIIYEBB2.js";import{a as P}from"./5OQYLBVK.js";import{b as S,d as k,f as y}from"./5HAYP3VQ.js";import"./RYQS3S5A.js";import"./GUL7EIJ4.js";import{a as E}from"./XUZB7XNL.js";import"./N3TIODOB.js";import"./SVYY36W2.js";import{G as w,H as x,I as g,K as $,h as u,j as s,t as f}from"./ZQPJGC6V.js";import"./C3LWMJ56.js";import{El as T}from"./P3M7MP34.js";import"./TAVTDQ6S.js";export default $arcgis.t(([,{a:p},{h:h,i:L,j:z},{a:M,b:B,c:m,d:C,e:A,f:I,g:N,i:F,j:D},{a:l}])=>{var V=u`:host{--calcite-block-padding: var(--calcite-spacing-sm);--breakpoints-popover-max-height: min(14rem, 20vh);display:block;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);overflow:hidden;height:100%;.console-shell,.tabs-container,calcite-tabs{height:100%}.tabs-container{flex:1 1 auto;min-height:0;overflow:hidden}.console-shell,calcite-tabs{display:flex;flex-direction:column;min-height:0}.console-shell{container-type:size;container-name:debugger-console}calcite-tab-nav{--calcite-size-2xl: var(--calcite-space-md);justify-content:flex-start;padding-inline:var(--calcite-spacing-sm)}calcite-tab-title{font-size:var(--calcite-font-size-sm)}calcite-tab{--calcite-tab-content-block-padding: 0;--calcite-tab-content-space-y: 0;display:flex;flex-direction:column;min-height:0}calcite-tab:not([selected]){display:none}.disabled-state-text{font-size:var(--calcite-font-size-sm);color:var(--calcite-color-text-3);font-style:italic;text-align:center;display:block;padding:var(--calcite-spacing-md)}.breakpoint-header{display:flex;align-items:flex-start;gap:var(--calcite-spacing-sm);padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);background-color:var(--calcite-color-foreground-1)}.load-action{--calcite-action-background-color: var(--calcite-color-foreground-2);--calcite-internal-action-height: 1.25rem;--calcite-internal-action-padding-block: 0;--calcite-internal-action-padding-inline: var(--calcite-spacing-xs);margin-block:var(--calcite-spacing-xxs)}.breakpoint-code-viewer{margin-block:0;width:100%}.tab-panel{display:flex;flex:1 1 auto;height:100%;min-height:0;overflow:hidden}.tab-panel>*{flex:1 1 auto;min-height:0}.tab-panel>calcite-tree{margin-inline-end:var(--calcite-space-sm);overflow-y:auto}.preview-panel{display:flex;flex:1 1 auto;min-height:0}.preview-empty-state{display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--calcite-spacing-md)}.preview-table-shell{display:flex;flex-direction:column;flex:1 1 auto;width:100%;min-width:0;min-height:0;overflow:hidden}.preview-table-summary{padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1)}.table-scroll{overflow:auto;flex:1 1 auto;min-width:0;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-sm)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}.breakpoints-popover{--calcite-popover-max-size-x: min(22rem, 68vw)}.breakpoints-popover-content{max-block-size:var(--breakpoints-popover-max-height);overflow:hidden}.breakpoints-list{box-sizing:border-box;display:flex;flex-direction:column;gap:var(--calcite-spacing-xs);padding:var(--calcite-spacing-xs);min-width:min(18rem,58vw);max-block-size:var(--breakpoints-popover-max-height);overflow:auto}.breakpoints-popover .breakpoint-code-viewer{--calcite-font-size--2: var(--calcite-font-size--3);--calcite-spacing-md: var(--calcite-spacing-sm);--calcite-spacing-sm: var(--calcite-spacing-xs);--calcite-spacing-xs: var(--calcite-spacing-xxs)}.breakpoint-list-item{border:1px solid var(--calcite-color-border-3);border-radius:var(--calcite-corner-radius-sharp);background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-xxs)}.breakpoint-list-item--current{border-color:var(--calcite-color-brand)}.breakpoint-list-item-meta{color:var(--calcite-color-text-2);font-size:var(--calcite-font-size-xs);margin-bottom:var(--calcite-spacing-xxs)}}`,q=100,v=class extends w{constructor(){super(...arguments),this.messages=P(),this._monacoEditor=y(E),this._breakpointPopoverId=`arcade-debugger-console-breakpoints-${f()}`,this.modelId=""}static{this.properties={debuggerStore:0,modelId:1}}static{this.styles=[V,z,L()]}get breakpoints(){return this.debuggerStore?.debuggerBreakpoints??[]}get previewTabsState(){return this.debuggerStore.previewTabsState}get lazyTreeState(){return this.debuggerStore?.lazyTreeState}get executionProgramState(){return this.debuggerStore?.executionState?.result}load(){this.manager.onLifecycle(()=>{let e=this.el.closest("arcgis-code-editor-shell")??this.el.getRootNode(),t=S(this.el,["class"],this.updateTheme.bind(this)),a=i=>this.dismissBreakpointPopoverOnResize(i);return e?.addEventListener("pointerdown",a,!0),this.updateTheme(),()=>{t(),e?.removeEventListener("pointerdown",a,!0)}})}getContentAtLine(e){if(!this.modelId)return"";let t=this._monacoEditor.getModel(T.parse(this.modelId));return t?t.getLineContent(e):""}updateTheme(){k(this.el)==="dark"?this.elementInternals.states.add(h):this.elementInternals.states.delete(h)}getBreakpointCode(e){return e==null?this.messages.nocontent??"No content":this.getContentAtLine(e)||(this.messages.nocontent??"No content")}getPreviewLoadErrorMessage(){return this.messages.previewloaderror??"Unable to load preview."}getBreakpointPositionText(e){return(this.messages.breakpointposition??"{position} of {count}"??"{position} of {count}").replace("{position}",String(e)).replace("{count}",String(this.breakpoints.length))}findCollectionItemByPreviewSegment(e,t){if(t.startsWith("name:")){let a=t.slice(5);return e.find(i=>i.name===a)?.featureSet}if(t.startsWith("id:")){let a=t.slice(3);return e.find(i=>String(i.id)===a)?.featureSet}}getExpandedDebuggerMap(e){if(e==null||!m(e))return null;let t=e.expand();return Array.isArray(t)?null:t}getPreviewRows(e){return e.map(t=>this.getExpandedDebuggerMap(t)||new Map)}dismissBreakpointPopoverOnResize(e){if(!e.composedPath().some(a=>a instanceof HTMLElement&&a.classList.contains("bottom-drawer-resize-handle")))return;let t=this.el.shadowRoot?.querySelector(".breakpoints-popover");t?.open&&(t.open=!1)}getExpandedDebuggerChild(e,t){if(!e||!m(e))return;let a=e.expand();if(Array.isArray(a)){let i=Number(t);return!Number.isInteger(i)||String(i)!==t?void 0:a[i]}return a.get(t)}async resolvePreviewValueFromSegments(e,t){if(!t.length)return e;if(!e)return;let[a,...i]=t,o;if(N(e)){let r=await e.load();o=this.findCollectionItemByPreviewSegment(r,a)}else o=this.getExpandedDebuggerChild(e,a);return await this.resolvePreviewValueFromSegments(o,i)}getScope(e,t){switch(t){case"profile":return e.profile;case"globals":return e.globals;case"locals":return e.locals}}async resolvePreviewValue(e){let t=this.executionProgramState;if(!t)return;let a=B(e);if(!a)return;let{scopeName:i,rootName:o,pathSegments:r}=a,c=this.getScope(t,i);if(c)return await this.resolvePreviewValueFromSegments(c.get(o),r)}async loadPreview({label:e,sourcePath:t,value:a}){let i=this.previewTabsState,{snapshot:o}=i.startLoad(e,t),r=a;if(r==null)try{r=await this.resolvePreviewValue(t)}catch{i.setError(o,this.getPreviewLoadErrorMessage());return}if(r==null||!I(r)||typeof r.querySample!="function"||typeof r.schema!="function"){i.setUnavailable(o,this.messages.previewunavailable??"This preview is no longer available in the current paused state.");return}try{let{fields:c,features:d}=await r.querySample(),n=this.getPreviewRows(d);i.setLoaded(o,c,n)}catch{i.setError(o,this.getPreviewLoadErrorMessage())}}activateTab(e){if(e===p){this.previewTabsState.selectScope();return}this.previewTabsState.selectTab(e);let t=this.previewTabsState.getTab(e);t?.invalidated&&this.loadPreview({label:t.label,sourcePath:t.sourcePath})}closePreviewTab(e){e.closed=!1,this.previewTabsState.closeTab(e.tab)}scrollToSelectedBreakpoint(e){let t=e.currentTarget;requestAnimationFrame(()=>{t?.querySelector(".breakpoint-list-item--current")?.scrollIntoView({block:"center"})})}sortScopeEntries(e){return e.sort(([t],[a])=>t.localeCompare(a))}renderPreviewLabel(e){return s`<bdi>${e}</bdi>`}renderPreviewCell(e){return e?A(e)||C(e)?D({value:e}):s`<span class="xs"></span>`:s`<span class="xs"></span>`}renderScopeEntryForScope(e,t,a){let[i,o]=a,r=`${t}.${i}`,c=this.lazyTreeState;return c?F({name:i,value:o,messages:this.messages,path:`${e}.${i}`,lazyTreeState:c,previewLabel:r,previewSourcePath:M(e,i),previewLoading:this.previewTabsState.isTabLoading(r),onLoadPreview:d=>{this.loadPreview(d)}}):null}renderBreakpointPopover(e){return this.breakpoints.length?s`<calcite-popover .referenceElement=${this._breakpointPopoverId} placement=bottom-end scale=s auto-close focus-trap-disabled @calcitePopoverOpen=${t=>this.scrollToSelectedBreakpoint(t)} .label=${this.messages.breakpoints??"Breakpoints"} class="breakpoints-popover" .heading=${this.messages.breakpoints??"Breakpoints"} heading-level=2><div class="breakpoints-popover-content"><div class="breakpoints-list">${this.breakpoints.map((t,a)=>s`<div class=${x(t.line===e?"breakpoint-list-item breakpoint-list-item--current":"breakpoint-list-item")}><div class="breakpoint-list-item-meta"><bdi>${this.getBreakpointPositionText(a+1)}</bdi></div><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${i=>String(i+t.line-1)}>${this.getBreakpointCode(t.line)}</arcgis-code-viewer></div>`)}</div></div></calcite-popover>`:null}renderScopePanel(){let e=this.executionProgramState,t=this.sortScopeEntries(Array.from(e?.profile??[])),a=this.sortScopeEntries(Array.from(e?.globals??[])),i=e?.locals?this.sortScopeEntries(Array.from(e?.locals??[])):void 0,o=!!e?.locals,r=i&&i.length>0,c=t.length>0,d=a.length>0;return e?s`<calcite-tree .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect} .lines=${l.lines} .selectionMode=${l.selectionMode}><calcite-tree-item expanded .disabled=${!r}>${this.messages.local??"Local"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${o?r?i.map(n=>this.renderScopeEntryForScope("locals",this.messages.local??"Local",n)):s`<span><i>${this.messages.empty??"Empty"}</i></span>`:s`<span><i>${this.messages.nolocalscope??"No local scope"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!d}>${this.messages.global??"Global"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${d?a.map(n=>this.renderScopeEntryForScope("globals",this.messages.global??"Global",n)):s`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!c}>${this.messages.profile??"Profile"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${c?t.map(n=>this.renderScopeEntryForScope("profile",this.messages.profile??"Profile",n)):s`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item></calcite-tree>`:this.debuggerStore?.isExecuting?s`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"} .text=${this.messages.loading??"Loading"}></calcite-loader></div>`:s`<span class="disabled-state-text">${this.messages.notpaused??"Not paused"}</span>`}renderPreviewPanel(e){switch(e.status){case"loading":return s`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loadingpreview??"Loading preview"} .text=${this.messages.loadingpreview??"Loading preview"}></calcite-loader></div>`;case"unavailable":case"error":return s`<span class="disabled-state-text">${e.message}</span>`;case"loaded":let{fields:t,label:a,rows:i}=e;return!i.length||!t.length?s`<span class="disabled-state-text">${this.messages.nopreviewrows??"No preview rows available."}</span>`:s`<div class="preview-table-shell"><div class="preview-table-summary">${this.renderPreviewLabel(`${a}${i.length===q?` ${this.messages.previewlimit??"(showing first 100 items)"}`:""}`)}</div><div class="table-scroll"><table><thead><tr>${t.map(o=>s`<th><bdi>${o}</bdi></th>`)}</tr></thead><tbody>${i.map(o=>s`<tr>${t.map(r=>s`<td>${this.renderPreviewCell(o.get(r))}</td>`)}</tr>`)}</tbody></table></div></div>`;default:return s`<span class="disabled-state-text">${this.messages.nopreviewloaded??"Select a FeatureSet variable and load a preview."}</span>`}}renderTabs(){let e=this.previewTabsState.activeTabId;return s`<calcite-tabs><calcite-tab-nav slot=title-group><calcite-tab-title .tab=${p} .selected=${e===p} @calciteTabsActivate=${t=>this.activateTab(t.target.tab)}>${this.messages.scope??"Scope"}</calcite-tab-title>${b(this.previewTabsState.tabs,t=>`title-${t.id}`,t=>s`<calcite-tab-title .tab=${t.id} title=${t.label??g} closable .selected=${e===t.id} @calciteTabsActivate=${a=>this.activateTab(a.target.tab)} @calciteTabsClose=${a=>this.closePreviewTab(a.target)}><bdi>${t.title}</bdi></calcite-tab-title>`)}</calcite-tab-nav><calcite-tab .tab=${p} .selected=${e===p}><div class="tab-panel">${this.renderScopePanel()}</div></calcite-tab>${b(this.previewTabsState.tabs,t=>`panel-${t.id}`,t=>s`<calcite-tab .tab=${t.id} .selected=${e===t.id}><div class="tab-panel preview-panel">${this.renderPreviewPanel(t)}</div></calcite-tab>`)}</calcite-tabs>`}render(){let{line:e}=this.debuggerStore?.executionState??{},t=e?this.breakpoints.find(i=>i.line===e):this.breakpoints[0],a=e?this.breakpoints.findIndex(i=>i.line===e):0;return s`<div class="console-shell">${this.breakpoints.length&&s`<div class="breakpoint-header"><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${i=>String(i+(t?.line??e??1)-1)}>${this.getBreakpointCode(t?.line??this.breakpoints[0]?.line??e??1)}</arcgis-code-viewer>${this.breakpoints.length?s`<calcite-action id=${this._breakpointPopoverId??g} scale=s .text=${this.getBreakpointPositionText(a>=0?a+1:1)} text-enabled icon=chevron-down></calcite-action>`:null}${this.renderBreakpointPopover(t?.line??e)}</div>`||""}<div class="tabs-container">${this.renderTabs()}</div></div>`}};$("arcgis-arcade-debugger-console",v);return v},a,c,d,e,h)
2
+ import h from"./U4RRLHUQ.js";import{a as b}from"./OXS6MSEY.js";import e from"./5ETXQTFV.js";import d from"./PVLAI7SG.js";import"./JPCKFSCN.js";import c from"./FXTQDR6G.js";import"./A3VKXFUZ.js";import a from"./TIIYEBB2.js";import{a as P}from"./AOSAUASU.js";import{b as S,d as k,f as y}from"./65O2GRVU.js";import"./RYQS3S5A.js";import"./GUL7EIJ4.js";import{a as E}from"./XUZB7XNL.js";import"./N3TIODOB.js";import"./SVYY36W2.js";import{G as w,H as x,I as g,K as $,h as u,j as s,t as f}from"./O7IT7ZNK.js";import"./C3LWMJ56.js";import{El as T}from"./P3M7MP34.js";import"./TAVTDQ6S.js";export default $arcgis.t(([,{a:p},{h:h,i:L,j:z},{a:M,b:B,c:m,d:C,e:A,f:I,g:N,i:F,j:D},{a:l}])=>{var V=u`:host{--calcite-block-padding: var(--calcite-spacing-sm);--breakpoints-popover-max-height: min(14rem, 20vh);display:block;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);overflow:hidden;height:100%;.console-shell,.tabs-container,calcite-tabs{height:100%}.tabs-container{flex:1 1 auto;min-height:0;overflow:hidden}.console-shell,calcite-tabs{display:flex;flex-direction:column;min-height:0}.console-shell{container-type:size;container-name:debugger-console}calcite-tab-nav{--calcite-size-2xl: var(--calcite-space-md);justify-content:flex-start;padding-inline:var(--calcite-spacing-sm)}calcite-tab-title{font-size:var(--calcite-font-size-sm)}calcite-tab{--calcite-tab-content-block-padding: 0;--calcite-tab-content-space-y: 0;display:flex;flex-direction:column;min-height:0}calcite-tab:not([selected]){display:none}.disabled-state-text{font-size:var(--calcite-font-size-sm);color:var(--calcite-color-text-3);font-style:italic;text-align:center;display:block;padding:var(--calcite-spacing-md)}.breakpoint-header{display:flex;align-items:flex-start;gap:var(--calcite-spacing-sm);padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);background-color:var(--calcite-color-foreground-1)}.load-action{--calcite-action-background-color: var(--calcite-color-foreground-2);--calcite-internal-action-height: 1.25rem;--calcite-internal-action-padding-block: 0;--calcite-internal-action-padding-inline: var(--calcite-spacing-xs);margin-block:var(--calcite-spacing-xxs)}.breakpoint-code-viewer{margin-block:0;width:100%}.tab-panel{display:flex;flex:1 1 auto;height:100%;min-height:0;overflow:hidden}.tab-panel>*{flex:1 1 auto;min-height:0}.tab-panel>calcite-tree{margin-inline-end:var(--calcite-space-sm);overflow-y:auto}.preview-panel{display:flex;flex:1 1 auto;min-height:0}.preview-empty-state{display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--calcite-spacing-md)}.preview-table-shell{display:flex;flex-direction:column;flex:1 1 auto;width:100%;min-width:0;min-height:0;overflow:hidden}.preview-table-summary{padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1)}.table-scroll{overflow:auto;flex:1 1 auto;min-width:0;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-sm)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}.breakpoints-popover{--calcite-popover-max-size-x: min(22rem, 68vw)}.breakpoints-popover-content{max-block-size:var(--breakpoints-popover-max-height);overflow:hidden}.breakpoints-list{box-sizing:border-box;display:flex;flex-direction:column;gap:var(--calcite-spacing-xs);padding:var(--calcite-spacing-xs);min-width:min(18rem,58vw);max-block-size:var(--breakpoints-popover-max-height);overflow:auto}.breakpoints-popover .breakpoint-code-viewer{--calcite-font-size--2: var(--calcite-font-size--3);--calcite-spacing-md: var(--calcite-spacing-sm);--calcite-spacing-sm: var(--calcite-spacing-xs);--calcite-spacing-xs: var(--calcite-spacing-xxs)}.breakpoint-list-item{border:1px solid var(--calcite-color-border-3);border-radius:var(--calcite-corner-radius-sharp);background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-xxs)}.breakpoint-list-item--current{border-color:var(--calcite-color-brand)}.breakpoint-list-item-meta{color:var(--calcite-color-text-2);font-size:var(--calcite-font-size-xs);margin-bottom:var(--calcite-spacing-xxs)}}`,q=100,v=class extends w{constructor(){super(...arguments),this.messages=P(),this._monacoEditor=y(E),this._breakpointPopoverId=`arcade-debugger-console-breakpoints-${f()}`,this.modelId=""}static{this.properties={debuggerStore:0,modelId:1}}static{this.styles=[V,z,L()]}get breakpoints(){return this.debuggerStore?.debuggerBreakpoints??[]}get previewTabsState(){return this.debuggerStore.previewTabsState}get lazyTreeState(){return this.debuggerStore?.lazyTreeState}get executionProgramState(){return this.debuggerStore?.executionState?.result}load(){this.manager.onLifecycle(()=>{let e=this.el.closest("arcgis-code-editor-shell")??this.el.getRootNode(),t=S(this.el,["class"],this.updateTheme.bind(this)),a=i=>this.dismissBreakpointPopoverOnResize(i);return e?.addEventListener("pointerdown",a,!0),this.updateTheme(),()=>{t(),e?.removeEventListener("pointerdown",a,!0)}})}getContentAtLine(e){if(!this.modelId)return"";let t=this._monacoEditor.getModel(T.parse(this.modelId));return t?t.getLineContent(e):""}updateTheme(){k(this.el)==="dark"?this.elementInternals.states.add(h):this.elementInternals.states.delete(h)}getBreakpointCode(e){return e==null?this.messages.nocontent??"No content":this.getContentAtLine(e)||(this.messages.nocontent??"No content")}getPreviewLoadErrorMessage(){return this.messages.previewloaderror??"Unable to load preview."}getBreakpointPositionText(e){return(this.messages.breakpointposition??"{position} of {count}"??"{position} of {count}").replace("{position}",String(e)).replace("{count}",String(this.breakpoints.length))}findCollectionItemByPreviewSegment(e,t){if(t.startsWith("name:")){let a=t.slice(5);return e.find(i=>i.name===a)?.featureSet}if(t.startsWith("id:")){let a=t.slice(3);return e.find(i=>String(i.id)===a)?.featureSet}}getExpandedDebuggerMap(e){if(e==null||!m(e))return null;let t=e.expand();return Array.isArray(t)?null:t}getPreviewRows(e){return e.map(t=>this.getExpandedDebuggerMap(t)||new Map)}dismissBreakpointPopoverOnResize(e){if(!e.composedPath().some(a=>a instanceof HTMLElement&&a.classList.contains("bottom-drawer-resize-handle")))return;let t=this.el.shadowRoot?.querySelector(".breakpoints-popover");t?.open&&(t.open=!1)}getExpandedDebuggerChild(e,t){if(!e||!m(e))return;let a=e.expand();if(Array.isArray(a)){let i=Number(t);return!Number.isInteger(i)||String(i)!==t?void 0:a[i]}return a.get(t)}async resolvePreviewValueFromSegments(e,t){if(!t.length)return e;if(!e)return;let[a,...i]=t,o;if(N(e)){let r=await e.load();o=this.findCollectionItemByPreviewSegment(r,a)}else o=this.getExpandedDebuggerChild(e,a);return await this.resolvePreviewValueFromSegments(o,i)}getScope(e,t){switch(t){case"profile":return e.profile;case"globals":return e.globals;case"locals":return e.locals}}async resolvePreviewValue(e){let t=this.executionProgramState;if(!t)return;let a=B(e);if(!a)return;let{scopeName:i,rootName:o,pathSegments:r}=a,c=this.getScope(t,i);if(c)return await this.resolvePreviewValueFromSegments(c.get(o),r)}async loadPreview({label:e,sourcePath:t,value:a}){let i=this.previewTabsState,{snapshot:o}=i.startLoad(e,t),r=a;if(r==null)try{r=await this.resolvePreviewValue(t)}catch{i.setError(o,this.getPreviewLoadErrorMessage());return}if(r==null||!I(r)||typeof r.querySample!="function"||typeof r.schema!="function"){i.setUnavailable(o,this.messages.previewunavailable??"This preview is no longer available in the current paused state.");return}try{let{fields:c,features:d}=await r.querySample(),n=this.getPreviewRows(d);i.setLoaded(o,c,n)}catch{i.setError(o,this.getPreviewLoadErrorMessage())}}activateTab(e){if(e===p){this.previewTabsState.selectScope();return}this.previewTabsState.selectTab(e);let t=this.previewTabsState.getTab(e);t?.invalidated&&this.loadPreview({label:t.label,sourcePath:t.sourcePath})}closePreviewTab(e){e.closed=!1,this.previewTabsState.closeTab(e.tab)}scrollToSelectedBreakpoint(e){let t=e.currentTarget;requestAnimationFrame(()=>{t?.querySelector(".breakpoint-list-item--current")?.scrollIntoView({block:"center"})})}sortScopeEntries(e){return e.sort(([t],[a])=>t.localeCompare(a))}renderPreviewLabel(e){return s`<bdi>${e}</bdi>`}renderPreviewCell(e){return e?A(e)||C(e)?D({value:e}):s`<span class="xs"></span>`:s`<span class="xs"></span>`}renderScopeEntryForScope(e,t,a){let[i,o]=a,r=`${t}.${i}`,c=this.lazyTreeState;return c?F({name:i,value:o,messages:this.messages,path:`${e}.${i}`,lazyTreeState:c,previewLabel:r,previewSourcePath:M(e,i),previewLoading:this.previewTabsState.isTabLoading(r),onLoadPreview:d=>{this.loadPreview(d)}}):null}renderBreakpointPopover(e){return this.breakpoints.length?s`<calcite-popover .referenceElement=${this._breakpointPopoverId} placement=bottom-end scale=s auto-close focus-trap-disabled @calcitePopoverOpen=${t=>this.scrollToSelectedBreakpoint(t)} .label=${this.messages.breakpoints??"Breakpoints"} class="breakpoints-popover" .heading=${this.messages.breakpoints??"Breakpoints"} heading-level=2><div class="breakpoints-popover-content"><div class="breakpoints-list">${this.breakpoints.map((t,a)=>s`<div class=${x(t.line===e?"breakpoint-list-item breakpoint-list-item--current":"breakpoint-list-item")}><div class="breakpoint-list-item-meta"><bdi>${this.getBreakpointPositionText(a+1)}</bdi></div><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${i=>String(i+t.line-1)}>${this.getBreakpointCode(t.line)}</arcgis-code-viewer></div>`)}</div></div></calcite-popover>`:null}renderScopePanel(){let e=this.executionProgramState,t=this.sortScopeEntries(Array.from(e?.profile??[])),a=this.sortScopeEntries(Array.from(e?.globals??[])),i=e?.locals?this.sortScopeEntries(Array.from(e?.locals??[])):void 0,o=!!e?.locals,r=i&&i.length>0,c=t.length>0,d=a.length>0;return e?s`<calcite-tree .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect} .lines=${l.lines} .selectionMode=${l.selectionMode}><calcite-tree-item expanded .disabled=${!r}>${this.messages.local??"Local"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${o?r?i.map(n=>this.renderScopeEntryForScope("locals",this.messages.local??"Local",n)):s`<span><i>${this.messages.empty??"Empty"}</i></span>`:s`<span><i>${this.messages.nolocalscope??"No local scope"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!d}>${this.messages.global??"Global"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${d?a.map(n=>this.renderScopeEntryForScope("globals",this.messages.global??"Global",n)):s`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!c}>${this.messages.profile??"Profile"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${c?t.map(n=>this.renderScopeEntryForScope("profile",this.messages.profile??"Profile",n)):s`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item></calcite-tree>`:this.debuggerStore?.isExecuting?s`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"} .text=${this.messages.loading??"Loading"}></calcite-loader></div>`:s`<span class="disabled-state-text">${this.messages.notpaused??"Not paused"}</span>`}renderPreviewPanel(e){switch(e.status){case"loading":return s`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loadingpreview??"Loading preview"} .text=${this.messages.loadingpreview??"Loading preview"}></calcite-loader></div>`;case"unavailable":case"error":return s`<span class="disabled-state-text">${e.message}</span>`;case"loaded":let{fields:t,label:a,rows:i}=e;return!i.length||!t.length?s`<span class="disabled-state-text">${this.messages.nopreviewrows??"No preview rows available."}</span>`:s`<div class="preview-table-shell"><div class="preview-table-summary">${this.renderPreviewLabel(`${a}${i.length===q?` ${this.messages.previewlimit??"(showing first 100 items)"}`:""}`)}</div><div class="table-scroll"><table><thead><tr>${t.map(o=>s`<th><bdi>${o}</bdi></th>`)}</tr></thead><tbody>${i.map(o=>s`<tr>${t.map(r=>s`<td>${this.renderPreviewCell(o.get(r))}</td>`)}</tr>`)}</tbody></table></div></div>`;default:return s`<span class="disabled-state-text">${this.messages.nopreviewloaded??"Select a FeatureSet variable and load a preview."}</span>`}}renderTabs(){let e=this.previewTabsState.activeTabId;return s`<calcite-tabs><calcite-tab-nav slot=title-group><calcite-tab-title .tab=${p} .selected=${e===p} @calciteTabsActivate=${t=>this.activateTab(t.target.tab)}>${this.messages.scope??"Scope"}</calcite-tab-title>${b(this.previewTabsState.tabs,t=>`title-${t.id}`,t=>s`<calcite-tab-title .tab=${t.id} title=${t.label??g} closable .selected=${e===t.id} @calciteTabsActivate=${a=>this.activateTab(a.target.tab)} @calciteTabsClose=${a=>this.closePreviewTab(a.target)}><bdi>${t.title}</bdi></calcite-tab-title>`)}</calcite-tab-nav><calcite-tab .tab=${p} .selected=${e===p}><div class="tab-panel">${this.renderScopePanel()}</div></calcite-tab>${b(this.previewTabsState.tabs,t=>`panel-${t.id}`,t=>s`<calcite-tab .tab=${t.id} .selected=${e===t.id}><div class="tab-panel preview-panel">${this.renderPreviewPanel(t)}</div></calcite-tab>`)}</calcite-tabs>`}render(){let{line:e}=this.debuggerStore?.executionState??{},t=e?this.breakpoints.find(i=>i.line===e):this.breakpoints[0],a=e?this.breakpoints.findIndex(i=>i.line===e):0;return s`<div class="console-shell">${this.breakpoints.length&&s`<div class="breakpoint-header"><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${i=>String(i+(t?.line??e??1)-1)}>${this.getBreakpointCode(t?.line??this.breakpoints[0]?.line??e??1)}</arcgis-code-viewer>${this.breakpoints.length?s`<calcite-action id=${this._breakpointPopoverId??g} scale=s .text=${this.getBreakpointPositionText(a>=0?a+1:1)} text-enabled icon=chevron-down></calcite-action>`:null}${this.renderBreakpointPopover(t?.line??e)}</div>`||""}<div class="tabs-container">${this.renderTabs()}</div></div>`}};$("arcgis-arcade-debugger-console",v);return v},a,c,d,e,h)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import h from"./T2AUH4ME.js";import g from"./TPXFLFZD.js";import f from"./MVSNHZVB.js";import e from"./BBRNPEPV.js";import d from"./VFCQQ2QW.js";import{f as j}from"./MDIIPLU5.js";import b from"./FXTQDR6G.js";import"./A3VKXFUZ.js";import a from"./TIIYEBB2.js";import{a as W}from"./5OQYLBVK.js";import{f as H}from"./5HAYP3VQ.js";import"./RYQS3S5A.js";import{a as Z,b as ee,c as D}from"./T2HTSGVS.js";import"./BQAEB2CG.js";import"./GUL7EIJ4.js";import{a as Y}from"./XUZB7XNL.js";import"./N3TIODOB.js";import"./SVYY36W2.js";import{E as T,F as I,G as q,H as y,K as G,L as V,h as z,j as c,l as C,n as R,t as U}from"./ZQPJGC6V.js";import{b as l}from"./C3LWMJ56.js";import{El as Q,wl as L,xl as M,zl as F}from"./P3M7MP34.js";import"./TAVTDQ6S.js";export default $arcgis.t(([{watch:v},P,{property:r,subclass:A},{a:X,d:b,i:S,j:w},{b:O},,,f,{a:J},{a:te,b:se}])=>{var ae=z`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.bottom-action-bar.is-collapsed{border-bottom:0}.bottom-action-bar{display:flex;.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}}`,ne=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,m=(s,e,t,i)=>{for(var a=i>1?void 0:i?oe(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&ne(e,t,a),a},ie=100,h=class extends P{constructor(s){super(s),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=ie}};m([r()],h.prototype,"collectionItems",2);m([r()],h.prototype,"errorMessage",2);m([r()],h.prototype,"expanded",2);m([r()],h.prototype,"requestId",2);m([r()],h.prototype,"schemaValue",2);m([r()],h.prototype,"status",2);m([r()],h.prototype,"visibleChildCount",2);h=m([A("ArcadeDebuggerLazyTreeNodeState")],h);var B=class extends P{constructor(s){super(s),this.generation=0,this.nodes=new Map}reset(){this.generation+=1,this.destroyNodes()}ensureNode(s,e=!1,t){let i=this.nodes.get(s);if(i)return i;let a=new h;return a.expanded=e,this.nodes.set(s,a),e&&t&&this.loadNode(s,t),a}setExpanded(s,e,t){let i=this.ensureNode(s,e,t);if(i.expanded===e){e&&t&&this.loadNode(s,t);return}i.expanded=e,e&&t&&this.loadNode(s,t)}showMore(s,e){let t=this.ensureNode(s);t.visibleChildCount>=e||(t.visibleChildCount=Math.min(e,t.visibleChildCount+ie))}loadNode(s,e){switch(e.kind){case"collection":this.runLoad(s,e.load,(t,i)=>{t.collectionItems=i});return;case"schema":this.runLoad(s,e.load,(t,i)=>{t.schemaValue=i});return}}runLoad(s,e,t){let i=this.nodes.get(s);if(!i||i.status==="loading"||i.status==="loaded")return;let a=this.generation,n=i.requestId+1;i.requestId=n,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(o=>{let u=this.nodes.get(s);!u||this.generation!==a||u.requestId!==n||(t(u,o),u.status="loaded")}).catch(()=>{let o=this.nodes.get(s);!o||this.generation!==a||o.requestId!==n||(o.status="error")})}destroyNodes(){for(let s of this.nodes.values())s.destroy();this.nodes.clear()}};B=m([A("ArcadeDebuggerLazyTreeState")],B);var re=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,d=(s,e,t,i)=>{for(var a=i>1?void 0:i?ce(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&re(e,t,a),a},_=class extends P{constructor(s){super(s),this.phase="idle",this.sessionId=0,this.consoleLogs=[],this.hasExecuted=!1}get isExecuting(){return this.phase==="running"||this.phase==="debug-running"||this.phase==="debug-paused"}get isDebugging(){return this.phase==="debug-running"||this.phase==="debug-paused"}get isPaused(){return this.phase==="debug-paused"}get runResult(){return this.result?.resultType==="run"?this.result.result:void 0}get resultForLegacyRenderer(){return this.result?.resultType==="debug"?void 0:this.result?.result}get debugResult(){return this.result?.resultType==="debug"?this.result.result:void 0}get executionTiming(){return this.result?.resultType==="error"?void 0:this.result?.timing}addConsoleLog(s){this.consoleLogs=[...this.consoleLogs,s]}};d([r()],_.prototype,"phase",2);d([r()],_.prototype,"mode",2);d([r()],_.prototype,"sessionId",2);d([r()],_.prototype,"result",2);d([r()],_.prototype,"consoleLogs",2);d([r()],_.prototype,"hasExecuted",2);_=d([A("ArcadeDebuggerExecutionModel")],_);var $=class extends P{constructor(s){super(s),this.editorBreakpoints=[],this.executionBreakpoints=[]}setBreakpoints(s,e){s==="editor"?this.editorBreakpoints=Array.from(new Set(e)).sort((t,i)=>t-i):this.executionBreakpoints=Array.from(new Set(e)).sort((t,i)=>t-i)}toggleBreakpoint(s,e){let t=new Set(s==="editor"?this.editorBreakpoints:this.executionBreakpoints);t.has(e)?t.delete(e):t.add(e),this.setBreakpoints(s,t)}clearBreakpoints(s){s==="editor"?this.editorBreakpoints=[]:this.executionBreakpoints=[]}syncExecutionBreakpointsFromEditor(){this.executionBreakpoints=this.editorBreakpoints}};d([r()],$.prototype,"editorBreakpoints",2);d([r()],$.prototype,"executionBreakpoints",2);$=d([A("ArcadeDebuggerSessionModel")],$);var E=class extends P{constructor(s){super(s),this.openedPanel="output",this.showPanel=!1}};d([r()],E.prototype,"openedPanel",2);d([r()],E.prototype,"showPanel",2);E=d([A("ArcadeDebuggerUiModel")],E);var k=class extends P{constructor(s){super(s)}get line(){return this.pausedState?.line}clearPausedState(){this.lastPausedState=this.pausedState,this.pausedState=void 0}reset(){this.pausedState=void 0,this.lastPausedState=void 0}setPausedState(s){this.pausedState=s,this.lastPausedState=s}};d([r()],k.prototype,"pausedState",2);d([r()],k.prototype,"lastPausedState",2);k=d([A("ArcadeDebuggerPausedFrameModel")],k);var g=class extends P{constructor(s){super(s),this.execution=new _,this.lazyTreeState=new B,this.pausedFrame=new k,this.previewTabsState=new O,this.session=new $,this.ui=new E}get editorBreakpoints(){return this.session.editorBreakpoints}get debuggerBreakpoints(){return this.isPaused?this.session.executionBreakpoints.map(s=>({line:s})):this.session.editorBreakpoints.map(s=>({line:s}))}get executionBreakpoints(){return this.session.executionBreakpoints}get consoleLogs(){return this.execution.consoleLogs}get debug(){if(!(!this.pausedFrame.pausedState&&!this.pausedFrame.lastPausedState))return{pausedState:this.pausedFrame.pausedState,lastPausedState:this.pausedFrame.lastPausedState}}get debugResult(){return this.execution.debugResult}get executionTiming(){return this.execution.executionTiming}get debuggerLine(){return this.pausedFrame.pausedState?.line}get executionState(){return this.pausedFrame.pausedState}get hasExecuted(){return this.execution.hasExecuted}get isDebugging(){return this.execution.isDebugging}get isExecuting(){return this.execution.isExecuting}get isPaused(){return this.execution.isPaused}get mode(){return this.execution.mode}get openedPanel(){return this.ui.openedPanel}get outputRenderer(){if(this.execution.result)return this.execution.result.resultType==="debug"?"debugger":"legacy"}get phase(){return this.execution.phase}get result(){return this.execution.result}get runResult(){return this.execution.runResult}get resultForLegacyRenderer(){return this.execution.resultForLegacyRenderer}get sessionId(){return this.execution.sessionId}get showPanel(){return this.ui.showPanel}addConsoleLog(s){this.execution.addConsoleLog(s)}clearBreakpoints(s){this.session.clearBreakpoints(s)}clearForMissingTestData(){this.cancelExecution({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(s,e){this.execution.mode="debug",this.execution.result={resultType:"debug",result:s,...e?{timing:e}:{}},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(s,e={}){this.execution.mode="run",!e.useDebugRenderer&&S(s)?this.execution.result={resultType:"run",result:s}:e.useDebugRenderer&&!S(s)&&(this.execution.result={resultType:"debug",result:s,...e.timing?{timing:e.timing}:{}}),this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",this.resetTransientDebuggerState()}continueDebug(){let s=this.pausedFrame.pausedState?.continue;s&&(this.execution.phase="debug-running",this.pausedFrame.clearPausedState(),s.resolve())}disableDebugger(){this.cancelExecution({hidePanel:!0}),this.clearBreakpoints("execution"),this.clearBreakpoints("editor")}fail(s){this.execution.result={resultType:"error",result:s},this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",this.resetTransientDebuggerState()}pauseDebug(s){let e=this.pausedFrame.pausedState??this.pausedFrame.lastPausedState;this.syncPausedState(e,s),this.pausedFrame.setPausedState(s),this.execution.phase="debug-paused"}reset(){this.execution.phase="idle",this.execution.mode=void 0,this.execution.result=void 0,this.execution.consoleLogs=[],this.execution.hasExecuted=!1,this.execution.sessionId=0,this.ui.openedPanel="output",this.ui.showPanel=!1,this.pausedFrame.reset(),this.clearBreakpoints("execution"),this.clearBreakpoints("editor"),this.replaceTransientDebuggerState()}resetDebug(){this.cancelExecution({hidePanel:!1}),this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="debug-console"}disconnect(){this.cancelExecution({hidePanel:!0})}setBreakpoints(s){this.session.setBreakpoints("editor",s)}setPanel(s){this.execution.hasExecuted&&(this.ui.openedPanel=s,this.ui.showPanel=!0)}startDebug(){return this.execution.mode="debug",this.execution.phase="debug-running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.session.syncExecutionBreakpointsFromEditor(),this.execution.consoleLogs=[],this.ui.openedPanel="debug-console",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}startRun(){return this.execution.mode="run",this.execution.phase="running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="output",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}cancelExecution({hidePanel:s=!0,invalidateSession:e=!0}={}){let t=this.pausedFrame.pausedState?.continue;e&&(this.execution.sessionId+=1),this.execution.phase=this.execution.hasExecuted?"completed":"idle",this.pausedFrame.reset(),this.resetTransientDebuggerState(),s&&(this.ui.showPanel=!1),this.ui.openedPanel==="debug-console"&&(this.ui.openedPanel="output"),t?.resolve()}syncPausedState(s,e){this.lazyTreeState.reset(),s&&e&&s!==e&&this.previewTabsState.invalidateAll(),this.pausedLine=e?.line}toggleBreakpoint(s){this.session.toggleBreakpoint("editor",s)}togglePanel(s){if(this.execution.hasExecuted){if(s==null){this.ui.showPanel=!this.ui.showPanel;return}if(this.ui.openedPanel===s&&this.ui.showPanel){this.ui.showPanel=!1;return}this.setPanel(s)}}resetTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState.reset(),this.previewTabsState.clear()}replaceTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState=new B,this.previewTabsState=new O}};d([r()],g.prototype,"execution",2);d([r()],g.prototype,"lazyTreeState",2);d([r()],g.prototype,"pausedLine",2);d([r()],g.prototype,"pausedFrame",2);d([r()],g.prototype,"previewTabsState",2);d([r()],g.prototype,"session",2);d([r()],g.prototype,"ui",2);g=d([A("ArcadeDebuggerStore")],g);var N=class{#e;#a;#t;constructor(e,t=w){this.#e=e,this.#a=t}start(e){this.cancel({hidePanel:!1});let t=e.mode==="debug"?this.#e.startDebug():this.#e.startRun();setTimeout(()=>{this.#s(t)&&this.#o(e,t)},0)}cancel({hidePanel:e=!0}={}){this.#t?.abort(),this.#t=void 0,this.#e.isExecuting&&this.#e.cancelExecution({hidePanel:e})}async#o(e,t){let i;try{let{externalExecutor:a}=e;i=a?await this.#c({...e,externalExecutor:a},t):await this.#r(e,t)}catch(a){let n=a instanceof Error?a.message:String(a);i={type:"failure",error:b(n,a)}}this.#d(t,i)}async#r(e,t){if(!e.testData)return{type:"failure",error:b("Missing test data")};let i=await e.editorProfile;if(!i)return{type:"failure",error:b("Missing editor profile")};let a=await this.#a(i.definition,e.script,e.testData,{mode:e.mode,console:n=>this.#i(t,n),breakpoints:e.mode==="debug"?e.breakpoints:void 0,onDebugPause:e.mode==="debug"?(n,o)=>this.#n(t,n,o):void 0});return e.mode==="debug"?S(a)?{type:"failure",error:this.#u(a)}:{type:"debug",value:a}:S(a)?{type:"legacy-run",result:a}:{type:"failure",error:b("Unexpected debug result")}}async#c(e,t){let{externalExecutor:i}=e,a=new AbortController;this.#t=a;try{if(e.mode==="debug"){let o=await i.execute({mode:"debug",script:e.script,console:u=>this.#i(t,u),signal:a.signal,breakpoints:e.breakpoints,onDebugPause:(u,x)=>this.#n(t,u,x)});return{type:"debug",value:o.result,timing:o.timing}}let n=await i.execute({mode:"run",script:e.script,console:o=>this.#i(t,o),signal:a.signal});return{type:"run",value:n.result,timing:n.timing}}catch(n){let o=n instanceof Error?n.message:String(n);return{type:"failure",error:b(o,n)}}finally{this.#t===a&&(this.#t=void 0)}}#i(e,t){this.#s(e)&&this.#e.addConsoleLog(t)}async#n(e,t,i){if(!this.#s(e)||!this.#e.isDebugging)return;let a=Promise.withResolvers();return this.#e.pauseDebug({line:t.line,result:i,continue:a}),await a.promise}#d(e,t){if(this.#s(e))switch(t.type){case"debug":this.#e.completeDebug(t.value,t.timing);return;case"failure":this.#e.fail(t.error);return;case"legacy-run":this.#e.completeRun(t.result);return;case"run":this.#e.completeRun(t.value,{useDebugRenderer:!0,timing:t.timing})}}#u(e){return e.type==="error"?b(e.value,e.error):b("Unexpected legacy result")}#s(e){return e===this.#e.sessionId}},de={glyphMargin:!0,lineNumbersMinChars:1},K=class extends q{constructor(){super(...arguments),this._codeEditorElt=T(),this._arcadeAssistantElt=T(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._focusContinueActionOnPause=!1,this._debuggerState=new g,this._executionCoordinator=new N(this._debuggerState),this.messages=W(),this._modelId=U(),this._openArcadeHelp=()=>{window.open(X,"Arcade Help")},this._decorations=void 0,this._monacoEditor=H(Y),this._editorOptions={},this._toggleSidePanel=e=>{e.currentTarget instanceof HTMLElement&&this._setOpenedSidePanel(e.currentTarget.dataset.panelName??"none")},this._closeSidePanel=()=>{this._setOpenedSidePanel("none")},this._updateBreakpointsDecorations=()=>{let e=this.editorInstance;if(!e)return;let t=this._debuggerState.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}));this._decorations?.clear(),this._decorations=e.createDecorationsCollection(t)},this._clearDebuggerDecorations=()=>{this._decorations?.clear(),this._decorations=void 0,this._debuggerPausedLineDecoration?.clear(),this._debuggerPausedLineDecoration=void 0},this._debuggerPausedLineDecoration=void 0,this._preparingArcade=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this._diagnostics=[],this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.disableAssistant=!1,this.arcgisDiagnosticsChange=R({bubbles:!1}),this.arcgisScriptChange=R({bubbles:!1})}static{this.properties={_apiLibrary:16,_editorProfile:16,_preparingArcade:16,_arcadeAssistantRemoteState:16,_diagnostics:16,editorInstance:32,editorOptions:0,enableDebugger:5,hideDocumentationActions:5,hideSideBar:5,messageOverrides:0,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,disableAssistant:5,arcadeAssistant:0,externalExecutor:0,docsConfig:0}}static{this.styles=[ae]}get _canExecute(){return!!(this.testData||this.externalExecutor)}get _usesBottomExecutionDrawer(){return this._canExecute&&(this.enableDebugger||!!this.externalExecutor)}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...de,...this._editorOptions}}set editorOptions(e){this._editorOptions=e??{}}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let t=this._codeEditorElt.value?.value,i=await w(e.definition,t,this.testData,{mode:"run"});return S(i)?i:{type:"error",value:"Unexpected result",error:null}}async testRun(){try{let e=this._codeEditorElt.value?.value??this.script;if(this.externalExecutor){let{result:n}=await this.externalExecutor.execute({mode:"run",script:e,console:()=>{},signal:new AbortController().signal});return n}let t=this.testData;if(!t)throw new Error("Missing test data");await this._componentReadyDefer.promise;let i=await this._editorProfilePromise;if(!i)throw new Error("Missing editor profile");let a=await w(i.definition,e,t,{mode:"debug"});if(S(a))throw a.type==="error"&&a.error instanceof Error?a.error:new Error(a.type==="error"?a.value:"Unexpected Arcade result");return a}catch(e){let t=e instanceof Error?e.message:String(e);return b(t,e)}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async openArcadeAssistant(e){if(!this._arcadeAssistantRemoteState.shouldRender)return!1;if(this.openedSidePanel="arcade-assistant",await this.updateComplete,!this._canPromptWithArcadeAssistant())return!0;let t=this._arcadeAssistantElt.value;return e?.prompt&&await t?.openPrompt(e.prompt),!0}async load(){let e=V("./assets");te(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(l(this)),()=>{for(this._askAiBindingKey&&(D(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);this._disposables.length;)this._disposables.pop()?.dispose();this._executionCoordinator.cancel(),this._connectMonacoCustomizationsPromise=void 0,this._executeScriptAction=void 0,this._executeDebugScriptAction=void 0,this._hasDebuggerBreakpointsContextKey=void 0,this._focusContinueActionOnPause=!1,this._clearDebuggerDecorations(),this._debuggerState.disconnect()}))}willUpdate(e){(e.has("messages")||e.has("profile"))&&this._updateDataModelDeps(),(e.has("testData")||e.has("externalExecutor"))&&this._executionContextChanged(),e.has("enableDebugger")&&(this.enableDebugger||this._debuggerState.disableDebugger(),this._syncExecuteDebugScriptAction()),e.has("snippets")&&f.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve()}_setOpenedSidePanel(e){this.openedSidePanel=e===this.openedSidePanel?"none":e}async _connectMonacoCustomizations(){if(this._connectMonacoCustomizationsPromise)return await this._connectMonacoCustomizationsPromise;this._connectMonacoCustomizationsPromise=(async()=>{if(!this.isConnected)return;let e=await se();this._disposables.push(e.onDiagnosticsChange(p=>{this._preparingArcade||(this._diagnostics=p.diagnostics,this.arcgisDiagnosticsChange.emit(p.diagnostics))})),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let t=v(()=>this._debuggerState.editorBreakpoints,()=>{this._updateBreakpointsDecorations(),this._updateDebuggerBreakpointContextKey()},{sync:!0}),i=v(()=>this._debuggerState.debuggerLine,()=>this._updateDebuggerPausedLineDecoration(),{sync:!0}),a=v(()=>this._debuggerState.isPaused,()=>{!this._debuggerState.isPaused||!this._focusContinueActionOnPause||(this._focusContinueActionOnPause=!1,this.updateComplete.then(()=>{requestAnimationFrame(()=>{this.isConnected&&this._debuggerState.isPaused&&this.el.shadowRoot?.querySelector("#debugger-continue-action")?.setFocus()})}))},{sync:!0}),n=v(()=>this._debuggerState.isDebugging,()=>{this._debuggerState.isDebugging||(this._focusContinueActionOnPause=!1)},{sync:!0}),o=v(()=>this._debuggerState.consoleLogs.length,()=>this.requestUpdate(),{sync:!0});this._disposables.push({dispose:()=>t.remove()},{dispose:()=>i.remove()},{dispose:()=>a.remove()},{dispose:()=>n.remove()},{dispose:()=>o.remove()}),this._updateDebuggerBreakpointContextKey();let u=this.editorInstance?.onMouseDown(p=>this._onEditorMouseDown(p));u&&this._disposables.push(u);let x=this.editorInstance?.onDidChangeModelContent(p=>this._onEditorModelContentChange(p));x&&this._disposables.push(x),this._updateBreakpointsDecorations(),this._updateDebuggerPausedLineDecoration()})();try{await this._connectMonacoCustomizationsPromise}finally{this._connectMonacoCustomizationsPromise=void 0}}_onEditorMouseDown(e){if(!this.enableDebugger||![this._monacoEditor.MouseTargetType.GUTTER_GLYPH_MARGIN].includes(e.target.type)||e.target.element?.classList.contains("codicon-gutter-lightbulb"))return;let t=e.target.position?.lineNumber;t&&this._debuggerState.toggleBreakpoint(t)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||e.isFlush)return;let t=j(this._debuggerState.editorBreakpoints,e.changes);t.length===this._debuggerState.editorBreakpoints.length&&t.every((i,a)=>i===this._debuggerState.editorBreakpoints[a])||this._debuggerState.setBreakpoints(t)}_updateDebuggerPausedLineDecoration(){let e=this.editorInstance;if(!e)return;this._debuggerPausedLineDecoration?.clear();let t=this._debuggerState.debuggerLine;t!=null?this._debuggerPausedLineDecoration=e.createDecorationsCollection([{range:new F(t,1,t,1),options:{isWholeLine:!0,className:"arcgis-code-editor__debugger-paused-line",glyphMarginClassName:"arcgis-code-editor__debugger-paused-glyph",marginClassName:"arcgis-code-editor__debugger-paused-line arcgis-code-editor__debugger-paused-margin",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_stopDebugSession(){this._executionCoordinator.cancel({hidePanel:!1})}_resetDebugSession(){this._debuggerState.resetDebug(),this._executeScript("debug").catch(l(this))}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}_executionContextChanged(){this._canExecute||(this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this._executeDebugScriptAction&&(this._disposeSafely(this._executeDebugScriptAction),this._executeDebugScriptAction=void 0)),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.openedPanel==="debug-console"&&!this.enableDebugger&&this._debuggerState.closePanel(),this._executionCoordinator.cancel({hidePanel:!1}),this._debuggerState.showPanel&&this._executeScript("run").catch(l(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await f.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=f.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await f.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e,t=!1){let i=this.testData,a=this.externalExecutor;!this._codeEditorElt.value||!i&&!a||(this._focusContinueActionOnPause=e==="debug"&&t,this._executionCoordinator.start({mode:e,script:this._codeEditorElt.value?.value??this.script,testData:i,editorProfile:this._editorProfilePromise,externalExecutor:a,breakpoints:this._debuggerState.debuggerBreakpoints}))}_toggleShowExecutionPanel(){this._debuggerState.togglePanel()}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(l(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(l(this))}_onResultPanelChange(e){let t=e.currentTarget;this._debuggerState.setPanel(t.openedResultPanel)}_onExecutionPanelClose(){this._debuggerState.closePanel()}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[L.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this._canExecute&&this._executeScript("run").catch(l(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e)),this._syncExecuteDebugScriptAction()}_syncExecuteDebugScriptAction(){if(!this._canExecute||!this.enableDebugger){this._executeDebugScriptAction&&(this._disposeSafely(this._executeDebugScriptAction),this._executeDebugScriptAction=void 0);return}if(this._executeDebugScriptAction)return;let e=this.editorInstance?.addAction({id:"run-debug-script",label:this.messages.runanddebug??"Run and debug",precondition:"arcgisArcadeDebuggerHasBreakpoints",keybindings:[M.CtrlCmd|M.Shift|L.F5],contextMenuGroupId:"code",contextMenuOrder:2,run:()=>this._runAndDebug()});this._hasDebuggerBreakpointsContextKey??=this.editorInstance?.createContextKey("arcgisArcadeDebuggerHasBreakpoints",this._debuggerState.editorBreakpoints.length>0),this._updateDebuggerBreakpointContextKey(),e&&(this._executeDebugScriptAction=e,this._disposables.push(e))}_updateDebuggerBreakpointContextKey(){this._hasDebuggerBreakpointsContextKey?.set(this._debuggerState.editorBreakpoints.length>0)}_runAndDebug(){!this._canExecute||!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||this._executeScript("debug",!0).catch(l(this))}_getAskAiBindingKey(){return Q.parse(this._modelId).toString()}_canRenderAskAiCodeActions(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.codeActions:!1}_canPromptWithArcadeAssistant(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.prompting:!1}_getAskAiCodeActions(e){if(!this._canRenderAskAiCodeActions())return[];if(!e.markers.length)return[];let t=this.messages.askarcadeassistant??"Ask Arcade Assistant",i=this._getAskAiBindingKey();return[{title:t,kind:Z,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:ee,title:t,arguments:[i,this.messages.askarcadeassistantprompt??"Fix the errors in my script"]}}]}_syncAskAiAction(){if(!this.editorInstance)return;let e=this._getAskAiBindingKey();if(!this._arcadeAssistantRemoteState.shouldRender){this._askAiBindingKey&&(D(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&D(this._askAiBindingKey,void 0),D(e,{provideCodeActions:({context:t})=>this._getAskAiCodeActions(t),run:t=>{this.openArcadeAssistant({prompt:t??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(l(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await J(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this._usesBottomExecutionDrawer||!this._canExecute?null:c`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-toggle-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${()=>{this._executeScript("run").catch(l(this))}}></calcite-action>${this._debuggerState.result?c`<calcite-action .text=${this.messages.lastresults??""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`}renderMainPanel(){return c`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${f.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${I(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:t,icon:i,active:a,panelName:n,iconFlipRtl:o=!1,onClick:u=this._toggleSidePanel}){return c`<calcite-action id=${e??C} .text=${t} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${u} data-panel-name=${n??C} .iconFlipRtl=${o}></calcite-action>${!this.sideActionBarExpanded&&c`<calcite-tooltip .referenceElement=${e}><span>${t}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:c`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e,_arcadeAssistantRemoteState:t}=this;return c`<arcgis-language-api-panel slot=side-panel class=${y(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${y(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty,profilevariables:this.messages.profilevariables}}></arcgis-editor-variables>${this.suggestions?.length&&c`<arcgis-arcade-suggestions slot=side-panel class=${y(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${t?.shouldRender&&c`<arcgis-arcade-coding-assistant slot=side-panel class=${y(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${t.portalUrl} .serviceUrl=${"serviceUrl"in t?t.serviceUrl:void 0} .helpBase=${t.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${t.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant?.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant?.disableQuestionAnswerLogging} .diagnostics=${this._diagnostics} .isDevEnv=${"isDevEnv"in t?t.isDevEnv:!1} .docsConfig=${this.docsConfig} ${I(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(i=>c`<calcite-flow slot=side-panel class=${y(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):c`<calcite-flow-item .heading=${i.name} heading-level=2 closable .closed=${e!==i.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${i.description}>${i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){if(this._usesBottomExecutionDrawer)return this.renderBottomExecutionBody();if(!this._debuggerState.showPanel)return null;let e=this._debuggerState.openedPanel==="debug-console"?"output":this._debuggerState.openedPanel;return c`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.resultForLegacyRenderer} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:t,debugResult:i,isExecuting:a}=this._debuggerState;if(!e)return null;let n=t==="debug-console"?"output":t;return this.enableDebugger&&t==="debug-console"?c`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:t==="output"&&i?c`<arcgis-arcade-debugger-output slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:c`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${n} .loading=${t==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.resultForLegacyRenderer} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:t,openedPanel:i,isDebugging:a,isPaused:n,isExecuting:o}=this._debuggerState,u=this.messages.continue??"Continue",x=this.messages.reset??"Reset",p=this.messages.stop??"Stop";return c`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger&&a?c`<calcite-action id=debugger-continue-action .text=${u} icon=forward scale=s .disabled=${!n} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${u}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${x} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${x}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${p} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${p}</span></calcite-tooltip>`:c`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||o} @click=${()=>{this._executeScript("run").catch(l(this))}}></calcite-action>${this.enableDebugger&&c`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length===0} .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||o} @click=${this._runAndDebug}></calcite-action>`||""}`}</calcite-action-group>${t?c`<calcite-action-group scale=s><calcite-action .active=${i==="output"&&e} .text=${this.messages.output??"Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${()=>this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i==="console"&&e} .text=${this.messages.console??"Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${()=>this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i==="log"&&e} .text=${this.messages.log??"Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${()=>this._setExecutionPanel("log")} .disabled=${this.enableDebugger&&this._debuggerState.mode==="debug"}></calcite-action>${this.enableDebugger&&c`<calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug console"} text-enabled scale=s icon=debug .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action>`||""}</calcite-action-group>`:null}</calcite-action-bar>${e?c`<calcite-action .text=${this.messages.collapse??"Collapse"} scale=s icon=chevrons-down icon-flip-rtl @click=${this._onExecutionPanelClose} slot=actions-end></calcite-action>`:null}</div>`}render(){return c`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};G("arcgis-arcade-editor",K);return K},"core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,d,e,f,g,h)
2
+ import h from"./T2AUH4ME.js";import g from"./6X5E2FQY.js";import f from"./XEH5I4IM.js";import e from"./VHRD4SVJ.js";import d from"./VFCQQ2QW.js";import{f as j}from"./33G24YP5.js";import b from"./FXTQDR6G.js";import"./A3VKXFUZ.js";import a from"./TIIYEBB2.js";import{a as W}from"./AOSAUASU.js";import{f as H}from"./65O2GRVU.js";import"./RYQS3S5A.js";import{a as Z,b as ee,c as D}from"./T2HTSGVS.js";import"./BQAEB2CG.js";import"./GUL7EIJ4.js";import{a as Y}from"./XUZB7XNL.js";import"./N3TIODOB.js";import"./SVYY36W2.js";import{E as T,F as I,G as q,H as y,K as G,L as V,h as z,j as c,l as C,n as R,t as U}from"./O7IT7ZNK.js";import{b as l}from"./C3LWMJ56.js";import{El as Q,wl as L,xl as M,zl as F}from"./P3M7MP34.js";import"./TAVTDQ6S.js";export default $arcgis.t(([{watch:v},P,{property:r,subclass:A},{a:X,d:b,i:S,j:w},{b:O},,,f,{a:J},{a:te,b:se}])=>{var ae=z`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.bottom-action-bar.is-collapsed{border-bottom:0}.bottom-action-bar{display:flex;.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}}`,ne=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,m=(s,e,t,i)=>{for(var a=i>1?void 0:i?oe(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&ne(e,t,a),a},ie=100,h=class extends P{constructor(s){super(s),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=ie}};m([r()],h.prototype,"collectionItems",2);m([r()],h.prototype,"errorMessage",2);m([r()],h.prototype,"expanded",2);m([r()],h.prototype,"requestId",2);m([r()],h.prototype,"schemaValue",2);m([r()],h.prototype,"status",2);m([r()],h.prototype,"visibleChildCount",2);h=m([A("ArcadeDebuggerLazyTreeNodeState")],h);var B=class extends P{constructor(s){super(s),this.generation=0,this.nodes=new Map}reset(){this.generation+=1,this.destroyNodes()}ensureNode(s,e=!1,t){let i=this.nodes.get(s);if(i)return i;let a=new h;return a.expanded=e,this.nodes.set(s,a),e&&t&&this.loadNode(s,t),a}setExpanded(s,e,t){let i=this.ensureNode(s,e,t);if(i.expanded===e){e&&t&&this.loadNode(s,t);return}i.expanded=e,e&&t&&this.loadNode(s,t)}showMore(s,e){let t=this.ensureNode(s);t.visibleChildCount>=e||(t.visibleChildCount=Math.min(e,t.visibleChildCount+ie))}loadNode(s,e){switch(e.kind){case"collection":this.runLoad(s,e.load,(t,i)=>{t.collectionItems=i});return;case"schema":this.runLoad(s,e.load,(t,i)=>{t.schemaValue=i});return}}runLoad(s,e,t){let i=this.nodes.get(s);if(!i||i.status==="loading"||i.status==="loaded")return;let a=this.generation,n=i.requestId+1;i.requestId=n,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(o=>{let u=this.nodes.get(s);!u||this.generation!==a||u.requestId!==n||(t(u,o),u.status="loaded")}).catch(()=>{let o=this.nodes.get(s);!o||this.generation!==a||o.requestId!==n||(o.status="error")})}destroyNodes(){for(let s of this.nodes.values())s.destroy();this.nodes.clear()}};B=m([A("ArcadeDebuggerLazyTreeState")],B);var re=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,d=(s,e,t,i)=>{for(var a=i>1?void 0:i?ce(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&re(e,t,a),a},_=class extends P{constructor(s){super(s),this.phase="idle",this.sessionId=0,this.consoleLogs=[],this.hasExecuted=!1}get isExecuting(){return this.phase==="running"||this.phase==="debug-running"||this.phase==="debug-paused"}get isDebugging(){return this.phase==="debug-running"||this.phase==="debug-paused"}get isPaused(){return this.phase==="debug-paused"}get runResult(){return this.result?.resultType==="run"?this.result.result:void 0}get resultForLegacyRenderer(){return this.result?.resultType==="debug"?void 0:this.result?.result}get debugResult(){return this.result?.resultType==="debug"?this.result.result:void 0}get executionTiming(){return this.result?.resultType==="error"?void 0:this.result?.timing}addConsoleLog(s){this.consoleLogs=[...this.consoleLogs,s]}};d([r()],_.prototype,"phase",2);d([r()],_.prototype,"mode",2);d([r()],_.prototype,"sessionId",2);d([r()],_.prototype,"result",2);d([r()],_.prototype,"consoleLogs",2);d([r()],_.prototype,"hasExecuted",2);_=d([A("ArcadeDebuggerExecutionModel")],_);var $=class extends P{constructor(s){super(s),this.editorBreakpoints=[],this.executionBreakpoints=[]}setBreakpoints(s,e){s==="editor"?this.editorBreakpoints=Array.from(new Set(e)).sort((t,i)=>t-i):this.executionBreakpoints=Array.from(new Set(e)).sort((t,i)=>t-i)}toggleBreakpoint(s,e){let t=new Set(s==="editor"?this.editorBreakpoints:this.executionBreakpoints);t.has(e)?t.delete(e):t.add(e),this.setBreakpoints(s,t)}clearBreakpoints(s){s==="editor"?this.editorBreakpoints=[]:this.executionBreakpoints=[]}syncExecutionBreakpointsFromEditor(){this.executionBreakpoints=this.editorBreakpoints}};d([r()],$.prototype,"editorBreakpoints",2);d([r()],$.prototype,"executionBreakpoints",2);$=d([A("ArcadeDebuggerSessionModel")],$);var E=class extends P{constructor(s){super(s),this.openedPanel="output",this.showPanel=!1}};d([r()],E.prototype,"openedPanel",2);d([r()],E.prototype,"showPanel",2);E=d([A("ArcadeDebuggerUiModel")],E);var k=class extends P{constructor(s){super(s)}get line(){return this.pausedState?.line}clearPausedState(){this.lastPausedState=this.pausedState,this.pausedState=void 0}reset(){this.pausedState=void 0,this.lastPausedState=void 0}setPausedState(s){this.pausedState=s,this.lastPausedState=s}};d([r()],k.prototype,"pausedState",2);d([r()],k.prototype,"lastPausedState",2);k=d([A("ArcadeDebuggerPausedFrameModel")],k);var g=class extends P{constructor(s){super(s),this.execution=new _,this.lazyTreeState=new B,this.pausedFrame=new k,this.previewTabsState=new O,this.session=new $,this.ui=new E}get editorBreakpoints(){return this.session.editorBreakpoints}get debuggerBreakpoints(){return this.isPaused?this.session.executionBreakpoints.map(s=>({line:s})):this.session.editorBreakpoints.map(s=>({line:s}))}get executionBreakpoints(){return this.session.executionBreakpoints}get consoleLogs(){return this.execution.consoleLogs}get debug(){if(!(!this.pausedFrame.pausedState&&!this.pausedFrame.lastPausedState))return{pausedState:this.pausedFrame.pausedState,lastPausedState:this.pausedFrame.lastPausedState}}get debugResult(){return this.execution.debugResult}get executionTiming(){return this.execution.executionTiming}get debuggerLine(){return this.pausedFrame.pausedState?.line}get executionState(){return this.pausedFrame.pausedState}get hasExecuted(){return this.execution.hasExecuted}get isDebugging(){return this.execution.isDebugging}get isExecuting(){return this.execution.isExecuting}get isPaused(){return this.execution.isPaused}get mode(){return this.execution.mode}get openedPanel(){return this.ui.openedPanel}get outputRenderer(){if(this.execution.result)return this.execution.result.resultType==="debug"?"debugger":"legacy"}get phase(){return this.execution.phase}get result(){return this.execution.result}get runResult(){return this.execution.runResult}get resultForLegacyRenderer(){return this.execution.resultForLegacyRenderer}get sessionId(){return this.execution.sessionId}get showPanel(){return this.ui.showPanel}addConsoleLog(s){this.execution.addConsoleLog(s)}clearBreakpoints(s){this.session.clearBreakpoints(s)}clearForMissingTestData(){this.cancelExecution({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(s,e){this.execution.mode="debug",this.execution.result={resultType:"debug",result:s,...e?{timing:e}:{}},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(s,e={}){this.execution.mode="run",!e.useDebugRenderer&&S(s)?this.execution.result={resultType:"run",result:s}:e.useDebugRenderer&&!S(s)&&(this.execution.result={resultType:"debug",result:s,...e.timing?{timing:e.timing}:{}}),this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",this.resetTransientDebuggerState()}continueDebug(){let s=this.pausedFrame.pausedState?.continue;s&&(this.execution.phase="debug-running",this.pausedFrame.clearPausedState(),s.resolve())}disableDebugger(){this.cancelExecution({hidePanel:!0}),this.clearBreakpoints("execution"),this.clearBreakpoints("editor")}fail(s){this.execution.result={resultType:"error",result:s},this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",this.resetTransientDebuggerState()}pauseDebug(s){let e=this.pausedFrame.pausedState??this.pausedFrame.lastPausedState;this.syncPausedState(e,s),this.pausedFrame.setPausedState(s),this.execution.phase="debug-paused"}reset(){this.execution.phase="idle",this.execution.mode=void 0,this.execution.result=void 0,this.execution.consoleLogs=[],this.execution.hasExecuted=!1,this.execution.sessionId=0,this.ui.openedPanel="output",this.ui.showPanel=!1,this.pausedFrame.reset(),this.clearBreakpoints("execution"),this.clearBreakpoints("editor"),this.replaceTransientDebuggerState()}resetDebug(){this.cancelExecution({hidePanel:!1}),this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="debug-console"}disconnect(){this.cancelExecution({hidePanel:!0})}setBreakpoints(s){this.session.setBreakpoints("editor",s)}setPanel(s){this.execution.hasExecuted&&(this.ui.openedPanel=s,this.ui.showPanel=!0)}startDebug(){return this.execution.mode="debug",this.execution.phase="debug-running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.session.syncExecutionBreakpointsFromEditor(),this.execution.consoleLogs=[],this.ui.openedPanel="debug-console",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}startRun(){return this.execution.mode="run",this.execution.phase="running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="output",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}cancelExecution({hidePanel:s=!0,invalidateSession:e=!0}={}){let t=this.pausedFrame.pausedState?.continue;e&&(this.execution.sessionId+=1),this.execution.phase=this.execution.hasExecuted?"completed":"idle",this.pausedFrame.reset(),this.resetTransientDebuggerState(),s&&(this.ui.showPanel=!1),this.ui.openedPanel==="debug-console"&&(this.ui.openedPanel="output"),t?.resolve()}syncPausedState(s,e){this.lazyTreeState.reset(),s&&e&&s!==e&&this.previewTabsState.invalidateAll(),this.pausedLine=e?.line}toggleBreakpoint(s){this.session.toggleBreakpoint("editor",s)}togglePanel(s){if(this.execution.hasExecuted){if(s==null){this.ui.showPanel=!this.ui.showPanel;return}if(this.ui.openedPanel===s&&this.ui.showPanel){this.ui.showPanel=!1;return}this.setPanel(s)}}resetTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState.reset(),this.previewTabsState.clear()}replaceTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState=new B,this.previewTabsState=new O}};d([r()],g.prototype,"execution",2);d([r()],g.prototype,"lazyTreeState",2);d([r()],g.prototype,"pausedLine",2);d([r()],g.prototype,"pausedFrame",2);d([r()],g.prototype,"previewTabsState",2);d([r()],g.prototype,"session",2);d([r()],g.prototype,"ui",2);g=d([A("ArcadeDebuggerStore")],g);var N=class{#e;#a;#t;constructor(e,t=w){this.#e=e,this.#a=t}start(e){this.cancel({hidePanel:!1});let t=e.mode==="debug"?this.#e.startDebug():this.#e.startRun();setTimeout(()=>{this.#s(t)&&this.#o(e,t)},0)}cancel({hidePanel:e=!0}={}){this.#t?.abort(),this.#t=void 0,this.#e.isExecuting&&this.#e.cancelExecution({hidePanel:e})}async#o(e,t){let i;try{let{externalExecutor:a}=e;i=a?await this.#c({...e,externalExecutor:a},t):await this.#r(e,t)}catch(a){let n=a instanceof Error?a.message:String(a);i={type:"failure",error:b(n,a)}}this.#d(t,i)}async#r(e,t){if(!e.testData)return{type:"failure",error:b("Missing test data")};let i=await e.editorProfile;if(!i)return{type:"failure",error:b("Missing editor profile")};let a=await this.#a(i.definition,e.script,e.testData,{mode:e.mode,console:n=>this.#i(t,n),breakpoints:e.mode==="debug"?e.breakpoints:void 0,onDebugPause:e.mode==="debug"?(n,o)=>this.#n(t,n,o):void 0});return e.mode==="debug"?S(a)?{type:"failure",error:this.#u(a)}:{type:"debug",value:a}:S(a)?{type:"legacy-run",result:a}:{type:"failure",error:b("Unexpected debug result")}}async#c(e,t){let{externalExecutor:i}=e,a=new AbortController;this.#t=a;try{if(e.mode==="debug"){let o=await i.execute({mode:"debug",script:e.script,console:u=>this.#i(t,u),signal:a.signal,breakpoints:e.breakpoints,onDebugPause:(u,x)=>this.#n(t,u,x)});return{type:"debug",value:o.result,timing:o.timing}}let n=await i.execute({mode:"run",script:e.script,console:o=>this.#i(t,o),signal:a.signal});return{type:"run",value:n.result,timing:n.timing}}catch(n){let o=n instanceof Error?n.message:String(n);return{type:"failure",error:b(o,n)}}finally{this.#t===a&&(this.#t=void 0)}}#i(e,t){this.#s(e)&&this.#e.addConsoleLog(t)}async#n(e,t,i){if(!this.#s(e)||!this.#e.isDebugging)return;let a=Promise.withResolvers();return this.#e.pauseDebug({line:t.line,result:i,continue:a}),await a.promise}#d(e,t){if(this.#s(e))switch(t.type){case"debug":this.#e.completeDebug(t.value,t.timing);return;case"failure":this.#e.fail(t.error);return;case"legacy-run":this.#e.completeRun(t.result);return;case"run":this.#e.completeRun(t.value,{useDebugRenderer:!0,timing:t.timing})}}#u(e){return e.type==="error"?b(e.value,e.error):b("Unexpected legacy result")}#s(e){return e===this.#e.sessionId}},de={glyphMargin:!0,lineNumbersMinChars:1},K=class extends q{constructor(){super(...arguments),this._codeEditorElt=T(),this._arcadeAssistantElt=T(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._focusContinueActionOnPause=!1,this._debuggerState=new g,this._executionCoordinator=new N(this._debuggerState),this.messages=W(),this._modelId=U(),this._openArcadeHelp=()=>{window.open(X,"Arcade Help")},this._decorations=void 0,this._monacoEditor=H(Y),this._editorOptions={},this._toggleSidePanel=e=>{e.currentTarget instanceof HTMLElement&&this._setOpenedSidePanel(e.currentTarget.dataset.panelName??"none")},this._closeSidePanel=()=>{this._setOpenedSidePanel("none")},this._updateBreakpointsDecorations=()=>{let e=this.editorInstance;if(!e)return;let t=this._debuggerState.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}));this._decorations?.clear(),this._decorations=e.createDecorationsCollection(t)},this._clearDebuggerDecorations=()=>{this._decorations?.clear(),this._decorations=void 0,this._debuggerPausedLineDecoration?.clear(),this._debuggerPausedLineDecoration=void 0},this._debuggerPausedLineDecoration=void 0,this._preparingArcade=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this._diagnostics=[],this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.disableAssistant=!1,this.arcgisDiagnosticsChange=R({bubbles:!1}),this.arcgisScriptChange=R({bubbles:!1})}static{this.properties={_apiLibrary:16,_editorProfile:16,_preparingArcade:16,_arcadeAssistantRemoteState:16,_diagnostics:16,editorInstance:32,editorOptions:0,enableDebugger:5,hideDocumentationActions:5,hideSideBar:5,messageOverrides:0,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,disableAssistant:5,arcadeAssistant:0,externalExecutor:0,docsConfig:0}}static{this.styles=[ae]}get _canExecute(){return!!(this.testData||this.externalExecutor)}get _usesBottomExecutionDrawer(){return this._canExecute&&(this.enableDebugger||!!this.externalExecutor)}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...de,...this._editorOptions}}set editorOptions(e){this._editorOptions=e??{}}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let t=this._codeEditorElt.value?.value,i=await w(e.definition,t,this.testData,{mode:"run"});return S(i)?i:{type:"error",value:"Unexpected result",error:null}}async testRun(){try{let e=this._codeEditorElt.value?.value??this.script;if(this.externalExecutor){let{result:n}=await this.externalExecutor.execute({mode:"run",script:e,console:()=>{},signal:new AbortController().signal});return n}let t=this.testData;if(!t)throw new Error("Missing test data");await this._componentReadyDefer.promise;let i=await this._editorProfilePromise;if(!i)throw new Error("Missing editor profile");let a=await w(i.definition,e,t,{mode:"debug"});if(S(a))throw a.type==="error"&&a.error instanceof Error?a.error:new Error(a.type==="error"?a.value:"Unexpected Arcade result");return a}catch(e){let t=e instanceof Error?e.message:String(e);return b(t,e)}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async openArcadeAssistant(e){if(!this._arcadeAssistantRemoteState.shouldRender)return!1;if(this.openedSidePanel="arcade-assistant",await this.updateComplete,!this._canPromptWithArcadeAssistant())return!0;let t=this._arcadeAssistantElt.value;return e?.prompt&&await t?.openPrompt(e.prompt),!0}async load(){let e=V("./assets");te(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(l(this)),()=>{for(this._askAiBindingKey&&(D(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);this._disposables.length;)this._disposables.pop()?.dispose();this._executionCoordinator.cancel(),this._connectMonacoCustomizationsPromise=void 0,this._executeScriptAction=void 0,this._executeDebugScriptAction=void 0,this._hasDebuggerBreakpointsContextKey=void 0,this._focusContinueActionOnPause=!1,this._clearDebuggerDecorations(),this._debuggerState.disconnect()}))}willUpdate(e){(e.has("messages")||e.has("profile"))&&this._updateDataModelDeps(),(e.has("testData")||e.has("externalExecutor"))&&this._executionContextChanged(),e.has("enableDebugger")&&(this.enableDebugger||this._debuggerState.disableDebugger(),this._syncExecuteDebugScriptAction()),e.has("snippets")&&f.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve()}_setOpenedSidePanel(e){this.openedSidePanel=e===this.openedSidePanel?"none":e}async _connectMonacoCustomizations(){if(this._connectMonacoCustomizationsPromise)return await this._connectMonacoCustomizationsPromise;this._connectMonacoCustomizationsPromise=(async()=>{if(!this.isConnected)return;let e=await se();this._disposables.push(e.onDiagnosticsChange(p=>{this._preparingArcade||(this._diagnostics=p.diagnostics,this.arcgisDiagnosticsChange.emit(p.diagnostics))})),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let t=v(()=>this._debuggerState.editorBreakpoints,()=>{this._updateBreakpointsDecorations(),this._updateDebuggerBreakpointContextKey()},{sync:!0}),i=v(()=>this._debuggerState.debuggerLine,()=>this._updateDebuggerPausedLineDecoration(),{sync:!0}),a=v(()=>this._debuggerState.isPaused,()=>{!this._debuggerState.isPaused||!this._focusContinueActionOnPause||(this._focusContinueActionOnPause=!1,this.updateComplete.then(()=>{requestAnimationFrame(()=>{this.isConnected&&this._debuggerState.isPaused&&this.el.shadowRoot?.querySelector("#debugger-continue-action")?.setFocus()})}))},{sync:!0}),n=v(()=>this._debuggerState.isDebugging,()=>{this._debuggerState.isDebugging||(this._focusContinueActionOnPause=!1)},{sync:!0}),o=v(()=>this._debuggerState.consoleLogs.length,()=>this.requestUpdate(),{sync:!0});this._disposables.push({dispose:()=>t.remove()},{dispose:()=>i.remove()},{dispose:()=>a.remove()},{dispose:()=>n.remove()},{dispose:()=>o.remove()}),this._updateDebuggerBreakpointContextKey();let u=this.editorInstance?.onMouseDown(p=>this._onEditorMouseDown(p));u&&this._disposables.push(u);let x=this.editorInstance?.onDidChangeModelContent(p=>this._onEditorModelContentChange(p));x&&this._disposables.push(x),this._updateBreakpointsDecorations(),this._updateDebuggerPausedLineDecoration()})();try{await this._connectMonacoCustomizationsPromise}finally{this._connectMonacoCustomizationsPromise=void 0}}_onEditorMouseDown(e){if(!this.enableDebugger||![this._monacoEditor.MouseTargetType.GUTTER_GLYPH_MARGIN].includes(e.target.type)||e.target.element?.classList.contains("codicon-gutter-lightbulb"))return;let t=e.target.position?.lineNumber;t&&this._debuggerState.toggleBreakpoint(t)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||e.isFlush)return;let t=j(this._debuggerState.editorBreakpoints,e.changes);t.length===this._debuggerState.editorBreakpoints.length&&t.every((i,a)=>i===this._debuggerState.editorBreakpoints[a])||this._debuggerState.setBreakpoints(t)}_updateDebuggerPausedLineDecoration(){let e=this.editorInstance;if(!e)return;this._debuggerPausedLineDecoration?.clear();let t=this._debuggerState.debuggerLine;t!=null?this._debuggerPausedLineDecoration=e.createDecorationsCollection([{range:new F(t,1,t,1),options:{isWholeLine:!0,className:"arcgis-code-editor__debugger-paused-line",glyphMarginClassName:"arcgis-code-editor__debugger-paused-glyph",marginClassName:"arcgis-code-editor__debugger-paused-line arcgis-code-editor__debugger-paused-margin",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_stopDebugSession(){this._executionCoordinator.cancel({hidePanel:!1})}_resetDebugSession(){this._debuggerState.resetDebug(),this._executeScript("debug").catch(l(this))}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}_executionContextChanged(){this._canExecute||(this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this._executeDebugScriptAction&&(this._disposeSafely(this._executeDebugScriptAction),this._executeDebugScriptAction=void 0)),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.openedPanel==="debug-console"&&!this.enableDebugger&&this._debuggerState.closePanel(),this._executionCoordinator.cancel({hidePanel:!1}),this._debuggerState.showPanel&&this._executeScript("run").catch(l(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await f.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=f.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await f.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e,t=!1){let i=this.testData,a=this.externalExecutor;!this._codeEditorElt.value||!i&&!a||(this._focusContinueActionOnPause=e==="debug"&&t,this._executionCoordinator.start({mode:e,script:this._codeEditorElt.value?.value??this.script,testData:i,editorProfile:this._editorProfilePromise,externalExecutor:a,breakpoints:this._debuggerState.debuggerBreakpoints}))}_toggleShowExecutionPanel(){this._debuggerState.togglePanel()}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(l(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(l(this))}_onResultPanelChange(e){let t=e.currentTarget;this._debuggerState.setPanel(t.openedResultPanel)}_onExecutionPanelClose(){this._debuggerState.closePanel()}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[L.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this._canExecute&&this._executeScript("run").catch(l(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e)),this._syncExecuteDebugScriptAction()}_syncExecuteDebugScriptAction(){if(!this._canExecute||!this.enableDebugger){this._executeDebugScriptAction&&(this._disposeSafely(this._executeDebugScriptAction),this._executeDebugScriptAction=void 0);return}if(this._executeDebugScriptAction)return;let e=this.editorInstance?.addAction({id:"run-debug-script",label:this.messages.runanddebug??"Run and debug",precondition:"arcgisArcadeDebuggerHasBreakpoints",keybindings:[M.CtrlCmd|M.Shift|L.F5],contextMenuGroupId:"code",contextMenuOrder:2,run:()=>this._runAndDebug()});this._hasDebuggerBreakpointsContextKey??=this.editorInstance?.createContextKey("arcgisArcadeDebuggerHasBreakpoints",this._debuggerState.editorBreakpoints.length>0),this._updateDebuggerBreakpointContextKey(),e&&(this._executeDebugScriptAction=e,this._disposables.push(e))}_updateDebuggerBreakpointContextKey(){this._hasDebuggerBreakpointsContextKey?.set(this._debuggerState.editorBreakpoints.length>0)}_runAndDebug(){!this._canExecute||!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||this._executeScript("debug",!0).catch(l(this))}_getAskAiBindingKey(){return Q.parse(this._modelId).toString()}_canRenderAskAiCodeActions(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.codeActions:!1}_canPromptWithArcadeAssistant(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.prompting:!1}_getAskAiCodeActions(e){if(!this._canRenderAskAiCodeActions())return[];if(!e.markers.length)return[];let t=this.messages.askarcadeassistant??"Ask Arcade Assistant",i=this._getAskAiBindingKey();return[{title:t,kind:Z,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:ee,title:t,arguments:[i,this.messages.askarcadeassistantprompt??"Fix the errors in my script"]}}]}_syncAskAiAction(){if(!this.editorInstance)return;let e=this._getAskAiBindingKey();if(!this._arcadeAssistantRemoteState.shouldRender){this._askAiBindingKey&&(D(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&D(this._askAiBindingKey,void 0),D(e,{provideCodeActions:({context:t})=>this._getAskAiCodeActions(t),run:t=>{this.openArcadeAssistant({prompt:t??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(l(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await J(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this._usesBottomExecutionDrawer||!this._canExecute?null:c`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-toggle-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${()=>{this._executeScript("run").catch(l(this))}}></calcite-action>${this._debuggerState.result?c`<calcite-action .text=${this.messages.lastresults??""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`}renderMainPanel(){return c`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${f.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${I(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:t,icon:i,active:a,panelName:n,iconFlipRtl:o=!1,onClick:u=this._toggleSidePanel}){return c`<calcite-action id=${e??C} .text=${t} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${u} data-panel-name=${n??C} .iconFlipRtl=${o}></calcite-action>${!this.sideActionBarExpanded&&c`<calcite-tooltip .referenceElement=${e}><span>${t}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:c`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e,_arcadeAssistantRemoteState:t}=this;return c`<arcgis-language-api-panel slot=side-panel class=${y(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${y(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty,profilevariables:this.messages.profilevariables}}></arcgis-editor-variables>${this.suggestions?.length&&c`<arcgis-arcade-suggestions slot=side-panel class=${y(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${t?.shouldRender&&c`<arcgis-arcade-coding-assistant slot=side-panel class=${y(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${t.portalUrl} .serviceUrl=${"serviceUrl"in t?t.serviceUrl:void 0} .helpBase=${t.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${t.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant?.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant?.disableQuestionAnswerLogging} .diagnostics=${this._diagnostics} .isDevEnv=${"isDevEnv"in t?t.isDevEnv:!1} .docsConfig=${this.docsConfig} ${I(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(i=>c`<calcite-flow slot=side-panel class=${y(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):c`<calcite-flow-item .heading=${i.name} heading-level=2 closable .closed=${e!==i.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${i.description}>${i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){if(this._usesBottomExecutionDrawer)return this.renderBottomExecutionBody();if(!this._debuggerState.showPanel)return null;let e=this._debuggerState.openedPanel==="debug-console"?"output":this._debuggerState.openedPanel;return c`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.resultForLegacyRenderer} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:t,debugResult:i,isExecuting:a}=this._debuggerState;if(!e)return null;let n=t==="debug-console"?"output":t;return this.enableDebugger&&t==="debug-console"?c`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:t==="output"&&i?c`<arcgis-arcade-debugger-output slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:c`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${n} .loading=${t==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.resultForLegacyRenderer} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:t,openedPanel:i,isDebugging:a,isPaused:n,isExecuting:o}=this._debuggerState,u=this.messages.continue??"Continue",x=this.messages.reset??"Reset",p=this.messages.stop??"Stop";return c`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger&&a?c`<calcite-action id=debugger-continue-action .text=${u} icon=forward scale=s .disabled=${!n} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${u}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${x} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${x}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${p} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${p}</span></calcite-tooltip>`:c`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||o} @click=${()=>{this._executeScript("run").catch(l(this))}}></calcite-action>${this.enableDebugger&&c`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length===0} .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||o} @click=${this._runAndDebug}></calcite-action>`||""}`}</calcite-action-group>${t?c`<calcite-action-group scale=s><calcite-action .active=${i==="output"&&e} .text=${this.messages.output??"Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${()=>this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i==="console"&&e} .text=${this.messages.console??"Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${()=>this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i==="log"&&e} .text=${this.messages.log??"Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${()=>this._setExecutionPanel("log")} .disabled=${this.enableDebugger&&this._debuggerState.mode==="debug"}></calcite-action>${this.enableDebugger&&c`<calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug console"} text-enabled scale=s icon=debug .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action>`||""}</calcite-action-group>`:null}</calcite-action-bar>${e?c`<calcite-action .text=${this.messages.collapse??"Collapse"} scale=s icon=chevrons-down icon-flip-rtl @click=${this._onExecutionPanelClose} slot=actions-end></calcite-action>`:null}</div>`}render(){return c`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};G("arcgis-arcade-editor",K);return K},"core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,d,e,f,g,h)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import a from"./BZQJZCPB.js";import{H as z,j as l,q as A}from"./ZQPJGC6V.js";export default $arcgis.t(([{a:y}])=>{var _=/^[$A-Z_a-z][$\w]*$/u;function V(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function U(e){return _.test(e)}function W(e){return typeof e=="number"?`[${e}]`:e.startsWith("name:")?`[name="${V(e.slice(5))}"]`:e.startsWith("id:")?`[id="${V(e.slice(3))}"]`:U(e)?`.${e}`:`["${V(e)}"]`}function E(e,t){if(e[t]!=='"')return;let i="",a=t+1;for(;a<e.length;){let m=e[a];if(m==="\\"){if(a+=1,a>=e.length)return;i+=e[a],a+=1;continue}if(m==='"')return{value:i,nextIndex:a+1};i+=m,a+=1}}function H(e){if(!e)return;let t=0,i=[];for(;t<e.length&&/[$A-Z_a-z0-9]/u.test(e[t]);)t+=1;let a=e.slice(0,t);if(!a)return;for(;t<e.length;){let p=e[t];if(p==="."){t+=1;let c=t;for(;t<e.length&&/[$\w]/u.test(e[t]);)t+=1;if(c===t)return;i.push(e.slice(c,t));continue}if(p!=="[")return;if(t+=1,/\d/u.test(e[t]??"")){let c=t;for(;t<e.length&&/\d/u.test(e[t]);)t+=1;if(e[t]!=="]")return;i.push(e.slice(c,t)),t+=1;continue}let f=e.startsWith("name=",t)?"name":e.startsWith("id=",t)?"id":void 0;if(f){let c=E(e,t+f.length+1);if(!c||e[c.nextIndex]!=="]")return;i.push(`${f}:${c.value}`),t=c.nextIndex+1;continue}let o=E(e,t);if(!o||e[o.nextIndex]!=="]")return;i.push(o.value),t=o.nextIndex+1}let[m,...s]=i;if(m)return{scopeName:a,rootName:m,pathSegments:s}}function de(e,t){return`${e}${W(t)}`}function M(e,t){return e?`${e}.${t}`:String(t)}function k(e,t){if(e)return`${e}${W(t)}`}function pe(e){return H(e)}function q(e,t){return typeof t=="number"?`${e}[${t}]`:`${e}.${t}`}function J(e){return e.name?`name:${e.name}`:`id:${e.id}`}function K(e){return Object.entries(e).filter(([t])=>t!=="featureSet")}function Q(e,t){if(t){let i=t.featureSet;return{kind:"feature-set",displayValue:i.arcadeType,featureSetValue:i,loadRequest:{kind:"schema",load:()=>i.schema()},mergedCollectionItem:t}}return e.type==="feature-set"?{kind:"feature-set",displayValue:e.arcadeType,featureSetValue:e,loadRequest:{kind:"schema",load:()=>e.schema()}}:e.type==="feature-set-collection"?{kind:"collection",collectionValue:e,displayValue:e.arcadeType,loadRequest:{kind:"collection",load:()=>e.load()}}:null}function x(e){return l`<calcite-tree slot=children .lines=${y.lines} .selectionMode=${y.selectionMode} .scale=${y.scale} @calciteTreeSelect=${y.oncalciteTreeSelect}>${e}</calcite-tree>`}function j({lazyTreeState:e,nodePath:t,mergedCollectionItem:i,expanded:a=!1,isMetadata:m=!1,messages:s,name:p,value:f,loadPreview:o,previewLabel:c,previewSourcePath:b,previewLoading:g=!1}){let u=Q(f,i);if(!u)return null;let n=e.ensureNode(t,a,u.loadRequest),$=u.kind==="feature-set"?u.featureSetValue:void 0,S=c??String(p),v=b??t,C=!!(o&&S&&$&&typeof $.querySample=="function"),d=r=>{r.target===r.currentTarget&&e.setExpanded(t,!0,u.loadRequest)},h=r=>{r.target===r.currentTarget&&e.setExpanded(t,!1,u.loadRequest)},I=r=>{r.stopPropagation(),!(!o||!S||!$)&&o({label:S,sourcePath:v,value:$})},w=()=>l`<calcite-tree-item disabled><div class="tree-item-label"><span class="constant-value">${n.errorMessage||(s.loaderror??"Unable to load data.")}</span></div></calcite-tree-item>`,D=()=>u.kind!=="feature-set"||!n.schemaValue?null:T({name:"schema",value:n.schemaValue,messages:s,path:q(t,"schema"),lazyTreeState:e}),F=()=>u.kind!=="feature-set"||!u.mergedCollectionItem?[]:K(u.mergedCollectionItem).map(([r,P])=>T({name:r,value:X(P),messages:s,path:q(t,r),lazyTreeState:e})),G=()=>{if(u.kind!=="feature-set")return null;if(!n.expanded||n.status==="loading")return x();let r=[];if(n.status==="error")r.push(w());else{r.push(...F());let P=D();P&&r.push(P)}return r.length?x(r):x()},O=()=>u.kind!=="collection"?null:!n.expanded||n.status==="loading"?x():x(l`${n.status==="error"?w():null}${n.status==="loaded"?n.collectionItems.map(r=>j({name:r.name||r.id,mergedCollectionItem:r,messages:s,nodePath:q(t,r.id),lazyTreeState:e,value:r.featureSet,loadPreview:o,previewLabel:M(c,r.name||r.id),previewSourcePath:k(v,J(r)),previewLoading:g})):null}`),Z=()=>u.kind==="collection"?O():G();return l`<calcite-tree-item .expanded=${n.expanded} @calciteTreeItemExpand=${d} @calciteTreeItemCollapse=${h}><div class="tree-item-label">${L({name:p,isMetadata:m})}<bdi>${u.displayValue}</bdi></div>${n.status==="loading"?l`<calcite-loader slot=actions-end scale=s inline type=indeterminate .label=${s.loading??"Loading"} .text=${s.loading??"Loading"}></calcite-loader>`:null}${C?l`<calcite-action slot=actions-end scale=s class="load-action" .text=${s.loadpreview??"Load preview"} text-enabled icon=play .disabled=${g} @click=${I}></calcite-action>`:null}${Z()}</calcite-tree-item>`}function X(e){if(e==null)return{type:"primitive",arcadeType:"",value:null};switch(typeof e){case"boolean":return{type:"primitive",arcadeType:"Boolean",value:e};case"number":return{type:"primitive",arcadeType:"Number",value:e};case"string":return{type:"primitive",arcadeType:"String",value:e};default:return{type:"primitive",arcadeType:"String",value:String(e)}}}var N="tree-item-metadata";function L({name:e,isMetadata:t=!1}){let i=t?`dictionary-property ${N}`:"dictionary-property",a=t?N:void 0;return l`<bdi class=${z(i)}>${e}</bdi><bdi class=${z(a)}>:&nbsp;</bdi>`}function Y({lazyTreeState:e,path:t,expanded:i=!1,value:a,subtree:m,messages:s,onLoadPreview:p,previewLabel:f,previewSourcePath:o,previewLoading:c=!1}){let b=d=>l`<calcite-tree slot=${"children"} .lines=${y.lines} .selectionMode=${y.selectionMode} .scale=${y.scale} @calciteTreeSelect=${y.oncalciteTreeSelect}>${d}</calcite-tree>`;if(!i)return b();let g=e.ensureNode(t,i),u=d=>g.visibleChildCount>=d?null:l`<calcite-tree-item @click=${h=>{h.stopPropagation(),e.showMore(t,d)}}><div class="tree-item-label"><span class=${z(N)}>${s.showmore??"Show more"}</span></div></calcite-tree-item>`,n=a.expand();if(Array.isArray(n)){let d=n.slice(0,g.visibleChildCount),h=B(a)?a.length:n.length;return b(l`${d.map((I,w)=>T({name:w,value:I,messages:s,path:`${t}[${w}]`,lazyTreeState:e,onLoadPreview:p,previewLabel:M(f,w),previewSourcePath:k(o,w),previewLoading:c}))}${u(n.length)}${T({name:"length",value:{arcadeType:"Number",type:"primitive",value:h},isMetadata:!0,messages:s,path:`${t}.length`,lazyTreeState:e})}`)}let $=a.arcadeType==="Feature"?n.get("Geometry()"):void 0,S=Math.min(g.visibleChildCount,$?n.size-1:n.size),v=[];for(let[d,h]of n.entries())if(!(d==="Geometry()"&&a.arcadeType==="Feature")){if(v.length>=S)break;v.push([d,h])}let C=!!($&&g.visibleChildCount>v.length);return b(l`${v.map(([d,h])=>T({name:d,value:h,messages:s,path:`${t}.${d}`,lazyTreeState:e,onLoadPreview:p,previewLabel:M(f,d),previewSourcePath:k(o,d),previewLoading:c}))}${C?T({name:"geometry",value:$,messages:s,path:`${t}.geometry`,lazyTreeState:e,onLoadPreview:p,previewLabel:M(f,"geometry"),previewSourcePath:k(o,"geometry"),previewLoading:c}):null}${u(n.size)}`)}function ee(e){return"expand"in e}function te(e){return e.type==="simple"}function ae(e){return e.type==="primitive"}function B(e){return e.type==="sequence-container"}function ie(e){return e.type==="feature-set"}function ne(e){return e.type==="feature-set-collection"}function re(e){return e.type==="minimal"}function le(e){return ie(e)||ne(e)}function T({lazyTreeState:e,path:t,name:i,value:a,messages:m,expanded:s,isMetadata:p=!1,onLoadPreview:f,previewLabel:o,previewSourcePath:c,previewLoading:b=!1}){if(a===void 0)return null;if(a===null)return l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}<bdi class="uninitialized-value tree-item-metadata">${m.uninitialized??"uninitialized"}</bdi></div></calcite-tree-item>`;if(ee(a)){let g=e.ensureNode(t,s),u=v=>{v.target===v.currentTarget&&e.setExpanded(t,!0)},n=v=>{v.target===v.currentTarget&&e.setExpanded(t,!1)},$=typeof a.arcadeType=="string"?a.arcadeType:"unknown",S=B(a)?`${$}(${a.length})`:$;return l`<calcite-tree-item .expanded=${g.expanded} @calciteTreeItemExpand=${u} @calciteTreeItemCollapse=${n}><div class="tree-item-label">${L({name:i,isMetadata:p})}<bdi>${S}</bdi></div>${Y({expanded:g.expanded,value:a,subtree:!0,messages:m,path:t,lazyTreeState:e,onLoadPreview:f,previewLabel:o,previewSourcePath:c,previewLoading:b})}</calcite-tree-item>`}return le(a)?j({name:i,value:a,nodePath:t,lazyTreeState:e,messages:m,expanded:s,isMetadata:p,loadPreview:f,previewLabel:o,previewSourcePath:c,previewLoading:b}):te(a)?l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}${R({value:a})}</div></calcite-tree-item>`:ae(a)||re(a)?l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}${R({value:a})}</div></calcite-tree-item>`:null}var R=({value:e})=>{switch(e.type){case"primitive":if(e.value===null)return l`<bdi class="constant-value">null</bdi>`;switch(e.arcadeType){case"String":return l`<bdi class="string-value">${A(String(e.value))}</bdi>`;case"Number":return l`<bdi class="number-value">${Object.is(e.value,-0)?"-0":String(e.value)}</bdi>`;case"Boolean":return l`<bdi class="constant-value">${String(e.value)}</bdi>`;default:return null}case"simple":return l`<bdi class="date-value">${e.render()}</bdi>`;case"minimal":return l`<bdi class="constant-value">${e.arcadeType}</bdi>`;default:return null}};return{a:de,b:pe,c:ee,d:te,e:ae,f:ie,g:ne,h:re,i:T,j:R}},a)
2
+ import a from"./PVLAI7SG.js";import{H as z,j as l,q as A}from"./O7IT7ZNK.js";export default $arcgis.t(([{a:y}])=>{var _=/^[$A-Z_a-z][$\w]*$/u;function V(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function U(e){return _.test(e)}function W(e){return typeof e=="number"?`[${e}]`:e.startsWith("name:")?`[name="${V(e.slice(5))}"]`:e.startsWith("id:")?`[id="${V(e.slice(3))}"]`:U(e)?`.${e}`:`["${V(e)}"]`}function E(e,t){if(e[t]!=='"')return;let i="",a=t+1;for(;a<e.length;){let m=e[a];if(m==="\\"){if(a+=1,a>=e.length)return;i+=e[a],a+=1;continue}if(m==='"')return{value:i,nextIndex:a+1};i+=m,a+=1}}function H(e){if(!e)return;let t=0,i=[];for(;t<e.length&&/[$A-Z_a-z0-9]/u.test(e[t]);)t+=1;let a=e.slice(0,t);if(!a)return;for(;t<e.length;){let p=e[t];if(p==="."){t+=1;let c=t;for(;t<e.length&&/[$\w]/u.test(e[t]);)t+=1;if(c===t)return;i.push(e.slice(c,t));continue}if(p!=="[")return;if(t+=1,/\d/u.test(e[t]??"")){let c=t;for(;t<e.length&&/\d/u.test(e[t]);)t+=1;if(e[t]!=="]")return;i.push(e.slice(c,t)),t+=1;continue}let f=e.startsWith("name=",t)?"name":e.startsWith("id=",t)?"id":void 0;if(f){let c=E(e,t+f.length+1);if(!c||e[c.nextIndex]!=="]")return;i.push(`${f}:${c.value}`),t=c.nextIndex+1;continue}let o=E(e,t);if(!o||e[o.nextIndex]!=="]")return;i.push(o.value),t=o.nextIndex+1}let[m,...s]=i;if(m)return{scopeName:a,rootName:m,pathSegments:s}}function de(e,t){return`${e}${W(t)}`}function M(e,t){return e?`${e}.${t}`:String(t)}function k(e,t){if(e)return`${e}${W(t)}`}function pe(e){return H(e)}function q(e,t){return typeof t=="number"?`${e}[${t}]`:`${e}.${t}`}function J(e){return e.name?`name:${e.name}`:`id:${e.id}`}function K(e){return Object.entries(e).filter(([t])=>t!=="featureSet")}function Q(e,t){if(t){let i=t.featureSet;return{kind:"feature-set",displayValue:i.arcadeType,featureSetValue:i,loadRequest:{kind:"schema",load:()=>i.schema()},mergedCollectionItem:t}}return e.type==="feature-set"?{kind:"feature-set",displayValue:e.arcadeType,featureSetValue:e,loadRequest:{kind:"schema",load:()=>e.schema()}}:e.type==="feature-set-collection"?{kind:"collection",collectionValue:e,displayValue:e.arcadeType,loadRequest:{kind:"collection",load:()=>e.load()}}:null}function x(e){return l`<calcite-tree slot=children .lines=${y.lines} .selectionMode=${y.selectionMode} .scale=${y.scale} @calciteTreeSelect=${y.oncalciteTreeSelect}>${e}</calcite-tree>`}function j({lazyTreeState:e,nodePath:t,mergedCollectionItem:i,expanded:a=!1,isMetadata:m=!1,messages:s,name:p,value:f,loadPreview:o,previewLabel:c,previewSourcePath:b,previewLoading:g=!1}){let u=Q(f,i);if(!u)return null;let n=e.ensureNode(t,a,u.loadRequest),$=u.kind==="feature-set"?u.featureSetValue:void 0,S=c??String(p),v=b??t,C=!!(o&&S&&$&&typeof $.querySample=="function"),d=r=>{r.target===r.currentTarget&&e.setExpanded(t,!0,u.loadRequest)},h=r=>{r.target===r.currentTarget&&e.setExpanded(t,!1,u.loadRequest)},I=r=>{r.stopPropagation(),!(!o||!S||!$)&&o({label:S,sourcePath:v,value:$})},w=()=>l`<calcite-tree-item disabled><div class="tree-item-label"><span class="constant-value">${n.errorMessage||(s.loaderror??"Unable to load data.")}</span></div></calcite-tree-item>`,D=()=>u.kind!=="feature-set"||!n.schemaValue?null:T({name:"schema",value:n.schemaValue,messages:s,path:q(t,"schema"),lazyTreeState:e}),F=()=>u.kind!=="feature-set"||!u.mergedCollectionItem?[]:K(u.mergedCollectionItem).map(([r,P])=>T({name:r,value:X(P),messages:s,path:q(t,r),lazyTreeState:e})),G=()=>{if(u.kind!=="feature-set")return null;if(!n.expanded||n.status==="loading")return x();let r=[];if(n.status==="error")r.push(w());else{r.push(...F());let P=D();P&&r.push(P)}return r.length?x(r):x()},O=()=>u.kind!=="collection"?null:!n.expanded||n.status==="loading"?x():x(l`${n.status==="error"?w():null}${n.status==="loaded"?n.collectionItems.map(r=>j({name:r.name||r.id,mergedCollectionItem:r,messages:s,nodePath:q(t,r.id),lazyTreeState:e,value:r.featureSet,loadPreview:o,previewLabel:M(c,r.name||r.id),previewSourcePath:k(v,J(r)),previewLoading:g})):null}`),Z=()=>u.kind==="collection"?O():G();return l`<calcite-tree-item .expanded=${n.expanded} @calciteTreeItemExpand=${d} @calciteTreeItemCollapse=${h}><div class="tree-item-label">${L({name:p,isMetadata:m})}<bdi>${u.displayValue}</bdi></div>${n.status==="loading"?l`<calcite-loader slot=actions-end scale=s inline type=indeterminate .label=${s.loading??"Loading"} .text=${s.loading??"Loading"}></calcite-loader>`:null}${C?l`<calcite-action slot=actions-end scale=s class="load-action" .text=${s.loadpreview??"Load preview"} text-enabled icon=play .disabled=${g} @click=${I}></calcite-action>`:null}${Z()}</calcite-tree-item>`}function X(e){if(e==null)return{type:"primitive",arcadeType:"",value:null};switch(typeof e){case"boolean":return{type:"primitive",arcadeType:"Boolean",value:e};case"number":return{type:"primitive",arcadeType:"Number",value:e};case"string":return{type:"primitive",arcadeType:"String",value:e};default:return{type:"primitive",arcadeType:"String",value:String(e)}}}var N="tree-item-metadata";function L({name:e,isMetadata:t=!1}){let i=t?`dictionary-property ${N}`:"dictionary-property",a=t?N:void 0;return l`<bdi class=${z(i)}>${e}</bdi><bdi class=${z(a)}>:&nbsp;</bdi>`}function Y({lazyTreeState:e,path:t,expanded:i=!1,value:a,subtree:m,messages:s,onLoadPreview:p,previewLabel:f,previewSourcePath:o,previewLoading:c=!1}){let b=d=>l`<calcite-tree slot=${"children"} .lines=${y.lines} .selectionMode=${y.selectionMode} .scale=${y.scale} @calciteTreeSelect=${y.oncalciteTreeSelect}>${d}</calcite-tree>`;if(!i)return b();let g=e.ensureNode(t,i),u=d=>g.visibleChildCount>=d?null:l`<calcite-tree-item @click=${h=>{h.stopPropagation(),e.showMore(t,d)}}><div class="tree-item-label"><span class=${z(N)}>${s.showmore??"Show more"}</span></div></calcite-tree-item>`,n=a.expand();if(Array.isArray(n)){let d=n.slice(0,g.visibleChildCount),h=B(a)?a.length:n.length;return b(l`${d.map((I,w)=>T({name:w,value:I,messages:s,path:`${t}[${w}]`,lazyTreeState:e,onLoadPreview:p,previewLabel:M(f,w),previewSourcePath:k(o,w),previewLoading:c}))}${u(n.length)}${T({name:"length",value:{arcadeType:"Number",type:"primitive",value:h},isMetadata:!0,messages:s,path:`${t}.length`,lazyTreeState:e})}`)}let $=a.arcadeType==="Feature"?n.get("Geometry()"):void 0,S=Math.min(g.visibleChildCount,$?n.size-1:n.size),v=[];for(let[d,h]of n.entries())if(!(d==="Geometry()"&&a.arcadeType==="Feature")){if(v.length>=S)break;v.push([d,h])}let C=!!($&&g.visibleChildCount>v.length);return b(l`${v.map(([d,h])=>T({name:d,value:h,messages:s,path:`${t}.${d}`,lazyTreeState:e,onLoadPreview:p,previewLabel:M(f,d),previewSourcePath:k(o,d),previewLoading:c}))}${C?T({name:"geometry",value:$,messages:s,path:`${t}.geometry`,lazyTreeState:e,onLoadPreview:p,previewLabel:M(f,"geometry"),previewSourcePath:k(o,"geometry"),previewLoading:c}):null}${u(n.size)}`)}function ee(e){return"expand"in e}function te(e){return e.type==="simple"}function ae(e){return e.type==="primitive"}function B(e){return e.type==="sequence-container"}function ie(e){return e.type==="feature-set"}function ne(e){return e.type==="feature-set-collection"}function re(e){return e.type==="minimal"}function le(e){return ie(e)||ne(e)}function T({lazyTreeState:e,path:t,name:i,value:a,messages:m,expanded:s,isMetadata:p=!1,onLoadPreview:f,previewLabel:o,previewSourcePath:c,previewLoading:b=!1}){if(a===void 0)return null;if(a===null)return l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}<bdi class="uninitialized-value tree-item-metadata">${m.uninitialized??"uninitialized"}</bdi></div></calcite-tree-item>`;if(ee(a)){let g=e.ensureNode(t,s),u=v=>{v.target===v.currentTarget&&e.setExpanded(t,!0)},n=v=>{v.target===v.currentTarget&&e.setExpanded(t,!1)},$=typeof a.arcadeType=="string"?a.arcadeType:"unknown",S=B(a)?`${$}(${a.length})`:$;return l`<calcite-tree-item .expanded=${g.expanded} @calciteTreeItemExpand=${u} @calciteTreeItemCollapse=${n}><div class="tree-item-label">${L({name:i,isMetadata:p})}<bdi>${S}</bdi></div>${Y({expanded:g.expanded,value:a,subtree:!0,messages:m,path:t,lazyTreeState:e,onLoadPreview:f,previewLabel:o,previewSourcePath:c,previewLoading:b})}</calcite-tree-item>`}return le(a)?j({name:i,value:a,nodePath:t,lazyTreeState:e,messages:m,expanded:s,isMetadata:p,loadPreview:f,previewLabel:o,previewSourcePath:c,previewLoading:b}):te(a)?l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}${R({value:a})}</div></calcite-tree-item>`:ae(a)||re(a)?l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}${R({value:a})}</div></calcite-tree-item>`:null}var R=({value:e})=>{switch(e.type){case"primitive":if(e.value===null)return l`<bdi class="constant-value">null</bdi>`;switch(e.arcadeType){case"String":return l`<bdi class="string-value">${A(String(e.value))}</bdi>`;case"Number":return l`<bdi class="number-value">${Object.is(e.value,-0)?"-0":String(e.value)}</bdi>`;case"Boolean":return l`<bdi class="constant-value">${String(e.value)}</bdi>`;default:return null}case"simple":return l`<bdi class="date-value">${e.render()}</bdi>`;case"minimal":return l`<bdi class="constant-value">${e.arcadeType}</bdi>`;default:return null}};return{a:de,b:pe,c:ee,d:te,e:ae,f:ie,g:ne,h:re,i:T,j:R}},a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{b as P,c as A,d as N}from"./RYQS3S5A.js";import{a as y,b as x,c as m,d as f,e as C,f as O,m as h,o as L}from"./ZQPJGC6V.js";import{a as w}from"./C3LWMJ56.js";var $=(...e)=>{let r=[];for(let o=0;o<e.length;++o){let s=e[o];if(typeof s=="string")r.push(s);else if(Array.isArray(s))r.push.apply(r,s);else if(typeof s=="object")for(let n in s)s[n]&&r.push(n)}let t=r.join(" ");return r.length=0,t},W=(e,r)=>{let t=e;for(;t;){if(t===r)return!0;if(!t.parentNode)return!1;t.parentNode instanceof ShadowRoot?t=t.parentNode.host:t=t.parentNode}return!1},M=(e,r,t)=>{let o=F(r).subscribe;return o(s=>{s.some(i=>W(e,i.target))&&t()})},g={},F=e=>{let r=e.join(","),t=g[r];if(t!==void 0)return t;let o=new Set,s=new MutationObserver(i=>o.forEach(a=>a(i)));globalThis.document&&s.observe(document.documentElement,{attributes:!0,attributeFilter:e,subtree:!0});let n={subscribe:i=>(o.add(i),()=>{o.delete(i),o.size===0&&(s.disconnect(),g[r]=void 0)})};return g[r]=n,n},D=(e,r)=>{let t=e;for(;t;){let o=t.closest?.(r);if(o)return o;let s=t.getRootNode?.();if(s===globalThis.document)return;t=s?.host}};function q(e){let r=D(e,".calcite-mode-dark, .calcite-mode-light, .calcite-mode-auto");return r?.classList.contains("calcite-mode-dark")||r?.classList.contains("calcite-mode-auto")&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var _=(e,r,t)=>D(e,`[${r}]`)?.getAttribute(r)??t,G=async e=>{e!=null&&(U(e)?await e.setFocus():e.focus())},U=e=>typeof e.setFocus=="function";var j=e=>(...r)=>{let t=f(),o=new e(...r),s=o.exports;m(t.at(-1));let n=o.component.manager;n.W(o,s),o.watchExports(n.W.bind(n,o)),C(o);let i=[o.component,...t].reverse();return h(i,a=>a===void 0?void 0:k(o,a,s),s)},k=(e,{host:r,key:t,isReactive:o},s)=>{let n=r,i=n[t]!==e.exports,a=n[t]!==s,c=s!==e.exports;if(i&&!a&&c&&(n[t]=e.exports),r===e.component){if(o){let l=e.component.manager;a&&l.W(e,n[t]),e.onUpdate(d=>{if(d.has(t)){let E=n[t];E!==e.exports&&l.W(e,E)}})}e.O=o?void 0:t}let u=e.component.constructor.elementProperties.get(t)?.readOnly;e.watchExports(()=>{n[t]!==e.exports&&(u?O(()=>{n[t]=e.exports}):n[t]=e.exports)})};var b=e=>{let r=_(e,"lang",globalThis.navigator?.language||P);return{lang:r,t9nLocale:N(r)}},T=(e,r,t,o)=>{let s,n=()=>K(e,r(),o).then(i=>{(s?.lang!==i.lang||s.t9nLocale!==i.t9nLocale||s.t9nStrings!==i.t9nStrings)&&t(i),s=i}).catch(i=>{w("error","intl","Error updating component locale state",{detail:{error:i}})});return queueMicrotask(n),M(e,["lang"],n)},K=async(e,r,t=e.localName.split("-").slice(1).join("-"))=>{let{lang:o,t9nLocale:s}=b(e),n=`${r}/${t}/t9n`,a=t===null?{}:await A(s,n,"messages.");return{lang:o,t9nLocale:s,t9nStrings:a}};var V=e=>R(void 0,e);var v=class extends L{constructor(r,t){super(r);let o=this.exports;try{x(this.component);let s=t(this.component,this),n=this.exports!==o;if(y(s)){n||this.setProvisionalExports(s);let i=s.then(a=>{this.exports=a,super.catchUpLifecycle()}).catch(a=>{this.P.reject(a)});this.onLoad(async()=>await i)}else(!n||s!==void 0)&&(this.exports=s),queueMicrotask(()=>super.catchUpLifecycle())}catch(s){this.P.reject(s)}}catchUpLifecycle(){}},R=j(v);var ce=V;var le=e=>(r={})=>V((t,o)=>{let s=b(t.el),n={_lang:s.lang,_t9nLocale:s.t9nLocale,_loading:!0},i=t;o.onLifecycle(()=>T(t.el,()=>e("./assets"),({t9nLocale:c,t9nStrings:p,lang:u})=>{let l={...p,_lang:u,_t9nLocale:c,_loading:!1};o.exports=l;let d=p.componentLabel;typeof d=="string"&&"label"in t&&t.label==null&&(t.label??=d),a(i.messageOverrides)},r.name));let a=c=>{let p=o.exports,u=p._original??p,l=S(u,c);c&&(l._original=u),o.exports=l};return"messageOverrides"in i&&o.onUpdate(c=>{c.has("messageOverrides")&&a(i.messageOverrides)}),r.blocking?(o.setProvisionalExports(n,!1),o.ready):n}),S=(e,r)=>{if(!r)return e;let t={...e};return Object.entries(r).forEach(([o,s])=>{e[o]!==void 0&&(typeof s=="object"?t[o]=S(e[o],s):t[o]=s??e[o])}),t};export{$ as a,M as b,D as c,q as d,G as e,ce as f,le as g};
2
+ import{b as P,c as A,d as N}from"./RYQS3S5A.js";import{a as y,b as x,c as m,d as f,e as C,f as O,m as h,o as L}from"./O7IT7ZNK.js";import{a as w}from"./C3LWMJ56.js";var $=(...e)=>{let r=[];for(let o=0;o<e.length;++o){let s=e[o];if(typeof s=="string")r.push(s);else if(Array.isArray(s))r.push.apply(r,s);else if(typeof s=="object")for(let n in s)s[n]&&r.push(n)}let t=r.join(" ");return r.length=0,t},W=(e,r)=>{let t=e;for(;t;){if(t===r)return!0;if(!t.parentNode)return!1;t.parentNode instanceof ShadowRoot?t=t.parentNode.host:t=t.parentNode}return!1},M=(e,r,t)=>{let o=F(r).subscribe;return o(s=>{s.some(i=>W(e,i.target))&&t()})},g={},F=e=>{let r=e.join(","),t=g[r];if(t!==void 0)return t;let o=new Set,s=new MutationObserver(i=>o.forEach(a=>a(i)));globalThis.document&&s.observe(document.documentElement,{attributes:!0,attributeFilter:e,subtree:!0});let n={subscribe:i=>(o.add(i),()=>{o.delete(i),o.size===0&&(s.disconnect(),g[r]=void 0)})};return g[r]=n,n},D=(e,r)=>{let t=e;for(;t;){let o=t.closest?.(r);if(o)return o;let s=t.getRootNode?.();if(s===globalThis.document)return;t=s?.host}};function q(e){let r=D(e,".calcite-mode-dark, .calcite-mode-light, .calcite-mode-auto");return r?.classList.contains("calcite-mode-dark")||r?.classList.contains("calcite-mode-auto")&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var _=(e,r,t)=>D(e,`[${r}]`)?.getAttribute(r)??t,G=async e=>{e!=null&&(U(e)?await e.setFocus():e.focus())},U=e=>typeof e.setFocus=="function";var j=e=>(...r)=>{let t=f(),o=new e(...r),s=o.exports;m(t.at(-1));let n=o.component.manager;n.W(o,s),o.watchExports(n.W.bind(n,o)),C(o);let i=[o.component,...t].reverse();return h(i,a=>a===void 0?void 0:k(o,a,s),s)},k=(e,{host:r,key:t,isReactive:o},s)=>{let n=r,i=n[t]!==e.exports,a=n[t]!==s,c=s!==e.exports;if(i&&!a&&c&&(n[t]=e.exports),r===e.component){if(o){let l=e.component.manager;a&&l.W(e,n[t]),e.onUpdate(d=>{if(d.has(t)){let E=n[t];E!==e.exports&&l.W(e,E)}})}e.O=o?void 0:t}let u=e.component.constructor.elementProperties.get(t)?.readOnly;e.watchExports(()=>{n[t]!==e.exports&&(u?O(()=>{n[t]=e.exports}):n[t]=e.exports)})};var b=e=>{let r=_(e,"lang",globalThis.navigator?.language||P);return{lang:r,t9nLocale:N(r)}},T=(e,r,t,o)=>{let s,n=()=>K(e,r(),o).then(i=>{(s?.lang!==i.lang||s.t9nLocale!==i.t9nLocale||s.t9nStrings!==i.t9nStrings)&&t(i),s=i}).catch(i=>{w("error","intl","Error updating component locale state",{detail:{error:i}})});return queueMicrotask(n),M(e,["lang"],n)},K=async(e,r,t=e.localName.split("-").slice(1).join("-"))=>{let{lang:o,t9nLocale:s}=b(e),n=`${r}/${t}/t9n`,a=t===null?{}:await A(s,n,"messages.");return{lang:o,t9nLocale:s,t9nStrings:a}};var V=e=>R(void 0,e);var v=class extends L{constructor(r,t){super(r);let o=this.exports;try{x(this.component);let s=t(this.component,this),n=this.exports!==o;if(y(s)){n||this.setProvisionalExports(s);let i=s.then(a=>{this.exports=a,super.catchUpLifecycle()}).catch(a=>{this.P.reject(a)});this.onLoad(async()=>await i)}else(!n||s!==void 0)&&(this.exports=s),queueMicrotask(()=>super.catchUpLifecycle())}catch(s){this.P.reject(s)}}catchUpLifecycle(){}},R=j(v);var ce=V;var le=e=>(r={})=>V((t,o)=>{let s=b(t.el),n={_lang:s.lang,_t9nLocale:s.t9nLocale,_loading:!0},i=t;o.onLifecycle(()=>T(t.el,()=>e("./assets"),({t9nLocale:c,t9nStrings:p,lang:u})=>{let l={...p,_lang:u,_t9nLocale:c,_loading:!1};o.exports=l;let d=p.componentLabel;typeof d=="string"&&"label"in t&&t.label==null&&(t.label??=d),a(i.messageOverrides)},r.name));let a=c=>{let p=o.exports,u=p._original??p,l=S(u,c);c&&(l._original=u),o.exports=l};return"messageOverrides"in i&&o.onUpdate(c=>{c.has("messageOverrides")&&a(i.messageOverrides)}),r.blocking?(o.setProvisionalExports(n,!1),o.ready):n}),S=(e,r)=>{if(!r)return e;let t={...e};return Object.entries(r).forEach(([o,s])=>{e[o]!==void 0&&(typeof s=="object"?t[o]=S(e[o],s):t[o]=s??e[o])}),t};export{$ as a,M as b,D as c,q as d,G as e,ce as f,le as g};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{u as h}from"./ZQPJGC6V.js";import{a as b}from"./C3LWMJ56.js";export default $arcgis.t(([N,{version:I,fullVersion:P},U,S])=>{var w="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",a=(e,s)=>{b(e,"Arcade Assistant",s)},d=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],R=d,C=(e,s)=>s.every(r=>e[r]===!0),$=e=>{let{aiConfig:s}=e;return s?.aiForOrg?.enabled===!0&&s?.aiForOrg?.aiCapabilities?.aiAssistants?.enabled===!0};async function L({portalUrl:e}){e&&a("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let s=e||N.portalUrl;if(!s)return a("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let r;if(e?r=new U({url:s,authMode:"no-prompt"}):r=U.getDefault(),await r.load().catch(t=>(a("warn",`Failed to load portal. Reason: ${t}.`),{shouldRender:!1})),!r.user)return a("warn","User is not signed in."),{shouldRender:!1};let i=r.sourceJSON,n=i?.isPortal===!0;if(n&&!q(i.enterpriseVersion))return{shouldRender:!1};let{restUrl:o}=r,F=`${o}/portals/self/settings`,y=S(F,{query:{f:"json"}}).then(t=>t.data).catch(t=>(a("warn",`Failed to fetch settingsUrl. Reason: ${t}.`),{})),l=n,k=l?S(`${o}/portals/self/aiServer/status`,{query:{f:"json"}}).then(t=>t.data).catch(t=>(a("warn",`Failed to fetch aiServerStatusUrl. Reason: ${t}.`),{})):Promise.resolve({}),[u,p]=await Promise.all([y,k]);if(l&&!p?.success)return{shouldRender:!1};let A=i.helpBase||"";if(!u)return a("warn","Settings response is not available."),{shouldRender:!1};let c={orgAiAssistantsEnabled:$(u),betaAppsAllowed:u.blockBetaApps!==!0,serviceUrlAvailable:!!i?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:["portal:user:useAIAssistants","portal:user:useAI"].some(t=>i?.user?.privileges?.includes(t)),aiServerConfigured:p?.aiCapabilities?.aiAssistants?.configured===!0};c.betaAppsAllowed||a("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),c.userHasUseAiAssistantsPrivilege||a("warn","User does not have the required privileges to use AI Assistants.");let B=l?[...R,"aiServerConfigured"]:R,H=l?[...d,"aiServerConfigured"]:d,f=C(c,B),v=C(c,H),g=x(r),m=i?.helperServices?.aiAssistantServices?.url;return m?{shouldRender:!0,portalUrl:s,availableFeatures:{codeActions:f,prompting:v},serviceUrl:m,helpBase:A,feedbackServiceUrl:w,isDevEnv:g}:{shouldRender:!0,portalUrl:s,availableFeatures:{codeActions:f,prompting:v},helpBase:A,feedbackServiceUrl:w,isDevEnv:g}}function q(e){let s=h(e),[r,i="0"]=s.split("."),n=Number.parseInt(r,10),o=Number.parseInt(i,10);return Number.isNaN(n)||Number.isNaN(o)?!1:n>12||n===12&&o>=2}function E(e){return e.toLowerCase().includes("pro")}function T(){let e=N?.applicationName;return E(e)?e.toLowerCase():`jsSdk_${I}`}var j=P;function x(e){if(j.includes("next"))return!0;let{portalHostname:s}=e;return!!["devext.arcgis.com","qaext.arcgis.com"].some(r=>s?.includes(r))}return{a:L,b:T}},"config","kernel","portal/Portal","request")
2
+ import{u as h}from"./O7IT7ZNK.js";import{a as b}from"./C3LWMJ56.js";export default $arcgis.t(([N,{version:I,fullVersion:P},U,S])=>{var w="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",a=(e,s)=>{b(e,"Arcade Assistant",s)},d=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],R=d,C=(e,s)=>s.every(r=>e[r]===!0),$=e=>{let{aiConfig:s}=e;return s?.aiForOrg?.enabled===!0&&s?.aiForOrg?.aiCapabilities?.aiAssistants?.enabled===!0};async function L({portalUrl:e}){e&&a("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let s=e||N.portalUrl;if(!s)return a("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let r;if(e?r=new U({url:s,authMode:"no-prompt"}):r=U.getDefault(),await r.load().catch(t=>(a("warn",`Failed to load portal. Reason: ${t}.`),{shouldRender:!1})),!r.user)return a("warn","User is not signed in."),{shouldRender:!1};let i=r.sourceJSON,n=i?.isPortal===!0;if(n&&!q(i.enterpriseVersion))return{shouldRender:!1};let{restUrl:o}=r,F=`${o}/portals/self/settings`,y=S(F,{query:{f:"json"}}).then(t=>t.data).catch(t=>(a("warn",`Failed to fetch settingsUrl. Reason: ${t}.`),{})),l=n,k=l?S(`${o}/portals/self/aiServer/status`,{query:{f:"json"}}).then(t=>t.data).catch(t=>(a("warn",`Failed to fetch aiServerStatusUrl. Reason: ${t}.`),{})):Promise.resolve({}),[u,p]=await Promise.all([y,k]);if(l&&!p?.success)return{shouldRender:!1};let A=i.helpBase||"";if(!u)return a("warn","Settings response is not available."),{shouldRender:!1};let c={orgAiAssistantsEnabled:$(u),betaAppsAllowed:u.blockBetaApps!==!0,serviceUrlAvailable:!!i?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:["portal:user:useAIAssistants","portal:user:useAI"].some(t=>i?.user?.privileges?.includes(t)),aiServerConfigured:p?.aiCapabilities?.aiAssistants?.configured===!0};c.betaAppsAllowed||a("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),c.userHasUseAiAssistantsPrivilege||a("warn","User does not have the required privileges to use AI Assistants.");let B=l?[...R,"aiServerConfigured"]:R,H=l?[...d,"aiServerConfigured"]:d,f=C(c,B),v=C(c,H),g=x(r),m=i?.helperServices?.aiAssistantServices?.url;return m?{shouldRender:!0,portalUrl:s,availableFeatures:{codeActions:f,prompting:v},serviceUrl:m,helpBase:A,feedbackServiceUrl:w,isDevEnv:g}:{shouldRender:!0,portalUrl:s,availableFeatures:{codeActions:f,prompting:v},helpBase:A,feedbackServiceUrl:w,isDevEnv:g}}function q(e){let s=h(e),[r,i="0"]=s.split("."),n=Number.parseInt(r,10),o=Number.parseInt(i,10);return Number.isNaN(n)||Number.isNaN(o)?!1:n>12||n===12&&o>=2}function E(e){return e.toLowerCase().includes("pro")}function T(){let e=N?.applicationName;return E(e)?e.toLowerCase():`jsSdk_${I}`}var j=P;function x(e){if(j.includes("next"))return!0;let{portalHostname:s}=e;return!!["devext.arcgis.com","qaext.arcgis.com"].some(r=>s?.includes(r))}return{a:L,b:T}},"config","kernel","portal/Portal","request")
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import b from"./BBRNPEPV.js";import a from"./VFCQQ2QW.js";import{c as q}from"./RYQS3S5A.js";import{L as P}from"./ZQPJGC6V.js";export default $arcgis.t(([B,{substitute:E},{B:F},{a:T,d:C,e:N,f:b,g:g,h:$,i:x,j:L,n:_,o:D,p:A}])=>{function w(t,e,a){return t?.[e]??a}function h(t,e,a,n){return E(w(t,e,a),n)}function K(t,e){return w(t,e?"nullable":"notnull",e?"nullable":"not nullable")}function j(t,e){return w(t,e?"yes":"no",e?"yes":"no")}function v(t){for(let e of t){if(e instanceof _)return e;if(e.isCollection&&"variables"in e){let a=v(e.variables.filter(n=>n.type!=="group"));if(a)return a}}}function V(t,e){return`${t}:${e}`}function z(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function U(t){let e=new B({url:t.portal.url});return await e.load(),new T({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function k(t){return F(t)?await U(t):t}function H(t,e,a,n){let o=`**${t}**`;return e.type&&(o+=`
2
+ import b from"./VHRD4SVJ.js";import a from"./VFCQQ2QW.js";import{c as q}from"./RYQS3S5A.js";import{L as P}from"./O7IT7ZNK.js";export default $arcgis.t(([B,{substitute:E},{B:F},{a:T,d:C,e:N,f:b,g:g,h:$,i:x,j:L,n:_,o:D,p:A}])=>{function w(t,e,a){return t?.[e]??a}function h(t,e,a,n){return E(w(t,e,a),n)}function K(t,e){return w(t,e?"nullable":"notnull",e?"nullable":"not nullable")}function j(t,e){return w(t,e?"yes":"no",e?"yes":"no")}function v(t){for(let e of t){if(e instanceof _)return e;if(e.isCollection&&"variables"in e){let a=v(e.variables.filter(n=>n.type!=="group"));if(a)return a}}}function V(t,e){return`${t}:${e}`}function z(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function U(t){let e=new B({url:t.portal.url});return await e.load(),new T({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function k(t){return F(t)?await U(t):t}function H(t,e,a,n){let o=`**${t}**`;return e.type&&(o+=`
3
3
  ${e.type}`),a&&(o+=`
4
4
  ${h(n,"datastoreformat","Datastore: {datastoreName}",{datastoreName:a})}`),{value:o}}function W(t,e,a){let n=`**${t.name}**`;return t.serverType&&(n+=`
5
5
  ${t.serverType}`),n+=`