@arcgis/coding-components 5.1.0-next.55 → 5.1.0-next.56

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 (87) hide show
  1. package/dist/cdn/{PKG2K3V2.js → 23B5EVBR.js} +1 -1
  2. package/dist/cdn/2RXM4OOZ.js +2 -0
  3. package/dist/cdn/2XTHR2WZ.js +2 -0
  4. package/dist/cdn/5PWITOEV.js +2 -0
  5. package/dist/cdn/A53COIII.js +6 -0
  6. package/dist/cdn/AESP7B22.js +2 -0
  7. package/dist/cdn/AHN2NEBT.js +2 -0
  8. package/dist/cdn/{54ZOADNQ.js → BXUVVQLE.js} +1 -1
  9. package/dist/cdn/BYHBHJML.js +2 -0
  10. package/dist/cdn/CLBLJN2Z.js +7 -0
  11. package/dist/cdn/CZ2DJPO4.js +2 -0
  12. package/dist/cdn/DGFH2WPL.js +2 -0
  13. package/dist/cdn/{RJRCBNNO.js → DJYSIOXC.js} +1 -1
  14. package/dist/cdn/FLNLMLTL.js +2 -0
  15. package/dist/cdn/ITDFOKJG.js +2 -0
  16. package/dist/cdn/MH4UADDE.js +2 -0
  17. package/dist/cdn/{UZJHWA6T.js → ODKUCLFB.js} +1 -1
  18. package/dist/cdn/{PVL67WGX.js → PD5NEK47.js} +1 -1
  19. package/dist/cdn/PRB6IWVU.js +2 -0
  20. package/dist/cdn/{4A2CLADY.js → QCARFVF7.js} +1 -1
  21. package/dist/cdn/{6YD47X7H.js → QF6ON7LK.js} +1 -1
  22. package/dist/cdn/QRDRCFJZ.js +2 -0
  23. package/dist/cdn/SV4IPD4A.js +2 -0
  24. package/dist/cdn/UH44LJA7.js +4 -0
  25. package/dist/cdn/VF7TALAI.js +12 -0
  26. package/dist/cdn/VPP77CFW.js +2 -0
  27. package/dist/cdn/YPMKBMXS.js +2 -0
  28. package/dist/cdn/ZHZFKZA7.js +2 -0
  29. package/dist/cdn/assets/arcade-editor/t9n/messages.en.json +1 -1
  30. package/dist/cdn/assets/code-editor/sql-expr.worker.js +119 -116
  31. package/dist/cdn/assets/code-editor/sql-layer.worker.js +10087 -0
  32. package/dist/cdn/assets/editor-variables/t9n/messages.en.json +1 -1
  33. package/dist/cdn/assets/sql-expression-editor/t9n/messages.en.json +1 -1
  34. package/dist/cdn/assets/sql-layer-editor/t9n/messages.en.json +1 -0
  35. package/dist/cdn/index.js +1 -1
  36. package/dist/cdn/main.css +1 -1
  37. package/dist/chunks/arcade-defaults.js +98 -96
  38. package/dist/chunks/arcade-service-accessors.js +40 -28
  39. package/dist/chunks/bigquery.js +186 -0
  40. package/dist/chunks/colorize.js +1 -1
  41. package/dist/chunks/fields.js +2 -2
  42. package/dist/chunks/language-defaults-base.js +733 -464
  43. package/dist/chunks/postgres.js +209 -0
  44. package/dist/chunks/setup-monaco-theme.js +28 -20
  45. package/dist/chunks/sql-expr-defaults.js +11 -10
  46. package/dist/chunks/sql-layer-defaults.js +231 -0
  47. package/dist/chunks/sql-layer-mode.js +301 -0
  48. package/dist/chunks/sqlServer.js +288 -0
  49. package/dist/chunks/utils.js +184 -0
  50. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +134 -123
  51. package/dist/components/arcgis-arcade-editor/customElement.d.ts +17 -0
  52. package/dist/components/arcgis-arcade-editor/customElement.js +22 -22
  53. package/dist/components/arcgis-code-editor/customElement.d.ts +2 -1
  54. package/dist/components/arcgis-code-editor/customElement.js +91 -71
  55. package/dist/components/arcgis-editor-variables/customElement.js +50 -47
  56. package/dist/components/arcgis-sql-expression-editor/customElement.d.ts +12 -0
  57. package/dist/components/arcgis-sql-expression-editor/customElement.js +17 -17
  58. package/dist/components/arcgis-sql-layer-editor/customElement.d.ts +50 -0
  59. package/dist/components/arcgis-sql-layer-editor/customElement.js +92 -0
  60. package/dist/components/arcgis-sql-layer-editor/index.d.ts +1 -0
  61. package/dist/components/arcgis-sql-layer-editor/index.js +7 -0
  62. package/dist/components/types.d.ts +79 -2
  63. package/dist/docs/api.json +1 -1
  64. package/dist/docs/docs.json +1 -1
  65. package/dist/docs/vscode.html-custom-data.json +1 -1
  66. package/dist/docs/web-types.json +1 -1
  67. package/dist/index.d.ts +10 -0
  68. package/dist/loader.js +6 -5
  69. package/dist/types/lumina.d.ts +9 -2
  70. package/dist/types/preact.d.ts +10 -2
  71. package/dist/types/react.d.ts +11 -2
  72. package/dist/types/stencil.d.ts +9 -2
  73. package/dist/utils/data-catalog-datastore.d.ts +170 -0
  74. package/package.json +5 -5
  75. package/dist/cdn/5CO7XWOT.js +0 -2
  76. package/dist/cdn/5FXY5U3T.js +0 -2
  77. package/dist/cdn/CYC4AWZE.js +0 -2
  78. package/dist/cdn/GVO3LEFV.js +0 -2
  79. package/dist/cdn/J5X2KSYD.js +0 -2
  80. package/dist/cdn/QHJAF7L3.js +0 -6
  81. package/dist/cdn/T7GEIGWF.js +0 -2
  82. package/dist/cdn/TAXRVBJC.js +0 -2
  83. package/dist/cdn/VR5CATAW.js +0 -2
  84. package/dist/cdn/WTNM2NCZ.js +0 -2
  85. package/dist/cdn/XEUG3X2W.js +0 -2
  86. package/dist/cdn/ZJCI6LP6.js +0 -12
  87. package/dist/cdn/ZSVJAJND.js +0 -4
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{b as r}from"./RJRCBNNO.js";import{K as o}from"./4BNI5KJQ.js";var s=r(o);export{s as a};
2
+ import{b as r}from"./DJYSIOXC.js";import{K as o}from"./4BNI5KJQ.js";var s=r(o);export{s as a};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as v}from"./N2YCVDWS.js";import{b,c as r,d as _}from"./WTNM2NCZ.js";import{a as p}from"./4A2CLADY.js";import"./RJRCBNNO.js";import{a as f}from"./OZ65S2RS.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import{d as h,e as m}from"./UZJHWA6T.js";import"./UYBZWFE5.js";import{E as c,F as d,J as u,h as g,j as s,l,n as a}from"./4BNI5KJQ.js";import"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";function S(o){return!Array.isArray(o)||!o.length?!1:Array.isArray(o[0].suggestions)}var $=g`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,n=class extends d{constructor(){super(...arguments),this._beforeBack=async()=>{this._selectedSuggestion=void 0},this.messages=p(),this._colorizeStyle="",this._filterValue="",this.closed=!1,this.arcgisInternalClosePanel=a({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=a({bubbles:!1,composed:!1})}static{this.properties={_colorizeStyle:16,_filterValue:16,_selectedSuggestion:16,suggestions:0,closed:5}}static{this.styles=$}load(){this._colorizeStyle=r(),this._themeChangedListener=_(()=>this._colorizeStyle=r())}willUpdate(e){e.has("suggestions")&&this.suggestionsPropChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect(),this._themeChangedListener?.dispose()}suggestionsPropChanged(){this._selectedSuggestion=void 0}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{m(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget?.value??""}_emitItemSelected(e,t){let i=e;(!i.key||i.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.code))}_showSuggestionDetail(e,t){e.stopPropagation(),this._selectedSuggestion=t}_emitClose(){this.arcgisInternalClosePanel.emit()}_colorizeCode(e){e!==void 0&&b(e,this._selectedSuggestion.code,"arcade")}renderSuggestionGroups(){return this.suggestions===void 0?null:S(this.suggestions)?this.suggestions.map(e=>s`<calcite-list-item-group .heading=${e.label}>${this.renderSuggestionListItems(e.suggestions)}</calcite-list-item-group>`):this.renderSuggestionListItems(this.suggestions)}renderSuggestionListItems(e){return e=f(e,"label",this._filterValue),e.length?e.map(t=>s`<calcite-list-item .label=${t.label} .description=${t.description} @calciteListItemSelect=${i=>this._emitItemSelected(i,t)} @keydown=${i=>this._emitItemSelected(i,t)} data-item=${t??l}><calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${i=>this._showSuggestionDetail(i,t)} data-item=${t??l}></calcite-action></calcite-list-item>`):s`<div class="notice-container">${this.messages.noitems}</div>`}renderSuggestionFlowItem(){let e=this._selectedSuggestion;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${t=>this._emitItemSelected(t,e)} data-item=${e??l} ${c(h)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${v(e.documentation)??""}></div><pre><code ${c(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>`:null}render(){return this.closed?null:s`<style>${this._colorizeStyle}</style><calcite-flow ${c(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions??"Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`}};u("arcgis-arcade-suggestions",n);export{n as ArcgisArcadeSuggestions};
2
+ import{b,c as r,d as _}from"./2XTHR2WZ.js";import{a as v}from"./N2YCVDWS.js";import{a as p}from"./QCARFVF7.js";import"./DJYSIOXC.js";import{a as f}from"./OZ65S2RS.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import{e as h,f as m}from"./ODKUCLFB.js";import"./UYBZWFE5.js";import{E as c,F as d,J as u,h as g,j as s,l,n as a}from"./4BNI5KJQ.js";import"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";function S(o){return!Array.isArray(o)||!o.length?!1:Array.isArray(o[0].suggestions)}var $=g`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,n=class extends d{constructor(){super(...arguments),this._beforeBack=async()=>{this._selectedSuggestion=void 0},this.messages=p(),this._colorizeStyle="",this._filterValue="",this.closed=!1,this.arcgisInternalClosePanel=a({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=a({bubbles:!1,composed:!1})}static{this.properties={_colorizeStyle:16,_filterValue:16,_selectedSuggestion:16,suggestions:0,closed:5}}static{this.styles=$}load(){this._colorizeStyle=r(),this._themeChangedListener=_(()=>this._colorizeStyle=r())}willUpdate(e){e.has("suggestions")&&this.suggestionsPropChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect(),this._themeChangedListener?.dispose()}suggestionsPropChanged(){this._selectedSuggestion=void 0}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{m(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget?.value??""}_emitItemSelected(e,t){let i=e;(!i.key||i.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.code))}_showSuggestionDetail(e,t){e.stopPropagation(),this._selectedSuggestion=t}_emitClose(){this.arcgisInternalClosePanel.emit()}_colorizeCode(e){e!==void 0&&b(e,this._selectedSuggestion.code,"arcade")}renderSuggestionGroups(){return this.suggestions===void 0?null:S(this.suggestions)?this.suggestions.map(e=>s`<calcite-list-item-group .heading=${e.label}>${this.renderSuggestionListItems(e.suggestions)}</calcite-list-item-group>`):this.renderSuggestionListItems(this.suggestions)}renderSuggestionListItems(e){return e=f(e,"label",this._filterValue),e.length?e.map(t=>s`<calcite-list-item .label=${t.label} .description=${t.description} @calciteListItemSelect=${i=>this._emitItemSelected(i,t)} @keydown=${i=>this._emitItemSelected(i,t)} data-item=${t??l}><calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${i=>this._showSuggestionDetail(i,t)} data-item=${t??l}></calcite-action></calcite-list-item>`):s`<div class="notice-container">${this.messages.noitems}</div>`}renderSuggestionFlowItem(){let e=this._selectedSuggestion;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${t=>this._emitItemSelected(t,e)} data-item=${e??l} ${c(h)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${v(e.documentation)??""}></div><pre><code ${c(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>`:null}render(){return this.closed?null:s`<style>${this._colorizeStyle}</style><calcite-flow ${c(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions??"Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`}};u("arcgis-arcade-suggestions",n);export{n as ArcgisArcadeSuggestions};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{b as E}from"./CZ2DJPO4.js";import f from"./CLBLJN2Z.js";import{a as m}from"./QCARFVF7.js";import"./DJYSIOXC.js";import e from"./VF7TALAI.js";import b from"./ZHZFKZA7.js";import"./MP6Z45SA.js";import"./IFNCCZ7O.js";import"./OZ65S2RS.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import"./ODKUCLFB.js";import"./UYBZWFE5.js";import{D as n,E as c,F as h,G as p,J as g,h as d,j as s,n as a,s as l}from"./4BNI5KJQ.js";import{b as t}from"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export default $arcgis.t(([,,,,,,,{E:_},{c:o},{a:b,b:u,c:f,d:v}])=>{var S=d`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,r=class extends h{constructor(){super(...arguments),this._codeEditorElt=n(),this._disposables=[],this._modelId=l(),this.messages=m(),this._preparing=!1,this._resolvedLanguage=o,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.openedSidePanel="none",this.arcgisDiagnosticsChange=a({bubbles:!1}),this.arcgisScriptChange=a({bubbles:!1})}static{this.properties={_editorProfile:16,_preparing:16,_resolvedLanguage:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0,openedSidePanel:3}}static{this.styles=[S]}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateDataModelDeps().catch(t(this))}willUpdate(e){e.has("profile")&&this._updateDataModelDeps().catch(t(this))}async loaded(){let e=E();this._disposables.push(e.onDiagnosticsChange(i=>{i.uri.toString()===this._modelId&&!this._preparing&&this.arcgisDiagnosticsChange.emit(i.diagnostics)}))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose();v().forEach(e=>e.disposeForModel(this._modelId))}async _updateDataModelDeps(){this._preparing=!0;try{let e=await b(this.profile);e!==this._resolvedLanguage&&(f(this._resolvedLanguage)?.disposeForModel(this._modelId),this._resolvedLanguage=e);let i=u(this._resolvedLanguage);await i.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=i.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0,this._resolvedLanguage=o}finally{this._preparing=!1}}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_toggleSidePanel(e){this.openedSidePanel=this.openedSidePanel===e?"none":e,this.openedSidePanel==="none"&&this._codeEditorElt.value?.setFocus().catch(t(this))}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsText(e){this._codeEditorElt.value?.insertText(e.detail).catch(t(this))}_getTablesVariable(){return this._editorProfile?.variables.find(_)}render(){let e=this._getTablesVariable();return s`<arcgis-code-editor-shell><arcgis-code-editor slot=editor .language=${this._resolvedLanguage} .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} ${c(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&s`<arcgis-editor-variables slot=side-panel .variable=${e} .heading=${this.messages.tables??"Tables"} .messageOverrides=${{profileempty:this.messages.profileempty}} .closed=${this.openedSidePanel!=="variables"} class=${p(this.openedSidePanel==="variables"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${()=>{this.openedSidePanel="none"}} data-panel-name=none></arcgis-editor-variables><calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action id=tables-action .text=${this.messages.tables??"Tables"} icon=table .active=${this.openedSidePanel==="variables"} data-panel-name=variables @click=${()=>this._toggleSidePanel("variables")}></calcite-action>${!this.sideActionBarExpanded&&s`<calcite-tooltip reference-element=tables-action><span>${this.messages.tables??"Tables"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};g("arcgis-sql-layer-editor",r);return r},"portal/PortalItem","WebMap","WebScene","layers/FeatureLayer","applications/Components/arcadeEditorUtils","core/Error","portal/Portal",b,e,f)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{Ok as i,aj as l}from"./NG7S6FUK.js";export default $arcgis.t(([d])=>{function m(){return!!window.MonacoEnvironment?.getWorker}var c="",f=new Map,u=!1;async function p(t,r,e){if(e)return r?r():new Worker(t);let s=window.location.origin;if(new URL(t,window.location.href).origin!==s){let o=await d(t,{responseType:"text"});return new Worker(URL.createObjectURL(new Blob([o.data],{type:"text/javascript"})),{type:"module"})}return new Worker(t,{type:"module"})}function E(t){if(m())return;g(),c=t;let r=`${c}/code-editor`,e={arcade:`${r}/arcade.worker.js`,"arcgis-sql-expression":`${r}/sql-expr.worker.js`,"sql-layer-sql-server":`${r}/sql-layer.worker.js`,"sql-layer-postgres":`${r}/sql-layer.worker.js`,"sql-layer-bigquery":`${r}/sql-layer.worker.js`,html:`${r}/html.worker.js`,css:`${r}/css.worker.js`,typescript:`${r}/ts.worker.js`,json:`${r}/json.worker.js`,default:`${r}/editor.worker.js`},s={arcade:{url:e.arcade},"arcgis-sql-expression":{url:e["arcgis-sql-expression"]},"sql-layer-sql-server":{url:e["sql-layer-sql-server"]},"sql-layer-postgres":{url:e["sql-layer-postgres"]},"sql-layer-bigquery":{url:e["sql-layer-bigquery"]},html:{url:e.html},css:{url:e.css},typescript:{url:e.typescript},javascript:{url:e.typescript},json:{url:e.json},default:{url:e.default}};window.MonacoEnvironment={getWorker:async(o,a)=>{let n=f.get(a);if(n)return await p(n,void 0,u);let{url:y,localWorker:q}=s[a]||s.default;return await p(y,q,u)}}}var w=!1;function g(){w||(i.get(l),w=!0)}async function L(){return(await j()).getArcadeDiagnosticService()}async function j(){return await import("./XEUCI6KC.js")}return{a:E,b:L,c:j}},"request")
@@ -0,0 +1,4 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import c from"./A53COIII.js";import{a as ne}from"./QCARFVF7.js";import"./DJYSIOXC.js";import b from"./VF7TALAI.js";import a from"./ZHZFKZA7.js";import"./MP6Z45SA.js";import{d as de}from"./IFNCCZ7O.js";import{c as ce,d as le}from"./OZ65S2RS.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import"./ODKUCLFB.js";import"./UYBZWFE5.js";import{A as Z,B as ee,C as D,D as te,E as ae,F as ie,G as se,H as _,J as oe,h as K,j as p,k as P,l as U,s as X,v as q,w as N,x as F,y as I,z as S}from"./4BNI5KJQ.js";import{a as k}from"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export default $arcgis.t(([Me,ue,Ee,me,he,{getDeclaredVoxelMembers:Re,getDeclaredPixelMembers:Ve},Pe,{property:w,subclass:qe},{G:z,w:re,x:O},,L])=>{var pe=(a,e,t)=>{let i=new Map;for(let s=e;s<=t;s++)i.set(a[s],s);return i},B=N(class extends F{constructor(a){if(super(a),a.type!==q.CHILD)throw Error("repeat() can only be used in text expressions")}dt(a,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);let s=[],n=[],c=0;for(let d of a)s[c]=i?i(d,c):c,n[c]=t(d,c),c++;return{values:n,keys:s}}render(a,e,t){return this.dt(a,e,t).values}update(a,[e,t,i]){let s=ee(a),{values:n,keys:c}=this.dt(e,t,i);if(!Array.isArray(s))return this.ut=c,n;let d=this.ut??=[],r=[],o,g,l=0,u=s.length-1,m=0,h=n.length-1;for(;l<=u&&m<=h;)if(s[l]===null)l++;else if(s[u]===null)u--;else if(d[l]===c[m])r[m]=S(s[l],n[m]),l++,m++;else if(d[u]===c[h])r[h]=S(s[u],n[h]),u--,h--;else if(d[l]===c[h])r[h]=S(s[l],n[h]),I(a,r[h+1],s[l]),l++,h--;else if(d[u]===c[m])r[m]=S(s[u],n[m]),I(a,s[l],s[u]),u--,m++;else if(o===void 0&&(o=pe(c,m,h),g=pe(d,l,u)),o.has(d[l]))if(o.has(d[u])){let f=g.get(c[m]),T=f!==void 0?s[f]:null;if(T===null){let v=I(a,s[l]);S(v,n[m]),r[m]=v}else r[m]=S(T,n[m]),I(a,s[l],T),s[f]=null;m++}else D(s[u]),u--;else D(s[l]),l++;for(;m<=h;){let f=I(a,r[h+1]);S(f,n[m]),r[m++]=f}for(;l<=u;){let f=s[l++];f!==null&&D(f)}return this.ut=c,Z(a,r),P}});var R=class extends F{constructor(e){if(super(e),this.it=U,e.type!==q.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===U||e==null)return this._t=void 0,this.it=e;if(e===P)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};R.directiveName="unsafeHTML",R.resultType=1;var V=N(R);var Ne=K`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,A=class extends Error{constructor({message:e,code:t,subCode:i,details:s,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=i,this.details=s,this.source=n}};function ge(a){if(!a)return;let e=a.indexOf('{"error":');if(e!==-1)try{let t=a.slice(e),i=JSON.parse(t);if(i&&typeof i=="object"&&i.error)return i.error}catch{return}}async function Fe(a){let{baseUrl:e,skillId:t,message:i,authToken:s,previousConversationId:n,context:c}=a,d=t?`${e}/skills/${t}/chat`:`${e}/chat`,r=[],o={message:i,context:c};n&&(o.conversation_id=n);let g;try{g=await ue(d,{method:"post",headers:{"Content-Type":"application/json",token:s},body:JSON.stringify(o),responseType:"json"})}catch(v){let $=v,C=$.details?.rawResponse||$.message||String(v),M=ge(C);throw M?new A(M):v}let l=g.data;r.push(l);let u=l.conversationId,m=l.inquiryId,h=l.sequenceNumber;async function f(){let v=0,$=100;for(;v<$;){await new Promise(E=>setTimeout(E,1e3));let C=De(u,h,m),M;try{M=await ue(d,{method:"post",headers:{"Content-Type":"application/json",token:s},body:JSON.stringify(C),responseType:"json"})}catch(E){let Y=E,Ie=Y.details?.rawResponse||Y.message||String(E),W=ge(Ie);throw W?new A(W):E}let x=M.data;if(x.context?.kind==="ArcgisErrorAsContext"&&x.context.error)throw new A({message:x.context.error.message||"ArcGIS Assistant error",code:x.context.error.code,subCode:x.context.error.subCode,details:x.context.error.details,source:"polling-response"});if(r.push(x),h=x.sequenceNumber,v++,!x.hasMore)break}if(v===$)throw new A({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let T=120*1e3;return await Promise.race([f(),new Promise((v,$)=>setTimeout(()=>$(new A({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),T))]),r}function De(a,e,t){return{conversationId:a,inquiryId:t,ackSequenceNumber:e}}function _e(a){return a.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":a.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":a.message}var Ue=({notices:a})=>a.length?p`<div class="border-block-end">${B(a,e=>e.id??e.title,e=>p`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&p`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&p`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,Oe=a=>{let e=a.value.length,t=72,i=180,s=a.offsetWidth,n=Math.max(1,Math.floor(s/8)),c=Math.ceil(e/n),d=t+(c-2)*24;a.style.setProperty("--calcite-text-area-min-height",`${Math.min(d,i)}px`)},ze=({promptValidationMessage:a,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:i,setContextReducedNoticeDismissed:s,setErrorMessage:n,messages:c})=>{let d=[];if(a&&d.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:a,closable:!0}),e&&d.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!i){let r=c.contextreduced??"Context reduced",o=c.contextreducedmessage??"The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";d.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:r,message:o,closable:!0,onClose:()=>s(!0)})}return d};function Le({messages:a}){return p`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${a.beta??"Beta"}>${a.beta??"Beta"}</calcite-chip>`}function Be({popoverContent:a,messages:e}){return p`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer??"Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${a}</div></calcite-popover>`}function Qe({errorMessage:a,slot:e}){return p`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??_}>${a}</calcite-input-message></div>`}function je({active:a,setActive:e,messages:t}){return p`<calcite-alert slot=alerts .open=${a} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function He({context:a,messages:e}){return a?p`<div class="gaps">${a.profileId&&p`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function Ge({isDisabled:a,isReadOnly:e,setQuestion:t,setIsViewingResult:i,textAreaRef:s,question:n,errorMessage:c,setErrorMessage:d,promptValidationMessage:r,setPromptValidationMessage:o,submitQuestion:g,messages:l,mode:u,assistantRef:m,context:h,contextReducedNoticeDismissed:f,setContextReducedNoticeDismissed:T}){let v=h?.contextTooLarge??!1,$=ze({promptValidationMessage:r,errorMessage:c,contextTooBig:v,contextReducedNoticeDismissed:f,setContextReducedNoticeDismissed:T,setErrorMessage:d,messages:l});return p`<div class="text-area-wrapper">${Ue({notices:$})}<calcite-text-area scale=s resize=vertical .readOnly=${a||e} class=${se($.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${l.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${C=>{Oe(C.target),t(C.target.value)}} ${ae(s)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${h&&He({context:h,messages:l})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${u!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${a} @click=${async()=>{i(!1),t("")}} .label=${l.startover??"Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${u!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${a} @click=${async()=>{i(!1),t("")}} class="hidden-below-380" scale=s>${l.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} @click=${async()=>{if(d(""),!n){o(l.enteraprompt??"Please enter a prompt");return}o(void 0),await g()}} class="hidden-below-380">${u==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} id=small-submit-button @click=${async()=>{if(d(""),!n){o(l.enteraprompt??"Please enter a prompt");return}o(void 0),await g()}} class="hidden-above-380" .label=${u==="prompt"?l.ask??"Generate":l.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${u==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`}var Je="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Ye="https://www.esri.com/en-us/privacy/privacy-statements";function We({setOpen:a,messages:e,feedback:t,learnMoreUrl:i,setFeedback:s,onSubmit:n}){return t.active?p`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>a(!1)}><calcite-panel .heading=${e.submitfeedback??"Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${c=>s({...t,text:c.target.value})} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo??"Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${c=>{s({...t,termsAccepted:c.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${V((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Ye} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${Je} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${V((e.feedbackhelps??"Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}",`<calcite-link href=${i} target="_blank">${e.learnmore??"Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${()=>a(!1)} .disabled=${t.submitting}>${e.cancel??"Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit??"Submit"}</calcite-button></div></calcite-panel></calcite-sheet>`:null}function be({assistantsEnabled:a,messages:e,slot:t,helpTopicUrl:i}){return p`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??_} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div>${a?p`<p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${V((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${i} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:p`<p>${e.useofassistant??"The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg??"AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps??"Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege??"Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`}function Ke({messages:a,onProceed:e,onExit:t,helpTopicUrl:i}){return p`<calcite-dialog close-disabled placement=top .heading=${a.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${a.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${a.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${V((a.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${i} target="_blank">${a.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${a.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${a.exit??"Exit"}</calcite-button></calcite-dialog>`}function Xe({messages:a,suggestions:e,onSuggestionClick:t}){return p`<calcite-block .heading=${a.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(i=>p`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${a.promptsuggestion} class="suggestion-button" @click=${()=>t?.(i)}>${i}</calcite-button>`)}</div></calcite-block>`}var fe=200;function ve({hidden:a=!1,expanded:e=!1,messages:t,cards:i,heading:s,collapsible:n=!1,showEffectsIcon:c=!1,onCopyCode:d,standalone:r}){return p`<calcite-block .hidden=${a} id=result-block .heading=${s??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${c&&p`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${B(i,o=>o.conversationId,o=>p`<calcite-card><div slot=heading><div class="prior-prompt"><span>${o.priorPrompt.length>fe?`${o.priorPrompt.slice(0,fe)}...`:o.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} @click=${g=>{let l=g.currentTarget;navigator.clipboard.writeText(o.priorPrompt).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${o.message&&r&&p`<div class="response-error-container">${Qe({errorMessage:o.message})}</div>`||""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext??"Response Context"} scale=s>${o.message&&!r&&p`<calcite-tooltip .referenceElement=${`response-chip-${o.conversationId}-error`} placement=top-start>${o.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${o.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${Ze({card:o,messages:t})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${o.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${()=>o.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor??"Add to editor"} .id=${`add-to-editor-button-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start>${t.addtoeditor??"Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${()=>o.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor??"Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${()=>o.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.replaceineditor??"Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${g=>{let l=g.currentTarget;d(o.code).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard??"Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup??"Thumbs up"} scale=s icon=thumbs-up @click=${o.onThumbsUp} .id=${`thumbs-up-${o.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.helpful??"Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown??"Thumbs down"} scale=s icon=thumbs-down @click=${o.onThumbsDown} .id=${`thumbs-down-${o.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ze=({card:a,messages:e})=>{let t=X(),i=`response-chip-profile-${a.conversationId}-${t}`,s=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId);return p`<calcite-tooltip .referenceElement=${i} placement=top-start class="contained-popover-or-tooltip">${s}</calcite-tooltip><calcite-chip .label=${a.profileId} scale=s appearance=outline icon=map-information id=${i??_}>${a.profileId}</calcite-chip>`},ye=a=>a.type==="featureSet";function Ae(a){return a&&a!=="dataCatalogDatastore"?a:void 0}var Q=a=>{if(!re(a))return[];let e=[];return a.relationships?.forEach(t=>{e.push(t.toJSON())}),e},j=a=>a.length>0?{relationships:a}:{},et=a=>de(a).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),H=a=>a?{fields:et(a)}:{fields:[]};async function we(a){let e=await a.loadSource(),t=O(e)&&e.isTable,i=Q(e);return{name:a.name,type:"featureSet",isTable:t,...H(e?.fields),...j(i)}}async function Ce(a){switch(a.type){case"feature":{let t=await a.loadSource(),i=Q(t);return{name:a.name,type:a.type,...H(t?.fields),...j(i)}}case"featureSet":{let t=await a.loadSource(),i=O(t)&&t.isTable;return{name:a.name,type:"featureSet",...i?{isTable:i}:{},...H(t?.fields),...j(Q(t))}}case"featureSetCollection":{let t=await a.loadSource(),i=t?.layers.filter(ye)??[],s=t?.tables.filter(ye)??[],n=await Promise.all(i.map(we)),c=await Promise.all(s.map(we));return{name:a.name,type:"featureSetCollection",layers:n,tables:c}}case"dictionary":{let t=await Promise.all(a.dictionaryVariables.filter(z).map(Ce));return{name:a.name,type:"dictionary",attributes:t}}case"pixel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"pixel"};let i=await Ve(t);return{name:a.name,type:"pixel",members:i.map($e)}}case"voxel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"voxel"};let i=await Re(t);return{name:a.name,type:"voxel",members:i.map($e)}}case"array":let e=Ae(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:a.name,type:a.type}}}function $e(a){if(a.type==="array"){let e=Ae(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}}}return{name:a.name,type:a.type}}async function tt(a){return{variables:await Promise.all(a.variables.filter(z).map(Ce))}}var at=1e5;function it(a){let e=new TextEncoder().encode(a).length;return Math.ceil(e/3.5)}function G(a){return it(JSON.stringify(a))}function st(a){let e=i=>({name:i.name,type:i.type,...i.isTable?{isTable:i.isTable}:{},...i.relationships?{relationships:i.relationships}:{}}),t=i=>{switch(i.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:i.name,type:i.type,..."isTable"in i&&i.isTable?{isTable:i.isTable}:{},..."relationships"in i?{relationships:i.relationships}:{}};case"featureSetCollection":return{name:i.name,type:"featureSetCollection",layers:i.layers.map(e),tables:i.tables.map(e)};case"dictionary":return{name:i.name,type:"dictionary",attributes:i.attributes.map(t)};case"pixel":case"voxel":return{name:i.name,type:i.type};case"array":return{name:i.name,type:"array",...i.elementType?{elementType:i.elementType}:{}};default:return i}};return{variables:a.variables.map(t)}}function ot(a){let e=a.variables,t=e.length,i=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],s=i?[i]:[];return{context:{variables:s},wasReduced:t!==s.length,reducedToVariableName:i?.name}}function nt(a){return G(a)>at}var rt=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,y=(a,e,t,i)=>{for(var s=i>1?void 0:i?ct(e,t):e,n=a.length-1,c;n>=0;n--)(c=a[n])&&(s=(i?c(e,t,s):c(s))||s);return i&&s&&rt(e,t,s),s},b=class extends Pe{constructor(a){super(a),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};y([w()],b.prototype,"viewMode",2);y([w()],b.prototype,"confirmationActive",2);y([w()],b.prototype,"contextReducedNoticeDismissed",2);y([w()],b.prototype,"splashActive",2);y([w()],b.prototype,"isSubmitting",2);y([w()],b.prototype,"errorMessage",2);y([w()],b.prototype,"promptValidationMessage",2);y([w()],b.prototype,"question",2);y([w()],b.prototype,"history",2);y([w()],b.prototype,"feedback",2);y([w()],b.prototype,"context",2);b=y([qe("ArcadeAssistantViewState")],b);var lt="arcade_generation",dt="ArcadeCodeRequest",xe="visualization",ke="ArcadeAssistant",pt=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras","conversation_id","privacy_statement"],Se=[],Te=!0,J=class extends ie{constructor(){super(...arguments),this.textAreaRef=te(),this.messages=ne(),this._feedbackService=void 0,this.viewState=new b,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=!1,i;this.viewState.feedback.item.conversationId===this.viewState.history[0]?.conversationId&&this.viewState.viewMode==="result"?(i=this.viewState.context,t=!0):i=this.viewState.feedback.item.contextSnapshot;let s=me.applicationName;!s&&!this.appVersion&&k("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:n,text:c,termsAccepted:d,item:{question:r,formattedScript:o,conversationId:g}}=this.viewState.feedback,l={user_evaluation:n,your_comments:c||void 0,question:r??"",answer:this.encodeAnswerForFeedback(o),useragent:navigator.userAgent,_source:ke,version:this.appVersion||s||"NOT_SET",context:i?JSON.stringify({...i,isSnapshot:!t}):"",extras:i?.profileId??"",conversation_id:g??"",privacy_statement:d?"I_agree":""};try{await e.applyEdits({addFeatures:[new he({attributes:l})]})}catch(u){k("error",this,"Error submitting feedback.",{detail:{error:u}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.assistantsEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,disableQuestionAnswerLogging:5}}static{this.styles=Ne}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
3
+ // ${this.messages.disclaimerpt2??"AI-generated content may be inaccurate. Review before using."}`}get assistantOverviewDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}get usingTheAssitantDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}async destroy(){}connectedCallback(){super.connectedCallback(),this.updateViewState({history:Se,splashActive:Te})}load(){let e=async()=>{let t=this.getModel();if(!t){this.updateViewState({context:void 0});return}let i=await this.getProfileAndMetadata(t.uri);this.updateViewState({context:i,contextReducedNoticeDismissed:i.contextTooLarge?!1:this.viewState.contextReducedNoticeDismissed})};e().catch(t=>{k("error",this,"Error setting initial context.",{detail:{error:t}})}),this.manager.onLifecycle(()=>{let t=L.onModelContextDidChange(async()=>{e().catch(i=>{k("error",this,"Error setting context.",{detail:{error:i}})})});return{remove:()=>{t.dispose()}}})}disconnectedCallback(){super.disconnectedCallback(),Se=this.viewState.history,Te=this.viewState.splashActive,this.copySuccessTimer&&(clearTimeout(this.copySuccessTimer),this.copySuccessTimer=void 0)}createFeedbackContextSnapshot(e){let t=st(e.metadata);return{...e,metadata:t,estimatedTokens:G(t)}}encodeAnswerForFeedback(e){return encodeURIComponent(e??"")}updateViewState(e){this.viewState.set(e)}getHistoryCards(){return this.viewState.history.reduce((e,t)=>(!t.script||(e.push({priorPrompt:t.question,code:t.formattedScript||t.error||"",profileId:t.profile??xe,onAddToEditor:i=>{ce(this.editorRef.editorInstance,t.formattedScript??"",i,this.disclaimerComment)},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),conversationId:t.conversationId??"",message:t.message}),this.viewState.viewMode),e),[])}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new Ee({url:this.feedbackServiceUrl});await e.load();let t=pt.filter(i=>!e.fields.some(s=>s.name===i));if(t.length>0){k("error",this,`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);return}return this._feedbackService=e,e}async logInteractionToFeedbackService(e){if(this.disableQuestionAnswerLogging||!e.question)return;let t;try{t=await this.ensureFeedbackService()}catch(c){k("error",this,"Error initializing feedback service for interaction logging.",{detail:{error:c}});return}if(!t)return;let i=me.applicationName,s=e.contextSnapshot,n={question:e.question,answer:this.encodeAnswerForFeedback(e.answer),useragent:navigator.userAgent,_source:ke,version:this.appVersion||i||"NOT_SET",context:s?JSON.stringify({...s,isSnapshot:!0}):"",extras:s?.profileId??"",conversation_id:e.conversationId??"",privacy_statement:""};try{await t.applyEdits({addFeatures:[new he({attributes:n})]})}catch(c){k("error",this,"Error logging arcade assistant question/answer interaction.",{detail:{error:c}})}}getModel(){return this.editorRef.editorInstance?.getModel()}async submitQuestion(){if(!this.viewState.question)return;let e=this.viewState.question;this.updateViewState({isSubmitting:!0,errorMessage:void 0});let t,i;try{let s=this.getModel();if(!s||!this.serviceUrl)return;let n=this.viewState.context??await this.getProfileAndMetadata(s.uri);t=this.createFeedbackContextSnapshot(n);let c=await this.getToken(),d=await Fe({baseUrl:this.serviceUrl,skillId:lt,message:e,authToken:c,context:{kind:dt,context:{profile_id:n.profileId,metadata:[n.metadata]}}});i=d?.[0]?.conversationId;let r=d.find(o=>o.context?.kind==="ArcadeCodeResponse");if(!r){await this.logInteractionToFeedbackService({question:e,answer:"No ArcadeCodeResponse returned.",contextSnapshot:t,conversationId:i});return}if(r.context?.kind==="ArcadeCodeResponse"){let o=this.createFeedbackContextSnapshot(n),g=le(r?.context?.arcadeCode?.code??"");this.updateViewState({history:[{script:r?.context?.arcadeCode?.code,formattedScript:g,error:void 0,question:e,profile:n.profileId,conversationId:r.conversationId,contextSnapshot:o,...r.message?{message:r.message}:{}},...this.viewState.history],viewMode:"result",errorMessage:void 0}),await this.logInteractionToFeedbackService({question:e,answer:g,contextSnapshot:t,conversationId:r.conversationId})}}catch(s){let n=s instanceof Error&&s.name==="ArcadeAssistantError"?_e(s)||this.messages.erroroccurred||"An error occurred.":this.messages.erroroccurred||"An error occurred.";this.updateViewState({errorMessage:n}),await this.logInteractionToFeedbackService({question:e,answer:n,contextSnapshot:t,conversationId:i}),k("error",this,"Error submitting question",{detail:{error:s}})}finally{this.updateViewState({isSubmitting:!1})}}async getToken(){let{token:e}=await Me.getCredential(this.portalUrl);return e}async getProfileAndMetadata(e){let t=xe,i=L.getEditorProfileForModel(e);i?.loaded||await i?.loadSource();let s=this.editorRef.profile;s&&"id"in s&&(t=s.id);let n=i?await tt(i):{variables:[]},c=nt(n),d=c?ot(n):void 0,r=d?d.context:n,o=G(r);return{profileId:t,metadata:r,contextTooLarge:c,reducedToVariableName:d?.reducedToVariableName,estimatedTokens:o}}onCopyCode(e){let t=e?`${this.disclaimerComment}
4
+ ${e}`:"";return navigator.clipboard.writeText(t)}render(){if(this.closed)return null;let e=this.viewState.viewMode==="result",t=this.getHistoryCards();return this.assistantsEnabled?p`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive&&p`<calcite-scrim></calcite-scrim>`||""}${Le({messages:this.messages})}${Be({messages:this.messages,popoverContent:be({assistantsEnabled:this.assistantsEnabled,messages:this.messages,helpTopicUrl:this.usingTheAssitantDocUrl})})}<calcite-shell class="unstyled-shell">${this.viewState.splashActive&&Ke({messages:this.messages,onProceed:()=>{this.updateViewState({splashActive:!1})},helpTopicUrl:this.assistantOverviewDocUrl,onExit:i=>this.closePanel?.(i)})||""}${je({active:this.viewState.confirmationActive,setActive:i=>this.updateViewState({confirmationActive:i}),messages:this.messages})}${Ge({isDisabled:this.viewState.isSubmitting,isReadOnly:!1,setQuestion:this.setQuestionState,setIsViewingResult:i=>this.updateViewState({viewMode:i?"result":"prompt"}),mode:e?"refine":"prompt",textAreaRef:this.textAreaRef,question:this.viewState.question,errorMessage:this.viewState.errorMessage,setErrorMessage:i=>this.updateViewState({errorMessage:i}),promptValidationMessage:this.viewState.promptValidationMessage,setPromptValidationMessage:i=>this.updateViewState({promptValidationMessage:i}),submitQuestion:this.submitQuestion.bind(this),assistantRef:this.el,messages:this.messages,context:this.viewState.context,contextReducedNoticeDismissed:this.viewState.contextReducedNoticeDismissed,setContextReducedNoticeDismissed:i=>this.updateViewState({contextReducedNoticeDismissed:i})})}<calcite-block-group .label=${this.messages.interactiveblocks??"interactive blocks"}>${!e&&!this.viewState.isSubmitting&&Xe({messages:this.messages,suggestions:[this.messages.prompsuggestion1??"",this.messages.prompsuggestion2??""],onSuggestionClick:this.onSuggestionClick})||""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse??"Generating response..."}></calcite-block>${ve({expanded:e,messages:this.messages,collapsible:!0,showEffectsIcon:!0,cards:t.length?[t[0]]:[],heading:this.messages.besteffort??"Here's the assistant's best effort",hidden:this.viewState.isSubmitting||!e,onCopyCode:this.onCopyCode.bind(this),standalone:!0})}${ve({expanded:!e,messages:this.messages,collapsible:!0,cards:e?t.slice(1):t,heading:this.messages.recentprompts??"Recent prompts",hidden:this.viewState.isSubmitting||this.viewState.history.length===0,onCopyCode:this.onCopyCode.bind(this)})}</calcite-block-group>${this.viewState.feedback.active?We({setOpen:this.handleFeedbackSheetClose,messages:this.messages,onSubmit:this.handleFeedbackSubmit,feedback:this.viewState.feedback,setFeedback:this.setFeedbackState,learnMoreUrl:this.assistantOverviewDocUrl}):null}</calcite-shell></calcite-flow-item></calcite-flow>`:p`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${be({slot:"content-top",messages:this.messages,assistantsEnabled:this.assistantsEnabled,helpTopicUrl:this.usingTheAssitantDocUrl})}</calcite-flow-item></calcite-flow>`}};oe("arcgis-arcade-coding-assistant",J);return J},"identity/IdentityManager","request","layers/FeatureLayer","config","Graphic","applications/Components/arcadeEditorUtils","core/Accessor","core/accessorSupport/decorators",a,b,c)
@@ -0,0 +1,12 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import a from"./ZHZFKZA7.js";import{a as R,b as Se,c as k,d as b,e as g}from"./IFNCCZ7O.js";import{b as De}from"./OZ65S2RS.js";import{a as ve}from"./NKCYMRE4.js";import{b as P,c as M,d as $,e as we}from"./BQLG62QR.js";import{j as ae}from"./ODKUCLFB.js";import{K as se,r as re,t as A}from"./4BNI5KJQ.js";import{a as c}from"./BCUUVBXH.js";import{Qk as G,Zk as W}from"./NG7S6FUK.js";export default $arcgis.t(([Ee,Ae,Le,B,{getDeclaredVoxelMembers:Ue,getDeclaredPixelMembers:Ne},qe,Oe,{A:q,B:y,F:be,H:O,I:ge,a:L,b:ne,c:oe,d:le,e:pe,k:U,l:T,m:ce,o:u,p:he,q:ue,r:x,s:N,t:m,u:de,v:fe,w:_e,y:me,z:ye}])=>{var w=s=>s!==void 0,_=s=>s!==null;function Re(s){switch(s){case"esriFieldTypeOID":return"oid";case"esriFieldTypeSmallInteger":return"small-integer";case"esriFieldTypeInteger":return"integer";case"esriFieldTypeBigInteger":return"big-integer";case"esriFieldTypeSingle":return"single";case"esriFieldTypeDouble":return"double";case"esriFieldTypeDate":return"date";case"esriFieldTypeDateOnly":return"date-only";case"esriFieldTypeTimeOnly":return"time-only";case"esriFieldTypeTimestampOffset":return"timestamp-offset";case"esriFieldTypeGUID":return"guid";case"esriFieldTypeGlobalID":return"global-id";case"esriFieldTypeString":return"string";case"esriFieldTypeGeometry":return"geometry";case"esriFieldTypeBlob":return"blob";case"esriFieldTypeRaster":return"raster";case"esriFieldTypeXML":return"xml";default:return"string"}}function ke(s){return{fields:s.fields.map(e=>({name:e.name,type:Re(e.type),serverType:e.type,nullable:e.nullable}))}}function Ce(s){return typeof s?.query=="object"&&s.query?s.query:{}}var H=class{constructor(e){this.itemId=e.itemId,this.portal=e.portal,this.serviceUrl=e.serviceUrl,this._requestOptions=e.requestOptions}fetchInfo(e){return this.portal.request(this._datastoreUrl,this._createRequestOptions(e))}async fetchDatasets(e){return(await this.portal.request(z(this._datastoreUrl,"datasets"),this._createRequestOptions(e))).datasets}async fetchTableDescription(e,t){if(!e)throw new qe("portal:invalid-parameter",'The "tableName" parameter must be provided.');let i=await this.portal.request(z(this._datastoreUrl,"tableDescription"),{...this._createRequestOptions(t),query:{...Ce(this._requestOptions),...Ce(t),tableName:e}});return ke(i)}get _datastoreUrl(){return z(this.serviceUrl,"datastores",encodeURIComponent(this.itemId))}_createRequestOptions(e){return{...this._requestOptions,...e}}};function z(s,...e){let t=s.replaceAll(/\/+$/gu,""),i=e.filter(r=>!!r).map(r=>r.replaceAll(/^\/+|\/+$/gu,""));return[t,...i].join("/")}var Ge={id:"ansi",keywords:[],functions:[],operators:[],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:null,end:null},escapeClause:{keyword:"ESCAPE",suffix:null}}},Fe=new Map,We={ansi:async()=>await Promise.resolve(Ge),bigquery:async()=>(await import("./FLNLMLTL.js")).bigqueryDialect,postgres:async()=>(await import("./VPP77CFW.js")).postgresDialect,sqlServer:async()=>(await import("./DGFH2WPL.js")).sqlServerDialect};async function ze(s){let e=Fe.get(s);if(e)return await e;let t=We[s]();return Fe.set(s,t),await t}var Be=["SELECT","FROM","WHERE","GROUP","BY","HAVING","ORDER","LIMIT","DISTINCT","AS","JOIN","LEFT","RIGHT","FULL","INNER","OUTER","CROSS","ON","USING","AND","OR","NOT","IN","IS","LIKE","BETWEEN","NULL","TRUE","FALSE","ASC","DESC"],He=["<=",">=","<>","!=","=","<",">","+","-","*","/","%","||"],Ke=(s,e={})=>{let t=new Set(e.baseKeywords??Be);for(let r of s.keywords)t.add(r.toUpperCase());let i=new Set(e.baseOperators??He);for(let r of s.operators)i.add(r);return{keywords:Array.from(t),functions:s.functions,operators:Array.from(i),specialChars:s.specialChars}},D={sqlServer:"sql-layer-sql-server",postgres:"sql-layer-postgres",bigquery:"sql-layer-bigquery"},Ie=D.postgres,je={[D.sqlServer]:"sqlServer",[D.postgres]:"postgres",[D.bigquery]:"bigquery"};function Qe(s){return je[s]}async function Je(s){return Ke(await ze(Qe(s)))}var Ze=/^[A-Za-z_][A-Za-z0-9_$]*$/u;function Xe(s){return s==="esriDBMS_PostgreSQL"?Ie:s==="esriDBMS_SQLServer"?D.sqlServer:Ie}function It(s){return s.trim().toLowerCase()}function Ye(s){return s.specialChars.identifierQuote}function et(s,e){let t=s.trim();return t?Ze.test(t)?e.keywords.includes(t.toUpperCase()):!0:!1}function $e(s,e){let t=s.trim();if(!t||!et(t,e))return t;let i=Ye(e),r=t.replaceAll(i.end,`${i.end}${i.end}`);return`${i.start}${r}${i.end}`}function tt(s,e){return s.split(".").map(t=>$e(t,e)).join(".")}function Tt(s){return s.split(".").at(-1)??s}function it(s){return Je(Xe(s))}async function rt(s,e){let t=new B({url:`${s.url}/${e.relatedTableId}`});return await t.load(),t}function ee(s){return(e,t)=>{if(e.type==="oid")return-1;if(t.type==="oid")return 1;if(m(s)){if(e.name===s.subtypeField)return-1;if(t.name===s.subtypeField)return 1}if(x(s)){if(e.name===s.typeIdField)return-1;if(t.name===s.typeIdField)return 1}return e.name.localeCompare(t.name,"en",{sensitivity:"base"})}}function Te(s,e){return s?.every(t=>t.domains?.[e.name]?.type==="inherited")??!1}var st=/^[a-z_$][a-z0-9_$]*$/giu;function te(s,e=!0){return s.match(st)?`${e?".":""}${s}`:`["${s}"]`}function Ve(s,e){return s?`${s}${te(e)}`:e}function xe(s){return fe(s)?s.portalItem:null}function xt(s,e,t=!1){let i=e,r=[],n=[];return b(s).forEach(a=>{i&&(i+=`
3
+
4
+ `),i+=`**${a.name}** (${a.alias})
5
+ ${a.type}`,a.description&&(i+=`
6
+ '${a.description}`);let f=k(a),h=te(a.name,!1),p=g(a);if(r.push({name:a.name,description:p,type:f,completion:{label:a.name,detail:p,insertText:h,insertTextMode:$.asIs,insertTextFormat:M.PlainText,kind:P.Field}}),t){if(!a.alias||a.alias.toLowerCase()===a.name.toLowerCase())return;let I=`**${a.alias}**
7
+ ${a.type}`;a.description&&(I+=`
8
+ '${a.description}`),n.push({name:a.alias,description:a.name,type:f,completion:{label:a.alias,detail:a.name,insertText:h,insertTextMode:$.asIs,insertTextFormat:M.PlainText,kind:P.Field,documentation:{kind:"markdown",value:I}}})}}),[[...r,...n],i]}function Pt(s,e){let t=e,i=[];return s.forEach(r=>{t&&(t+=`
9
+
10
+ `),t+=`**${r.name}**
11
+ ${r.type}`,r.name&&(t+=`
12
+ '${r.name}`),i.push({name:r.name,description:r.name,type:"array",completion:{label:r.name,detail:r.name,insertText:te(r.name,!1),insertTextMode:$.asIs,insertTextFormat:M.PlainText,kind:P.Field}})}),[i,t]}var V=class{constructor(e,t,i){this._profile=e,this._label=t,this.description=i,this.filterDescription=!1}getLabel(){return this._label==null?"":typeof this._label=="string"?re(this._label):A(this._profile?.intlStrings[this._label.code],this._label.formatValues)}getDescription(){return this.description==null?"":typeof this.description=="string"?this.description:A(this._profile?.intlStrings[this.description.code],this.description.formatValues)}passFilter(e){return!e||e.test(this.getLabel())?!0:this.filterDescription&&e.test(this.getDescription())}},S=class extends V{constructor(e){super(e.profile,e.label,e.description??e.declaration?.description),this.declaration=e.declaration??{},this.name=e.declaration?.name??"",this.snippet=e.snippet??"",this.nonInteractive=e.nonInteractive??!1,this.filterDescription=e.filterDescription??!1,this.icon=e.icon}},o=class extends S{constructor(e){super(e),this.type="text",this.isCollection=!1,this.type=e.declaration?.type??"text"}getDescription(){return this.description==null?this._profile?.intlStrings[this.type.toLowerCase()]??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}},K=class extends S{constructor(e){super(e),this.type="array",this.isCollection=!1,this.elementType=e.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return this.description==null?this._profile?.intlStrings[this.type.toLowerCase()]??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}},d=class extends S{constructor(e,t){super(t),this.owner=e,this.isCollection=!0,this._loaded=!0,this.variables=[]}get breadcrumb(){if(this.owner){let e=this.owner.breadcrumb;return e?`${e} / ${this.name}`:this.name}return this.name}get loaded(){return this._loaded}get informationUrl(){return null}get informationType(){return""}},l=class extends V{constructor(e,t,i=[],r=!1){super(e,t),this.variables=i,this.isHeader=r,this.type="group",this.isCollection=!0}passFilter(){return!0}},v=class s extends d{constructor(e,t){super(e,t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new l(this._profile,this.snippet,this.dictionaryVariables)])}async loadSource(){}loadPropertyDeclarations(e){this.dictionaryVariables=this.createVariableInstances(e),this.variables=this.dictionaryVariables}createVariableInstances(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(i=>{let r=this.createVariableInstance(i);r&&t.push(r)}),t}createVariableInstance(e){let t=Ve(this.snippet,e.name);switch(e.type){case"number":case"text":case"boolean":case"date":case"dateOnly":case"time":case"geometry":case"knowledgeGraph":return new o({profile:this._profile,declaration:e,label:t,snippet:t});case"pixel":return new J(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"voxel":return new Q(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"feature":return new j(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"featureSet":return new F(this,{profile:this._profile,declaration:e,label:t,snippet:t},[new o({profile:this._profile,label:t,description:"",snippet:t})]);case"featureSetCollection":return new Z(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"dictionary":return new s(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"array":return new K({profile:this._profile,declaration:e,label:t,snippet:t});case"dataCatalogDatastore":return new X(this,{profile:this._profile,declaration:e,label:t,snippet:t});default:return c("error","Editor profile","Invalid profile variable",{detail:{declaration:e}}),null}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,properties:this.dictionaryVariables.map(e=>e.toProfileVariableDefinition())}}},E=class extends d{constructor(e,t,i){super(e,t),this.relationshipsProperties=i,this._source=null,this._loaded=!1,this._definition=t.declaration?.definition}get title(){return u(this._source)?this._source.title??"":""}get url(){return he(this._source)?this._source.url??"":""}get informationUrl(){return!this.loaded||!this.url?null:ue(this._source)?`${this.url}/${this._source.layerId}`:this.url}get informationType(){return this._profile?.intlStrings.layer??"layer"}async loadSource(){return _(this._loadPromise)&&w(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}_getValueSnippet(e){return["feature","voxel","pixel"].includes(this.type)?Ve(this.snippet,e.name):e.name}_getSubtypeOrDomainNameSnippet(e){return this.type!=="feature"?null:m(this._source)&&e.name===this._source.subtypeField?`SubtypeName(${this.snippet})`:`DomainName(${this.snippet}, "${e.name}")`}_getFieldProperty(e,t){let i=this._getDomainDictionary(e);if(i)return i;let r=this._getValueSnippet(e);return new o({profile:this._profile,label:r,description:g(e),snippet:r,icon:R(e,t),filterDescription:!0})}_getMemberProperty(e){let t=this._getValueSnippet(e);return new o({profile:this._profile,label:t,description:e.name,snippet:t,icon:Se(e),filterDescription:!0})}_getDomainDictionary(e){return N(this._source)?m(this._source)&&this._source.subtypeField?this._getSubtypeDomainDictionary(e):x(this._source)&&this._source.typeIdField?this._getFeatureTypeDomainDictionary(e):this._getFieldDomainDictionary(e):null}_getSubtypeDomainDictionary(e){if(!m(this._source))return null;if(!de(this._source))return e.name===this._source.subtypeField?null:this._getFieldDomainDictionary(e);if(e.name===this._source.subtypeField){let r=this._createDomainDictionary(e);return r.icon="subtype",r.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.subtypes,e)),r}if(Te(this._source.subtypes,e))return this._getFieldDomainDictionary(e);let t=this._getDomainValuesGroup(this._source.subtypes,e);if(!t)return null;let i=this._createDomainDictionary(e);return i.variables.push(t),i}_getFeatureTypeDomainDictionary(e){if(!x(this._source))return null;if(e.name===this._source.typeIdField){let r=this._createDomainDictionary(e);return r.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.types,e)),r}if(Te(this._source.types,e))return this._getFieldDomainDictionary(e);let t=this._getDomainValuesGroup(this._source.types,e);if(!t)return null;let i=this._createDomainDictionary(e);return i.variables.push(t),i}_getFieldDomainDictionary(e){if(!N(this._source))return null;let t=this._source.getFieldDomain(e.name);if(!T(t))return null;let i=this._getCodedValueDomainGroup(t,{code:"domainvalues"}),r=this._createDomainDictionary(e);return r.variables.push(i),r}_getTypeOrSubtypeDomainGroup(e,t){if(T(t.domain))return this._getCodedValueDomainGroup(t.domain,{code:"subtypes"});let i=e?.map(r=>{let n=U(r)?r.code:r.id;return new o({profile:this._profile,label:`${n}`,description:r.name,snippet:`"${n}"`})})??[];return new l(this._profile,{code:"subtypes"},i)}_getCodedValueDomainGroup(e,t){let i=e.codedValues.map(r=>new o({profile:this._profile,label:`${r.code}`,description:r.name,snippet:`"${r.code}"`,filterDescription:!0}));return new l(this._profile,t,i)}_getDomainValuesGroup(e,t){let i=[];return!e||e.length===0||(e.forEach(r=>{let n=r.domains?.[t.name];if(!n||ce(n)||!T(n))return;let a=g(t),f=this._getCodedValueDomainGroup(n,{code:"domainvaluesfortypeformat",formatValues:{fieldName:a,typeName:r.name}}),h=U(r)?r.code:r.id,p=`${h}`,I=`"${h}""`,ie=new v(this,{profile:this._profile,label:p,snippet:I,description:r.name,declaration:{name:a}});ie.variables=[f],i.push(ie)}),!i.length)?null:new l(this._profile,{code:"domainvaluesbysubtypes"},i)}_createDomainDictionary(e){let t=this._getValueSnippet(e),i=g(e),r=new v(this,{profile:this._profile,label:t,description:i,snippet:t,icon:"form-dropdown",declaration:{name:e.name}}),n=new l(this._profile,i,[new o({profile:this._profile,label:t,description:"",snippet:t})]);r.variables=[n];let a=this._getSubtypeOrDomainNameSnippet(e);return a&&n.variables.push(new o({profile:this._profile,label:a,description:"",snippet:a})),r}async _getRelationshipsProperty(){if(!this.relationshipsProperties?.exposeRelationships||!this._profile?.supportFeatureSetFunctions)return null;let e=this._source;if(!_e(e))return null;let t=new l(this._profile,{code:"relationships"}),i=await Promise.all(e.relationships?.map(async r=>{let n=await rt(e,r);if(!L(n)||r.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;let a=`FeatureSetByRelationshipName(${this.snippet}, "${r.name}")`;return new F(this,{profile:this._profile,declaration:{definition:n},label:n.title,description:"",nonInteractive:!0},[new o({profile:this._profile,label:a,description:"",snippet:a})],{exposeRelationships:!0,sourceTableId:e.layerId})})??[]);return t.variables=i.filter(_),t.variables.length?t:null}},C=class extends E{constructor(e,t,i,r={exposeRelationships:!0}){super(e,t,r),this.type=i}get title(){return u(this._source)?this._source.title??"":{code:this.type}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}},j=class extends C{constructor(e,t){super(e,t,"feature",{exposeRelationships:!0}),this.type="feature"}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await O(this._definition),!this._source)throw new Error("Invalid definition");let e=u(this._source)?this._source.title??"":"";this.variables.push(new l(this._profile,e,[new o({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new l(this._profile,{code:"values"});if(this.variables.push(t),me(this._source)){let n=`Geometry(${this.snippet})`,a=new o({profile:this._profile,declaration:{name:n},label:n,description:"Geometry",snippet:n,icon:"shapes",filterDescription:!0});t.variables.push(a)}let i=this._source;b(this._source.fields).map(n=>i.fields.find(a=>a.name===n.name)).sort(ee(i)).forEach(n=>{t.variables.push(this._getFieldProperty(n))});let r=await this._getRelationshipsProperty();r&&this.variables.push(r)}catch(e){c("error","FeatureVariable","Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},Q=class extends C{constructor(e,t){super(e,t,"voxel",{exposeRelationships:!1}),this.type="voxel",this._source=null}async _loadSource(){if(this.loaded)return this._source;try{if(!ye(this._definition))throw new Error("Invalid definition - not a VoxelLayer");if(await this._definition.load(),this._source=this._definition,!this._source)throw new Error("Invalid definition");let e=u(this._source)?this._source.title??"":"";this.variables.push(new l(this._profile,e,[new o({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new l(this._profile,{code:"values"});this.variables.push(t);let i=await Ue(this._source),r=this._source;b(this._source.fields).map(n=>r.fields.find(a=>a.name===n.name)).sort(ee(r)).forEach(n=>{t.variables.push(this._getFieldProperty(n,i))})}catch(e){c("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},J=class extends C{constructor(e,t){super(e,t,"pixel",{exposeRelationships:!1}),this.type="pixel",this._source=null}async _loadSource(){if(this.loaded)return this._source;try{if(!q(this._definition))throw new Error("Invalid definition - not an ImageryLayer");if(await this._definition.load(),this._source=this._definition,!this._source)throw new Error("Invalid definition");let e=u(this._source)?this._source.title??"":"";this.variables.push(new l(this._profile,e,[new o({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new l(this._profile,{code:"values"});if(this.variables.push(t),!q(this._source))throw new Error("Invalid definition - not an ImageryLayer");(await Ne(this._source)).forEach(i=>{t.variables.push(this._getMemberProperty(i))})}catch(e){c("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},F=class extends E{constructor(e,t,i=[],r){super(e,t,r),this.featureSetSnippets=i,this.type="featureSet"}get title(){return u(this._source)?this._source.title??"":{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await O(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new l(this._profile,this.title,this.featureSetSnippets,!0));let e=new l(this._profile,{code:"fields"});this.variables.push(e),e.variables=b(this._source.fields).sort(ee(this._source)).map(i=>this._getFieldProperty(i));let t=await this._getRelationshipsProperty();t&&this.variables.push(t)}catch(e){c("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}},Z=class extends d{constructor(e,t){super(e,t),this.type="featureSetCollection",this._featureSetCollections=null,this._loaded=!1,this._definition=t.declaration?.definition}get informationUrl(){return!this.loaded||!this._featureSetCollections?null:typeof this._featureSetCollections.source!="string"?De(xe(this._featureSetCollections.source)):null}get informationType(){if(!this.loaded||!this._featureSetCollections)return"";if(typeof this._featureSetCollections.source=="string")return this._profile?.intlStrings.featureservice??"featureservice";switch(this._featureSetCollections.source.declaredClass){case"esri.WebMap":return this._profile?.intlStrings.webmap??"webmap";case"esri.WebScene":return this._profile?.intlStrings.webscene??"webscene";default:return this._profile?.intlStrings.map??"map"}}async loadSource(){return _(this._loadPromise)&&w(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}async _loadSource(){if(this.loaded)return this._featureSetCollections;try{if(this._featureSetCollections=await this._featureSetCollectionsFromDefinition(),!this._featureSetCollections)throw new Error("Invalid definition");let e=typeof this._featureSetCollections.source=="string"?{code:this._featureSetCollections.source.endsWith("FeatureServer")?"featureservice":"mapservice"}:{code:"webmapformat",formatValues:{webMapTitle:xe(this._featureSetCollections.source)?.title||"Untitled map"}},t=new l(this._profile,e,[new o({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),i=new l(this._profile,{code:"layers"},this._featureSetCollections.layers),r=new l(this._profile,{code:"tables"},this._featureSetCollections.tables);this.variables.push(t,i,r)}catch(e){c("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._featureSetCollections=null}finally{this._loaded=!0}return this._featureSetCollections}async _featureSetCollectionsFromDefinition(){return this._definition?ne(this._definition)?await this._featureSetCollectionFromMap(this._definition):pe(this._definition)?await this._featureSetCollectionFromUrl(this._definition.url):le(this._definition)?await this._featureSetCollectionFromPortalItem(this._definition.portalItem):null:null}async _featureSetCollectionFromMap(e){oe(e)&&await e.loadAll(),await Promise.all(e.allTables.map(async i=>await i.load()));let t=this._profile?.policy?.filterFsCollectionLayersFromMap??(()=>!0);return{layers:this._convertWebMapLayersToVariables(e.allLayers.filter(t)),tables:this._convertWebMapLayersToVariables(e.allTables),source:e}}async _featureSetCollectionFromPortalItem(e){let t=new Ee(e);switch(await t.load(),t.type){case"Web Map":{let i=new Ae({portalItem:t});return await this._featureSetCollectionFromMap(i)}case"Web Scene":{let i=new Le({portalItem:t});return await this._featureSetCollectionFromMap(i)}case"Feature Service":return await this._featureSetCollectionFromUrl(t.url);default:return c("error",this.type,"Unsupported portal item",{detail:{definition:e}}),null}}async _featureSetCollectionFromUrl(e){let t=e?.replace(/\/featureserver\/[0-9]*/iu,"/FeatureServer");if(t=t?.replace(/\/mapserver\/[0-9]*/iu,"/MapServer"),t=t?.split("?")[0],!t)return null;let i=await ge(t),r=Promise.all(i.layers.map(async h=>{let p=new B({url:`${t}/${h.id}`});return await p.load(),this._createFeatureSetVariable(p)})),n=Promise.all(i.tables.map(async h=>{let p=new B({url:`${t}/${h.id}`});return await p.load(),this._createFeatureSetVariable(p)})),[a,f]=await Promise.all([r,n]);return{layers:a,tables:f,source:t}}_convertWebMapLayersToVariables(e){let t=[];return e.toArray().reverse().forEach(i=>{if(L(i)){t.push(this._createFeatureSetVariable(i,!0));return}}),t}_createFeatureSetVariable(e,t=!1){return new F(this,{profile:this._profile,declaration:{name:e.title??"",definition:e},label:t?e.title:e.sourceJSON.name??e.title,description:"",nonInteractive:!0},this._makeFeatureSetSnippets(e,t))}_makeFeatureSetSnippets(e,t=!1){if(!this._profile?.supportFeatureSetFunctions)return[];if(t){let i=`FeatureSetById(${this.snippet}, "${e.id}")`,r=`FeatureSetByName(${this.snippet}, "${e.title}")`;return[new o({profile:this._profile,label:i,description:"",snippet:i}),new o({profile:this._profile,label:r,description:"",snippet:r})]}else{let i=`FeatureSetById(${this.snippet}, "${e.layerId}")`;return[new o({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}},X=class extends d{constructor(e,t){super(e,t),this.type="dataCatalogDatastore",this._catalogDatastore=null,this._datastore=null,this._loaded=!1,this._definition=t.declaration?.definition}_serializeDefinitionFromInstance(e){return{id:e.itemId??"",serviceUrl:e.serviceUrl??"",portal:{url:e.portal?.url??""}}}_getSerializedDefinition(){let e=this.declaration.definition;if(e)return y(e)?e:this._serializeDefinitionFromInstance(e);if(y(this._definition))return this._definition;if(this._catalogDatastore)return this._serializeDefinitionFromInstance(this._catalogDatastore);if(this._definition)return this._serializeDefinitionFromInstance(this._definition)}async loadSource(){return _(this._loadPromise)&&w(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}async _loadSource(){if(this.loaded)return this._datastore;try{if(!this._definition)throw new Error("No definition provided");y(this._definition)?this._catalogDatastore=await this._dataCatalogDatastoreFromDefinition(this._definition):this._catalogDatastore=this._definition;let e=this._catalogDatastore;if(!e)throw new Error("Invalid definition");let t=await e.fetchInfo();this._datastoreInfo=t;let i=await e.fetchDatasets(),r=await it(t.databasePlatform),n=i.map(a=>new Y(this,{profile:this._profile,declaration:{name:a.name},label:a.name,description:a.type,snippet:tt(a.name,r)},e,a,r));this.variables=n,this._datastore={tables:n,source:y(this._definition)?this._definition:e,info:t}}catch(e){c("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._datastore=null}finally{this._loaded=!0}return this._datastore}get datastoreInfo(){return this._datastoreInfo}get tableVariables(){return this.variables.filter(be)}async _dataCatalogDatastoreFromDefinition(e){let t=new Oe({url:e.portal.url});return await t.load(),new H({itemId:e.id,serviceUrl:e.serviceUrl,portal:t})}toProfileVariableDefinition(){let e=this.declaration,t=this._getSerializedDefinition();return{type:this.type,name:"",...e,...t?{definition:t}:{}}}},Y=class extends d{constructor(e,t,i,r,n){super(e,t),this._catalogDatastore=i,this.datasetInfo=r,this._dialectSpec=n,this.type="dictionary",this._fieldInfos=[],this._loaded=!1}get fieldInfos(){return this._fieldInfos}async loadSource(){return _(this._loadPromise)&&w(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadFields(),await this._loadPromise)}async _loadFields(){if(this.loaded)return this._fieldInfos;try{let e=await this._catalogDatastore.fetchTableDescription(this.datasetInfo.name);this._fieldInfos=e.fields,this.variables=this._fieldInfos.map(t=>{let i={name:t.name,alias:t.name,type:t.type};return new o({profile:this._profile,declaration:{type:k(i)},label:t.name,description:[t.serverType,t.nullable?"nullable":"not null"].filter(Boolean).join(" | "),snippet:$e(t.name,this._dialectSpec),icon:R(i),filterDescription:!0})})}catch(e){c("error","DataCatalogDatastoreTableVariable","Error loading dataset",{detail:{error:e,dataset:this.datasetInfo}}),this._fieldInfos=[]}finally{this._loaded=!0}return this._fieldInfos}toProfileVariableDefinition(){return{type:"dictionary",name:this.datasetInfo.name,description:this.datasetInfo.type}}},Pe=class extends v{constructor(e,t,i="en",r={}){super(void 0,{profile:null,declaration:{properties:[]}}),this.definition=e,this.intlStrings=t,this.locale=i,this.policy=r,this.variables=[],this._profile=this,this.loadPropertyDeclarations(e?.variables)}get supportFeatureSetFunctions(){return this.definition?.bundles?.includes("data-access")??!1}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map(e=>e.toProfileVariableDefinition())}}},at={locale:"en"},Me=class{constructor(e,t){this.languageId=e,this._apiConfig=t,this._onDidChange=new G,this._modelToProfileMap=new Map,this._modelToApiContextMap=new Map,this._localeToApiLibraryPromiseMap=new Map,this._onModelContextDidChange=new G,this._onDidModelContextChangeTimeout=-1,ve().then(i=>{i.onWillDisposeModel(r=>{this.disposeForModel(r.uri)})})}_fireModelContextDidChange(e){this._onDidModelContextChangeTimeout===-1&&(this._onDidModelContextChangeTimeout=window.setTimeout(()=>{this._onDidModelContextChangeTimeout=-1,this._onModelContextDidChange.fire(e)},0))}_getApiKey(e){return W.isUri(e)||(e=W.parse(e)),e.toString()}getWorkerHostExtension(){}get onDidChange(){return this._onDidChange.event}disposeForModel(e){let t=this._getApiKey(e);this._modelToProfileMap.delete(t),this._modelToApiContextMap.delete(t)&&this._fireModelContextDidChange(t)}getEditorProfileForModel(e){return this._modelToProfileMap.get(this._getApiKey(e))}getApiContextForModel(e){return this._modelToApiContextMap.get(this._getApiKey(e))??at}updateApiContextForModel(e,t){let i=this._getApiKey(e),r=this._modelToApiContextMap.get(i)??{};this._modelToApiContextMap.set(i,{...r,...t}),this._fireModelContextDidChange(i)}get onModelContextDidChange(){return this._onModelContextDidChange.event}async getApiLibraryForModel(e){let t=this.getApiContextForModel(e),i=this.getApiLibrary(t.locale??"en");return(await we(i,t)).categories}get workerHost(){if(!this._workerHost){let e=Object.assign({getApiLibrary:async t=>await this.getApiLibrary(t),getLanguageId:()=>this.languageId},this.getWorkerHostExtension());this._workerHost=e}return this._workerHost}async fetchApiLibrary(e){try{let{apiPath:t,apiPrefix:i}=this._apiConfig,r=se(`${t}/${i}${e}.json`),n=await fetch(r);return n.ok?await n.json():[]}catch{return[]}}async getApiLibrary(e){let t=ae(e);return this._localeToApiLibraryPromiseMap.has(t)||this._localeToApiLibraryPromiseMap.set(t,this.fetchApiLibrary(t)),await this._localeToApiLibraryPromiseMap.get(t)??[]}};return{a:H,b:D,c:Ie,d:Qe,e:Je,f:Xe,g:It,h:$e,i:tt,j:Tt,k:te,l:xt,m:Pt,n:X,o:Pe,p:Me}},"portal/PortalItem","WebMap","WebScene","layers/FeatureLayer","applications/Components/arcadeEditorUtils","core/Error","portal/Portal",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import"./3TTFCHAA.js";var E={id:"postgres",keywords:["ALL","ANALYSE","ANALYZE","AND","ANY","ARRAY","AS","ASC","ASYMMETRIC","AUTHORIZATION","BETWEEN","BINARY","BOTH","CASE","CAST","CHECK","COLLATE","COLLATION","COLUMN","CONCURRENTLY","CONSTRAINT","CREATE","CROSS","CURRENT_CATALOG","CURRENT_DATE","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","DEFAULT","DEFERRABLE","DESC","DISTINCT","DO","ELSE","END","EXCEPT","FALSE","FETCH","FOR","FOREIGN","FREEZE","FROM","FULL","GRANT","GROUP","HAVING","ILIKE","IN","INITIALLY","INNER","INTERSECT","INTO","IS","ISNULL","JOIN","LATERAL","LEADING","LEFT","LIKE","LIMIT","LOCALTIME","LOCALTIMESTAMP","NATURAL","NEW","NOT","NOTNULL","NULL","OFF","OFFSET","OLD","ON","ONLY","OR","ORDER","OUTER","OVER","OVERLAPS","PLACING","PRIMARY","REFERENCES","RETURNING","RIGHT","SELECT","SESSION_USER","SIMILAR","SOME","SYMMETRIC","TABLE","THEN","TO","TRAILING","TRUE","UNION","UNIQUE","USER","USING","VARIADIC","VERBOSE","WHEN","WHERE","WINDOW","WITH","CMAX","CMIN","CTID","TABLEOID","XMAX","XMIN"],functions:["UPPER","LOWER","CONCAT","ASCII","CHAR_LENGTH","OCTET_LENGTH","CHR","LTRIM","RTRIM","SUBSTRING","SOUNDEX","REPLACE","TRIM","CEILING","FLOOR","ROUND","LN","LOG","MOD","POWER","SIGN","TRUNC","ASIN","ACOS","ATAN","TO_HEX","SIN","COS","TAN","EXTRACT","BIT_LENGTH","POSITION","ABS","VARIANCE","STDDEV","AVG","COUNT","MAX","MIN","SUM","COALESCE","CONVERT","CAST","CURRENT_USER","CURRENT_TIME","CURRENT_DATE","CURRENT_TIMESTAMP","STDDEV_POP","STDDEV_SAMP","VAR_POP","VAR_SAMP","NULLIF","PERCENTILE_CONT","PERCENTILE_DISC","CUME_DIST","FIRST_VALUE","LAST_VALUE","LEAD","LAG","PERCENT_RANK","RANK","NTILE","DENSE_RANK","ROW_NUMBER","STRING_AGG","GROUPING SETS","CUBE","ROLLUP","REGR_INTERCEPT","REGR_R2","REGR_SLOPE"],operators:["||"],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:"'",end:null},escapeClause:{keyword:"ESCAPE",suffix:""}}};export{E as postgresDialect};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{a,b,c}from"./CZ2DJPO4.js";import"./MP6Z45SA.js";import"./NKCYMRE4.js";import"./UYBZWFE5.js";import"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export{b as getSqlLayerDiagnosticService,a as getSqlLayerWorker,c as setupMode};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ export default $arcgis.t(([f,y])=>{function v(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&typeof t.declaredClass=="string"&&t.declaredClass.startsWith("esri.layers.")&&i(t)&&"queryFeatures"in t&&typeof t.queryFeatures=="function"}function c(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&typeof t.declaredClass=="string"&&(t.declaredClass==="esri.Map"||t.declaredClass==="esri.WebMap"||t.declaredClass==="esri.WebScene")}function h(t){return!!t&&typeof t=="object"&&"loadAll"in t&&typeof t.loadAll=="function"}function p(t){return!!t&&typeof t=="object"&&"portalItem"in t&&t.portalItem!=null}function s(t){return!!t&&typeof t=="object"&&"portalItem"in t&&t.portalItem!=null}function i(t){return!!t&&typeof t=="object"&&"fields"in t&&Array.isArray(t.fields)}function o(t){return!!t&&typeof t=="object"&&"url"in t&&typeof t.url=="string"}function d(t){return o(t)&&/\/(?:featureserver|mapserver)(?:\/|$)/iu.test(t.url??"")}function u(t){return o(t)||i(t)||s(t)}function D(t){return u(t)&&"type"in t&&t.type==="voxel"}function F(t){return u(t)&&"type"in t&&(t.type==="imagery"||t.type==="imagery-tile")}function w(t){return o(t)||i(t)||s(t)}function q(t){return p(t)||c(t)||d(t)}function S(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.Subtype"}function x(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.CodedValueDomain"}function W(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.InheritedDomain"}function L(t){return!!t&&typeof t=="object"&&"id"in t&&typeof t.id=="string"&&"definitions"in t&&typeof t.definitions=="object"&&!Array.isArray(t.definitions)}function M(t){return!!t&&typeof t=="object"&&"title"in t&&typeof t.title=="string"}function G(t){return!!t&&typeof t=="object"&&"url"in t&&typeof t.url=="string"}function b(t){return!!t&&typeof t=="object"&&"layerId"in t&&typeof t.layerId=="number"}function U(t){return!!t&&typeof t=="object"&&"typeIdField"in t&&"types"in t}function k(t){return!!t&&typeof t=="object"&&"getFieldDomain"in t&&typeof t.getFieldDomain=="function"}function j(t){return!!t&&typeof t=="object"&&"subtypeField"in t}function z(t){return j(t)&&"subtypes"in t}function B(t){return!!t&&typeof t=="object"&&"portalItem"in t}function E(t){return b(t)&&"relationships"in t&&"url"in t&&Array.isArray(t.relationships)&&typeof t.url=="string"}function g(t){return!!t&&typeof t=="object"&&"isTable"in t&&typeof t.isTable=="boolean"}function m(t){if(t&&typeof t=="object"){if(g(t))return t.isTable||"type"in t&&t.type==="table";if("geometryType"in t)return t.geometryType===""||t.geometryType==="esriGeometryNull"||t.geometryType===null}return!1}function H(t){return!m(t)}function C(t){return!!t&&typeof t=="object"&&"load"in t&&typeof t.load=="function"}function N(t){return!!t&&typeof t=="object"&&"type"in t&&t.type==="voxel"}function O(t){return!!t&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&["imagery","imagery-tile"].includes(t.type)}function V(t){return!!t&&typeof t=="object"&&"id"in t&&typeof t.id=="string"&&"serviceUrl"in t&&typeof t.serviceUrl=="string"&&"portal"in t&&!!t.portal&&typeof t.portal=="object"&&"url"in t.portal&&typeof t.portal.url=="string"}function $(t){return!!t&&"intlStrings"in t&&"policy"in t}function J(t){return t?.type==="featureSet"}function K(t){return t?.type==="dataCatalogDatastore"}function I(t){return!!t&&"datasetInfo"in t}function P(t){return!!t&&t.type!=="dataCatalogDatastore"&&!I(t)}async function Q(t){if(!t)return null;let r;return i(t)?r=t:r=new f(t),C(r)&&await r.load(),r}async function R(t){t+="/layers";let r=await y(t,{responseType:"json",query:{f:"json"}}),n=t.endsWith("MapServer/layers")?"data":"query",e=a(r.data?.layers,n),l=a(r.data?.tables,n);return{layers:e,tables:l}}function a(t,r){return t?t.filter(n=>{switch(n.type){case"Feature Layer":case"Oriented Imagery Layer":case"Catalog Layer":case"Table":return(n.capabilities?n.capabilities.toLowerCase().split(",").map(e=>e.trim()):[]).includes(r);default:return!1}}):[]}return{a:v,b:c,c:h,d:p,e:o,f:u,g:D,h:F,i:w,j:q,k:S,l:x,m:W,n:L,o:M,p:G,q:b,r:U,s:k,t:j,u:z,v:B,w:E,x:g,y:H,z:N,A:O,B:V,C:$,D:J,E:K,F:I,G:P,H:Q,I:R}},"layers/FeatureLayer","request")
@@ -1 +1 @@
1
- {"help":"Help","profilevariables":"Profile variables","constantsandfunctions":"Functions","suggestions":"Suggestions","run":"Run","lastresults":"Last results","arcadeassistant":"Arcade assistant"}
1
+ {"help":"Help","profilevariables":"Profile variables","constantsandfunctions":"Functions","suggestions":"Suggestions","run":"Run","lastresults":"Last results","arcadeassistant":"Arcade assistant","profileempty":"This profile does not have any variables."}