@arcgis/coding-components 5.2.0-next.1 → 5.2.0-next.10

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 (114) hide show
  1. package/dist/cdn/3LFA3ZUC.js +2 -0
  2. package/dist/cdn/{O3PQD5N5.js → 3RKKHGVW.js} +1 -1
  3. package/dist/cdn/4KFBAAVC.js +2 -0
  4. package/dist/cdn/4XEVYDUI.js +2 -0
  5. package/dist/cdn/4XMC5J5W.js +12 -0
  6. package/dist/cdn/{WWVPYM5B.js → 6IE7GBIZ.js} +1 -1
  7. package/dist/cdn/7Z6G332Z.js +2 -0
  8. package/dist/cdn/{QUR4WECO.js → BEDXEPMS.js} +1 -1
  9. package/dist/cdn/{PUY5G6AF.js → CKBZZB5E.js} +1 -1
  10. package/dist/cdn/CRXBAVHA.js +68 -0
  11. package/dist/cdn/{2WVAYBDV.js → DBVA54U6.js} +1 -1
  12. package/dist/cdn/{CC4XBW6V.js → EHMFQPTC.js} +1 -1
  13. package/dist/cdn/{LUJKYDO7.js → EIW62O7S.js} +1 -1
  14. package/dist/cdn/{BXEZA6TW.js → FJWYAXOE.js} +1 -1
  15. package/dist/cdn/GBBSV4NV.js +2 -0
  16. package/dist/cdn/{QW7OA32G.js → GRY2G3ZM.js} +1 -1
  17. package/dist/cdn/{HRM2JUGO.js → IMMQXUUH.js} +1 -1
  18. package/dist/cdn/IQR7XS6J.js +2 -0
  19. package/dist/cdn/{QGBZYXBS.js → MFMTJO3G.js} +1 -1
  20. package/dist/cdn/MQ6ZAZZK.js +2 -0
  21. package/dist/cdn/MZMKV7FA.js +2 -0
  22. package/dist/cdn/NP37C536.js +2 -0
  23. package/dist/cdn/PE22Q7FG.js +2 -0
  24. package/dist/cdn/{2DNHMHBF.js → PNDN33UV.js} +1 -1
  25. package/dist/cdn/QRQEHI3E.js +2 -0
  26. package/dist/cdn/{CA3GVMWI.js → R4PIOB2F.js} +1 -1
  27. package/dist/cdn/SYSBF5A6.js +2 -0
  28. package/dist/cdn/UCJZGGBB.js +6 -0
  29. package/dist/cdn/{IETP57KJ.js → VVAIS3PR.js} +1 -1
  30. package/dist/cdn/assets/arcade-language/api/arcade-api.t9n.en.json +1 -1
  31. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.ar.json +1 -1
  32. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.bg.json +1 -1
  33. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.bs.json +1 -1
  34. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.ca.json +1 -1
  35. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.cs.json +1 -1
  36. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.da.json +1 -1
  37. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.de.json +1 -1
  38. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.el.json +1 -1
  39. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.es.json +1 -1
  40. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.et.json +1 -1
  41. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.fi.json +1 -1
  42. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.fr.json +1 -1
  43. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.he.json +1 -1
  44. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.hr.json +1 -1
  45. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.hu.json +1 -1
  46. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.id.json +1 -1
  47. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.it.json +1 -1
  48. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.ja.json +1 -1
  49. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.ko.json +1 -1
  50. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.lt.json +1 -1
  51. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.lv.json +1 -1
  52. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.nl.json +1 -1
  53. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.no.json +1 -1
  54. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.pl.json +1 -1
  55. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.pt-BR.json +1 -1
  56. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.pt-PT.json +1 -1
  57. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.ro.json +1 -1
  58. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.ru.json +1 -1
  59. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.sk.json +1 -1
  60. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.sl.json +1 -1
  61. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.sr.json +1 -1
  62. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.sv.json +1 -1
  63. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.th.json +1 -1
  64. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.tr.json +1 -1
  65. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.uk.json +1 -1
  66. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.vi.json +1 -1
  67. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.zh-CN.json +1 -1
  68. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.zh-HK.json +1 -1
  69. package/dist/cdn/assets/arcade-language/profiles/arcade-profiles.t9n.zh-TW.json +1 -1
  70. package/dist/cdn/assets/code-editor/sql-expr.worker.js +3 -3
  71. package/dist/cdn/index.js +1 -1
  72. package/dist/chunks/ArcadeDebuggerPreviewTabsState.js +1 -1
  73. package/dist/chunks/arcade-defaults.js +56 -54
  74. package/dist/chunks/debugger-value-components.js +1 -1
  75. package/dist/chunks/debugger-value-styles.js +8 -8
  76. package/dist/chunks/fields.js +18 -14
  77. package/dist/chunks/functional.js +34 -34
  78. package/dist/chunks/language-defaults-base.js +230 -221
  79. package/dist/chunks/sql-expr-defaults.js +63 -59
  80. package/dist/components/arcgis-arcade-debugger-console/customElement.js +7 -7
  81. package/dist/components/arcgis-arcade-debugger-output/customElement.js +1 -1
  82. package/dist/components/arcgis-arcade-editor/customElement.d.ts +38 -3
  83. package/dist/components/arcgis-arcade-editor/customElement.js +184 -178
  84. package/dist/components/arcgis-arcade-results/customElement.js +18 -18
  85. package/dist/components/arcgis-code-editor-shell/customElement.js +70 -65
  86. package/dist/components/arcgis-editor-variables/customElement.js +12 -6
  87. package/dist/components/arcgis-sql-expression-editor/customElement.d.ts +11 -0
  88. package/dist/components/arcgis-sql-expression-editor/customElement.js +5 -5
  89. package/dist/docs/api.json +1 -1
  90. package/dist/docs/docs.json +1 -1
  91. package/dist/docs/vscode.html-custom-data.json +1 -1
  92. package/dist/docs/web-types.json +1 -1
  93. package/dist/index.d.ts +3 -3
  94. package/dist/loader.js +2 -2
  95. package/dist/types/lumina.d.ts +1 -1
  96. package/dist/types/preact.d.ts +1 -1
  97. package/dist/types/react.d.ts +1 -1
  98. package/dist/types/stencil.d.ts +1 -1
  99. package/package.json +8 -8
  100. package/dist/cdn/3CHKFCKR.js +0 -2
  101. package/dist/cdn/3UD4JSPW.js +0 -2
  102. package/dist/cdn/4G3EYLJY.js +0 -2
  103. package/dist/cdn/4N67XYKO.js +0 -2
  104. package/dist/cdn/6QMGBWXM.js +0 -2
  105. package/dist/cdn/72E5GBWN.js +0 -68
  106. package/dist/cdn/B5A6XU2C.js +0 -2
  107. package/dist/cdn/CQTJWVFM.js +0 -6
  108. package/dist/cdn/G5IXPOCO.js +0 -2
  109. package/dist/cdn/P3LG4UGD.js +0 -2
  110. package/dist/cdn/RMVHO2AH.js +0 -12
  111. package/dist/cdn/RO6RHW6I.js +0 -2
  112. package/dist/cdn/TQDN6SR5.js +0 -2
  113. package/dist/cdn/TWEJITWD.js +0 -2
  114. package/dist/cdn/ZTCCL565.js +0 -2
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import e from"./CRXBAVHA.js";import{d as S}from"./MZMKV7FA.js";import d from"./2WB7S5TQ.js";import{j as a,p as c,u as b}from"./XU7YAUUX.js";export default $arcgis.t(([{b:u,c:g,d:m},{b:d,c:f,d:M,e:v,f:k,g:y}])=>{var l={lines:!0,selectionMode:"none",scale:"s",oncalciteTreeSelect:e=>e.currentTarget.selectedItems.forEach(t=>t.selected=!1)},$={onClick:e=>{let t=e.currentTarget;t.expanded=!t.expanded}},R=({arcadeResult:e,t9nStrings:t})=>{let s=e.value??[],n=Math.max(s.length-u,0);return a`<bdi>${`${c(e.type)}(${s.length??0})`}</bdi>${n>0?a`<span>&nbsp;${b(t.showingfirstitemsformat,{count:u.toString()})}</span>`:null}`},T=({value:e,subtree:t,t9nStrings:s})=>{let n=e.geometry?.();return a`<calcite-tree slot=${"children"} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${e.keys().map(r=>{let i=m(e.field(r));return e.arcadeDeclaredClass==="esri.arcade.Feature"&&i.type==="geometry"?null:p({arcadeResult:i,name:r,t9nStrings:s})})}${n?p({arcadeResult:{type:"geometry",value:n},name:"geometry",t9nStrings:s}):null}</calcite-tree>`},G=({arcadeResult:e,t9nStrings:t})=>a`<div class="value-type"><bdi>${c(e.type)}:</bdi>${e.features.length>=g?a`<span>&nbsp;${b(t.showingfirstitemsformat,{count:g.toString()})}</span>`:null}</div>`,C=({items:e,subtree:t,arrayLength:s=e.length,t9nStrings:n})=>a`<calcite-tree slot=${"children"} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${e.map((r,i)=>{let o=m(r);return p({arcadeResult:o,name:i,expanded:!t,t9nStrings:n})})}${p({arcadeResult:{type:"number",value:s},name:"length",isMetadata:!0,t9nStrings:n})}</calcite-tree>`,p=({arcadeResult:e,name:t,isMetadata:s=!1,expanded:n,t9nStrings:r})=>{switch(e.type){case"null":case"unknown":case"text":case"number":case"date":case"dateOnly":case"time":case"boolean":let{type:i,value:o}=y(e);return a`<calcite-tree-item><div class="tree-item-label">${d({name:t,isMetadata:s})}${v({type:i,value:o})}</div></calcite-tree-item>`;case"array":{let h=e.value??[],x=h.slice(0,u);return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}${R({arcadeResult:e,t9nStrings:r})}</div>${C({items:x,arrayLength:h.length,subtree:!0,t9nStrings:r})}</calcite-tree-item>`}case"geometry":return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}<bdi>${c(e.type)}</bdi></div>${M({value:e.value,subtree:!0})}</calcite-tree-item>`;case"attachment":return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}<bdi>${c(e.type)}</bdi></div>${f({obj:e.value.castAsJson(),subtree:!0})}</calcite-tree-item>`;case"feature":case"dictionary":case"portal":return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}<bdi>${c(e.type)}</bdi></div>${T({value:e.value,subtree:!0,t9nStrings:r})}</calcite-tree-item>`;default:return null}},I=({arcadeResult:e})=>{let t=S(e.value.fields);return a`<div class="table-scroll"><table><thead><tr>${t.map(s=>a`<th>${s.name}</th>`)}</tr></thead><tbody>${e.features.map(s=>a`<tr>${t.map(n=>{let r=m(s.field(n.name));if(!k(r))return a`<td></td>`;try{let{type:i,value:o}=y(r);return a`<td>${v({type:i,value:o})}</td>`}catch{return a`<td></td>`}})}</tr>`)}</tbody></table></div>`};return{a:l,b:R,c:T,d:G,e:C,f:I}},d,e)
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{b as I}from"./T5PTHYE5.js";import e from"./QUR4WECO.js";import d from"./RMVHO2AH.js";import c from"./STN3LSQR.js";import{c as E}from"./3PBQ47BB.js";import"./OLNYBWUC.js";import"./P37AQWGL.js";import"./ZTCCL565.js";import{a as u}from"./2WVAYBDV.js";import"./CC4XBW6V.js";import"./TQDN6SR5.js";import"./XSKI5PRU.js";import"./ECNI2A4K.js";import"./XRUKVCVF.js";import{E as g,F as m,G as _,H as b,K as f,h as p,j as o,n as r,t as h}from"./XU7YAUUX.js";import{b as a}from"./VGOFAQ7A.js";import"./257WOXQH.js";import"./R2XZZWNP.js";import"./QTLHVR4Y.js";import"./TEXAGKBD.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,,,,,{E:l},{c:d},{a:S,b:v,c:$,d:y}])=>{var x=p`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,n=class extends _{constructor(){super(...arguments),this._codeEditorElt=g(),this._disposables=[],this._modelId=h(),this.messages=u(),this._preparing=!1,this._resolvedLanguage=d,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.openedSidePanel="none",this.arcgisDiagnosticsChange=r({bubbles:!1}),this.arcgisScriptChange=r({bubbles:!1})}static{this.properties={_editorProfile:16,_preparing:16,_resolvedLanguage:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0,openedSidePanel:3,editorOptions:0,editorInstance:32}}static{this.styles=[x]}get editorInstance(){return this._codeEditorElt.value?.editorInstance}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateDataModelDeps().catch(a(this))}willUpdate(e){e.has("profile")&&this._updateDataModelDeps().catch(a(this))}async loaded(){let e=I();this._disposables.push(e.onDiagnosticsChange(t=>{t.uri.toString()===this._modelId&&!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)}))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose();y().forEach(e=>e.disposeForModel(this._modelId))}async _updateDataModelDeps(){this._preparing=!0;try{let e=await S(this.profile);e!==this._resolvedLanguage&&($(this._resolvedLanguage)?.disposeForModel(this._modelId),this._resolvedLanguage=e);let t=v(this._resolvedLanguage);await t.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=t.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0,this._resolvedLanguage=d}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(a(this))}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}async _onItemSelected(e){e.stopPropagation();let t=this._getSelectedTableVariable(e.detail);if(!t){this._codeEditorElt.value?.insertText(e.detail).catch(a(this));return}await t.loadSource();let i,c=t.fieldInfos.filter(s=>s.type==="geometry"&&!i?(i=s.name,!0):s.type!=="geometry").map(s=>s.name).filter(Boolean),P=`select ${c.length?c.join(", "):"*"} from ${t.snippet}`;E(this._codeEditorElt.value?.editorInstance,P,"replace","")}_getTablesVariable(){return this._editorProfile?.variables.find(l)}_getSelectedTableVariable(e){let t=this._getTablesVariable();if(l(t))return t.tableVariables.find(i=>i.snippet===e)}render(){let e=this._getTablesVariable(),t=String(this.messages.placeholderexample??"Example: {sqlQueryExample}").replace("{sqlQueryExample}","select field1, field2 from db.dataset"),i=`${this.messages.placeholder??"Start filtering data using SQL query syntax"}
2
+ import{b as I}from"./T5PTHYE5.js";import e from"./BEDXEPMS.js";import d from"./4XMC5J5W.js";import c from"./STN3LSQR.js";import{c as E}from"./3PBQ47BB.js";import"./OLNYBWUC.js";import"./P37AQWGL.js";import"./MZMKV7FA.js";import{a as u}from"./DBVA54U6.js";import"./EHMFQPTC.js";import"./NP37C536.js";import"./XSKI5PRU.js";import"./ECNI2A4K.js";import"./XRUKVCVF.js";import{E as g,F as m,G as _,H as b,K as f,h as p,j as o,n as r,t as h}from"./XU7YAUUX.js";import{b as a}from"./VGOFAQ7A.js";import"./257WOXQH.js";import"./R2XZZWNP.js";import"./QTLHVR4Y.js";import"./TEXAGKBD.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,,,,,{E:l},{c:d},{a:S,b:v,c:$,d:y}])=>{var x=p`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,n=class extends _{constructor(){super(...arguments),this._codeEditorElt=g(),this._disposables=[],this._modelId=h(),this.messages=u(),this._preparing=!1,this._resolvedLanguage=d,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.openedSidePanel="none",this.arcgisDiagnosticsChange=r({bubbles:!1}),this.arcgisScriptChange=r({bubbles:!1})}static{this.properties={_editorProfile:16,_preparing:16,_resolvedLanguage:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0,openedSidePanel:3,editorOptions:0,editorInstance:32}}static{this.styles=[x]}get editorInstance(){return this._codeEditorElt.value?.editorInstance}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateDataModelDeps().catch(a(this))}willUpdate(e){e.has("profile")&&this._updateDataModelDeps().catch(a(this))}async loaded(){let e=I();this._disposables.push(e.onDiagnosticsChange(t=>{t.uri.toString()===this._modelId&&!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)}))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose();y().forEach(e=>e.disposeForModel(this._modelId))}async _updateDataModelDeps(){this._preparing=!0;try{let e=await S(this.profile);e!==this._resolvedLanguage&&($(this._resolvedLanguage)?.disposeForModel(this._modelId),this._resolvedLanguage=e);let t=v(this._resolvedLanguage);await t.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=t.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0,this._resolvedLanguage=d}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(a(this))}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}async _onItemSelected(e){e.stopPropagation();let t=this._getSelectedTableVariable(e.detail);if(!t){this._codeEditorElt.value?.insertText(e.detail).catch(a(this));return}await t.loadSource();let i,c=t.fieldInfos.filter(s=>s.type==="geometry"&&!i?(i=s.name,!0):s.type!=="geometry").map(s=>s.name).filter(Boolean),P=`select ${c.length?c.join(", "):"*"} from ${t.snippet}`;E(this._codeEditorElt.value?.editorInstance,P,"replace","")}_getTablesVariable(){return this._editorProfile?.variables.find(l)}_getSelectedTableVariable(e){let t=this._getTablesVariable();if(l(t))return t.tableVariables.find(i=>i.snippet===e)}render(){let e=this._getTablesVariable(),t=String(this.messages.placeholderexample??"Example: {sqlQueryExample}").replace("{sqlQueryExample}","select field1, field2 from db.dataset"),i=`${this.messages.placeholder??"Start filtering data using SQL query syntax"}
3
3
  ${t}`;return o`<arcgis-code-editor-shell><arcgis-code-editor slot=editor .language=${this._resolvedLanguage} .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} .editorOptions=${{placeholder:i,...this.editorOptions}} ${m(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&o`<arcgis-editor-variables slot=side-panel .variable=${e} .heading=${this.messages.tables??"Tables"} .messageOverrides=${{profileempty:this.messages.profileempty}} .closed=${this.openedSidePanel!=="variables"} class=${b(this.openedSidePanel==="variables"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._onItemSelected} @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&&o`<calcite-tooltip reference-element=tables-action><span>${this.messages.tables??"Tables"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};f("arcgis-sql-layer-editor",n);return n},"portal/PortalItem","WebMap","WebScene","layers/FeatureLayer","applications/Components/arcadeEditorUtils","core/Error","portal/Portal",c,d,e)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import g from"./Q2EZ6DGG.js";import f from"./UCJZGGBB.js";import e from"./4XMC5J5W.js";import c from"./STN3LSQR.js";import{e as te}from"./3PBQ47BB.js";import b from"./7Z6G332Z.js";import{a as oe,b as re,c as D}from"./O5XRLNCX.js";import"./OLNYBWUC.js";import{a as ae}from"./P37AQWGL.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as ee}from"./DBVA54U6.js";import{a as Z}from"./EHMFQPTC.js";import"./NP37C536.js";import"./XSKI5PRU.js";import"./ECNI2A4K.js";import"./XRUKVCVF.js";import{E as M,F as T,G as X,H as P,K as Y,L as J,h as W,j as d,l as I,n as L,t as Q}from"./XU7YAUUX.js";import{a as G,b as u}from"./VGOFAQ7A.js";import"./257WOXQH.js";import"./R2XZZWNP.js";import"./QTLHVR4Y.js";import{Rk as se,Uk as F,Zk as ie}from"./TEXAGKBD.js";import"./H6RQVSYM.js";export default $arcgis.t(([_e,he,{watch:O},m,{property:c,subclass:x},{a:ne,h:v,i:U},{b:N},,,f,{a:ce,b:le}])=>{var me=W`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.bottom-action-bar.is-collapsed{border-bottom:0}.bottom-action-bar{display:flex;align-items:stretch;background-color:var(--calcite-color-foreground-1);.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}.bottom-action-bar__close{flex:0 0 auto}}`,de="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",h=(t,e)=>{G(t,"Arcade Assistant",e)},ge=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],xe=ge,ue=(t,e)=>e.every(s=>t[s]===!0),Se=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(h("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},Ae=async t=>(await he.getCredential(t,{oAuthPopupConfirmation:!1})).token,Pe=async t=>{try{return!!await he.checkSignInStatus(t)}catch{return h("warn","User is not signed in."),!1}};async function fe({portalUrl:t}){t&&h("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let e=t||_e.portalUrl;if(!e)return h("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let s=e.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await Pe(s))return{shouldRender:!1};let i=await Ae(e),a=`${s}/sharing/rest/portals/self?f=json&token=${i}`,o=`${s}/sharing/rest/portals/self/settings?f=json&token=${i}`,n=`${s}/sharing/rest/portals/self/signinSettings?f=json&token=${i}`,r=await Promise.allSettled([fetch(a,{credentials:"include"}).then($=>$.json()),fetch(o,{credentials:"include"}).then($=>$.json()),fetch(n,{credentials:"include"}).then($=>$.json())]),[S,A,R]=r,y=S.status==="fulfilled"?S.value:(h("warn",`Failed to fetch selfUrl. Reason: ${S.reason}.`),{}),K=A.status==="fulfilled"?A.value:(h("warn",`Failed to fetch settingsUrl. Reason: ${A.reason}.`),{}),be=R.status==="fulfilled"?R.value:(h("warn",`Failed to fetch signinSettingsUrl. Reason: ${R.reason}.`),{});if(y.isPortal)return{shouldRender:!1};let j=y.helpBase||"";if(!K)return h("warn","Settings response is not available."),{shouldRender:!1};let B={orgAiAssistantsEnabled:Se(K),betaAppsAllowed:be.blockBetaApps!==!0,serviceUrlAvailable:!!y?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:y?.user?.privileges?.includes("portal:user:useAIAssistants")===!0};B.betaAppsAllowed||h("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),B.userHasUseAiAssistantsPrivilege||h("warn","User does not have the required privileges to use AI Assistants.");let H=ue(B,xe),q=ue(B,ge),V=y?.helperServices?.aiAssistantServices?.url;return V?{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:q},serviceUrl:V,helpBase:j,feedbackServiceUrl:de}:{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:q},helpBase:j,feedbackServiceUrl:de}}var ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,_=(t,e,s,i)=>{for(var a=i>1?void 0:i?ye(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ve(e,s,a),a},pe=100,g=class extends m{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=pe}};_([c()],g.prototype,"collectionItems",2);_([c()],g.prototype,"errorMessage",2);_([c()],g.prototype,"expanded",2);_([c()],g.prototype,"requestId",2);_([c()],g.prototype,"schemaValue",2);_([c()],g.prototype,"status",2);_([c()],g.prototype,"visibleChildCount",2);g=_([x("ArcadeDebuggerLazyTreeNodeState")],g);var C=class extends m{constructor(t){super(t),this.generation=0,this.nodes=new Map}reset(){this.generation+=1,this.destroyNodes()}ensureNode(t,e=!1,s){let i=this.nodes.get(t);if(i)return i;let a=new g;return a.expanded=e,this.nodes.set(t,a),e&&s&&this.loadNode(t,s),a}setExpanded(t,e,s){let i=this.ensureNode(t,e,s);if(i.expanded===e){e&&s&&this.loadNode(t,s);return}i.expanded=e,e&&s&&this.loadNode(t,s)}showMore(t,e){let s=this.ensureNode(t);s.visibleChildCount>=e||(s.visibleChildCount=Math.min(e,s.visibleChildCount+pe))}loadNode(t,e){switch(e.kind){case"collection":this.runLoad(t,e.load,(s,i)=>{s.collectionItems=i});return;case"schema":this.runLoad(t,e.load,(s,i)=>{s.schemaValue=i});return}}runLoad(t,e,s){let i=this.nodes.get(t);if(!i||i.status==="loading"||i.status==="loaded")return;let a=this.generation,o=i.requestId+1;i.requestId=o,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(n=>{let r=this.nodes.get(t);!r||this.generation!==a||r.requestId!==o||(s(r,n),r.status="loaded")}).catch(()=>{let n=this.nodes.get(t);!n||this.generation!==a||n.requestId!==o||(n.status="error")})}destroyNodes(){for(let t of this.nodes.values())t.destroy();this.nodes.clear()}};C=_([x("ArcadeDebuggerLazyTreeState")],C);var $e=Object.defineProperty,De=Object.getOwnPropertyDescriptor,l=(t,e,s,i)=>{for(var a=i>1?void 0:i?De(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$e(e,s,a),a},b=class extends m{constructor(t){super(t),this.phase="idle",this.sessionId=0,this.consoleLogs=[],this.hasExecuted=!1}get isExecuting(){return this.phase==="running"||this.phase==="debug-running"||this.phase==="debug-paused"}get isDebugging(){return this.phase==="debug-running"||this.phase==="debug-paused"}get isPaused(){return this.phase==="debug-paused"}get runResult(){return this.result?.resultType==="run"?this.result.result:void 0}get debugResult(){return this.result?.resultType==="debug"?this.result.result:void 0}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};l([c()],b.prototype,"phase",2);l([c()],b.prototype,"mode",2);l([c()],b.prototype,"sessionId",2);l([c()],b.prototype,"result",2);l([c()],b.prototype,"consoleLogs",2);l([c()],b.prototype,"hasExecuted",2);b=l([x("ArcadeDebuggerExecutionModel")],b);var E=class extends m{constructor(t){super(t),this.editorBreakpoints=[],this.executionBreakpoints=[]}setBreakpoints(t,e){t==="editor"?this.editorBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i):this.executionBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i)}toggleBreakpoint(t,e){let s=new Set(t==="editor"?this.editorBreakpoints:this.executionBreakpoints);s.has(e)?s.delete(e):s.add(e),this.setBreakpoints(t,s)}clearBreakpoints(t){t==="editor"?this.editorBreakpoints=[]:this.executionBreakpoints=[]}syncExecutionBreakpointsFromEditor(){this.executionBreakpoints=this.editorBreakpoints}};l([c()],E.prototype,"editorBreakpoints",2);l([c()],E.prototype,"executionBreakpoints",2);E=l([x("ArcadeDebuggerSessionModel")],E);var w=class extends m{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};l([c()],w.prototype,"openedPanel",2);l([c()],w.prototype,"showPanel",2);w=l([x("ArcadeDebuggerUiModel")],w);var k=class extends m{constructor(t){super(t)}get line(){return this.pausedState?.line}clearPausedState(){this.lastPausedState=this.pausedState,this.pausedState=void 0}reset(){this.pausedState=void 0,this.lastPausedState=void 0}setPausedState(t){this.pausedState=t,this.lastPausedState=t}};l([c()],k.prototype,"pausedState",2);l([c()],k.prototype,"lastPausedState",2);k=l([x("ArcadeDebuggerPausedFrameModel")],k);var p=class extends m{constructor(t){super(t),this.execution=new b,this.lazyTreeState=new C,this.pausedFrame=new k,this.previewTabsState=new N,this.session=new E,this.ui=new w}get editorBreakpoints(){return this.session.editorBreakpoints}get debuggerBreakpoints(){return this.isPaused?this.session.executionBreakpoints.map(t=>({line:t})):this.session.editorBreakpoints.map(t=>({line:t}))}get executionBreakpoints(){return this.session.executionBreakpoints}get consoleLogs(){return this.execution.consoleLogs}get debug(){if(!(!this.pausedFrame.pausedState&&!this.pausedFrame.lastPausedState))return{pausedState:this.pausedFrame.pausedState,lastPausedState:this.pausedFrame.lastPausedState}}get debugResult(){return this.execution.debugResult}get debuggerLine(){return this.pausedFrame.pausedState?.line}get executionState(){return this.pausedFrame.pausedState}get hasExecuted(){return this.execution.hasExecuted}get isDebugging(){return this.execution.isDebugging}get isExecuting(){return this.execution.isExecuting}get isPaused(){return this.execution.isPaused}get mode(){return this.execution.mode}get openedPanel(){return this.ui.openedPanel}get outputRenderer(){if(this.execution.result)return this.execution.result.resultType==="debug"?"debugger":"legacy"}get phase(){return this.execution.phase}get result(){return this.execution.result}get runResult(){return this.execution.runResult}get sessionId(){return this.execution.sessionId}get showPanel(){return this.ui.showPanel}addConsoleLog(t){this.execution.addConsoleLog(t)}clearBreakpoints(t){this.session.clearBreakpoints(t)}clearForMissingTestData(){this.stopDebug({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(t){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t,e={}){this.execution.mode="run",!e.useDebugRenderer&&v(t)?this.execution.result={resultType:"run",result:t}:e.useDebugRenderer&&!v(t)&&(this.execution.result={resultType:"debug",result:t}),this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",this.resetTransientDebuggerState()}continueDebug(){let t=this.pausedFrame.pausedState?.continue;t&&(this.execution.phase="debug-running",this.pausedFrame.clearPausedState(),t.resolve())}disableDebugger(){this.stopDebug({hidePanel:!0}),this.clearBreakpoints("execution"),this.clearBreakpoints("editor")}fail(t){this.completeRun(t)}pauseDebug(t){let e=this.pausedFrame.pausedState??this.pausedFrame.lastPausedState;this.syncPausedState(e,t),this.pausedFrame.setPausedState(t),this.execution.phase="debug-paused"}reset(){this.execution.phase="idle",this.execution.mode=void 0,this.execution.result=void 0,this.execution.consoleLogs=[],this.execution.hasExecuted=!1,this.execution.sessionId=0,this.ui.openedPanel="output",this.ui.showPanel=!1,this.pausedFrame.reset(),this.clearBreakpoints("execution"),this.clearBreakpoints("editor"),this.replaceTransientDebuggerState()}resetDebug(){this.stopDebug({hidePanel:!1}),this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="debug-console"}disconnect(){this.stopDebug({hidePanel:!0})}setBreakpoints(t){this.session.setBreakpoints("editor",t)}setPanel(t){this.execution.hasExecuted&&(this.ui.openedPanel=t,this.ui.showPanel=!0)}startDebug(){return this.execution.mode="debug",this.execution.phase="debug-running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.session.syncExecutionBreakpointsFromEditor(),this.execution.consoleLogs=[],this.ui.openedPanel="debug-console",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}startRun(){return this.execution.mode="run",this.execution.phase="running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="output",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}stopDebug({hidePanel:t=!0,invalidateSession:e=!0}={}){let s=this.pausedFrame.pausedState?.continue;e&&(this.execution.sessionId+=1),this.execution.phase=this.execution.hasExecuted?"completed":"idle",this.pausedFrame.reset(),this.resetTransientDebuggerState(),t&&(this.ui.showPanel=!1),this.ui.openedPanel==="debug-console"&&(this.ui.openedPanel="output"),s?.resolve()}syncPausedState(t,e){this.lazyTreeState.reset(),t&&e&&t!==e&&this.previewTabsState.invalidateAll(),this.pausedLine=e?.line}toggleBreakpoint(t){this.session.toggleBreakpoint("editor",t)}togglePanel(t){if(this.execution.hasExecuted){if(t==null){this.ui.showPanel=!this.ui.showPanel;return}if(this.ui.openedPanel===t&&this.ui.showPanel){this.ui.showPanel=!1;return}this.setPanel(t)}}resetTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState.reset(),this.previewTabsState.clear()}replaceTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState=new C,this.previewTabsState=new N}};l([c()],p.prototype,"execution",2);l([c()],p.prototype,"lazyTreeState",2);l([c()],p.prototype,"pausedLine",2);l([c()],p.prototype,"pausedFrame",2);l([c()],p.prototype,"previewTabsState",2);l([c()],p.prototype,"session",2);l([c()],p.prototype,"ui",2);p=l([x("ArcadeDebuggerStore")],p);var Ee={glyphMargin:!0,lineNumbersMinChars:1},z=class extends X{constructor(){super(...arguments),this._codeEditorElt=M(),this._arcadeAssistantElt=M(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new p,this.messages=ee(),this._modelId=Q(),this._openArcadeHelp=()=>{window.open(ne,"Arcade Help")},this._decorations=void 0,this._monacoEditor=Z(ae),this._editorOptions={},this._toggleSidePanel=e=>{e.currentTarget instanceof HTMLElement&&this._setOpenedSidePanel(e.currentTarget.dataset.panelName??"none")},this._closeSidePanel=()=>{this._setOpenedSidePanel("none")},this._updateBreakpointsDecorations=()=>{let e=this.editorInstance;if(!e)return;let s=this._debuggerState.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph"}}));this._decorations?.clear(),this._decorations=e.createDecorationsCollection(s)},this._clearDebuggerDecorations=()=>{this._decorations?.clear(),this._decorations=void 0,this._debuggerPausedLineDecoration?.clear(),this._debuggerPausedLineDecoration=void 0},this._debuggerPausedLineDecoration=void 0,this._preparingArcade=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this._diagnostics=[],this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.disableAssistant=!1,this.arcgisDiagnosticsChange=L({bubbles:!1}),this.arcgisScriptChange=L({bubbles:!1})}static{this.properties={_apiLibrary:16,_editorProfile:16,_preparingArcade:16,_arcadeAssistantRemoteState:16,_diagnostics:16,editorInstance:32,editorOptions:0,enableDebugger:5,hideDocumentationActions:5,hideSideBar:5,messageOverrides:0,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,disableAssistant:5,arcadeAssistant:0,externalExecutor:0}}static{this.styles=[me]}get _usesBottomExecutionDrawer(){return this.enableDebugger&&!!this.testData}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...Ee,...this._editorOptions}}set editorOptions(e){this._editorOptions=e??{}}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let s=this._codeEditorElt.value?.value,i=await U(e.definition,s,this.testData,{mode:"run"});return v(i)?i:{type:"error",value:"Unexpected debug result",error:null}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async openArcadeAssistant(e){if(!this._arcadeAssistantRemoteState.shouldRender)return!1;if(this.openedSidePanel="arcade-assistant",await this.updateComplete,!this._canPromptWithArcadeAssistant())return!0;let s=this._arcadeAssistantElt.value;return e?.prompt&&await s?.openPrompt(e.prompt),!0}async load(){let e=J("./assets");ce(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(u(this)),()=>{for(this._askAiBindingKey&&(D(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);this._disposables.length;)this._disposables.pop()?.dispose();this._abortExternalExecution(),this._connectMonacoCustomizationsPromise=void 0,this._executeScriptAction=void 0,this._clearDebuggerDecorations(),this._debuggerState.disconnect()}))}willUpdate(e){(e.has("messages")||e.has("profile"))&&this._updateDataModelDeps(),e.has("testData")&&this._testDataChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&f.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve(),await this._codeEditorElt.value?.setFocus()}_setOpenedSidePanel(e){this.openedSidePanel=e===this.openedSidePanel?"none":e}async _connectMonacoCustomizations(){if(this._connectMonacoCustomizationsPromise)return await this._connectMonacoCustomizationsPromise;this._connectMonacoCustomizationsPromise=(async()=>{if(!this.isConnected)return;let e=await le();this._disposables.push(e.onDiagnosticsChange(r=>{this._preparingArcade||(this._diagnostics=r.diagnostics,this.arcgisDiagnosticsChange.emit(r.diagnostics))})),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let s=O(()=>this._debuggerState.editorBreakpoints,()=>this._updateBreakpointsDecorations(),{sync:!0}),i=O(()=>this._debuggerState.debuggerLine,()=>this._updateDebuggerPausedLineDecoration(),{sync:!0}),a=O(()=>this._debuggerState.consoleLogs.length,()=>this.requestUpdate(),{sync:!0});this._disposables.push({dispose:()=>s.remove()},{dispose:()=>i.remove()},{dispose:()=>a.remove()});let o=this.editorInstance?.onMouseDown(r=>this._onEditorMouseDown(r));o&&this._disposables.push(o);let n=this.editorInstance?.onDidChangeModelContent(r=>this._onEditorModelContentChange(r));n&&this._disposables.push(n),this._updateBreakpointsDecorations(),this._updateDebuggerPausedLineDecoration()})();try{await this._connectMonacoCustomizationsPromise}finally{this._connectMonacoCustomizationsPromise=void 0}}_onEditorMouseDown(e){if(!this.enableDebugger||![this._monacoEditor.MouseTargetType.GUTTER_GLYPH_MARGIN].includes(e.target.type)||e.target.element?.classList.contains("codicon-gutter-lightbulb"))return;let s=e.target.position?.lineNumber;s&&this._debuggerState.toggleBreakpoint(s)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||e.isFlush)return;let s=te(this._debuggerState.editorBreakpoints,e.changes);s.length===this._debuggerState.editorBreakpoints.length&&s.every((i,a)=>i===this._debuggerState.editorBreakpoints[a])||this._debuggerState.setBreakpoints(s)}_updateDebuggerPausedLineDecoration(){let e=this.editorInstance;if(!e)return;this._debuggerPausedLineDecoration?.clear();let s=this._debuggerState.debuggerLine;s!=null?this._debuggerPausedLineDecoration=e.createDecorationsCollection([{range:new F(s,1,s,1),options:{isWholeLine:!0,className:"arcgis-code-editor__debugger-paused-line",glyphMarginClassName:"arcgis-code-editor__debugger-paused-glyph",marginClassName:"arcgis-code-editor__debugger-paused-line arcgis-code-editor__debugger-paused-margin"}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_abortExternalExecution(){this._externalExecutionAbortController?.abort(),this._externalExecutionAbortController=void 0}_stopDebugSession(){this._abortExternalExecution(),this._debuggerState.stopDebug({hidePanel:!1})}_resetDebugSession(){this._abortExternalExecution(),this._debuggerState.resetDebug(),this._executeScript("debug").catch(u(this))}async _handleDebugPause(e,s,i){if(!this._debuggerState.isDebugging||e!==this._debuggerState.sessionId)return;let a=Promise.withResolvers();return this._debuggerState.pauseDebug({line:s.line,result:i,continue:a}),await a.promise}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _executeWithExternalExecutor(e,s,i){if(!this.externalExecutor)return{type:"error",value:"Missing external executor",error:null};let a=new AbortController;this._abortExternalExecution(),this._externalExecutionAbortController=a;let o=i.console??(()=>{});try{if(e==="debug"){let{breakpoints:n,onDebugPause:r}=i;if(!n||!r)throw new Error("Missing debug execution options");return await this.externalExecutor.execute({mode:"debug",script:s,console:o,signal:a.signal,breakpoints:n,onDebugPause:r})}return await this.externalExecutor.execute({mode:"run",script:s,console:o,signal:a.signal})}catch(n){return{type:"error",value:"Execution failed",error:n instanceof Error?n:new Error(String(n))}}finally{this._externalExecutionAbortController===a&&(this._externalExecutionAbortController=void 0)}}_testDataChanged(){!this.testData&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.showPanel&&this._executeScript("run").catch(u(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await f.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=f.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await f.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e){let s=this.testData;if(!this._codeEditorElt.value||!s)return;let i=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun();setTimeout(()=>{(async()=>{let a=this._codeEditorElt.value?.value??this.script,o={mode:e,console:r=>this._debuggerState.addConsoleLog(r),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(o.onDebugPause=this._handleDebugPause.bind(this,i));let n;if(this.externalExecutor)n=await this._executeWithExternalExecutor(e,a,o);else{let r=await this._editorProfilePromise;if(!r){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}n=await U(r.definition,a,s,o)}if(i===this._debuggerState.sessionId){if(e==="debug"){if(v(n)){this._debuggerState.fail(n);return}this._debuggerState.completeDebug(n);return}v(n)?this._debuggerState.completeRun(n):this.externalExecutor?this._debuggerState.completeRun(n,{useDebugRenderer:!0}):this._debuggerState.fail({type:"error",value:"Unexpected debug result",error:null})}})()},0)}_toggleShowExecutionPanel(){this._debuggerState.togglePanel()}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(u(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(u(this))}_onResultPanelChange(e){let s=e.currentTarget;this._debuggerState.setPanel(s.openedResultPanel)}_onExecutionPanelClose(){this._debuggerState.closePanel()}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[se.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this.testData&&this._executeScript("run").catch(u(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_getAskAiBindingKey(){return ie.parse(this._modelId).toString()}_canRenderAskAiCodeActions(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.codeActions:!1}_canPromptWithArcadeAssistant(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.prompting:!1}_getAskAiCodeActions(e){if(!this._canRenderAskAiCodeActions())return[];if(!e.markers.length)return[];let s=this.messages.askarcadeassistant??"Ask Arcade Assistant",i=this._getAskAiBindingKey();return[{title:s,kind:oe,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:re,title:s,arguments:[i,this.messages.askarcadeassistantprompt??"Fix the errors in my script"]}}]}_syncAskAiAction(){if(!this.editorInstance)return;let e=this._getAskAiBindingKey();if(!this._arcadeAssistantRemoteState.shouldRender){this._askAiBindingKey&&(D(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&D(this._askAiBindingKey,void 0),D(e,{provideCodeActions:({context:s})=>this._getAskAiCodeActions(s),run:s=>{this.openArcadeAssistant({prompt:s??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(u(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await fe(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this.enableDebugger||!this.testData?null:d`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${()=>{this._executeScript("run").catch(u(this))}}></calcite-action>${this._debuggerState.result?d`<calcite-action .text=${this.messages.lastresults??""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`}renderMainPanel(){return d`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${f.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${T(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:s,icon:i,active:a,panelName:o,iconFlipRtl:n=!1,onClick:r=this._toggleSidePanel}){return d`<calcite-action id=${e??I} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${r} data-panel-name=${o??I} .iconFlipRtl=${n}></calcite-action>${!this.sideActionBarExpanded&&d`<calcite-tooltip .referenceElement=${e}><span>${s}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:d`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e,_arcadeAssistantRemoteState:s}=this;return d`<arcgis-language-api-panel slot=side-panel class=${P(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${P(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty}}></arcgis-editor-variables>${this.suggestions?.length&&d`<arcgis-arcade-suggestions slot=side-panel class=${P(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${s?.shouldRender&&d`<arcgis-arcade-coding-assistant slot=side-panel class=${P(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${s.portalUrl} .serviceUrl=${"serviceUrl"in s?s.serviceUrl:void 0} .helpBase=${s.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${s.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant?.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant?.disableQuestionAnswerLogging} .diagnostics=${this._diagnostics} ${T(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(i=>d`<calcite-flow slot=side-panel class=${P(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):d`<calcite-flow-item .heading=${i.name} heading-level=2 closable .closed=${e!==i.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${i.description}>${i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){if(this._usesBottomExecutionDrawer)return this.renderBottomExecutionBody();if(!this._debuggerState.showPanel)return null;let e=this._debuggerState.openedPanel==="debug-console"?"output":this._debuggerState.openedPanel;return d`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:s,debugResult:i,isExecuting:a,mode:o}=this._debuggerState;return e?s==="debug-console"?d`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:s==="output"&&(o==="debug"||i)?d`<arcgis-arcade-debugger-output slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:d`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${s} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`:null}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:o,isExecuting:n}=this._debuggerState,r=this.messages.continue??"Continue",S=this.messages.reset??"Reset",A=this.messages.stop??"Stop";return d`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-disabled><calcite-action-group scale=s>${a?d`<calcite-action id=debugger-continue-action .text=${r} icon=forward scale=s .disabled=${!o} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${r}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${S} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${S}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${A} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${A}</span></calcite-tooltip>`:d`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(u(this))}}></calcite-action><calcite-action .disabled=${this._debuggerState.editorBreakpoints.length===0} .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("debug").catch(u(this))}}></calcite-action>`}</calcite-action-group>${s?d`<calcite-action-group scale=s><calcite-action .active=${i==="output"&&e} .text=${this.messages.output??"Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${()=>this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i==="console"&&e} .text=${this.messages.console??"Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${()=>this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i==="log"&&e} .text=${this.messages.log??"Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${()=>this._setExecutionPanel("log")} .disabled=${this.enableDebugger&&this._debuggerState.mode==="debug"}></calcite-action><calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script icon-flip-rtl .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action></calcite-action-group>`:null}</calcite-action-bar>${e?d`<calcite-action class="bottom-action-bar__close" .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose}></calcite-action>`:null}</div>`}render(){return d`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};Y("arcgis-arcade-editor",z);return z},"config","identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,e,f,g)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./STN3LSQR.js";import{a as _}from"./DBVA54U6.js";import"./EHMFQPTC.js";import"./NP37C536.js";import{d as u,g as p}from"./XSKI5PRU.js";import{F as f,G as g,K as b,h as d,j as i,n as r,r as m}from"./XU7YAUUX.js";import{a as h}from"./VGOFAQ7A.js";import"./H6RQVSYM.js";export default $arcgis.t(([{C:o,D:n,E:v,F:w}])=>{var $=d`: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-list-item-group{background-color:var(--calcite-color-foreground-2);word-break:break-word}}`;function I(l){l.key==="Enter"&&l.stopPropagation()}var c=class extends g{constructor(){super(...arguments),this._beforeBack=async()=>{this.removeLastPanelRenderer(),this._filterValue=""},this.messages=_(),this._filterValue="",this._flowItemRenderers=[],this._rootPresentation="profile",this._mutationCounter=1,this.loading=!1,this.closed=!1,this.hideDescriptions=!1,this.arcgisInternalClosePanel=r({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=r({bubbles:!1})}static{this.properties={_filterValue:16,_flowItemRenderers:16,_rootPresentation:16,_mutationCounter:16,loading:5,modelId:1,closed:5,variable:0,heading:1,hideDescriptions:5,messageOverrides:0}}static{this.styles=$}load(){this._variableChanged()}willUpdate(e){e.has("modelId")&&(this._flowItemRenderers=[]),e.has("variable")&&this._variableChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}_variableChanged(){if(!this.variable||o(this.variable)){this._rootPresentation="profile";return}this._rootPresentation=this.variable.type==="featureSet"?"featureSetRoot":"collectionRoot"}addPanelRenderer(e){this._flowItemRenderers=[...this._flowItemRenderers,e]}removeLastPanelRenderer(){this._flowItemRenderers=this._flowItemRenderers.slice(0,-1)}_isRootPresentation(e){return this._rootPresentation===e}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{p(u(e.querySelector("calcite-flow-item:last-child")??e,"calcite-input"))}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget.value}_emitClose(){this.arcgisInternalClosePanel.emit()}_backToTop(){this._flowItemRenderers=[]}_emitItemSelected(e,t){if(t.nonInteractive)return;let s=e;(!s.key||s.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.snippet))}_showCollectionPanel(e,t){e.stopPropagation(),this.addPanelRenderer(s=>this.renderCollectionBasedVariable(t,!1,s))}_getHeadingForCollection(e,t=!1){if(!e)return"";if(t){if(this.heading)return this.heading;if(o(this.variable))return this.variable.definition?.label??this.messages.profilevariables??"Profile variables";if(this._isRootPresentation("featureSetRoot"))return this.messages.fields??"Fields";if(this._isRootPresentation("collectionRoot"))return this.messages.tables??"Tables"}return n(e)||w(e)?this.messages.fields??"Fields":this.messages.profilevariables??"Profile variables"}_getDescriptionForCollection(e){return e?n(e)?e.variables[0]?.getLabel()??"":v(e)?e.datastoreInfo?.name??e.getDescription()??"":e.breadcrumb:""}_getItemLabel(e){return e.getLabel()}_getItemDescription(e){return this.hideDescriptions?"":e.getDescription()}renderCollectionBasedVariable(e,t=!1,s=!1){if(!e)return null;let a=this.loading;return!a&&!e.loaded&&(e.loadSource().then(()=>setTimeout(()=>{this._mutationCounter+=1})).catch(()=>{h("error",this,"Error loading collection"),a=!1}),a=!0),i`<calcite-flow-item heading-level=2 .heading=${this._getHeadingForCollection(e,t)} .description=${this._getDescriptionForCollection(e)} .beforeBack=${this._beforeBack} closable @calciteFlowItemClose=${this._emitClose} .selected=${s}><calcite-action slot=header-actions-end .text=${this.messages.backtotop??""} scale=m .hidden=${t||this._isRootPresentation("featureSetRoot")} icon=chevrons-left icon-flip-rtl @click=${this._backToTop}></calcite-action><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m .label=${this.messages.filterthevariablesbyname??""} name=variable-filter></calcite-input>${a?i`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??""}></calcite-loader>`:i`<calcite-list .label=${this.messages.profilevariables??"Profile variables"}>${this.renderEditorVariables(e)}</calcite-list>`}</calcite-flow-item>`}renderEditorVariables(e){let t=m(this._filterValue),s=e.variables.filter(a=>a.passFilter(t));return s.length?s.map(a=>this.renderEditorVariable(a)):i`<div class="notice-container">${this.messages.noitems}</div>`}renderEditorVariable(e){return e.type==="group"?this._isRootPresentation("featureSetRoot")&&e.isHeader?i`<calcite-list-item-group .heading=${this._getItemLabel(e)}></calcite-list-item-group>`:this._isRootPresentation("featureSetRoot")&&e._label?.code==="fields"?this.renderEditorVariables(e):i`<calcite-list-item-group .heading=${this._getItemLabel(e)}>${this.renderEditorVariables(e)}</calcite-list-item-group>`:i`<calcite-list-item .label=${this._getItemLabel(e)} .description=${this._getItemDescription(e)} @calciteListItemSelect=${t=>this._emitItemSelected(t,e)} @keydown=${t=>this._emitItemSelected(t,e)}>${e.isCollection?i`<calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${t=>this._showCollectionPanel(t,e)} @keydown=${I}></calcite-action>`:null}${e.icon?i`<calcite-icon .icon=${e.icon} scale=s slot=content-start></calcite-icon>`:null}</calcite-list-item>`}render(){return this.closed?null:this.loading&&!this.variable?i`<calcite-flow><calcite-flow-item heading-level=2 .heading=${this.heading??this.messages.profilevariables} closable @calciteFlowItemClose=${this._emitClose}><calcite-loader scale=s type=indeterminate .label=${this.messages.loading??""}></calcite-loader></calcite-flow-item></calcite-flow>`:!this.loading&&(!this.variable||this.variable?.loaded&&!this.variable?.variables.length)?i`<calcite-flow><calcite-flow-item heading-level=2 .heading=${this.heading??this.messages.profilevariables} closable @calciteFlowItemClose=${this._emitClose}><div class="notice-container">${this.messages.profileempty}</div></calcite-flow-item></calcite-flow>`:i`<calcite-flow ${f(this.flowFocusHandler)}>${this.renderCollectionBasedVariable(this.variable,!0,this._flowItemRenderers.length===0)}${this._flowItemRenderers.map((e,t,s)=>e(t===s.length-1))}</calcite-flow>`}};b("arcgis-editor-variables",c);return c},a)
@@ -0,0 +1,12 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./STN3LSQR.js";import{b as Se}from"./3PBQ47BB.js";import{b as M,c as $,d as V,e as De}from"./OLNYBWUC.js";import{a as ve}from"./P37AQWGL.js";import{a as R,b as Fe,c as k,d as g,e as w}from"./MZMKV7FA.js";import{d as oe}from"./NP37C536.js";import{L as ae,s as se,u as A}from"./XU7YAUUX.js";import{a as h}from"./VGOFAQ7A.js";import{Qk as W,Zk as z}from"./TEXAGKBD.js";export default $arcgis.t(([Le,Ae,Ue,H,{getDeclaredVoxelMembers:Ne,getDeclaredPixelMembers:qe},Oe,Ge,{A:O,B:b,F:ge,H:G,I:we,a:U,b:ne,c:le,d:pe,e:ce,k:N,l:x,m:he,o:u,p:ue,q:de,r:P,s:q,t:y,u:fe,v:_e,w:me,y:ye,z:be}])=>{var D=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 K=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(B(this._datastoreUrl,"datasets"),this._createRequestOptions(e))).datasets}async fetchTableDescription(e,t){if(!e)throw new Oe("portal:invalid-parameter",'The "tableName" parameter must be provided.');let i=await this.portal.request(B(this._datastoreUrl,"tableDescription"),{...this._createRequestOptions(t),query:{...Ce(this._requestOptions),...Ce(t),tableName:e}});return ke(i)}get _datastoreUrl(){return B(this.serviceUrl,"datastores",encodeURIComponent(this.itemId))}_createRequestOptions(e){return{...this._requestOptions,...e}}};function B(s,...e){let t=s.replaceAll(/\/+$/gu,""),i=e.filter(r=>!!r).map(r=>r.replaceAll(/^\/+|\/+$/gu,""));return[t,...i].join("/")}var We={id:"ansi",keywords:[],functions:[],operators:[],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:null,end:null},escapeClause:{keyword:"ESCAPE",suffix:null}}},Ie=new Map,ze={ansi:async()=>await Promise.resolve(We),bigquery:async()=>(await import("./XG3S7JQW.js")).bigqueryDialect,postgres:async()=>(await import("./U2T7AGOO.js")).postgresDialect,sqlServer:async()=>(await import("./UZD32YRD.js")).sqlServerDialect};async function Be(s){let e=Ie.get(s);if(e)return await e;let t=ze[s]();return Ie.set(s,t),await t}var He=["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"],Ke=["<=",">=","<>","!=","=","<",">","+","-","*","/","%","||"],je=(s,e={})=>{let t=new Set(e.baseKeywords??He);for(let r of s.keywords)t.add(r.toUpperCase());let i=new Set(e.baseOperators??Ke);for(let r of s.operators)i.add(r);return{keywords:Array.from(t),functions:s.functions,operators:Array.from(i),specialChars:s.specialChars}},S={sqlServer:"sql-layer-sql-server",postgres:"sql-layer-postgres",bigquery:"sql-layer-bigquery"},Te=S.postgres,Qe={[S.sqlServer]:"sqlServer",[S.postgres]:"postgres",[S.bigquery]:"bigquery"};function Je(s){return Qe[s]}async function Ze(s){return je(await Be(Je(s)))}var Xe=/^[A-Za-z_][A-Za-z0-9_$]*$/u;function Ye(s){return s==="esriDBMS_PostgreSQL"?Te:s==="esriDBMS_SQLServer"?S.sqlServer:Te}function xt(s){return s.trim().toLowerCase()}function et(s){return s.specialChars.identifierQuote}function tt(s,e){let t=s.trim();return t?Xe.test(t)?e.keywords.includes(t.toUpperCase()):!0:!1}function Ve(s,e){let t=s.trim();if(!t||!tt(t,e))return t;let i=et(e),r=t.replaceAll(i.end,`${i.end}${i.end}`);return`${i.start}${r}${i.end}`}function it(s,e){return s.split(".").map(t=>Ve(t,e)).join(".")}function Pt(s){return s.split(".").at(-1)??s}function rt(s){return Ze(Ye(s))}async function st(s,e){let t=new H({url:`${s.url}/${e.relatedTableId}`});return await t.load(),t}function te(s){return(e,t)=>{if(e.type==="oid")return-1;if(t.type==="oid")return 1;if(y(s)){if(e.name===s.subtypeField)return-1;if(t.name===s.subtypeField)return 1}if(P(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 xe(s,e){return s?.every(t=>t.domains?.[e.name]?.type==="inherited")??!1}var at=/^[a-z_$][a-z0-9_$]*$/giu;function ie(s,e=!0){return s.match(at)?`${e?".":""}${s}`:`["${s}"]`}function Ee(s,e){return s?`${s}${ie(e)}`:e}function Pe(s){return _e(s)?s.portalItem:null}function ot(s,e){return e?s?.nullable??"nullable":s?.notnull??"not nullable"}function Mt(s,e,t){let{includeAliases:i=!1,supportGeometryFields:r=!1}=t??{},a=e,n=[],f=[];return g(s,{supportGeometry:r}).forEach(o=>{a&&(a+=`
3
+
4
+ `),a+=`**${o.name}** (${o.alias})
5
+ ${o.type}`,o.description&&(a+=`
6
+ '${o.description}`);let c=k(o,{supportGeometryFields:r}),T=ie(o.name,!1),m=w(o);if(n.push({name:o.name,description:m,type:c,completion:{label:o.name,detail:m,insertText:T,insertTextMode:V.asIs,insertTextFormat:$.PlainText,kind:M.Field}}),i){if(!o.alias||o.alias.toLowerCase()===o.name.toLowerCase())return;let re=`**${o.alias}**
7
+ ${o.type}`;o.description&&(re+=`
8
+ '${o.description}`),f.push({name:o.alias,description:o.name,type:c,completion:{label:o.alias,detail:o.name,insertText:T,insertTextMode:V.asIs,insertTextFormat:$.PlainText,kind:M.Field,documentation:{kind:"markdown",value:re}}})}}),[[...n,...f],a]}function $t(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:ie(r.name,!1),insertTextMode:V.asIs,insertTextFormat:$.PlainText,kind:M.Field}})}),[i,t]}var E=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"?se(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())}},F=class extends E{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}},l=class extends F{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}}},j=class extends F{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 F{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""}},p=class extends E{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 p(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=Ee(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 l({profile:this._profile,declaration:e,label:t,snippet:t});case"pixel":return new Z(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"voxel":return new J(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"feature":return new Q(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"featureSet":return new I(this,{profile:this._profile,declaration:e,label:t,snippet:t},[new l({profile:this._profile,label:t,description:"",snippet:t})]);case"featureSetCollection":return new X(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 j({profile:this._profile,declaration:e,label:t,snippet:t});case"dataCatalogDatastore":return new Y(this,{profile:this._profile,declaration:e,label:t,snippet:t});default:return h("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())}}},L=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 ue(this._source)?this._source.url??"":""}get informationUrl(){return!this.loaded||!this.url?null:de(this._source)?`${this.url}/${this._source.layerId}`:this.url}get informationType(){return this._profile?.intlStrings.layer??"layer"}async loadSource(){return _(this._loadPromise)&&D(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}_getValueSnippet(e){return["feature","voxel","pixel"].includes(this.type)?Ee(this.snippet,e.name):e.name}_getSubtypeOrDomainNameSnippet(e){return this.type!=="feature"?null:y(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 l({profile:this._profile,label:r,description:w(e),snippet:r,icon:R(e,t),filterDescription:!0})}_getMemberProperty(e){let t=this._getValueSnippet(e);return new l({profile:this._profile,label:t,description:e.name,snippet:t,icon:Fe(e),filterDescription:!0})}_getDomainDictionary(e){return q(this._source)?y(this._source)&&this._source.subtypeField?this._getSubtypeDomainDictionary(e):P(this._source)&&this._source.typeIdField?this._getFeatureTypeDomainDictionary(e):this._getFieldDomainDictionary(e):null}_getSubtypeDomainDictionary(e){if(!y(this._source))return null;if(!fe(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(xe(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(!P(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(xe(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(!q(this._source))return null;let t=this._source.getFieldDomain(e.name);if(!x(t))return null;let i=this._getCodedValueDomainGroup(t,{code:"domainvalues"}),r=this._createDomainDictionary(e);return r.variables.push(i),r}_getTypeOrSubtypeDomainGroup(e,t){if(x(t.domain))return this._getCodedValueDomainGroup(t.domain,{code:"subtypes"});let i=e?.map(r=>{let a=N(r)?r.code:r.id;return new l({profile:this._profile,label:`${a}`,description:r.name,snippet:`"${a}"`})})??[];return new p(this._profile,{code:"subtypes"},i)}_getCodedValueDomainGroup(e,t){let i=e.codedValues.map(r=>new l({profile:this._profile,label:`${r.code}`,description:r.name,snippet:`"${r.code}"`,filterDescription:!0}));return new p(this._profile,t,i)}_getDomainValuesGroup(e,t){let i=[];return!e||e.length===0||(e.forEach(r=>{let a=r.domains?.[t.name];if(!a||he(a)||!x(a))return;let n=w(t),f=this._getCodedValueDomainGroup(a,{code:"domainvaluesfortypeformat",formatValues:{fieldName:n,typeName:r.name}}),o=N(r)?r.code:r.id,c=`${o}`,T=`"${o}""`,m=new v(this,{profile:this._profile,label:c,snippet:T,description:r.name,declaration:{name:n}});m.variables=[f],i.push(m)}),!i.length)?null:new p(this._profile,{code:"domainvaluesbysubtypes"},i)}_createDomainDictionary(e){let t=this._getValueSnippet(e),i=w(e),r=new v(this,{profile:this._profile,label:t,description:i,snippet:t,icon:"form-dropdown",declaration:{name:e.name}}),a=new p(this._profile,i,[new l({profile:this._profile,label:t,description:"",snippet:t})]);r.variables=[a];let n=this._getSubtypeOrDomainNameSnippet(e);return n&&a.variables.push(new l({profile:this._profile,label:n,description:"",snippet:n})),r}async _getRelationshipsProperty(){if(!this.relationshipsProperties?.exposeRelationships||!this._profile?.supportFeatureSetFunctions)return null;let e=this._source;if(!me(e))return null;let t=new p(this._profile,{code:"relationships"}),i=await Promise.all(e.relationships?.map(async r=>{let a=await st(e,r);if(!U(a)||r.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;let n=`FeatureSetByRelationshipName(${this.snippet}, "${r.name}")`;return new I(this,{profile:this._profile,declaration:{definition:a},label:a.title,description:"",nonInteractive:!0},[new l({profile:this._profile,label:n,description:"",snippet:n})],{exposeRelationships:!0,sourceTableId:e.layerId})})??[]);return t.variables=i.filter(_),t.variables.length?t:null}},C=class extends L{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}}},Q=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 G(this._definition),!this._source)throw new Error("Invalid definition");let e=u(this._source)?this._source.title??"":"";this.variables.push(new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new p(this._profile,{code:"values"});if(this.variables.push(t),ye(this._source)){let a=`Geometry(${this.snippet})`,n=new l({profile:this._profile,declaration:{name:a},label:a,description:"Geometry",snippet:a,icon:"shapes",filterDescription:!0});t.variables.push(n)}let i=this._source;g(this._source.fields).map(a=>i.fields.find(n=>n.name===a.name)).sort(te(i)).forEach(a=>{t.variables.push(this._getFieldProperty(a))});let r=await this._getRelationshipsProperty();r&&this.variables.push(r)}catch(e){h("error","FeatureVariable","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,"voxel",{exposeRelationships:!1}),this.type="voxel",this._source=null}async _loadSource(){if(this.loaded)return this._source;try{if(!be(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 p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new p(this._profile,{code:"values"});this.variables.push(t);let i=await Ne(this._source),r=this._source;g(this._source.fields).map(a=>r.fields.find(n=>n.name===a.name)).sort(te(r)).forEach(a=>{t.variables.push(this._getFieldProperty(a,i))})}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},Z=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(!O(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 p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new p(this._profile,{code:"values"});if(this.variables.push(t),!O(this._source))throw new Error("Invalid definition - not an ImageryLayer");(await qe(this._source)).forEach(i=>{t.variables.push(this._getMemberProperty(i))})}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},I=class extends L{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 G(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new p(this._profile,this.title,this.featureSetSnippets,!0));let e=new p(this._profile,{code:"fields"});this.variables.push(e);let t=this._profile?.policy,i=t&&"allowGeometryFields"in t?t.allowGeometryFields??!1:!1;e.variables=g(this._source.fields,{supportGeometry:i}).sort(te(this._source)).map(a=>this._getFieldProperty(a));let r=await this._getRelationshipsProperty();r&&this.variables.push(r)}catch(e){h("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}}},X=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"?Se(Pe(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)&&D(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:Pe(this._featureSetCollections.source)?.title||"Untitled map"}},t=new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),i=new p(this._profile,{code:"layers"},this._featureSetCollections.layers),r=new p(this._profile,{code:"tables"},this._featureSetCollections.tables);this.variables.push(t,i,r)}catch(e){h("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):ce(this._definition)?await this._featureSetCollectionFromUrl(this._definition.url):pe(this._definition)?await this._featureSetCollectionFromPortalItem(this._definition.portalItem):null:null}async _featureSetCollectionFromMap(e){le(e)&&await e.loadAll(),await Promise.all(e.allTables.map(async r=>await r.load()));let t=this._profile?.policy,i=t&&"filterFsCollectionLayersFromMap"in t&&t.filterFsCollectionLayersFromMap?t.filterFsCollectionLayersFromMap:()=>!0;return{layers:this._convertWebMapLayersToVariables(e.allLayers.filter(i)),tables:this._convertWebMapLayersToVariables(e.allTables),source:e}}async _featureSetCollectionFromPortalItem(e){let t=new Le(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 Ue({portalItem:t});return await this._featureSetCollectionFromMap(i)}case"Feature Service":return await this._featureSetCollectionFromUrl(t.url);default:return h("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 we(t),r=Promise.all(i.layers.map(async o=>{let c=new H({url:`${t}/${o.id}`});return await c.load(),this._createFeatureSetVariable(c)})),a=Promise.all(i.tables.map(async o=>{let c=new H({url:`${t}/${o.id}`});return await c.load(),this._createFeatureSetVariable(c)})),[n,f]=await Promise.all([r,a]);return{layers:n,tables:f,source:t}}_convertWebMapLayersToVariables(e){let t=[];return e.toArray().reverse().forEach(i=>{if(U(i)){t.push(this._createFeatureSetVariable(i,!0));return}}),t}_createFeatureSetVariable(e,t=!1){return new I(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 l({profile:this._profile,label:i,description:"",snippet:i}),new l({profile:this._profile,label:r,description:"",snippet:r})]}else{let i=`FeatureSetById(${this.snippet}, "${e.layerId}")`;return[new l({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}},Y=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 b(e)?e:this._serializeDefinitionFromInstance(e);if(b(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)&&D(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");b(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 rt(t.databasePlatform),a=i.map(n=>new ee(this,{profile:this._profile,declaration:{name:n.name},label:n.name,description:n.type,snippet:it(n.name,r)},e,n,r));this.variables=a,this._datastore={tables:a,source:b(this._definition)?this._definition:e,info:t}}catch(e){h("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(ge)}async _dataCatalogDatastoreFromDefinition(e){let t=new Ge({url:e.portal.url});return await t.load(),new K({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}:{}}}},ee=class extends d{constructor(e,t,i,r,a){super(e,t),this._catalogDatastore=i,this.datasetInfo=r,this._dialectSpec=a,this.type="dictionary",this._fieldInfos=[],this._loaded=!1}get fieldInfos(){return this._fieldInfos}async loadSource(){return _(this._loadPromise)&&D(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 l({profile:this._profile,declaration:{type:k(i,{supportGeometryFields:!0})},label:t.name,description:[t.serverType,ot(this._profile?.intlStrings,t.nullable)].filter(Boolean).join(" | "),snippet:Ve(t.name,this._dialectSpec),icon:R(i),filterDescription:!0})})}catch(e){h("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}}},Me=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())}}},nt={locale:"en"},$e=class{constructor(e,t){this.languageId=e,this._apiConfig=t,this._onDidChange=new W,this._modelToProfileMap=new Map,this._modelToApiContextMap=new Map,this._localeToApiLibraryPromiseMap=new Map,this._onModelContextDidChange=new W,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 z.isUri(e)||(e=z.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))??nt}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 De(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=ae(`${t}/${i}${e}.json`),a=await fetch(r);return a.ok?await a.json():[]}catch{return[]}}async getApiLibrary(e){let t=oe(e);return this._localeToApiLibraryPromiseMap.has(t)||this._localeToApiLibraryPromiseMap.set(t,this.fetchApiLibrary(t)),await this._localeToApiLibraryPromiseMap.get(t)??[]}};return{a:K,b:S,c:Te,d:Je,e:Ze,f:Ye,g:xt,h:Ve,i:it,j:Pt,k:ie,l:Mt,m:$t,n:Y,o:Me,p:$e}},"portal/PortalItem","WebMap","WebScene","layers/FeatureLayer","applications/Components/arcadeEditorUtils","core/Error","portal/Portal",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as O,c as u,d as k}from"./5A4VZ22T.js";import i from"./IETP57KJ.js";import h from"./RO6RHW6I.js";import e from"./Q2EZ6DGG.js";import d from"./CQTJWVFM.js";import c from"./RMVHO2AH.js";import a from"./STN3LSQR.js";import"./3PBQ47BB.js";import"./OLNYBWUC.js";import{a as N}from"./P37AQWGL.js";import"./5HKDO4SX.js";import"./ZTCCL565.js";import{a as E}from"./CC4XBW6V.js";import"./TQDN6SR5.js";import{a as S,c as T,e as w}from"./XSKI5PRU.js";import{a as C}from"./ECNI2A4K.js";import"./XRUKVCVF.js";import{G as v,K as b,L as y,h as g,i as f,j as n}from"./XU7YAUUX.js";import{b as _}from"./VGOFAQ7A.js";import"./257WOXQH.js";import"./R2XZZWNP.js";import"./QTLHVR4Y.js";import"./TEXAGKBD.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,{a:L},,{b:c,d:m}])=>{var x=Symbol(),l=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??M,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let r=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(d){r=!0,s=d}if(this.p===i){if(e===x)this.i=0;else{if(r===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},M=(h,t)=>h===t||h.length===t.length&&h.every(((e,s)=>!f(e,t[s])));var $=g`:host{display:block}.arcgis-code-viewer-container{display:flex;align-items:stretch;background-color:var(--calcite-color-foreground-2)}.arcgis-code-viewer__gutter{display:flex;min-width:var(--calcite-spacing-md);padding:0 var(--calcite-spacing-xs) 0 var(--calcite-spacing-sm);border-inline-end:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-3);font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code);user-select:none;justify-items:center;font-variant-numeric:tabular-nums}.arcgis-code-viewer__line-number{display:flex;align-items:center}pre.arcgis-code-viewer{display:flex;direction:ltr;overflow-x:auto;margin:0;padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){.arcgis-code-viewer-container{border-radius:var(--calcite-corner-radius-round)}}`,p=class extends v{constructor(){super(...arguments),this._monacoEditor=E(N),this.#e=Promise.withResolvers(),this.#t="",this._slotContentObservers=[],this._onDefaultSlotChange=async t=>{S(t)||(this._codeFromSlot="");let e=t.target instanceof HTMLSlotElement?t.target:null,s=e?this._computeSlotText(e):"";e&&this._observeAssignedSlotNodes(e),s!==this._codeFromSlot&&(this._codeFromSlot=s),this.#e.resolve()},this._colorizeTask=new l(this,{task:async([t,e],{signal:s})=>{if(await this.#e.promise,s.aborted)return this.#t;if(await c(e),s.aborted)return this.#t;let i=await O(t,e);return s.aborted?this.#t:(this.#t=i,i)},args:()=>[this._codeFromSlot,this.language]}),this._codeFromSlot="",this.language="arcade",this.round=!1,this.lineNumbers="off"}static{this.properties={_codeFromSlot:16,language:1,round:7,lineNumbers:1}}static{this.styles=$}#e;#t;async load(){L(y("./assets")),await m(this.language),await c(this.language),this._applyColorizeStyles(u()),this.manager.onLifecycle(()=>(this._themeObserver=T(this.el,["class"],()=>this.updateTheme()),this._themeChangedListener=k(()=>{this._applyColorizeStyles(u())}),this.updateTheme(),()=>{this._themeObserver?.(),this._themeObserver=void 0,this._themeChangedListener?.dispose(),this._themeChangedListener=void 0}))}loaded(){this.el.hasChildNodes()||this.#e.resolve()}willUpdate(t){t.has("language")&&m(this.language).then(()=>c(this.language)).catch(_(this))}disconnectedCallback(){super.disconnectedCallback(),this._disposeSlotObservers()}_disposeSlotObservers(){this._slotContentObservers.length&&(this._slotContentObservers.forEach(t=>t.disconnect()),this._slotContentObservers=[])}_observeAssignedSlotNodes(t){this._disposeSlotObservers();let e=t.assignedNodes({flatten:!0});if(!e.length)return;let s=new Set;for(let o of e)o.nodeType===Node.ELEMENT_NODE?s.add(o):o.nodeType===Node.TEXT_NODE&&o.parentElement&&s.add(o.parentElement);let i={characterData:!0,childList:!0,subtree:!0},r=C(()=>{let o=this._computeSlotText(t);o!==this._codeFromSlot&&(this._codeFromSlot=o)},100),d=o=>{if(o.some(a=>a.type==="childList")){let a=this._computeSlotText(t);a!==this._codeFromSlot&&(this._codeFromSlot=a);return}r()};s.forEach(o=>{let a=new MutationObserver(d);a.observe(o,i),this._slotContentObservers.push(a)})}_computeSlotText(t){let e=t.assignedNodes({flatten:!0}).filter(s=>s.nodeType!==Node.COMMENT_NODE);if(this.language==="html"&&e.length){let s=e.find(r=>r.nodeType===Node.ELEMENT_NODE&&r.tagName==="TEMPLATE");if(s)return(s.innerHTML??"").trim();let i=e.map(r=>r.nodeType===Node.ELEMENT_NODE?r.outerHTML:r.nodeType===Node.TEXT_NODE?r.textContent??"":"").join("").trim();return i}return e.map(s=>s.textContent??"").join("").trim()}updateTheme(){let t=w(this.el)==="light"?"vs":"vs-dark";t!==this._currentTheme&&(this._currentTheme=t,this._monacoEditor.setTheme(t))}_applyColorizeStyles(t){if(!this._colorizeSheet){this._colorizeSheet=new CSSStyleSheet;let e=this.renderRoot;e.adoptedStyleSheets=[...e.adoptedStyleSheets,this._colorizeSheet]}this._colorizeSheet.replaceSync(t)}_showLineNumbers(){return typeof this.lineNumbers=="function"||this.lineNumbers==="on"}_getLineNumberLabel(t){return typeof this.lineNumbers=="function"?this.lineNumbers(t):`${t}`}_getRenderedLineNumbers(){if(!this._showLineNumbers())return[];let t=Math.max(this._codeFromSlot.split(/\r\n|\r|\n/u).length,1);return Array.from({length:t},(e,s)=>this._getLineNumberLabel(s+1))}render(){let t=this._getRenderedLineNumbers();return n`<div class=${`arcgis-code-viewer-container${t.length?" arcgis-code-viewer-container--with-line-numbers":""}`}><slot @slotchange=${this._onDefaultSlotChange} style="display:none" aria-hidden=true></slot>${t.length?n`<div class="arcgis-code-viewer__gutter" aria-hidden=true>${t.map(e=>n`<span class="arcgis-code-viewer__line-number">${e}</span>`)}</div>`:null}<pre class="arcgis-code-viewer" aria-label=${`${this.language} code snippet`}>${this._colorizeTask.render({error:()=>null,pending:()=>n`<code class=${`language-${this.language}`}></code>`,complete:e=>n`<code class=${`language-${this.language}`} .innerHTML=${e??""}></code>`})}</pre></div>`}};b("arcgis-code-viewer",p);return p},a,c,d,e,h,i)
2
+ import{a as O,c as u,d as k}from"./5A4VZ22T.js";import i from"./VVAIS3PR.js";import h from"./MQ6ZAZZK.js";import e from"./Q2EZ6DGG.js";import d from"./UCJZGGBB.js";import c from"./4XMC5J5W.js";import a from"./STN3LSQR.js";import"./3PBQ47BB.js";import"./OLNYBWUC.js";import{a as N}from"./P37AQWGL.js";import"./5HKDO4SX.js";import"./MZMKV7FA.js";import{a as E}from"./EHMFQPTC.js";import"./NP37C536.js";import{a as S,c as T,e as w}from"./XSKI5PRU.js";import{a as C}from"./ECNI2A4K.js";import"./XRUKVCVF.js";import{G as v,K as b,L as y,h as g,i as f,j as n}from"./XU7YAUUX.js";import{b as _}from"./VGOFAQ7A.js";import"./257WOXQH.js";import"./R2XZZWNP.js";import"./QTLHVR4Y.js";import"./TEXAGKBD.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,{a:L},,{b:c,d:m}])=>{var x=Symbol(),l=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??M,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let r=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(d){r=!0,s=d}if(this.p===i){if(e===x)this.i=0;else{if(r===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},M=(h,t)=>h===t||h.length===t.length&&h.every(((e,s)=>!f(e,t[s])));var $=g`:host{display:block}.arcgis-code-viewer-container{display:flex;align-items:stretch;background-color:var(--calcite-color-foreground-2)}.arcgis-code-viewer__gutter{display:flex;min-width:var(--calcite-spacing-md);padding:0 var(--calcite-spacing-xs) 0 var(--calcite-spacing-sm);border-inline-end:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-3);font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code);user-select:none;justify-items:center;font-variant-numeric:tabular-nums}.arcgis-code-viewer__line-number{display:flex;align-items:center}pre.arcgis-code-viewer{display:flex;direction:ltr;overflow-x:auto;margin:0;padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){.arcgis-code-viewer-container{border-radius:var(--calcite-corner-radius-round)}}`,p=class extends v{constructor(){super(...arguments),this._monacoEditor=E(N),this.#e=Promise.withResolvers(),this.#t="",this._slotContentObservers=[],this._onDefaultSlotChange=async t=>{S(t)||(this._codeFromSlot="");let e=t.target instanceof HTMLSlotElement?t.target:null,s=e?this._computeSlotText(e):"";e&&this._observeAssignedSlotNodes(e),s!==this._codeFromSlot&&(this._codeFromSlot=s),this.#e.resolve()},this._colorizeTask=new l(this,{task:async([t,e],{signal:s})=>{if(await this.#e.promise,s.aborted)return this.#t;if(await c(e),s.aborted)return this.#t;let i=await O(t,e);return s.aborted?this.#t:(this.#t=i,i)},args:()=>[this._codeFromSlot,this.language]}),this._codeFromSlot="",this.language="arcade",this.round=!1,this.lineNumbers="off"}static{this.properties={_codeFromSlot:16,language:1,round:7,lineNumbers:1}}static{this.styles=$}#e;#t;async load(){L(y("./assets")),await m(this.language),await c(this.language),this._applyColorizeStyles(u()),this.manager.onLifecycle(()=>(this._themeObserver=T(this.el,["class"],()=>this.updateTheme()),this._themeChangedListener=k(()=>{this._applyColorizeStyles(u())}),this.updateTheme(),()=>{this._themeObserver?.(),this._themeObserver=void 0,this._themeChangedListener?.dispose(),this._themeChangedListener=void 0}))}loaded(){this.el.hasChildNodes()||this.#e.resolve()}willUpdate(t){t.has("language")&&m(this.language).then(()=>c(this.language)).catch(_(this))}disconnectedCallback(){super.disconnectedCallback(),this._disposeSlotObservers()}_disposeSlotObservers(){this._slotContentObservers.length&&(this._slotContentObservers.forEach(t=>t.disconnect()),this._slotContentObservers=[])}_observeAssignedSlotNodes(t){this._disposeSlotObservers();let e=t.assignedNodes({flatten:!0});if(!e.length)return;let s=new Set;for(let o of e)o.nodeType===Node.ELEMENT_NODE?s.add(o):o.nodeType===Node.TEXT_NODE&&o.parentElement&&s.add(o.parentElement);let i={characterData:!0,childList:!0,subtree:!0},r=C(()=>{let o=this._computeSlotText(t);o!==this._codeFromSlot&&(this._codeFromSlot=o)},100),d=o=>{if(o.some(a=>a.type==="childList")){let a=this._computeSlotText(t);a!==this._codeFromSlot&&(this._codeFromSlot=a);return}r()};s.forEach(o=>{let a=new MutationObserver(d);a.observe(o,i),this._slotContentObservers.push(a)})}_computeSlotText(t){let e=t.assignedNodes({flatten:!0}).filter(s=>s.nodeType!==Node.COMMENT_NODE);if(this.language==="html"&&e.length){let s=e.find(r=>r.nodeType===Node.ELEMENT_NODE&&r.tagName==="TEMPLATE");if(s)return(s.innerHTML??"").trim();let i=e.map(r=>r.nodeType===Node.ELEMENT_NODE?r.outerHTML:r.nodeType===Node.TEXT_NODE?r.textContent??"":"").join("").trim();return i}return e.map(s=>s.textContent??"").join("").trim()}updateTheme(){let t=w(this.el)==="light"?"vs":"vs-dark";t!==this._currentTheme&&(this._currentTheme=t,this._monacoEditor.setTheme(t))}_applyColorizeStyles(t){if(!this._colorizeSheet){this._colorizeSheet=new CSSStyleSheet;let e=this.renderRoot;e.adoptedStyleSheets=[...e.adoptedStyleSheets,this._colorizeSheet]}this._colorizeSheet.replaceSync(t)}_showLineNumbers(){return typeof this.lineNumbers=="function"||this.lineNumbers==="on"}_getLineNumberLabel(t){return typeof this.lineNumbers=="function"?this.lineNumbers(t):`${t}`}_getRenderedLineNumbers(){if(!this._showLineNumbers())return[];let t=Math.max(this._codeFromSlot.split(/\r\n|\r|\n/u).length,1);return Array.from({length:t},(e,s)=>this._getLineNumberLabel(s+1))}render(){let t=this._getRenderedLineNumbers();return n`<div class=${`arcgis-code-viewer-container${t.length?" arcgis-code-viewer-container--with-line-numbers":""}`}><slot @slotchange=${this._onDefaultSlotChange} style="display:none" aria-hidden=true></slot>${t.length?n`<div class="arcgis-code-viewer__gutter" aria-hidden=true>${t.map(e=>n`<span class="arcgis-code-viewer__line-number">${e}</span>`)}</div>`:null}<pre class="arcgis-code-viewer" aria-label=${`${this.language} code snippet`}>${this._colorizeTask.render({error:()=>null,pending:()=>n`<code class=${`language-${this.language}`}></code>`,complete:e=>n`<code class=${`language-${this.language}`} .innerHTML=${e??""}></code>`})}</pre></div>`}};b("arcgis-code-viewer",p);return p},a,c,d,e,h,i)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ export default $arcgis.t(([u,{property:d,subclass:v}])=>{var I=Object.defineProperty,y=Object.getOwnPropertyDescriptor,r=(t,e,s,i)=>{for(var a=i>1?void 0:i?y(e,s):e,h=t.length-1,l;h>=0;h--)(l=t[h])&&(a=(i?l(e,s,a):l(a))||a);return i&&a&&I(e,s,a),a},b="scope";function c(t){return`preview:${t}`}function p(t){let e=t.split(".").filter(Boolean).at(-1)??t;return e.length>12?`${e.slice(0,12)}...`:e}var o=class extends u{constructor(t){super(t),this.fields=[],this.id="",this.invalidated=!1,this.label="",this.message="",this.requestId=0,this.rows=[],this.sourcePath="",this.status="idle",this.title=""}};r([d()],o.prototype,"fields",2);r([d()],o.prototype,"id",2);r([d()],o.prototype,"invalidated",2);r([d()],o.prototype,"label",2);r([d()],o.prototype,"message",2);r([d()],o.prototype,"requestId",2);r([d()],o.prototype,"rows",2);r([d()],o.prototype,"sourcePath",2);r([d()],o.prototype,"status",2);r([d()],o.prototype,"title",2);o=r([v("ArcadeDebuggerPreviewTabState")],o);var n=class extends u{constructor(t){super(t),this.activeTabId=b,this.tabs=[],this.revision=0,this.tabsById=new Map}get activeTab(){return this.tabsById.get(this.activeTabId)}clear(){this.revision+=1,this.activeTabId=b,this.destroyTabs()}closeTab(t){let e=this.tabs.findIndex(h=>h.id===t);if(e<0)return;let s=this.activeTabId===t,i=this.tabs[e+1]??this.tabs[e-1],a=this.tabs[e];this.tabsById.delete(t),a.destroy(),this.tabs=this.tabs.filter(h=>h.id!==t),s&&(this.activeTabId=i?.id??b)}getOrCreateTab(t,e){let s=c(t),i=this.tabsById.get(s);if(i)return i.label=t,i.sourcePath=e,i.title=p(t),i;let a=new o;return a.id=s,a.label=t,a.sourcePath=e,a.title=p(t),this.tabsById.set(s,a),this.tabs=[...this.tabs,a],a}getTab(t){return this.tabsById.get(t)}invalidateAll(){this.revision+=1,this.activeTabId=b;for(let t of this.tabs)t.invalidated=!0,this.resetTab(t)}isTabLoading(t){return this.tabsById.get(c(t))?.status==="loading"}selectScope(){this.activeTabId=b}selectTab(t){if(t===b){this.selectScope();return}this.tabsById.has(t)&&(this.activeTabId=t)}startLoad(t,e){let s=this.getOrCreateTab(t,e),i=s.requestId+1;return s.requestId=i,s.invalidated=!1,this.resetTab(s),s.status="loading",this.activeTabId=s.id,{snapshot:{revision:this.revision,requestId:i,tabId:s.id},tab:s}}setError(t,e){let s=this.validateSnapshot(t);s&&(s.status="error",s.message=e)}setLoaded(t,e,s){let i=this.validateSnapshot(t);i&&(i.status="loaded",i.message="",i.fields=e,i.rows=s)}setUnavailable(t,e){let s=this.validateSnapshot(t);s&&(s.status="unavailable",s.message=e,s.fields=[],s.rows=[])}destroyTabs(){for(let t of this.tabsById.values())t.destroy();this.tabsById.clear(),this.tabs=[]}resetTab(t){t.status="idle",t.message="",t.fields=[],t.rows=[]}validateSnapshot(t){let e=this.tabsById.get(t.tabId);if(!(!e||this.revision!==t.revision||e.requestId!==t.requestId))return e}};r([d()],n.prototype,"activeTabId",2);r([d()],n.prototype,"tabs",2);n=r([v("ArcadeDebuggerPreviewTabsState")],n);return{a:b,b:n}},"core/Accessor","core/accessorSupport/decorators")
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./RMVHO2AH.js";import a from"./STN3LSQR.js";import{b as q}from"./TQDN6SR5.js";import{L as P}from"./XU7YAUUX.js";export default $arcgis.t(([B,{substitute:E},{B:F},{a:T,d:C,e:N,f:b,g:g,h:$,i:x,j:L,n:_,o:D,p:A}])=>{function w(t,e,a){return t?.[e]??a}function h(t,e,a,n){return E(w(t,e,a),n)}function K(t,e){return w(t,e?"nullable":"notnull",e?"nullable":"not nullable")}function j(t,e){return w(t,e?"yes":"no",e?"yes":"no")}function v(t){for(let e of t){if(e instanceof _)return e;if(e.isCollection&&"variables"in e){let a=v(e.variables.filter(n=>n.type!=="group"));if(a)return a}}}function V(t,e){return`${t}:${e}`}function z(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function U(t){let e=new B({url:t.portal.url});return await e.load(),new T({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function k(t){return F(t)?await U(t):t}function H(t,e,a,n){let o=`**${t}**`;return e.type&&(o+=`
2
+ import b from"./4XMC5J5W.js";import a from"./STN3LSQR.js";import{b as q}from"./NP37C536.js";import{L as P}from"./XU7YAUUX.js";export default $arcgis.t(([B,{substitute:E},{B:F},{a:T,d:C,e:N,f:b,g:g,h:$,i:x,j:L,n:_,o:D,p:A}])=>{function w(t,e,a){return t?.[e]??a}function h(t,e,a,n){return E(w(t,e,a),n)}function K(t,e){return w(t,e?"nullable":"notnull",e?"nullable":"not nullable")}function j(t,e){return w(t,e?"yes":"no",e?"yes":"no")}function v(t){for(let e of t){if(e instanceof _)return e;if(e.isCollection&&"variables"in e){let a=v(e.variables.filter(n=>n.type!=="group"));if(a)return a}}}function V(t,e){return`${t}:${e}`}function z(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function U(t){let e=new B({url:t.portal.url});return await e.load(),new T({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function k(t){return F(t)?await U(t):t}function H(t,e,a,n){let o=`**${t}**`;return e.type&&(o+=`
3
3
  ${e.type}`),a&&(o+=`
4
4
  ${h(n,"datastoreformat","Datastore: {datastoreName}",{datastoreName:a})}`),{value:o}}function W(t,e,a){let n=`**${t.name}**`;return t.serverType&&(n+=`
5
5
  ${t.serverType}`),n+=`
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- function O(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var T=O();function ae(r){T=r}var R={exec:()=>null};function z(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),n=e[s];return n||(n=r(s),e[s]=n),n}}function u(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(n,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(x.caret,"$1"),t=t.replace(n,l),s},getRegex:()=>new RegExp(t,e)};return s}var we=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),x={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:z(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:z(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:z(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:z(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:z(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:z(r=>new RegExp(`^ {0,${r}}>`))},me=/^(?:[ \t]*(?:\n|$))+/,ye=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,$e=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,I=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Re=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,j=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,oe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ce=u(oe).replace(/bull/g,j).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Se=u(oe).replace(/bull/g,j).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),N=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Te=/^[^\n]+/,G=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ze=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",G).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ae=u(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,j).getRegex(),B="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",X=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Pe=u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",X).replace("tag",B).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),he=u(N).replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),_e=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",he).getRegex(),W={blockquote:_e,code:ye,def:ze,fences:$e,heading:Re,hr:I,html:Pe,lheading:ce,list:Ae,newline:me,paragraph:he,table:R,text:Te},ee=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),Le={...W,lheading:Se,table:ee,paragraph:u(N).replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ee).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex()},Ie={...W,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",X).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:R,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(N).replace("hr",I).replace("heading",` *#{1,6} *[^
2
+ function O(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var T=O();function ae(r){T=r}var R={exec:()=>null};function z(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),n=e[s];return n||(n=r(s),e[s]=n),n}}function u(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(n,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(x.caret,"$1"),t=t.replace(n,l),s},getRegex:()=>new RegExp(t,e)};return s}var we=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),x={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:z(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:z(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:z(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:z(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:z(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:z(r=>new RegExp(`^ {0,${r}}>`))},me=/^(?:[ \t]*(?:\n|$))+/,ye=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,$e=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,I=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Re=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,j=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,oe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ce=u(oe).replace(/bull/g,j).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Se=u(oe).replace(/bull/g,j).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),N=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Te=/^[^\n]+/,G=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ze=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",G).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ae=u(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,j).getRegex(),B="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",X=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Pe=u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",X).replace("tag",B).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),he=u(N).replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),_e=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",he).getRegex(),W={blockquote:_e,code:ye,def:ze,fences:$e,heading:Re,hr:I,html:Pe,lheading:ce,list:Ae,newline:me,paragraph:he,table:R,text:Te},ee=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),Le={...W,lheading:Se,table:ee,paragraph:u(N).replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ee).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex()},Ie={...W,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",X).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:R,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(N).replace("hr",I).replace("heading",` *#{1,6} *[^
3
3
  ]`).replace("lheading",ce).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ee=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ve=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pe=/^( {2,}|\\)\n(?!\s*$)/,Ce=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,Z=/[\s\p{P}\p{S}]/u,F=/[^\s\p{P}\p{S}]/u,qe=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Z).getRegex(),ue=/(?!~)[\p{P}\p{S}]/u,Be=/(?!~)[\s\p{P}\p{S}]/u,Ze=/(?:[^\s\p{P}\p{S}]|~)/u,De=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",we?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ge=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Qe=u(ge,"u").replace(/punct/g,A).getRegex(),Me=u(ge,"u").replace(/punct/g,ue).getRegex(),ke="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",He=u(ke,"gu").replace(/notPunctSpace/g,F).replace(/punctSpace/g,Z).replace(/punct/g,A).getRegex(),Oe=u(ke,"gu").replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Be).replace(/punct/g,ue).getRegex(),je=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,F).replace(/punctSpace/g,Z).replace(/punct/g,A).getRegex(),Ne=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Ge="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Xe=u(Ge,"gu").replace(/notPunctSpace/g,F).replace(/punctSpace/g,Z).replace(/punct/g,A).getRegex(),We=u(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Fe=u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ue=u(X).replace("(?:-->|$)","-->").getRegex(),Je=u("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ue).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),v=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ke=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",v).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),de=u(/^!?\[(label)\]\[(ref)\]/).replace("label",v).replace("ref",G).getRegex(),fe=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",G).getRegex(),Ve=u("reflink|nolink(?!\\()","g").replace("reflink",de).replace("nolink",fe).getRegex(),te=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,U={_backpedal:R,anyPunctuation:We,autolink:Fe,blockSkip:De,br:pe,code:ve,del:R,delLDelim:R,delRDelim:R,emStrongLDelim:Qe,emStrongRDelimAst:He,emStrongRDelimUnd:je,escape:Ee,link:Ke,nolink:fe,punctuation:qe,reflink:de,reflinkSearch:Ve,tag:Je,text:Ce,url:R},Ye={...U,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",v).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",v).getRegex()},Q={...U,emStrongRDelimAst:Oe,emStrongLDelim:Me,delLDelim:Ne,delRDelim:Xe,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",te).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:u(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",te).getRegex()},et={...Q,br:u(pe).replace("{2,}","*").getRegex(),text:u(Q.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},E={normal:W,gfm:Le,pedantic:Ie},_={normal:U,gfm:Q,breaks:et,pedantic:Ye},tt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},re=r=>tt[r];function m(r,e){if(e){if(x.escapeTest.test(r))return r.replace(x.escapeReplace,re)}else if(x.escapeTestNoEncode.test(r))return r.replace(x.escapeReplaceNoEncode,re);return r}function ne(r){try{r=encodeURI(r).replace(x.percentDecode,"%")}catch{return null}return r}function se(r,e){let t=r.replace(x.findPipe,(i,l,a)=>{let c=!1,o=l;for(;--o>=0&&a[o]==="\\";)c=!c;return c?"|":" |"}),s=t.split(x.splitPipe),n=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;n<s.length;n++)s[n]=s[n].trim().replace(x.slashPipe,"|");return s}function $(r,e,t){let s=r.length;if(s===0)return"";let n=0;for(;n<s;){let i=r.charAt(s-n-1);if(i===e&&!t)n++;else if(i!==e&&t)n++;else break}return r.slice(0,s-n)}function ie(r){let e=r.split(`
4
4
  `),t=e.length-1;for(;t>=0&&x.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
5
5
  `)}function rt(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function nt(r,e=0){let t=e,s="";for(let n of r)if(n===" "){let i=4-t%4;s+=" ".repeat(i),t+=i}else s+=n,t++;return s}function le(r,e,t,s,n){let i=e.href,l=e.title||null,a=r[1].replace(n.other.outputLinkReplace,"$1");s.state.inLink=!0;let c={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:l,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,c}function st(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
@@ -0,0 +1,68 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as u}from"./5HKDO4SX.js";import a from"./2WB7S5TQ.js";import{b as o}from"./XSKI5PRU.js";import{H as i,I as v,g as p,h as n,j as t,p as d,q as r}from"./XU7YAUUX.js";export default $arcgis.t(([{e:m,f:y,g:b}])=>{var s={lines:!0,selectionMode:"none",scale:"s",oncalciteTreeSelect:e=>e.currentTarget.selectedItems.forEach(a=>a.selected=!1)},g="tree-item-metadata",f=({name:e,isMetadata:a=!1})=>t`<bdi class=${i(o("dictionary-property",a&&g))}>${e}</bdi><bdi class=${i(o(a&&g))}>:&nbsp;</bdi>`,M=({obj:e,subtree:a})=>t`<calcite-tree slot=${"children"} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item class="string-value">${JSON.stringify(e,void 0,2)}</calcite-tree-item></calcite-tree>`,N=({value:e,subtree:a=!1})=>t`<calcite-tree slot=${(a?"children":void 0)??v} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item><div class="tree-item-label">${f({name:"type"})}<bdi>${d(e.type)}</bdi></div></calcite-tree-item><calcite-tree-item><div class="tree-item-label">${f({name:"value"})}<span class="string-value">${JSON.stringify(e,void 0,2)}</span></div></calcite-tree-item></calcite-tree>`,D=({type:e,value:a})=>{switch(e){case"unknown":case"Unknown":return t`<span class="constant-value">${e}</span>`;case"null":case"Null":return t`<span class="constant-value">null</span>`;case"text":case"String":case"Text":return t`<span class="string-value">${r(a)}</span>`;case"number":case"Number":return t`<span class="number-value">${a}</span>`;case"boolean":case"Boolean":return t`<span class="constant-value">${a}</span>`;case"date":case"Date":return t`<span class="date-value">${a}</span>`;case"dateOnly":case"DateOnly":return t`<span class="string-value">${r(a)}</span>`;case"time":case"Time":return t`<span class="string-value">${r(a)}</span>`;case"":return t`<span class="string-value">null</span>`;default:return null}},h=["boolean","date","dateOnly","null","number","text","time","unknown","Boolean","Date","DateOnly","Null","Number","Text","Time","Unknown","String",""],E=e=>h.includes(e.type);function j(e){switch(e.type){case"null":case"unknown":return{type:e.type,value:e.type};case"number":return{type:e.type,value:String(e.value)};case"boolean":return{type:e.type,value:String(e.value)};case"text":return{type:e.type,value:e.value};case"date":return{type:e.type,value:m(e)};case"dateOnly":return{type:e.type,value:y(e)};case"time":return{type:e.type,value:b(e)}}}var S="calcite-mode-dark";function C(){let e=`:host {
3
+ `,a=u["light-theme"];Object.entries(a).forEach(([c,l])=>{e+=` --arcgis-editor-${c}: ${l};
4
+ `}),e+=`}
5
+ `,e+=`:host(:state(${S})),
6
+ `,e+=`:host([calcite-mode-dark]) {
7
+ `;let $=u["dark-theme"];return Object.entries($).forEach(([c,l])=>{e+=`
8
+ --arcgis-editor-${c}: ${l};`}),e+=`
9
+ }
10
+ `,n`
11
+ ${p(e)}
12
+ `}var B=n`
13
+ .xs {
14
+ font-size: var(--calcite-font-size-xs);
15
+ color: var(--calcite-color-text-2);
16
+ }
17
+
18
+ .breakpoint-code {
19
+ font-size: var(--calcite-font-size--2);
20
+ }
21
+
22
+ [class*="result-value-"] {
23
+ font-size: var(--calcite-font-size--2);
24
+ background-color: var(--calcite-color-foreground-1);
25
+ }
26
+
27
+ .tree-item-label,
28
+ .number-value,
29
+ .string-value,
30
+ .boolean-value {
31
+ font-family: var(--calcite-code-family);
32
+ }
33
+
34
+ .tree-item-label,
35
+ .value-type {
36
+ color: var(--calcite-color-text-2);
37
+ font-weight: var(--calcite-font-weight-normal);
38
+ }
39
+
40
+ .tree-item-metadata {
41
+ opacity: 0.7;
42
+ }
43
+
44
+ .dictionary-property {
45
+ color: var(--arcgis-editor-identifier);
46
+ }
47
+
48
+ .uninitialized-value {
49
+ color: var(--arcgis-editor-identifier);
50
+ }
51
+
52
+ .number-value {
53
+ color: var(--arcgis-editor-number);
54
+ }
55
+
56
+ .string-value {
57
+ color: var(--arcgis-editor-string);
58
+ white-space: pre-wrap;
59
+ }
60
+
61
+ .constant-value {
62
+ color: var(--arcgis-editor-constant);
63
+ }
64
+
65
+ .date-value {
66
+ color: var(--arcgis-editor-date);
67
+ }
68
+ `;return{a:s,b:f,c:M,d:N,e:D,f:E,g:j,h:S,i:C,j:B}},a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{b as r}from"./CC4XBW6V.js";import{L as o}from"./XU7YAUUX.js";var s=r(o);export{s as a};
2
+ import{b as r}from"./EHMFQPTC.js";import{L as o}from"./XU7YAUUX.js";var s=r(o);export{s as a};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{c as P,e as O}from"./TQDN6SR5.js";import{a as b,b as y,c as u,d as m,e as E,f as x,m as f,o as C}from"./XU7YAUUX.js";var w=e=>(...n)=>{let t=m(),o=new e(...n),s=o.exports;u(t.at(-1));let r=o.component.manager;r.W(o,s),o.watchExports(r.W.bind(r,o)),E(o);let a=[o.component,...t].reverse();return f(a,i=>i===void 0?void 0:A(o,i,s),s)},A=(e,{host:n,key:t,isReactive:o},s)=>{let r=n,a=r[t]!==e.exports,i=r[t]!==s,c=s!==e.exports;if(a&&!i&&c&&(r[t]=e.exports),n===e.component){if(o){let p=e.component.manager;i&&p.W(e,r[t]),e.onUpdate(h=>{if(h.has(t)){let g=r[t];g!==e.exports&&p.W(e,g)}})}e.O=o?void 0:t}let d=e.component.constructor.elementProperties.get(t)?.readOnly;e.watchExports(()=>{r[t]!==e.exports&&(d?x(()=>{r[t]=e.exports}):r[t]=e.exports)})};var L=e=>D(void 0,e);var v=class extends C{constructor(n,t){super(n);let o=this.exports;try{y(this.component);let s=t(this.component,this),r=this.exports!==o;if(b(s)){r||this.setProvisionalExports(s);let a=s.then(i=>{this.exports=i,super.catchUpLifecycle()}).catch(i=>{this.P.reject(i)});this.onLoad(async()=>await a)}else(!r||s!==void 0)&&(this.exports=s),queueMicrotask(()=>super.catchUpLifecycle())}catch(s){this.P.reject(s)}}catchUpLifecycle(){}},D=w(v);var G=L;var $=e=>(n={})=>L((t,o)=>{let s=P(t.el),r={_lang:s.lang,_t9nLocale:s.t9nLocale,_loading:!0},a=t;o.onLifecycle(()=>O(t.el,()=>e("./assets"),({t9nLocale:c,t9nStrings:l,lang:d})=>{let p={...l,_lang:d,_t9nLocale:c,_loading:!1};o.exports=p;let h=l.componentLabel;typeof h=="string"&&"label"in t&&t.label==null&&(t.label??=h),i(a.messageOverrides)},n.name));let i=c=>{let l=o.exports,d=l._original??l,p=_(d,c);c&&(p._original=d),o.exports=p};return"messageOverrides"in a&&o.onUpdate(c=>{c.has("messageOverrides")&&i(a.messageOverrides)}),n.blocking?(o.setProvisionalExports(r,!1),o.ready):r}),_=(e,n)=>{if(!n)return e;let t={...e};return Object.entries(n).forEach(([o,s])=>{e[o]!==void 0&&(typeof s=="object"?t[o]=_(e[o],s):t[o]=s??e[o])}),t};export{G as a,$ as b};
2
+ import{c as P,e as O}from"./NP37C536.js";import{a as b,b as y,c as u,d as m,e as E,f as x,m as f,o as C}from"./XU7YAUUX.js";var w=e=>(...n)=>{let t=m(),o=new e(...n),s=o.exports;u(t.at(-1));let r=o.component.manager;r.W(o,s),o.watchExports(r.W.bind(r,o)),E(o);let a=[o.component,...t].reverse();return f(a,i=>i===void 0?void 0:A(o,i,s),s)},A=(e,{host:n,key:t,isReactive:o},s)=>{let r=n,a=r[t]!==e.exports,i=r[t]!==s,c=s!==e.exports;if(a&&!i&&c&&(r[t]=e.exports),n===e.component){if(o){let p=e.component.manager;i&&p.W(e,r[t]),e.onUpdate(h=>{if(h.has(t)){let g=r[t];g!==e.exports&&p.W(e,g)}})}e.O=o?void 0:t}let d=e.component.constructor.elementProperties.get(t)?.readOnly;e.watchExports(()=>{r[t]!==e.exports&&(d?x(()=>{r[t]=e.exports}):r[t]=e.exports)})};var L=e=>D(void 0,e);var v=class extends C{constructor(n,t){super(n);let o=this.exports;try{y(this.component);let s=t(this.component,this),r=this.exports!==o;if(b(s)){r||this.setProvisionalExports(s);let a=s.then(i=>{this.exports=i,super.catchUpLifecycle()}).catch(i=>{this.P.reject(i)});this.onLoad(async()=>await a)}else(!r||s!==void 0)&&(this.exports=s),queueMicrotask(()=>super.catchUpLifecycle())}catch(s){this.P.reject(s)}}catchUpLifecycle(){}},D=w(v);var G=L;var $=e=>(n={})=>L((t,o)=>{let s=P(t.el),r={_lang:s.lang,_t9nLocale:s.t9nLocale,_loading:!0},a=t;o.onLifecycle(()=>O(t.el,()=>e("./assets"),({t9nLocale:c,t9nStrings:l,lang:d})=>{let p={...l,_lang:d,_t9nLocale:c,_loading:!1};o.exports=p;let h=l.componentLabel;typeof h=="string"&&"label"in t&&t.label==null&&(t.label??=h),i(a.messageOverrides)},n.name));let i=c=>{let l=o.exports,d=l._original??l,p=_(d,c);c&&(p._original=d),o.exports=p};return"messageOverrides"in a&&o.onUpdate(c=>{c.has("messageOverrides")&&i(a.messageOverrides)}),n.blocking?(o.setProvisionalExports(r,!1),o.ready):r}),_=(e,n)=>{if(!n)return e;let t={...e};return Object.entries(n).forEach(([o,s])=>{e[o]!==void 0&&(typeof s=="object"?t[o]=_(e[o],s):t[o]=s??e[o])}),t};export{G as a,$ as b};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as b}from"./LZ2JU5WD.js";import h from"./6QMGBWXM.js";import e from"./3UD4JSPW.js";import{a as E}from"./P37AQWGL.js";import d from"./3CHKFCKR.js";import c from"./72E5GBWN.js";import"./5HKDO4SX.js";import"./ZTCCL565.js";import a from"./2WB7S5TQ.js";import{a as T}from"./2WVAYBDV.js";import{a as y}from"./CC4XBW6V.js";import"./TQDN6SR5.js";import{c as S,e as k}from"./XSKI5PRU.js";import"./ECNI2A4K.js";import"./XRUKVCVF.js";import{G as w,H as x,I as g,K as $,h as u,j as r,t as f}from"./XU7YAUUX.js";import"./VGOFAQ7A.js";import"./257WOXQH.js";import"./R2XZZWNP.js";import"./QTLHVR4Y.js";import{Zk as P}from"./TEXAGKBD.js";import"./H6RQVSYM.js";export default $arcgis.t(([,{h:m,i:L,j:M},{a:l},{a:p},{a:z,b:C,c:h,d:A,e:B,f:I,g:N,h:F,i:D}])=>{var V=u`:host{--calcite-block-padding: var(--calcite-spacing-sm);--breakpoints-popover-max-height: min(14rem, 20vh);display:block;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);overflow:hidden;height:100%;.console-shell,.tabs-container,calcite-tabs{height:100%}.tabs-container{flex:1 1 auto;min-height:0;overflow:hidden}.console-shell,calcite-tabs{display:flex;flex-direction:column;min-height:0}.console-shell{container-type:size;container-name:debugger-console}calcite-tab-nav{--calcite-size-2xl: var(--calcite-space-md);justify-content:flex-start;padding-inline:var(--calcite-spacing-sm)}calcite-tab-title{font-size:var(--calcite-font-size-sm)}calcite-tab{--calcite-tab-content-block-padding: 0;--calcite-tab-content-space-y: 0;display:flex;flex-direction:column;min-height:0}calcite-tab:not([selected]){display:none}.disabled-state-text{font-size:var(--calcite-font-size-sm);color:var(--calcite-color-text-3);font-style:italic;text-align:center;display:block;padding:var(--calcite-spacing-md)}.breakpoint-header{display:flex;align-items:flex-start;gap:var(--calcite-spacing-sm);padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);background-color:var(--calcite-color-foreground-1)}.load-action{--calcite-action-background-color: var(--calcite-color-foreground-2);--calcite-internal-action-height: 1.25rem;--calcite-internal-action-padding-block: 0;--calcite-internal-action-padding-inline: var(--calcite-spacing-xs);margin-block:var(--calcite-spacing-xxs)}.breakpoint-code-viewer{margin-block:0;width:100%}.tab-panel{display:flex;flex:1 1 auto;min-height:0;overflow:hidden}.tab-panel>*{flex:1 1 auto;min-height:0}.tab-panel>calcite-tree{margin-inline-end:var(--calcite-space-sm)}.preview-panel{display:flex;flex:1 1 auto;min-height:0}.preview-empty-state{display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--calcite-spacing-md)}.preview-table-shell{display:flex;flex-direction:column;flex:1 1 auto;width:100%;min-height:0;overflow:hidden}.preview-table-summary{padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-2);font-family:var(--calcite-code-family);background-color:var(--calcite-color-foreground-1)}.table-scroll{overflow:auto;flex:1 1 auto;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-sm)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}.breakpoints-popover{--calcite-popover-max-size-x: min(22rem, 68vw)}.breakpoints-popover-content{max-block-size:var(--breakpoints-popover-max-height);overflow:hidden}.breakpoints-list{display:flex;flex-direction:column;gap:var(--calcite-spacing-xs);padding:var(--calcite-spacing-xs);min-width:min(18rem,58vw);max-block-size:var(--breakpoints-popover-max-height);overflow:auto}.breakpoints-popover .breakpoint-code-viewer{--calcite-font-size--2: var(--calcite-font-size--3);--calcite-spacing-md: var(--calcite-spacing-sm);--calcite-spacing-sm: var(--calcite-spacing-xs);--calcite-spacing-xs: var(--calcite-spacing-xxs)}.breakpoint-list-item{border:1px solid var(--calcite-color-border-3);border-radius:var(--calcite-corner-radius-sharp);background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-xxs)}.breakpoint-list-item--current{border-color:var(--calcite-color-brand)}.breakpoint-list-item-meta{color:var(--calcite-color-text-2);font-size:var(--calcite-font-size-xs);margin-bottom:var(--calcite-spacing-xxs)}}`,v=class extends w{constructor(){super(...arguments),this.messages=T(),this._monacoEditor=y(E),this._breakpointPopoverId=`arcade-debugger-console-breakpoints-${f()}`,this.modelId=""}static{this.properties={debuggerStore:0,modelId:1}}static{this.styles=[V,M,L()]}get breakpoints(){return this.debuggerStore?.debuggerBreakpoints??[]}get previewTabsState(){return this.debuggerStore.previewTabsState}get lazyTreeState(){return this.debuggerStore?.lazyTreeState}get executionProgramState(){return this.debuggerStore?.executionState?.result}load(){this.manager.onLifecycle(()=>{let e=S(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>e()})}getContentAtLine(e){if(!this.modelId)return"";let t=this._monacoEditor.getModel(P.parse(this.modelId));return t?t.getLineContent(e):""}updateTheme(){k(this.el)==="dark"?this.elementInternals.states.add(m):this.elementInternals.states.delete(m)}getBreakpointCode(e){return e==null?this.messages.nocontent??"No content":this.getContentAtLine(e)||(this.messages.nocontent??"No content")}getPreviewLoadErrorMessage(){return this.messages.previewloaderror??"Unable to load preview."}getBreakpointPositionText(e){return(this.messages.breakpointposition??"{position} of {count}"??"{position} of {count}").replace("{position}",String(e)).replace("{count}",String(this.breakpoints.length))}findCollectionItemByPreviewSegment(e,t){if(t.startsWith("name:")){let i=t.slice(5);return e.find(a=>a.name===i)?.featureSet}if(t.startsWith("id:")){let i=t.slice(3);return e.find(a=>String(a.id)===i)?.featureSet}}getExpandedDebuggerMap(e){if(e==null||!h(e))return null;let t=e.expand();return Array.isArray(t)?null:t}getPreviewRows(e){return e.map(t=>this.getExpandedDebuggerMap(t)||new Map)}getExpandedDebuggerChild(e,t){if(!e||!h(e))return;let i=e.expand();if(Array.isArray(i)){let a=Number(t);return!Number.isInteger(a)||String(a)!==t?void 0:i[a]}return i.get(t)}async resolvePreviewValueFromSegments(e,t){if(!t.length)return e;if(!e)return;let[i,...a]=t,o;if(N(e)){let s=await e.load();o=this.findCollectionItemByPreviewSegment(s,i)}else o=this.getExpandedDebuggerChild(e,i);return await this.resolvePreviewValueFromSegments(o,a)}getScope(e,t){switch(t){case"profile":return e.profile;case"globals":return e.globals;case"locals":return e.locals}}async resolvePreviewValue(e){let t=this.executionProgramState;if(!t)return;let i=C(e);if(!i)return;let{scopeName:a,rootName:o,pathSegments:s}=i,c=this.getScope(t,a);if(c)return await this.resolvePreviewValueFromSegments(c.get(o),s)}async loadPreview({label:e,sourcePath:t,value:i}){let a=this.previewTabsState,{snapshot:o}=a.startLoad(e,t),s=i;if(s==null)try{s=await this.resolvePreviewValue(t)}catch{a.setError(o,this.getPreviewLoadErrorMessage());return}if(s==null||!I(s)||typeof s.querySample!="function"||typeof s.schema!="function"){a.setUnavailable(o,this.messages.previewunavailable??"This preview is no longer available in the current paused state.");return}try{let{fields:c,features:d}=await s.querySample(),n=this.getPreviewRows(d);a.setLoaded(o,c,n)}catch{a.setError(o,this.getPreviewLoadErrorMessage())}}activateTab(e){if(e===p){this.previewTabsState.selectScope();return}this.previewTabsState.selectTab(e);let t=this.previewTabsState.getTab(e);t?.invalidated&&this.loadPreview({label:t.label,sourcePath:t.sourcePath})}closePreviewTab(e){e.closed=!1,this.previewTabsState.closeTab(e.tab)}scrollToSelectedBreakpoint(e){let t=e.currentTarget;requestAnimationFrame(()=>{t?.querySelector(".breakpoint-list-item--current")?.scrollIntoView({block:"center"})})}sortScopeEntries(e){return e.sort(([t],[i])=>t.localeCompare(i))}renderPreviewLabel(e){return r`<bdi>${e}</bdi>`}renderPreviewCell(e){return e?B(e)||A(e)?D({value:e}):r`<span class="xs"></span>`:r`<span class="xs"></span>`}renderScopeEntryForScope(e,t,i){let[a,o]=i,s=`${t}.${a}`,c=this.lazyTreeState;return c?F({name:a,value:o,messages:this.messages,path:`${e}.${a}`,lazyTreeState:c,previewLabel:s,previewSourcePath:z(e,a),previewLoading:this.previewTabsState.isTabLoading(s),onLoadPreview:d=>{this.loadPreview(d)}}):null}renderBreakpointPopover(e){return this.breakpoints.length?r`<calcite-popover .referenceElement=${this._breakpointPopoverId} placement=bottom-end scale=s auto-close focus-trap-disabled @calcitePopoverOpen=${t=>this.scrollToSelectedBreakpoint(t)} .label=${this.messages.breakpoints??"Breakpoints"} class="breakpoints-popover" .heading=${this.messages.breakpoints??"Breakpoints"} heading-level=2><div class="breakpoints-popover-content"><div class="breakpoints-list">${this.breakpoints.map((t,i)=>r`<div class=${x(t.line===e?"breakpoint-list-item breakpoint-list-item--current":"breakpoint-list-item")}><div class="breakpoint-list-item-meta"><bdi>${this.getBreakpointPositionText(i+1)}</bdi></div><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${a=>String(a+t.line-1)}>${this.getBreakpointCode(t.line)}</arcgis-code-viewer></div>`)}</div></div></calcite-popover>`:null}renderScopePanel(){let e=this.executionProgramState,t=this.sortScopeEntries(Array.from(e?.profile??[])),i=this.sortScopeEntries(Array.from(e?.globals??[])),a=e?.locals?this.sortScopeEntries(Array.from(e?.locals??[])):void 0,o=!!e?.locals,s=a&&a.length>0,c=t.length>0,d=i.length>0;return e?r`<calcite-tree .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect} .lines=${l.lines} .selectionMode=${l.selectionMode}><calcite-tree-item expanded .disabled=${!s}>${this.messages.local??"Local"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${o?s?a.map(n=>this.renderScopeEntryForScope("locals",this.messages.local??"Local",n)):r`<span><i>${this.messages.empty??"Empty"}</i></span>`:r`<span><i>${this.messages.nolocalscope??"No local scope"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!d}>${this.messages.global??"Global"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${d?i.map(n=>this.renderScopeEntryForScope("globals",this.messages.global??"Global",n)):r`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!c}>${this.messages.profile??"Profile"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${c?t.map(n=>this.renderScopeEntryForScope("profile",this.messages.profile??"Profile",n)):r`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item></calcite-tree>`:this.debuggerStore?.isExecuting?r`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"} .text=${this.messages.loading??"Loading"}></calcite-loader></div>`:r`<span class="disabled-state-text">${this.messages.notpaused??"Not paused"}</span>`}renderPreviewPanel(e){switch(e.status){case"loading":return r`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loadingpreview??"Loading preview"} .text=${this.messages.loadingpreview??"Loading preview"}></calcite-loader></div>`;case"unavailable":case"error":return r`<span class="disabled-state-text">${e.message}</span>`;case"loaded":let{fields:t,label:i,rows:a}=e;return!a.length||!t.length?r`<span class="disabled-state-text">${this.messages.nopreviewrows??"No preview rows available."}</span>`:r`<div class="preview-table-shell"><div class="preview-table-summary">${this.renderPreviewLabel(i)}</div><div class="table-scroll"><table><thead><tr>${t.map(o=>r`<th><bdi>${o}</bdi></th>`)}</tr></thead><tbody>${a.map(o=>r`<tr>${t.map(s=>r`<td>${this.renderPreviewCell(o.get(s))}</td>`)}</tr>`)}</tbody></table></div></div>`;default:return r`<span class="disabled-state-text">${this.messages.nopreviewloaded??"Select a FeatureSet variable and load a preview."}</span>`}}renderTabs(){let e=this.previewTabsState.activeTabId;return r`<calcite-tabs><calcite-tab-nav slot=title-group><calcite-tab-title .tab=${p} .selected=${e===p} @calciteTabsActivate=${t=>this.activateTab(t.target.tab)}>${this.messages.scope??"Scope"}</calcite-tab-title>${b(this.previewTabsState.tabs,t=>`title-${t.id}`,t=>r`<calcite-tab-title .tab=${t.id} title=${t.label??g} closable .selected=${e===t.id} @calciteTabsActivate=${i=>this.activateTab(i.target.tab)} @calciteTabsClose=${i=>this.closePreviewTab(i.target)}><bdi>${t.title}</bdi></calcite-tab-title>`)}</calcite-tab-nav><calcite-tab .tab=${p} .selected=${e===p}><div class="tab-panel">${this.renderScopePanel()}</div></calcite-tab>${b(this.previewTabsState.tabs,t=>`panel-${t.id}`,t=>r`<calcite-tab .tab=${t.id} .selected=${e===t.id}><div class="tab-panel preview-panel">${this.renderPreviewPanel(t)}</div></calcite-tab>`)}</calcite-tabs>`}render(){let{line:e}=this.debuggerStore?.executionState??{},t=this.breakpoints.find(a=>a.line===e),i=this.breakpoints.findIndex(a=>a.line===e);return r`<div class="console-shell"><div class="breakpoint-header"><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${a=>String(a+(t?.line??e??1)-1)}>${this.getBreakpointCode(t?.line??this.breakpoints[0]?.line??e??1)}</arcgis-code-viewer>${this.breakpoints.length?r`<calcite-action id=${this._breakpointPopoverId??g} scale=s .text=${this.getBreakpointPositionText(i>=0?i+1:1)} text-enabled icon=chevron-down></calcite-action>`:null}${this.renderBreakpointPopover(t?.line??e)}</div><div class="tabs-container">${this.renderTabs()}</div></div>`}};$("arcgis-arcade-debugger-console",v);return v},a,c,d,e,h)
2
+ import{a as b}from"./LZ2JU5WD.js";import h from"./SYSBF5A6.js";import e from"./7Z6G332Z.js";import{a as E}from"./P37AQWGL.js";import d from"./3LFA3ZUC.js";import c from"./CRXBAVHA.js";import"./5HKDO4SX.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as T}from"./DBVA54U6.js";import{a as y}from"./EHMFQPTC.js";import"./NP37C536.js";import{c as S,e as k}from"./XSKI5PRU.js";import"./ECNI2A4K.js";import"./XRUKVCVF.js";import{G as w,H as x,I as g,K as $,h as u,j as r,t as f}from"./XU7YAUUX.js";import"./VGOFAQ7A.js";import"./257WOXQH.js";import"./R2XZZWNP.js";import"./QTLHVR4Y.js";import{Zk as P}from"./TEXAGKBD.js";import"./H6RQVSYM.js";export default $arcgis.t(([,{h:h,i:L,j:M},{a:l},{a:p},{a:z,b:C,c:m,d:A,e:B,f:I,g:N,h:F,i:D}])=>{var V=u`:host{--calcite-block-padding: var(--calcite-spacing-sm);--breakpoints-popover-max-height: min(14rem, 20vh);display:block;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);overflow:hidden;height:100%;.console-shell,.tabs-container,calcite-tabs{height:100%}.tabs-container{flex:1 1 auto;min-height:0;overflow:hidden}.console-shell,calcite-tabs{display:flex;flex-direction:column;min-height:0}.console-shell{container-type:size;container-name:debugger-console}calcite-tab-nav{--calcite-size-2xl: var(--calcite-space-md);justify-content:flex-start;padding-inline:var(--calcite-spacing-sm)}calcite-tab-title{font-size:var(--calcite-font-size-sm)}calcite-tab{--calcite-tab-content-block-padding: 0;--calcite-tab-content-space-y: 0;display:flex;flex-direction:column;min-height:0}calcite-tab:not([selected]){display:none}.disabled-state-text{font-size:var(--calcite-font-size-sm);color:var(--calcite-color-text-3);font-style:italic;text-align:center;display:block;padding:var(--calcite-spacing-md)}.breakpoint-header{display:flex;align-items:flex-start;gap:var(--calcite-spacing-sm);padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);background-color:var(--calcite-color-foreground-1)}.load-action{--calcite-action-background-color: var(--calcite-color-foreground-2);--calcite-internal-action-height: 1.25rem;--calcite-internal-action-padding-block: 0;--calcite-internal-action-padding-inline: var(--calcite-spacing-xs);margin-block:var(--calcite-spacing-xxs)}.breakpoint-code-viewer{margin-block:0;width:100%}.tab-panel{display:flex;flex:1 1 auto;min-height:0;overflow:hidden}.tab-panel>*{flex:1 1 auto;min-height:0}.tab-panel>calcite-tree{margin-inline-end:var(--calcite-space-sm)}.preview-panel{display:flex;flex:1 1 auto;min-height:0}.preview-empty-state{display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--calcite-spacing-md)}.preview-table-shell{display:flex;flex-direction:column;flex:1 1 auto;width:100%;min-height:0;overflow:hidden}.preview-table-summary{padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-2);font-family:var(--calcite-code-family);background-color:var(--calcite-color-foreground-1)}.table-scroll{overflow:auto;flex:1 1 auto;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-sm)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}.breakpoints-popover{--calcite-popover-max-size-x: min(22rem, 68vw)}.breakpoints-popover-content{max-block-size:var(--breakpoints-popover-max-height);overflow:hidden}.breakpoints-list{display:flex;flex-direction:column;gap:var(--calcite-spacing-xs);padding:var(--calcite-spacing-xs);min-width:min(18rem,58vw);max-block-size:var(--breakpoints-popover-max-height);overflow:auto}.breakpoints-popover .breakpoint-code-viewer{--calcite-font-size--2: var(--calcite-font-size--3);--calcite-spacing-md: var(--calcite-spacing-sm);--calcite-spacing-sm: var(--calcite-spacing-xs);--calcite-spacing-xs: var(--calcite-spacing-xxs)}.breakpoint-list-item{border:1px solid var(--calcite-color-border-3);border-radius:var(--calcite-corner-radius-sharp);background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-xxs)}.breakpoint-list-item--current{border-color:var(--calcite-color-brand)}.breakpoint-list-item-meta{color:var(--calcite-color-text-2);font-size:var(--calcite-font-size-xs);margin-bottom:var(--calcite-spacing-xxs)}}`,v=class extends w{constructor(){super(...arguments),this.messages=T(),this._monacoEditor=y(E),this._breakpointPopoverId=`arcade-debugger-console-breakpoints-${f()}`,this.modelId=""}static{this.properties={debuggerStore:0,modelId:1}}static{this.styles=[V,M,L()]}get breakpoints(){return this.debuggerStore?.debuggerBreakpoints??[]}get previewTabsState(){return this.debuggerStore.previewTabsState}get lazyTreeState(){return this.debuggerStore?.lazyTreeState}get executionProgramState(){return this.debuggerStore?.executionState?.result}load(){this.manager.onLifecycle(()=>{let e=S(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>e()})}getContentAtLine(e){if(!this.modelId)return"";let t=this._monacoEditor.getModel(P.parse(this.modelId));return t?t.getLineContent(e):""}updateTheme(){k(this.el)==="dark"?this.elementInternals.states.add(h):this.elementInternals.states.delete(h)}getBreakpointCode(e){return e==null?this.messages.nocontent??"No content":this.getContentAtLine(e)||(this.messages.nocontent??"No content")}getPreviewLoadErrorMessage(){return this.messages.previewloaderror??"Unable to load preview."}getBreakpointPositionText(e){return(this.messages.breakpointposition??"{position} of {count}"??"{position} of {count}").replace("{position}",String(e)).replace("{count}",String(this.breakpoints.length))}findCollectionItemByPreviewSegment(e,t){if(t.startsWith("name:")){let i=t.slice(5);return e.find(a=>a.name===i)?.featureSet}if(t.startsWith("id:")){let i=t.slice(3);return e.find(a=>String(a.id)===i)?.featureSet}}getExpandedDebuggerMap(e){if(e==null||!m(e))return null;let t=e.expand();return Array.isArray(t)?null:t}getPreviewRows(e){return e.map(t=>this.getExpandedDebuggerMap(t)||new Map)}getExpandedDebuggerChild(e,t){if(!e||!m(e))return;let i=e.expand();if(Array.isArray(i)){let a=Number(t);return!Number.isInteger(a)||String(a)!==t?void 0:i[a]}return i.get(t)}async resolvePreviewValueFromSegments(e,t){if(!t.length)return e;if(!e)return;let[i,...a]=t,o;if(N(e)){let s=await e.load();o=this.findCollectionItemByPreviewSegment(s,i)}else o=this.getExpandedDebuggerChild(e,i);return await this.resolvePreviewValueFromSegments(o,a)}getScope(e,t){switch(t){case"profile":return e.profile;case"globals":return e.globals;case"locals":return e.locals}}async resolvePreviewValue(e){let t=this.executionProgramState;if(!t)return;let i=C(e);if(!i)return;let{scopeName:a,rootName:o,pathSegments:s}=i,c=this.getScope(t,a);if(c)return await this.resolvePreviewValueFromSegments(c.get(o),s)}async loadPreview({label:e,sourcePath:t,value:i}){let a=this.previewTabsState,{snapshot:o}=a.startLoad(e,t),s=i;if(s==null)try{s=await this.resolvePreviewValue(t)}catch{a.setError(o,this.getPreviewLoadErrorMessage());return}if(s==null||!I(s)||typeof s.querySample!="function"||typeof s.schema!="function"){a.setUnavailable(o,this.messages.previewunavailable??"This preview is no longer available in the current paused state.");return}try{let{fields:c,features:d}=await s.querySample(),n=this.getPreviewRows(d);a.setLoaded(o,c,n)}catch{a.setError(o,this.getPreviewLoadErrorMessage())}}activateTab(e){if(e===p){this.previewTabsState.selectScope();return}this.previewTabsState.selectTab(e);let t=this.previewTabsState.getTab(e);t?.invalidated&&this.loadPreview({label:t.label,sourcePath:t.sourcePath})}closePreviewTab(e){e.closed=!1,this.previewTabsState.closeTab(e.tab)}scrollToSelectedBreakpoint(e){let t=e.currentTarget;requestAnimationFrame(()=>{t?.querySelector(".breakpoint-list-item--current")?.scrollIntoView({block:"center"})})}sortScopeEntries(e){return e.sort(([t],[i])=>t.localeCompare(i))}renderPreviewLabel(e){return r`<bdi>${e}</bdi>`}renderPreviewCell(e){return e?B(e)||A(e)?D({value:e}):r`<span class="xs"></span>`:r`<span class="xs"></span>`}renderScopeEntryForScope(e,t,i){let[a,o]=i,s=`${t}.${a}`,c=this.lazyTreeState;return c?F({name:a,value:o,messages:this.messages,path:`${e}.${a}`,lazyTreeState:c,previewLabel:s,previewSourcePath:z(e,a),previewLoading:this.previewTabsState.isTabLoading(s),onLoadPreview:d=>{this.loadPreview(d)}}):null}renderBreakpointPopover(e){return this.breakpoints.length?r`<calcite-popover .referenceElement=${this._breakpointPopoverId} placement=bottom-end scale=s auto-close focus-trap-disabled @calcitePopoverOpen=${t=>this.scrollToSelectedBreakpoint(t)} .label=${this.messages.breakpoints??"Breakpoints"} class="breakpoints-popover" .heading=${this.messages.breakpoints??"Breakpoints"} heading-level=2><div class="breakpoints-popover-content"><div class="breakpoints-list">${this.breakpoints.map((t,i)=>r`<div class=${x(t.line===e?"breakpoint-list-item breakpoint-list-item--current":"breakpoint-list-item")}><div class="breakpoint-list-item-meta"><bdi>${this.getBreakpointPositionText(i+1)}</bdi></div><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${a=>String(a+t.line-1)}>${this.getBreakpointCode(t.line)}</arcgis-code-viewer></div>`)}</div></div></calcite-popover>`:null}renderScopePanel(){let e=this.executionProgramState,t=this.sortScopeEntries(Array.from(e?.profile??[])),i=this.sortScopeEntries(Array.from(e?.globals??[])),a=e?.locals?this.sortScopeEntries(Array.from(e?.locals??[])):void 0,o=!!e?.locals,s=a&&a.length>0,c=t.length>0,d=i.length>0;return e?r`<calcite-tree .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect} .lines=${l.lines} .selectionMode=${l.selectionMode}><calcite-tree-item expanded .disabled=${!s}>${this.messages.local??"Local"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${o?s?a.map(n=>this.renderScopeEntryForScope("locals",this.messages.local??"Local",n)):r`<span><i>${this.messages.empty??"Empty"}</i></span>`:r`<span><i>${this.messages.nolocalscope??"No local scope"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!d}>${this.messages.global??"Global"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${d?i.map(n=>this.renderScopeEntryForScope("globals",this.messages.global??"Global",n)):r`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!c}>${this.messages.profile??"Profile"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${c?t.map(n=>this.renderScopeEntryForScope("profile",this.messages.profile??"Profile",n)):r`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item></calcite-tree>`:this.debuggerStore?.isExecuting?r`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"} .text=${this.messages.loading??"Loading"}></calcite-loader></div>`:r`<span class="disabled-state-text">${this.messages.notpaused??"Not paused"}</span>`}renderPreviewPanel(e){switch(e.status){case"loading":return r`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loadingpreview??"Loading preview"} .text=${this.messages.loadingpreview??"Loading preview"}></calcite-loader></div>`;case"unavailable":case"error":return r`<span class="disabled-state-text">${e.message}</span>`;case"loaded":let{fields:t,label:i,rows:a}=e;return!a.length||!t.length?r`<span class="disabled-state-text">${this.messages.nopreviewrows??"No preview rows available."}</span>`:r`<div class="preview-table-shell"><div class="preview-table-summary">${this.renderPreviewLabel(i)}</div><div class="table-scroll"><table><thead><tr>${t.map(o=>r`<th><bdi>${o}</bdi></th>`)}</tr></thead><tbody>${a.map(o=>r`<tr>${t.map(s=>r`<td>${this.renderPreviewCell(o.get(s))}</td>`)}</tr>`)}</tbody></table></div></div>`;default:return r`<span class="disabled-state-text">${this.messages.nopreviewloaded??"Select a FeatureSet variable and load a preview."}</span>`}}renderTabs(){let e=this.previewTabsState.activeTabId;return r`<calcite-tabs><calcite-tab-nav slot=title-group><calcite-tab-title .tab=${p} .selected=${e===p} @calciteTabsActivate=${t=>this.activateTab(t.target.tab)}>${this.messages.scope??"Scope"}</calcite-tab-title>${b(this.previewTabsState.tabs,t=>`title-${t.id}`,t=>r`<calcite-tab-title .tab=${t.id} title=${t.label??g} closable .selected=${e===t.id} @calciteTabsActivate=${i=>this.activateTab(i.target.tab)} @calciteTabsClose=${i=>this.closePreviewTab(i.target)}><bdi>${t.title}</bdi></calcite-tab-title>`)}</calcite-tab-nav><calcite-tab .tab=${p} .selected=${e===p}><div class="tab-panel">${this.renderScopePanel()}</div></calcite-tab>${b(this.previewTabsState.tabs,t=>`panel-${t.id}`,t=>r`<calcite-tab .tab=${t.id} .selected=${e===t.id}><div class="tab-panel preview-panel">${this.renderPreviewPanel(t)}</div></calcite-tab>`)}</calcite-tabs>`}render(){let{line:e}=this.debuggerStore?.executionState??{},t=e?this.breakpoints.find(a=>a.line===e):this.breakpoints[0],i=e?this.breakpoints.findIndex(a=>a.line===e):0;return r`<div class="console-shell">${this.breakpoints.length&&r`<div class="breakpoint-header"><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${a=>String(a+(t?.line??e??1)-1)}>${this.getBreakpointCode(t?.line??this.breakpoints[0]?.line??e??1)}</arcgis-code-viewer>${this.breakpoints.length?r`<calcite-action id=${this._breakpointPopoverId??g} scale=s .text=${this.getBreakpointPositionText(i>=0?i+1:1)} text-enabled icon=chevron-down></calcite-action>`:null}${this.renderBreakpointPopover(t?.line??e)}</div>`||""}<div class="tabs-container">${this.renderTabs()}</div></div>`}};$("arcgis-arcade-debugger-console",v);return v},a,c,d,e,h)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as n}from"./PUY5G6AF.js";import{a as g}from"./3PBQ47BB.js";import"./OLNYBWUC.js";import{a as f}from"./2WVAYBDV.js";import"./CC4XBW6V.js";import"./TQDN6SR5.js";import{g as p,h as u}from"./XSKI5PRU.js";import{F as a,G as d,K as h,h as m,j as s,n as c,s as o}from"./XU7YAUUX.js";import"./VGOFAQ7A.js";import"./H6RQVSYM.js";var b=m`: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}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,r=class extends d{constructor(){super(...arguments),this.messages=f(),this._unselectItem=async()=>{this._selectedApiItem=void 0},this._filterValue="",this.languageId="arcade",this.hideDocumentationActions=!1,this.loading=!1,this.closed=!1,this.arcgisInternalClosePanel=c({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=c({bubbles:!1,composed:!1})}static{this.properties={_filterValue:16,_selectedApiItem:16,languageId:1,apiLibrary:0,hideDocumentationActions:5,loading:5,closed:5}}static{this.styles=b}willUpdate(e){if(e.has("apiLibrary")){if(!this._selectedApiItem)return;for(let i of this.apiLibrary??[])for(let t of i.items)if(t.name===this._selectedApiItem.name){this._selectedApiItem=t;return}this._selectedApiItem=void 0}}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{u(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_emitItemSelected(e,i){if(!i)return;let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_emitClose(){this.arcgisInternalClosePanel.emit()}_emitItemSelectedAndClose(e,i){let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_selectItem(e,i){e.stopPropagation(),this._selectedApiItem=i}_updateFilterValue(e){this._filterValue=e.currentTarget.value??""}_elementToMarkdown(e){e!==void 0&&(e.innerHTML=n(this._selectedApiItem.examples))}renderApiCategory(e){let i=g(e.items,"name",this._filterValue);return i.length?s`<calcite-list-item-group .heading=${e.title}>${i.map(t=>s`<calcite-list-item .label=${o(t.completion.detail)} @calciteListItemSelect=${l=>this._emitItemSelected(l,t)} @keydown=${l=>this._emitItemSelected(l,t)}><calcite-action slot=actions-end .text=${this.messages.expand??""} icon=chevron-right icon-flip-rtl scale=s @click=${l=>this._selectItem(l,t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>`:null}renderApiItemFlowItem(){let e=this._selectedApiItem;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions?null:s`<calcite-button width=half slot=footer appearance=outline kind=brand scale=s .href=${e.link} target=Help icon-start=information>${this.messages.moreinformation}</calcite-button>`}<calcite-button .width=${this.hideDocumentationActions?"full":"half"} slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${i=>this._emitItemSelectedAndClose(i,e)} ${a(p)}>${this.messages.insert}</calcite-button><calcite-block expanded .heading=${o(e.completion.detail)}><div .innerHTML=${n(e.completion.documentation)??""}></div>${e.examples?s`<div ${a(this._elementToMarkdown)}></div>`:null}</calcite-block></calcite-flow-item>`:null}render(){if(this.closed)return null;let e=(this.apiLibrary??[]).map(t=>this.renderApiCategory(t)),i=e.every(t=>!t);return s`<calcite-flow ${a(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input>${this.loading?s`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:s`<calcite-list .label=${this.messages.api??"API"}>${i?s`<div class="notice-container">${this.messages.noitems}</div>`:e}</calcite-list>`}</calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`}};h("arcgis-language-api-panel",r);export{r as ArcgisLanguageApiPanel};
2
+ import{a as n}from"./CKBZZB5E.js";import{a as g}from"./3PBQ47BB.js";import"./OLNYBWUC.js";import{a as f}from"./DBVA54U6.js";import"./EHMFQPTC.js";import"./NP37C536.js";import{g as p,h as u}from"./XSKI5PRU.js";import{F as a,G as d,K as h,h as m,j as s,n as c,s as o}from"./XU7YAUUX.js";import"./VGOFAQ7A.js";import"./H6RQVSYM.js";var b=m`: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}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,r=class extends d{constructor(){super(...arguments),this.messages=f(),this._unselectItem=async()=>{this._selectedApiItem=void 0},this._filterValue="",this.languageId="arcade",this.hideDocumentationActions=!1,this.loading=!1,this.closed=!1,this.arcgisInternalClosePanel=c({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=c({bubbles:!1,composed:!1})}static{this.properties={_filterValue:16,_selectedApiItem:16,languageId:1,apiLibrary:0,hideDocumentationActions:5,loading:5,closed:5}}static{this.styles=b}willUpdate(e){if(e.has("apiLibrary")){if(!this._selectedApiItem)return;for(let i of this.apiLibrary??[])for(let t of i.items)if(t.name===this._selectedApiItem.name){this._selectedApiItem=t;return}this._selectedApiItem=void 0}}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{u(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_emitItemSelected(e,i){if(!i)return;let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_emitClose(){this.arcgisInternalClosePanel.emit()}_emitItemSelectedAndClose(e,i){let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_selectItem(e,i){e.stopPropagation(),this._selectedApiItem=i}_updateFilterValue(e){this._filterValue=e.currentTarget.value??""}_elementToMarkdown(e){e!==void 0&&(e.innerHTML=n(this._selectedApiItem.examples))}renderApiCategory(e){let i=g(e.items,"name",this._filterValue);return i.length?s`<calcite-list-item-group .heading=${e.title}>${i.map(t=>s`<calcite-list-item .label=${o(t.completion.detail)} @calciteListItemSelect=${l=>this._emitItemSelected(l,t)} @keydown=${l=>this._emitItemSelected(l,t)}><calcite-action slot=actions-end .text=${this.messages.expand??""} icon=chevron-right icon-flip-rtl scale=s @click=${l=>this._selectItem(l,t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>`:null}renderApiItemFlowItem(){let e=this._selectedApiItem;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions?null:s`<calcite-button width=half slot=footer appearance=outline kind=brand scale=s .href=${e.link} target=Help icon-start=information>${this.messages.moreinformation}</calcite-button>`}<calcite-button .width=${this.hideDocumentationActions?"full":"half"} slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${i=>this._emitItemSelectedAndClose(i,e)} ${a(p)}>${this.messages.insert}</calcite-button><calcite-block expanded .heading=${o(e.completion.detail)}><div .innerHTML=${n(e.completion.documentation)??""}></div>${e.examples?s`<div ${a(this._elementToMarkdown)}></div>`:null}</calcite-block></calcite-flow-item>`:null}render(){if(this.closed)return null;let e=(this.apiLibrary??[]).map(t=>this.renderApiCategory(t)),i=e.every(t=>!t);return s`<calcite-flow ${a(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input>${this.loading?s`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:s`<calcite-list .label=${this.messages.api??"API"}>${i?s`<div class="notice-container">${this.messages.noitems}</div>`:e}</calcite-list>`}</calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`}};h("arcgis-language-api-panel",r);export{r as ArcgisLanguageApiPanel};