@arcgis/portal-components 5.2.0-next.1 → 5.2.0-next.11

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 (89) hide show
  1. package/dist/cdn/2CA7QHVV.js +2 -0
  2. package/dist/cdn/{ZTHTFEYA.js → 2V5S6KBL.js} +1 -1
  3. package/dist/cdn/2X4VWQ5E.js +2 -0
  4. package/dist/cdn/{AQWTJKUH.js → 3MQIRMUM.js} +9 -7
  5. package/dist/cdn/{LAFNDBTQ.js → 4BGBBW4V.js} +1 -1
  6. package/dist/cdn/4VRIZNFA.js +2 -0
  7. package/dist/cdn/6AGZRMJC.js +2 -0
  8. package/dist/cdn/6W2IHKCA.js +2 -0
  9. package/dist/cdn/{DHHSKOUY.js → BMUU2S5H.js} +1 -1
  10. package/dist/cdn/{CI5ENGVT.js → CTVWAEEO.js} +1 -1
  11. package/dist/cdn/{WOZDQW3S.js → DB6O5DIG.js} +1 -1
  12. package/dist/cdn/DFTUMKSN.js +3 -0
  13. package/dist/cdn/{RNLVNDGG.js → G3AK2CRM.js} +1 -1
  14. package/dist/cdn/GS6MPCDK.js +2 -0
  15. package/dist/cdn/{5DPWJ7DI.js → IKOAI6C7.js} +1 -1
  16. package/dist/cdn/JVKWYKZR.js +2 -0
  17. package/dist/cdn/{N6G6Z7BF.js → KL4LVBFR.js} +188 -88
  18. package/dist/cdn/{GHQ3ZW4U.js → MLPVRTHY.js} +1 -1
  19. package/dist/cdn/{YG5YYL6X.js → OMD65KRY.js} +1 -1
  20. package/dist/cdn/QGFU75HM.js +3 -0
  21. package/dist/cdn/{K3HS2LQ7.js → QN3ZQLFB.js} +1 -1
  22. package/dist/cdn/{OQDPULPD.js → ROCZLAYA.js} +1 -1
  23. package/dist/cdn/SB25M4FP.js +2 -0
  24. package/dist/cdn/{GT26WGJS.js → SXZRHHXC.js} +1 -1
  25. package/dist/cdn/{53MSUMA3.js → TBYTYYJJ.js} +16 -0
  26. package/dist/cdn/VHSATYO4.js +65 -0
  27. package/dist/cdn/{G47ZZQYL.js → VQU2EEJR.js} +1 -1
  28. package/dist/cdn/{YMPTDKT6.js → W3ZB6MHE.js} +1 -1
  29. package/dist/cdn/{2UUZHENH.js → WSNLUGEP.js} +1 -1
  30. package/dist/cdn/{BEHLBKKM.js → XFFD6YY5.js} +1 -1
  31. package/dist/cdn/{JNRN6DTV.js → XLHPYPQY.js} +1 -1
  32. package/dist/cdn/{LQ3DMZ3K.js → YKHMRMUE.js} +1 -1
  33. package/dist/cdn/{QNUYUNEY.js → Z73H62GB.js} +1 -1
  34. package/dist/cdn/assets/portal-group-badges/t9n/messages.en.json +1 -0
  35. package/dist/cdn/assets/portal-group-card/t9n/messages.en.json +1 -0
  36. package/dist/cdn/assets/portal-item-type/icons/parquetfeaturelayer16.svg +1 -0
  37. package/dist/cdn/assets/portal-item-type/icons/parquetfeaturelayer32.svg +1 -0
  38. package/dist/cdn/assets/portal-item-type/icons/storymapframe16.svg +1 -0
  39. package/dist/cdn/assets/portal-item-type/icons/storymapframe32.svg +1 -0
  40. package/dist/cdn/assets/portal-item-type/t9n/messages.en.json +1 -1
  41. package/dist/cdn/assets/portal-user-popup/t9n/messages.en.json +1 -0
  42. package/dist/cdn/index.js +1 -1
  43. package/dist/cdn/main.css +1 -1
  44. package/dist/chunks/groups.js +7 -83
  45. package/dist/chunks/groups2.js +86 -0
  46. package/dist/chunks/portal.js +48 -8
  47. package/dist/chunks/user2.js +26 -25
  48. package/dist/components/arcgis-portal-ai-assistant/customElement.js +640 -335
  49. package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.js +10 -10
  50. package/dist/components/arcgis-portal-group-badges/customElement.d.ts +102 -0
  51. package/dist/components/arcgis-portal-group-badges/customElement.js +50 -0
  52. package/dist/components/arcgis-portal-group-badges/index.d.ts +1 -0
  53. package/dist/components/arcgis-portal-group-badges/index.js +3 -0
  54. package/dist/components/arcgis-portal-group-badges/types.d.ts +3 -0
  55. package/dist/components/arcgis-portal-group-card/customElement.d.ts +167 -0
  56. package/dist/components/arcgis-portal-group-card/customElement.js +187 -0
  57. package/dist/components/arcgis-portal-group-card/index.d.ts +1 -0
  58. package/dist/components/arcgis-portal-group-card/index.js +8 -0
  59. package/dist/components/arcgis-portal-group-thumbnail/customElement.d.ts +32 -0
  60. package/dist/components/arcgis-portal-group-thumbnail/customElement.js +153 -0
  61. package/dist/components/arcgis-portal-group-thumbnail/index.d.ts +1 -0
  62. package/dist/components/arcgis-portal-group-thumbnail/index.js +3 -0
  63. package/dist/components/arcgis-portal-item-type/customElement.d.ts +2 -0
  64. package/dist/components/arcgis-portal-item-type/customElement.js +45 -37
  65. package/dist/components/arcgis-portal-mentionable-text-area/customElement.js +1 -1
  66. package/dist/components/arcgis-portal-replacement-item-redirect/customElement.js +53 -41
  67. package/dist/components/arcgis-portal-user-popup/customElement.d.ts +111 -0
  68. package/dist/components/arcgis-portal-user-popup/customElement.js +231 -0
  69. package/dist/components/arcgis-portal-user-popup/index.d.ts +1 -0
  70. package/dist/components/arcgis-portal-user-popup/index.js +5 -0
  71. package/dist/components/arcgis-portal-voice-input/customElement.d.ts +1 -1
  72. package/dist/docs/api.json +1 -1
  73. package/dist/docs/docs.json +1 -1
  74. package/dist/docs/vscode.html-custom-data.json +1 -1
  75. package/dist/docs/web-types.json +1 -1
  76. package/dist/index.d.ts +30 -2
  77. package/dist/loader.js +7 -3
  78. package/dist/types/lumina.d.ts +25 -0
  79. package/dist/types/preact.d.ts +29 -0
  80. package/dist/types/react.d.ts +33 -0
  81. package/dist/types/stencil.d.ts +25 -0
  82. package/dist/types/tracking.d.ts +10 -0
  83. package/dist/types/user.d.ts +2 -2
  84. package/package.json +7 -7
  85. package/dist/cdn/5VSDGPHH.js +0 -2
  86. package/dist/cdn/GNOZCQ34.js +0 -2
  87. package/dist/cdn/KEKBRUUC.js +0 -2
  88. package/dist/cdn/SM4GWLRA.js +0 -66
  89. package/dist/cdn/TMYTUOSS.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as R}from"./LQ3DMZ3K.js";import"./KEKBRUUC.js";import{H as c,I as d,J as S,K as F,L as V,P as M,h as C,j as l,v as y}from"./DHHSKOUY.js";import"./YIMNOUTF.js";export default $arcgis.t(([T,I,b,x,P,g,h,N,m,u,w,v,D,O,G,z,j,k,W,B,J])=>{var U=C`.extent-picker-modal{z-index:1001}.extent-picker-content{display:flex;min-height:100%;height:100%}.side-panel{padding:var(--calcite-spacing-lg);display:flex;flex-direction:column;overflow-y:auto;max-height:100%;width:420px}.extent-button{margin-top:var(--calcite-spacing-lg)}.use-location-header{margin-top:var(--calcite-spacing-xxxl);margin-bottom:var(--calcite-spacing-lg)}.search-container,.search-container .esri-search{width:100%}.search-container calcite-autocomplete{width:100%}.map-panel{flex:1 1 0%;position:relative;display:flex}.map-loader{position:absolute;z-index:var(--calcite-z-index-1);top:50%;left:50%;transform:translate(-50%,-50%)}.map-container{flex:1 1 0%;opacity:0;transition:opacity .3s ease}.loader-container{flex:1 1 0%}.map-container--loaded{opacity:1}.coordinates-section{margin-top:var(--calcite-spacing-lg)}`,L=class{constructor(e){this.outerRing=[[180,-90],[-180,-90],[-180,90],[180,90],[180,-90]],this.map=e}init(){this.maskSymbol=new k({color:[0,0,0,.5],outline:{color:[128,128,128,.5],width:"0px"}}),this.maskLayer=new v({id:"maskLayer "}),this.overlapLayer=new v({id:"overlapLayer"}),this.map?.add(this.maskLayer),this.map?.add(this.overlapLayer)}hide(){this.maskLayer.visible=!1}show(){this.maskLayer.visible=!0}add(e,t){let i=this.buildGraphic(e,t);if(i)return i.graphic&&this.maskLayer?.add(i.graphic),i}update(e,t,i){i?this.remove(null,i):this.clear();let a=this.buildGraphic(e,t);if(a)return a.graphic&&this.maskLayer?.add(a.graphic),a}clear(){this.maskLayer?.removeAll()}remove(e,t){!e&&!t||(t&&!e&&(e=this.maskLayer?.graphics.getItemAt(t)),e&&this.maskLayer?.remove(e))}buildGraphic(e,t=this.maskSymbol){let i={};if(!e)return i;if(e.type==="extent"&&e.xmax===e.xmin){let o=new h({rings:[this.outerRing]});return i.graphic=new u({geometry:o,symbol:t}),i}e=this.toWGS84(e);let a,s;if(e.type==="extent"){let o=this.checkPolyOverlap(e);o?(a=o?.ring?.reverse(),s=o?.oring?.reverse()):a=[[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin],[e.xmin,e.ymax]]}let r=[];e.xmin===e.xmax?r=[this.outerRing]:r=[this.outerRing,a?.reverse()||[[]]];let n=new h({rings:r});return s&&(i.overlap=s),i.graphic=new u({geometry:n,symbol:t}),i}checkPolyOverlap(e){let t={};if(e.xmax<=e.xmin){let i=[[e.xmin,e.ymin],[180,e.ymin],[180,e.ymax],[e.xmin,e.ymax],[e.xmin,e.ymin]],a=[[-180,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax],[-180,e.ymax],[-180,e.ymin]],s=180-Math.abs(e.xmax),r=180-Math.abs(e.xmin);return s>r?(t.ring=a,t.oring=i):(t.ring=i,t.oring=a),t}else return}toWGS84(e){let t=new N({wkid:4326});return m.canProject(e,t)?m.project(e,t):e}};function q(p){if(!p)return;let e=b.assetsPath;e.endsWith("/")||(e+="/"),p?.firstElementChild?.insertAdjacentHTML("beforebegin",`<link rel="stylesheet" href="${e}esri/themes/light/main.css" />`)}var $=class extends S{constructor(){super(...arguments),this.polygonSymbol=new k({style:"solid",color:new I([227,139,79,0]),outline:{color:new I([65,105,255]),width:0}}),this.dlOverlapSymbol=new k({style:"solid",color:[255,0,0,.5],outline:{color:[65,105,255],width:0}}),this.messages=R(),this.searchContainer=c(),this.mapContainer=c(),this.topCoordField=c(),this.bottomCoordField=c(),this.leftCoordField=c(),this.rightCoordField=c(),this.minLatLabel="",this.maxLatLabel="",this.minLngLabel="",this.maxLngLabel="",this.ymax="0",this.ymin="0",this.xmin="0",this.xmax="0",this.isDrawStart=!1,this.loading=!0,this.active=!1,this.contentOnly=!1,this.isArea=!1,this.arcgisExtentPickerChange=y(),this.arcgisExtentPickerClose=y(),this.arcgisExtentPickerSave=y()}static{this.properties={ymax:16,ymin:16,xmin:16,xmax:16,isDrawStart:16,loading:16,featureExtent:16,initialValue:16,active:5,extentValue:0,itemId:1,portal:0,extentService:1,contentOnly:5,isArea:5}}static{this.styles=U}getExtent(){return this.getExtentValue()}async load(){if(this.itemId){if(this.portal){let t=this.portal.url.replace("/sharing/rest/","");t!==b.portalUrl&&(b.portalUrl=t)}let e=new Intl.NumberFormat(w.getLocale(),{minimumFractionDigits:1,maximumFractionDigits:1});this.minLatLabel=e.format(-90),this.maxLatLabel=e.format(90),this.minLngLabel=e.format(-180),this.maxLngLabel=e.format(180),this.item=new z({id:this.itemId,portal:this.portal}),await this.item.load()}if(this.portal&&(this.orgExtent=this.portal.defaultExtent?.toJSON()),this.portal?.region){let e=this.portal.region,t=await j(`${this.portal.url.replace("/sharing/rest/","")}/sharing/rest/portals/self?region=${e}&default=true&f=pjson`,{responseType:"json"});this.orgRegionExtent=t.data.defaultExtent}}async loaded(){q(this.el.shadowRoot),await this.initMap()}convertToNumber(e){return this.parseNumber(e)}setFeatureExtent(e){let t;e.spatialReference.isGeographic?t=new x({xmax:e.xmax,xmin:e.xmin,ymax:e.ymax,ymin:e.ymin,spatialReference:{wkid:4326}}):t=this.toWGS84(e),this.featureExtent?(this.featureExtent.xmin=Math.min(t.xmin,this.featureExtent.xmin),this.featureExtent.ymin=Math.min(t.ymin,this.featureExtent.ymin),this.featureExtent.xmax=Math.max(t.xmax,this.featureExtent.xmax),this.featureExtent.ymax=Math.max(t.ymax,this.featureExtent.ymax)):this.featureExtent=t}async initMap(){let e=new G({basemap:"streets-vector"});if(this.extentService){let t=new O({url:this.extentService}),i=new T({baseLayers:[t],id:"org_basemap"});e.basemap=i}if(this.mask=new L(e),this.mask.init(),this.dateLineLayer=new v({id:"dateLineLayer"}),e.add(this.dateLineLayer),this.areasLayer=new v({id:"areaGraphics"}),e.add(this.areasLayer),this.item?.type==="Feature Service"||this.item?.type==="Map Service"){let t=await D.fromPortalItem({portalItem:this.item});t.visible=!1,e.add(t),t.when(i=>{if("layers"in i)for(let a=0;a<i.layers.length;a++)i.layers.getItemAt(a).queryExtent().then(s=>{s.extent&&this.setFeatureExtent(s.extent)});else i.queryExtent().then(a=>{a.extent&&this.setFeatureExtent(a.extent)})})}this.view=new W({map:e,popup:{dockEnabled:!0,dockOptions:{buttonEnabled:!1,breakpoint:!1,position:"bottom-center"}},zoom:2,center:[0,0],container:this.mapContainer.value}),this.view.when(async()=>{if(this.basemapExtent=this.getBasemapExtent(),this.itemExtent=this.item?.extent,this.extentValue?.xmax!==void 0&&this.extentValue?.xmin!==void 0&&this.extentValue?.ymax!==void 0&&this.extentValue?.ymin!==void 0)this.ymin=this.extentValue?.ymin||"0",this.ymax=this.extentValue?.ymax||"0",this.xmax=this.extentValue?.xmax||"0",this.xmin=this.extentValue?.xmin||"0",this.handleInputChange(),this.initialValue=this.currentExtent;else if(this.itemExtent)await this.drawExtent(this.itemExtent),this.initialValue=this.itemExtent;else if(this.featureExtent)await this.drawExtent(this.featureExtent),this.initialValue=this.featureExtent;else if(this.portal?.defaultExtent){let t=this.portal.defaultExtent.toJSON();await this.drawExtent(t),this.initialValue=t}this.initSearchWidget(),this.loading=!1})}getBasemapExtent(){try{let e,t,i,a;if(this.view?.map?.basemap?.hasOwnProperty("baseLayers")){let s=this.view.map.basemap.baseLayers;if(s.length>0){for(let r of s){let n=r.fullExtent||{xmin:0,ymin:0,xmax:0,ymax:0};e=e!==void 0&&e>n?.xmin?e:n.xmin,i=i!==void 0&&i>n?.ymin?i:n.ymin,t=t!==void 0&&t<n.xmax?t:n.xmax,a=a!==void 0&&a<n.ymax?a:n.ymax}return new x({xmin:e,xmax:t,ymin:i,ymax:a,spatialReference:this.view.spatialReference})}}return new x({ymin:-90,ymax:90,xmin:-180,xmax:180,spatialReference:{wkid:4326}})}catch{return new x({ymin:-90,ymax:90,xmin:-180,xmax:180,spatialReference:{wkid:4326}})}}async drawExtent(e){if(!e||!e.xmin&&e.xmin!==0||!e.xmax&&e.xmax!==0||!e.ymin&&e.ymin!==0||!e.ymax&&e.ymax!==0)return;let t=new h;t.spatialReference=e.spatialReference,t.addRing([new g({x:e.xmin,y:e.ymin}),new g({x:e.xmin,y:e.ymax}),new g({x:e.xmax,y:e.ymax}),new g({x:e.xmax,y:e.ymin}),new g({x:e.xmin,y:e.ymin})]),await this.addInitialExtentPicker({geometry:t})}toWGS84(e){let t=new N({wkid:4326});return m.canProject(e,t)?m.project(e,t):e}formatNum(e){return w.formatNumber(e,{minimumFractionDigits:6,maximumFractionDigits:6})}strippedInvalidChars(e){let t=Array.from({length:10},(i,a)=>a.toString()).join("");return Array.from(e).filter(i=>t.includes(i)||i==="."||i==="-").join("")}parseNumber(e){let t=e.replace(",",".");return t=this.strippedInvalidChars(t),parseFloat(t)}async startupSketching(e,t){if(e&&(e=this.toMap(e)),this.sketchViewModel=new J({updateOnGraphicClick:!1,layer:this.areasLayer,view:this.view,polygonSymbol:this.polygonSymbol}),this.clearAllGraphics(),!t)if(e){e.type==="extent"&&(e=h.fromExtent(e)),this.currentExtent=this.toWGS84(e?.extent?.toJSON()),this.ymax=this.formatNum(this.currentExtent.ymax),this.ymin=this.formatNum(this.currentExtent.ymin),this.xmin=this.formatNum(this.currentExtent.xmin),this.xmax=this.formatNum(this.currentExtent.xmax),this.arcgisExtentPickerChange.emit(this.getExtentValue()),e=P.intersect(e,this.basemapExtent);let i=new u({symbol:this.polygonSymbol,geometry:e});i.geometry&&(this.fallbackExtent=i.geometry.extent,this.areasLayer?.add(i),this.mask?.clear(),this.mask?.update(i.geometry.extent),await this.zoomTo(),setTimeout(async()=>{try{i.layer&&await this.sketchViewModel?.update([i],{tool:"transform",enableRotation:!1,toggleToolOnClick:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!1}})}catch{}},0))}else this.sketchViewModel.create("rectangle");this.addSketchListeners()}addSketchListeners(){this.sketchViewModel?.on("update",async e=>{if(!e.toolEventInfo)return;let t=e?.graphics?.[0]?.geometry?.extent,i=t&&this.mask?.update(t);if(e.toolEventInfo.type==="scale-stop"||e.toolEventInfo.type==="move-stop"){let a,s=parseFloat(`${t?.xmax??"0"}`).toFixed(6),r=parseFloat(`${t?.xmin??"0"}`).toFixed(6),n=parseFloat(`${t?.ymax??"0"}`).toFixed(6),o=parseFloat(`${t?.ymin??"0"}`).toFixed(6);if(s===r||n===o?(a=t,s===r&&(a.xmax+=1),n===o&&(a.ymax+=1)):a=e?.graphics?.[0]?.geometry?.extent,i?.overlap){let E=i.graphic?.geometry,A=new h({rings:[E?.rings[1]]});await this.addInitialExtentPicker({geometry:A.extent})}else await this.startupSketching(a);this.isDrawStart=!1}else if(this.dateLineLayer?.removeAll(),i?.overlap){let a=new u({geometry:new h({rings:[i.overlap]}),symbol:this.dlOverlapSymbol});this.dateLineLayer?.add(a)}}),this.sketchViewModel?.on("create",async e=>{if(this.dateLineLayer?.removeAll(),!e.graphic)return;this.mask?.clear();let t=e?.graphic?.geometry?.extent,i=this.mask?.add(t);if(i?.overlap?(this.remainderPoly=new u({geometry:new h({rings:[i.overlap]}),symbol:this.dlOverlapSymbol}),this.dateLineLayer?.add(this.remainderPoly)):this.remainderPoly=null,e.state==="complete"){let a,s=e.graphic?.geometry?.extent?.xmin||0,r=e.graphic?.geometry?.extent?.xmax||0,n=e.graphic?.geometry?.extent?.ymin||0,o=e.graphic?.geometry?.extent?.ymax||0;if(s===r||n===o)s===r&&(r=r+1),n===o&&(o=o+1),a=new x({xmin:s,xmax:r,ymin:n,ymax:o,spatialReference:e.graphic?.geometry?.extent?.spatialReference});else{let E=i?.graphic?.geometry;a=new h({rings:[E?.rings[1]]}).extent}this.remainderPoly?await this.addInitialExtentPicker({geometry:a}):await this.startupSketching(a),this.isDrawStart=!1,this.mapContainer.value.focus()}})}async addInitialExtentPicker(e){if(!e.geometry){await this.startupSketching(null,!0);return}let t=this.toMap(e.geometry);await this.startupSketching(t)}async zoomTo(){if(this.areasLayer?.graphics){let e;if(this.areasLayer.graphics.forEach(i=>{let a=i?.geometry?.extent;e=e?e.union(a):a}),!e)return;let t=this.toMap(x.fromJSON(e.toJSON()).expand(1.35));t&&await this.view?.goTo(t)}}clearAllGraphics(){this.sketchViewModel?.cancel(),this.view?.map?.layers?.forEach(e=>{e.type==="graphics"&&e.removeAll()})}toMap(e){return this.view&&m.canProject(e,this.view)?m.project(e,this.view.spatialReference):e}initSearchWidget(){let e=new B({view:this.view,popupEnabled:!1,resultGraphicEnabled:!1,container:this.searchContainer.value}),t=e.viewModel;e.viewModel.allSources.on("change",()=>{t.allSources.forEach(i=>{i.zoomScale=null})}),e.on("select-result",i=>{this.startupSketching(i.result.extent)})}getExtentValue(){return{extent:{ymin:this.normalizeDecimal(this.ymin),ymax:this.normalizeDecimal(this.ymax),xmin:this.normalizeDecimal(this.xmin),xmax:this.normalizeDecimal(this.xmax)}}}handleInputChange(){let e=this.parseNumber(this.ymin),t=this.parseNumber(this.ymax),i=this.parseNumber(this.xmin),a=this.parseNumber(this.xmax),s=new x({spatialReference:{wkid:4326},xmin:i,xmax:a,ymin:e,ymax:t});this.currentExtent=s,this.drawExtent(s)}handleSave(){if(!this.topCoordField.value.isValid()){this.topCoordField.value.setFocus();return}if(!this.bottomCoordField.value.isValid()){this.bottomCoordField.value.setFocus();return}if(!this.leftCoordField.value.isValid()){this.leftCoordField.value.setFocus();return}if(!this.rightCoordField.value.isValid()){this.rightCoordField.value.setFocus();return}this.arcgisExtentPickerSave.emit(this.getExtentValue())}normalizeDecimal(e){return e.replace(",",".")}formatLongitudeError(e){return e.replace("${minLng}",this.minLngLabel).replace("${maxLng}",this.maxLngLabel)}formatLatitudeError(e){return e.replace("${minLat}",this.minLatLabel).replace("${maxLat}",this.maxLatLabel)}async timeout(e){return await new Promise(t=>setTimeout(t,e))}renderModal(){return l`<calcite-dialog class="extent-picker-modal" role=dialog scale=l outside-close-disabled .open=${this.active} placement=cover @calciteDialogClose=${()=>{this.arcgisExtentPickerClose.emit()}} style=${V({"--calcite-dialog-content-space":"0"})} .heading=${this.isArea?this.messages.setArea:this.messages.setExtent} heading-level=3><div class="extent-picker-content">${this.renderContent()}</div>${this.initialValue&&l`<calcite-button appearance=outline slot=footer-start icon-start=reset @click=${async()=>{if(this.initialValue){let e=+this.ymin===f(this.initialValue.ymin)&&+this.ymax===f(this.initialValue.ymax);+this.xmin===f(this.initialValue.xmin)&&+this.xmax===f(this.initialValue.xmax)&&e&&(this.ymin="0",this.ymax="0",this.xmin="0",this.xmax="0",await this.timeout(100)),this.drawExtent(this.initialValue)}}}>${this.messages.revert}</calcite-button>`||""}<calcite-button appearance=outline slot=footer-end @click=${()=>this.arcgisExtentPickerClose.emit()}>${this.messages.cancel}</calcite-button><calcite-button slot=footer-end @click=${async()=>this.handleSave()}>${this.messages.save}</calcite-button></calcite-dialog>`}renderContent(){let e=!!(this.portal&&!this.portal.id),t=!!(this.orgExtent&&!e),i=!!(this.orgRegionExtent&&!e),a=!!this.featureExtent;return l`<div class="side-panel">${!(!t&&!i&&!a)&&l`<div>${this.isArea?this.messages.areaBasedOn:this.messages.extentBasedOn}</div>${t&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=organization @click=${()=>{this.drawExtent(this.orgExtent)}}>${this.messages.orgExtent}</calcite-button>`||""}${i&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=organization @click=${()=>{this.drawExtent(this.orgRegionExtent)}}>${this.messages.orgRegion}</calcite-button>`||""}${a&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=feature-layer @click=${()=>{this.drawExtent(this.featureExtent)}}>${this.messages.currentFeatures}</calcite-button>`||""}`||""}<div class="use-location-header">${this.messages.useLocation}</div><div class="search-container"><div ${d(this.searchContainer)}></div></div><div><div class="use-location-header">${this.isArea?this.messages.drawAreaTitle:this.messages.drawExtentTitle}</div><calcite-action .text=${(this.isArea?this.messages.drawArea:this.messages.drawExtent)||""} text-enabled icon=rectangle-plus .active=${this.isDrawStart} .indicator=${this.isDrawStart} @click=${async()=>{this.isDrawStart=!this.isDrawStart,this.isDrawStart?(this.sketchViewModel||await this.startupSketching(),this.clearAllGraphics(),this.sketchViewModel?.create("rectangle")):(this.sketchViewModel?.cancel(),this.startupSketching(this.fallbackExtent))}}></calcite-action></div><div class="coordinates-section"><calcite-accordion appearance=transparent icon-position=start scale=l><calcite-accordion-item .heading=${this.messages.coordinates}><p>${this.messages.coordinatesDescription}</p><arcgis-portal-extent-picker-coord-field input-id=top-coord .label=${this.messages.top} .value=${this.strippedInvalidChars(this.ymax)} .errorMessage=${this.formatLatitudeError(this.messages.invalidTop||"")} min=-90 max=90 @arcgisCoordChange=${s=>{this.ymax=s.detail;let r=this.bottomCoordField.value.checkRelatedField();r&&(this.ymin=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.topGreaterThanBottom} .validateRelated=${s=>s>this.convertToNumber(this.ymin)} ${d(this.topCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=bottom-coord .label=${this.messages.bottom} .value=${this.strippedInvalidChars(this.ymin)} .errorMessage=${this.formatLatitudeError(this.messages.invalidBottom||"")} min=-90 max=90 @arcgisCoordChange=${s=>{this.ymin=s.detail;let r=this.topCoordField.value.checkRelatedField();r&&(this.ymax=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.bottomLessThanTop} .validateRelated=${s=>s<this.convertToNumber(this.ymax)} ${d(this.bottomCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=left-coord .label=${this.messages.left} .value=${this.strippedInvalidChars(this.xmin)} .errorMessage=${this.formatLongitudeError(this.messages.invalidLeft||"")} min=-180 max=180 @arcgisCoordChange=${s=>{this.xmin=s.detail;let r=this.rightCoordField.value.checkRelatedField();r&&(this.xmax=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.leftLessThanRight} .validateRelated=${s=>s<this.convertToNumber(this.xmax)} ${d(this.leftCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=right-coord .label=${this.messages.right} .value=${this.strippedInvalidChars(this.xmax)} .errorMessage=${this.formatLongitudeError(this.messages.invalidRight||"")} min=-180 max=180 @arcgisCoordChange=${s=>{this.xmax=s.detail;let r=this.leftCoordField.value.checkRelatedField();r&&(this.xmin=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.rightGreaterThanLeft} .validateRelated=${s=>s>this.convertToNumber(this.xmin)} ${d(this.rightCoordField)}></arcgis-portal-extent-picker-coord-field></calcite-accordion-item></calcite-accordion></div></div><div class="map-panel">${this.loading&&l`<calcite-loader class="map-loader" label="Loading the application"></calcite-loader>`||""}<div class=${F({"map-container":!0,"map-container--loaded":!this.loading})} ${d(this.mapContainer)}></div></div>`}render(){return this.contentOnly?l`<div class="extent-picker-content">${this.renderContent()}</div>`:this.renderModal()}};function f(p){return Math.round(p*1e6)/1e6}M("arcgis-portal-extent-picker",$);return $},"Basemap","Color","config","geometry/Extent","geometry/geometryEngine","geometry/Point","geometry/Polygon","geometry/SpatialReference","geometry/support/webMercatorUtils","Graphic","intl","layers/GraphicsLayer","layers/Layer","layers/TileLayer","Map","portal/PortalItem","request","symbols/SimpleFillSymbol","views/MapView","widgets/Search","widgets/Sketch/SketchViewModel")
2
+ import{a as R}from"./YKHMRMUE.js";import"./GS6MPCDK.js";import{H as c,I as d,J as S,K as F,L as V,P as M,h as C,j as l,v as y}from"./BMUU2S5H.js";import"./YIMNOUTF.js";export default $arcgis.t(([T,I,b,x,P,g,h,N,m,u,w,v,D,O,G,z,j,k,W,B,J])=>{var U=C`.extent-picker-modal{z-index:1001}.extent-picker-content{display:flex;min-height:100%;height:100%}.side-panel{padding:var(--calcite-spacing-lg);display:flex;flex-direction:column;overflow-y:auto;max-height:100%;width:420px}.extent-button{margin-top:var(--calcite-spacing-lg)}.use-location-header{margin-top:var(--calcite-spacing-xxxl);margin-bottom:var(--calcite-spacing-lg)}.search-container,.search-container .esri-search{width:100%}.search-container calcite-autocomplete{width:100%}.map-panel{flex:1 1 0%;position:relative;display:flex}.map-loader{position:absolute;z-index:var(--calcite-z-index-1);top:50%;left:50%;transform:translate(-50%,-50%)}.map-container{flex:1 1 0%;opacity:0;transition:opacity .3s ease}.loader-container{flex:1 1 0%}.map-container--loaded{opacity:1}.coordinates-section{margin-top:var(--calcite-spacing-lg)}`,L=class{constructor(e){this.outerRing=[[180,-90],[-180,-90],[-180,90],[180,90],[180,-90]],this.map=e}init(){this.maskSymbol=new k({color:[0,0,0,.5],outline:{color:[128,128,128,.5],width:"0px"}}),this.maskLayer=new v({id:"maskLayer "}),this.overlapLayer=new v({id:"overlapLayer"}),this.map?.add(this.maskLayer),this.map?.add(this.overlapLayer)}hide(){this.maskLayer.visible=!1}show(){this.maskLayer.visible=!0}add(e,t){let i=this.buildGraphic(e,t);if(i)return i.graphic&&this.maskLayer?.add(i.graphic),i}update(e,t,i){i?this.remove(null,i):this.clear();let a=this.buildGraphic(e,t);if(a)return a.graphic&&this.maskLayer?.add(a.graphic),a}clear(){this.maskLayer?.removeAll()}remove(e,t){!e&&!t||(t&&!e&&(e=this.maskLayer?.graphics.getItemAt(t)),e&&this.maskLayer?.remove(e))}buildGraphic(e,t=this.maskSymbol){let i={};if(!e)return i;if(e.type==="extent"&&e.xmax===e.xmin){let o=new h({rings:[this.outerRing]});return i.graphic=new u({geometry:o,symbol:t}),i}e=this.toWGS84(e);let a,s;if(e.type==="extent"){let o=this.checkPolyOverlap(e);o?(a=o?.ring?.reverse(),s=o?.oring?.reverse()):a=[[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin],[e.xmin,e.ymax]]}let r=[];e.xmin===e.xmax?r=[this.outerRing]:r=[this.outerRing,a?.reverse()||[[]]];let n=new h({rings:r});return s&&(i.overlap=s),i.graphic=new u({geometry:n,symbol:t}),i}checkPolyOverlap(e){let t={};if(e.xmax<=e.xmin){let i=[[e.xmin,e.ymin],[180,e.ymin],[180,e.ymax],[e.xmin,e.ymax],[e.xmin,e.ymin]],a=[[-180,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax],[-180,e.ymax],[-180,e.ymin]],s=180-Math.abs(e.xmax),r=180-Math.abs(e.xmin);return s>r?(t.ring=a,t.oring=i):(t.ring=i,t.oring=a),t}else return}toWGS84(e){let t=new N({wkid:4326});return m.canProject(e,t)?m.project(e,t):e}};function q(p){if(!p)return;let e=b.assetsPath;e.endsWith("/")||(e+="/"),p?.firstElementChild?.insertAdjacentHTML("beforebegin",`<link rel="stylesheet" href="${e}esri/themes/light/main.css" />`)}var $=class extends S{constructor(){super(...arguments),this.polygonSymbol=new k({style:"solid",color:new I([227,139,79,0]),outline:{color:new I([65,105,255]),width:0}}),this.dlOverlapSymbol=new k({style:"solid",color:[255,0,0,.5],outline:{color:[65,105,255],width:0}}),this.messages=R(),this.searchContainer=c(),this.mapContainer=c(),this.topCoordField=c(),this.bottomCoordField=c(),this.leftCoordField=c(),this.rightCoordField=c(),this.minLatLabel="",this.maxLatLabel="",this.minLngLabel="",this.maxLngLabel="",this.ymax="0",this.ymin="0",this.xmin="0",this.xmax="0",this.isDrawStart=!1,this.loading=!0,this.active=!1,this.contentOnly=!1,this.isArea=!1,this.arcgisExtentPickerChange=y(),this.arcgisExtentPickerClose=y(),this.arcgisExtentPickerSave=y()}static{this.properties={ymax:16,ymin:16,xmin:16,xmax:16,isDrawStart:16,loading:16,featureExtent:16,initialValue:16,active:5,extentValue:0,itemId:1,portal:0,extentService:1,contentOnly:5,isArea:5}}static{this.styles=U}getExtent(){return this.getExtentValue()}async load(){if(this.itemId){if(this.portal){let t=this.portal.url.replace("/sharing/rest/","");t!==b.portalUrl&&(b.portalUrl=t)}let e=new Intl.NumberFormat(w.getLocale(),{minimumFractionDigits:1,maximumFractionDigits:1});this.minLatLabel=e.format(-90),this.maxLatLabel=e.format(90),this.minLngLabel=e.format(-180),this.maxLngLabel=e.format(180),this.item=new z({id:this.itemId,portal:this.portal}),await this.item.load()}if(this.portal&&(this.orgExtent=this.portal.defaultExtent?.toJSON()),this.portal?.region){let e=this.portal.region,t=await j(`${this.portal.url.replace("/sharing/rest/","")}/sharing/rest/portals/self?region=${e}&default=true&f=pjson`,{responseType:"json"});this.orgRegionExtent=t.data.defaultExtent}}async loaded(){q(this.el.shadowRoot),await this.initMap()}convertToNumber(e){return this.parseNumber(e)}setFeatureExtent(e){let t;e.spatialReference.isGeographic?t=new x({xmax:e.xmax,xmin:e.xmin,ymax:e.ymax,ymin:e.ymin,spatialReference:{wkid:4326}}):t=this.toWGS84(e),this.featureExtent?(this.featureExtent.xmin=Math.min(t.xmin,this.featureExtent.xmin),this.featureExtent.ymin=Math.min(t.ymin,this.featureExtent.ymin),this.featureExtent.xmax=Math.max(t.xmax,this.featureExtent.xmax),this.featureExtent.ymax=Math.max(t.ymax,this.featureExtent.ymax)):this.featureExtent=t}async initMap(){let e=new G({basemap:"streets-vector"});if(this.extentService){let t=new O({url:this.extentService}),i=new T({baseLayers:[t],id:"org_basemap"});e.basemap=i}if(this.mask=new L(e),this.mask.init(),this.dateLineLayer=new v({id:"dateLineLayer"}),e.add(this.dateLineLayer),this.areasLayer=new v({id:"areaGraphics"}),e.add(this.areasLayer),this.item?.type==="Feature Service"||this.item?.type==="Map Service"){let t=await D.fromPortalItem({portalItem:this.item});t.visible=!1,e.add(t),t.when(i=>{if("layers"in i)for(let a=0;a<i.layers.length;a++)i.layers.getItemAt(a).queryExtent().then(s=>{s.extent&&this.setFeatureExtent(s.extent)});else i.queryExtent().then(a=>{a.extent&&this.setFeatureExtent(a.extent)})})}this.view=new W({map:e,popup:{dockEnabled:!0,dockOptions:{buttonEnabled:!1,breakpoint:!1,position:"bottom-center"}},zoom:2,center:[0,0],container:this.mapContainer.value}),this.view.when(async()=>{if(this.basemapExtent=this.getBasemapExtent(),this.itemExtent=this.item?.extent,this.extentValue?.xmax!==void 0&&this.extentValue?.xmin!==void 0&&this.extentValue?.ymax!==void 0&&this.extentValue?.ymin!==void 0)this.ymin=this.extentValue?.ymin||"0",this.ymax=this.extentValue?.ymax||"0",this.xmax=this.extentValue?.xmax||"0",this.xmin=this.extentValue?.xmin||"0",this.handleInputChange(),this.initialValue=this.currentExtent;else if(this.itemExtent)await this.drawExtent(this.itemExtent),this.initialValue=this.itemExtent;else if(this.featureExtent)await this.drawExtent(this.featureExtent),this.initialValue=this.featureExtent;else if(this.portal?.defaultExtent){let t=this.portal.defaultExtent.toJSON();await this.drawExtent(t),this.initialValue=t}this.initSearchWidget(),this.loading=!1})}getBasemapExtent(){try{let e,t,i,a;if(this.view?.map?.basemap?.hasOwnProperty("baseLayers")){let s=this.view.map.basemap.baseLayers;if(s.length>0){for(let r of s){let n=r.fullExtent||{xmin:0,ymin:0,xmax:0,ymax:0};e=e!==void 0&&e>n?.xmin?e:n.xmin,i=i!==void 0&&i>n?.ymin?i:n.ymin,t=t!==void 0&&t<n.xmax?t:n.xmax,a=a!==void 0&&a<n.ymax?a:n.ymax}return new x({xmin:e,xmax:t,ymin:i,ymax:a,spatialReference:this.view.spatialReference})}}return new x({ymin:-90,ymax:90,xmin:-180,xmax:180,spatialReference:{wkid:4326}})}catch{return new x({ymin:-90,ymax:90,xmin:-180,xmax:180,spatialReference:{wkid:4326}})}}async drawExtent(e){if(!e||!e.xmin&&e.xmin!==0||!e.xmax&&e.xmax!==0||!e.ymin&&e.ymin!==0||!e.ymax&&e.ymax!==0)return;let t=new h;t.spatialReference=e.spatialReference,t.addRing([new g({x:e.xmin,y:e.ymin}),new g({x:e.xmin,y:e.ymax}),new g({x:e.xmax,y:e.ymax}),new g({x:e.xmax,y:e.ymin}),new g({x:e.xmin,y:e.ymin})]),await this.addInitialExtentPicker({geometry:t})}toWGS84(e){let t=new N({wkid:4326});return m.canProject(e,t)?m.project(e,t):e}formatNum(e){return w.formatNumber(e,{minimumFractionDigits:6,maximumFractionDigits:6})}strippedInvalidChars(e){let t=Array.from({length:10},(i,a)=>a.toString()).join("");return Array.from(e).filter(i=>t.includes(i)||i==="."||i==="-").join("")}parseNumber(e){let t=e.replace(",",".");return t=this.strippedInvalidChars(t),parseFloat(t)}async startupSketching(e,t){if(e&&(e=this.toMap(e)),this.sketchViewModel=new J({updateOnGraphicClick:!1,layer:this.areasLayer,view:this.view,polygonSymbol:this.polygonSymbol}),this.clearAllGraphics(),!t)if(e){e.type==="extent"&&(e=h.fromExtent(e)),this.currentExtent=this.toWGS84(e?.extent?.toJSON()),this.ymax=this.formatNum(this.currentExtent.ymax),this.ymin=this.formatNum(this.currentExtent.ymin),this.xmin=this.formatNum(this.currentExtent.xmin),this.xmax=this.formatNum(this.currentExtent.xmax),this.arcgisExtentPickerChange.emit(this.getExtentValue()),e=P.intersect(e,this.basemapExtent);let i=new u({symbol:this.polygonSymbol,geometry:e});i.geometry&&(this.fallbackExtent=i.geometry.extent,this.areasLayer?.add(i),this.mask?.clear(),this.mask?.update(i.geometry.extent),await this.zoomTo(),setTimeout(async()=>{try{i.layer&&await this.sketchViewModel?.update([i],{tool:"transform",enableRotation:!1,toggleToolOnClick:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!1}})}catch{}},0))}else this.sketchViewModel.create("rectangle");this.addSketchListeners()}addSketchListeners(){this.sketchViewModel?.on("update",async e=>{if(!e.toolEventInfo)return;let t=e?.graphics?.[0]?.geometry?.extent,i=t&&this.mask?.update(t);if(e.toolEventInfo.type==="scale-stop"||e.toolEventInfo.type==="move-stop"){let a,s=parseFloat(`${t?.xmax??"0"}`).toFixed(6),r=parseFloat(`${t?.xmin??"0"}`).toFixed(6),n=parseFloat(`${t?.ymax??"0"}`).toFixed(6),o=parseFloat(`${t?.ymin??"0"}`).toFixed(6);if(s===r||n===o?(a=t,s===r&&(a.xmax+=1),n===o&&(a.ymax+=1)):a=e?.graphics?.[0]?.geometry?.extent,i?.overlap){let E=i.graphic?.geometry,A=new h({rings:[E?.rings[1]]});await this.addInitialExtentPicker({geometry:A.extent})}else await this.startupSketching(a);this.isDrawStart=!1}else if(this.dateLineLayer?.removeAll(),i?.overlap){let a=new u({geometry:new h({rings:[i.overlap]}),symbol:this.dlOverlapSymbol});this.dateLineLayer?.add(a)}}),this.sketchViewModel?.on("create",async e=>{if(this.dateLineLayer?.removeAll(),!e.graphic)return;this.mask?.clear();let t=e?.graphic?.geometry?.extent,i=this.mask?.add(t);if(i?.overlap?(this.remainderPoly=new u({geometry:new h({rings:[i.overlap]}),symbol:this.dlOverlapSymbol}),this.dateLineLayer?.add(this.remainderPoly)):this.remainderPoly=null,e.state==="complete"){let a,s=e.graphic?.geometry?.extent?.xmin||0,r=e.graphic?.geometry?.extent?.xmax||0,n=e.graphic?.geometry?.extent?.ymin||0,o=e.graphic?.geometry?.extent?.ymax||0;if(s===r||n===o)s===r&&(r=r+1),n===o&&(o=o+1),a=new x({xmin:s,xmax:r,ymin:n,ymax:o,spatialReference:e.graphic?.geometry?.extent?.spatialReference});else{let E=i?.graphic?.geometry;a=new h({rings:[E?.rings[1]]}).extent}this.remainderPoly?await this.addInitialExtentPicker({geometry:a}):await this.startupSketching(a),this.isDrawStart=!1,this.mapContainer.value.focus()}})}async addInitialExtentPicker(e){if(!e.geometry){await this.startupSketching(null,!0);return}let t=this.toMap(e.geometry);await this.startupSketching(t)}async zoomTo(){if(this.areasLayer?.graphics){let e;if(this.areasLayer.graphics.forEach(i=>{let a=i?.geometry?.extent;e=e?e.union(a):a}),!e)return;let t=this.toMap(x.fromJSON(e.toJSON()).expand(1.35));t&&await this.view?.goTo(t)}}clearAllGraphics(){this.sketchViewModel?.cancel(),this.view?.map?.layers?.forEach(e=>{e.type==="graphics"&&e.removeAll()})}toMap(e){return this.view&&m.canProject(e,this.view)?m.project(e,this.view.spatialReference):e}initSearchWidget(){let e=new B({view:this.view,popupEnabled:!1,resultGraphicEnabled:!1,container:this.searchContainer.value}),t=e.viewModel;e.viewModel.allSources.on("change",()=>{t.allSources.forEach(i=>{i.zoomScale=null})}),e.on("select-result",i=>{this.startupSketching(i.result.extent)})}getExtentValue(){return{extent:{ymin:this.normalizeDecimal(this.ymin),ymax:this.normalizeDecimal(this.ymax),xmin:this.normalizeDecimal(this.xmin),xmax:this.normalizeDecimal(this.xmax)}}}handleInputChange(){let e=this.parseNumber(this.ymin),t=this.parseNumber(this.ymax),i=this.parseNumber(this.xmin),a=this.parseNumber(this.xmax),s=new x({spatialReference:{wkid:4326},xmin:i,xmax:a,ymin:e,ymax:t});this.currentExtent=s,this.drawExtent(s)}handleSave(){if(!this.topCoordField.value.isValid()){this.topCoordField.value.setFocus();return}if(!this.bottomCoordField.value.isValid()){this.bottomCoordField.value.setFocus();return}if(!this.leftCoordField.value.isValid()){this.leftCoordField.value.setFocus();return}if(!this.rightCoordField.value.isValid()){this.rightCoordField.value.setFocus();return}this.arcgisExtentPickerSave.emit(this.getExtentValue())}normalizeDecimal(e){return e.replace(",",".")}formatLongitudeError(e){return e.replace("${minLng}",this.minLngLabel).replace("${maxLng}",this.maxLngLabel)}formatLatitudeError(e){return e.replace("${minLat}",this.minLatLabel).replace("${maxLat}",this.maxLatLabel)}async timeout(e){return await new Promise(t=>setTimeout(t,e))}renderModal(){return l`<calcite-dialog class="extent-picker-modal" role=dialog scale=l outside-close-disabled .open=${this.active} placement=cover @calciteDialogClose=${()=>{this.arcgisExtentPickerClose.emit()}} style=${V({"--calcite-dialog-content-space":"0"})} .heading=${this.isArea?this.messages.setArea:this.messages.setExtent} heading-level=3><div class="extent-picker-content">${this.renderContent()}</div>${this.initialValue&&l`<calcite-button appearance=outline slot=footer-start icon-start=reset @click=${async()=>{if(this.initialValue){let e=+this.ymin===f(this.initialValue.ymin)&&+this.ymax===f(this.initialValue.ymax);+this.xmin===f(this.initialValue.xmin)&&+this.xmax===f(this.initialValue.xmax)&&e&&(this.ymin="0",this.ymax="0",this.xmin="0",this.xmax="0",await this.timeout(100)),this.drawExtent(this.initialValue)}}}>${this.messages.revert}</calcite-button>`||""}<calcite-button appearance=outline slot=footer-end @click=${()=>this.arcgisExtentPickerClose.emit()}>${this.messages.cancel}</calcite-button><calcite-button slot=footer-end @click=${async()=>this.handleSave()}>${this.messages.save}</calcite-button></calcite-dialog>`}renderContent(){let e=!!(this.portal&&!this.portal.id),t=!!(this.orgExtent&&!e),i=!!(this.orgRegionExtent&&!e),a=!!this.featureExtent;return l`<div class="side-panel">${!(!t&&!i&&!a)&&l`<div>${this.isArea?this.messages.areaBasedOn:this.messages.extentBasedOn}</div>${t&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=organization @click=${()=>{this.drawExtent(this.orgExtent)}}>${this.messages.orgExtent}</calcite-button>`||""}${i&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=organization @click=${()=>{this.drawExtent(this.orgRegionExtent)}}>${this.messages.orgRegion}</calcite-button>`||""}${a&&l`<calcite-button class="extent-button" alignment=start scale=l kind=neutral appearance=outline-fill icon-start=feature-layer @click=${()=>{this.drawExtent(this.featureExtent)}}>${this.messages.currentFeatures}</calcite-button>`||""}`||""}<div class="use-location-header">${this.messages.useLocation}</div><div class="search-container"><div ${d(this.searchContainer)}></div></div><div><div class="use-location-header">${this.isArea?this.messages.drawAreaTitle:this.messages.drawExtentTitle}</div><calcite-action .text=${(this.isArea?this.messages.drawArea:this.messages.drawExtent)||""} text-enabled icon=rectangle-plus .active=${this.isDrawStart} .indicator=${this.isDrawStart} @click=${async()=>{this.isDrawStart=!this.isDrawStart,this.isDrawStart?(this.sketchViewModel||await this.startupSketching(),this.clearAllGraphics(),this.sketchViewModel?.create("rectangle")):(this.sketchViewModel?.cancel(),this.startupSketching(this.fallbackExtent))}}></calcite-action></div><div class="coordinates-section"><calcite-accordion appearance=transparent icon-position=start scale=l><calcite-accordion-item .heading=${this.messages.coordinates}><p>${this.messages.coordinatesDescription}</p><arcgis-portal-extent-picker-coord-field input-id=top-coord .label=${this.messages.top} .value=${this.strippedInvalidChars(this.ymax)} .errorMessage=${this.formatLatitudeError(this.messages.invalidTop||"")} min=-90 max=90 @arcgisCoordChange=${s=>{this.ymax=s.detail;let r=this.bottomCoordField.value.checkRelatedField();r&&(this.ymin=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.topGreaterThanBottom} .validateRelated=${s=>s>this.convertToNumber(this.ymin)} ${d(this.topCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=bottom-coord .label=${this.messages.bottom} .value=${this.strippedInvalidChars(this.ymin)} .errorMessage=${this.formatLatitudeError(this.messages.invalidBottom||"")} min=-90 max=90 @arcgisCoordChange=${s=>{this.ymin=s.detail;let r=this.topCoordField.value.checkRelatedField();r&&(this.ymax=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.bottomLessThanTop} .validateRelated=${s=>s<this.convertToNumber(this.ymax)} ${d(this.bottomCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=left-coord .label=${this.messages.left} .value=${this.strippedInvalidChars(this.xmin)} .errorMessage=${this.formatLongitudeError(this.messages.invalidLeft||"")} min=-180 max=180 @arcgisCoordChange=${s=>{this.xmin=s.detail;let r=this.rightCoordField.value.checkRelatedField();r&&(this.xmax=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.leftLessThanRight} .validateRelated=${s=>s<this.convertToNumber(this.xmax)} ${d(this.leftCoordField)}></arcgis-portal-extent-picker-coord-field><arcgis-portal-extent-picker-coord-field input-id=right-coord .label=${this.messages.right} .value=${this.strippedInvalidChars(this.xmax)} .errorMessage=${this.formatLongitudeError(this.messages.invalidRight||"")} min=-180 max=180 @arcgisCoordChange=${s=>{this.xmax=s.detail;let r=this.leftCoordField.value.checkRelatedField();r&&(this.xmin=r),this.handleInputChange()}} .relatedErrorMessage=${this.messages.rightGreaterThanLeft} .validateRelated=${s=>s>this.convertToNumber(this.xmin)} ${d(this.rightCoordField)}></arcgis-portal-extent-picker-coord-field></calcite-accordion-item></calcite-accordion></div></div><div class="map-panel">${this.loading&&l`<calcite-loader class="map-loader" label="Loading the application"></calcite-loader>`||""}<div class=${F({"map-container":!0,"map-container--loaded":!this.loading})} ${d(this.mapContainer)}></div></div>`}render(){return this.contentOnly?l`<div class="extent-picker-content">${this.renderContent()}</div>`:this.renderModal()}};function f(p){return Math.round(p*1e6)/1e6}M("arcgis-portal-extent-picker",$);return $},"Basemap","Color","config","geometry/Extent","geometry/geometryEngine","geometry/Point","geometry/Polygon","geometry/SpatialReference","geometry/support/webMercatorUtils","Graphic","intl","layers/GraphicsLayer","layers/Layer","layers/TileLayer","Map","portal/PortalItem","request","symbols/SimpleFillSymbol","views/MapView","widgets/Search","widgets/Sketch/SketchViewModel")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./GT26WGJS.js";import{a as T}from"./5VSDGPHH.js";import{b as W}from"./QNUYUNEY.js";import{a as q}from"./LQ3DMZ3K.js";import"./KEKBRUUC.js";import{H as C,I as P,J,N as A,P as B,h as R,j as y,o as N,q as S,r as j,v as E}from"./DHHSKOUY.js";import"./YIMNOUTF.js";export default $arcgis.t(([le,Ie,ve,Fe,x,de,I,pe,fe,L,Z,$,ee,{g:G,i:z,j:V,k:U,l:_,m:H,n:K,o:Q,p:X,q:Y}])=>{var k=(i=>(i.expression="expression/",i))(k||{});function F(i){return i!=null}function te(i,e,t){let s=e.fieldName;if(s.includes(k.expression)){let r=t.get(s);return r?.title?r.title:s}else return ee.supportsFieldConfiguration(i)&&i.getFieldConfiguration(s)?i.getFieldAlias(s)||s:e.label||s}function se(i,e,t){let s="";if(/^raster.(?:item|service)pixelvalue/iu.test(i))s="number";else if(e.has(i)){let r=e.get(i);s=r.type?r.type.toLowerCase():""}else if(t.has(i)){let r=t.get(i);s=r.returnType?r.returnType.toLowerCase():""}else s="number";return s}async function ie(i){return new Map((await me(i)).filter(e=>e.visible).map(e=>[e.name,e]))}function re(i){let e=new Map;return i?.expressionInfos&&i.expressionInfos.forEach(t=>{let s=`${k.expression}${t.name}`;e.set(s,t)}),e}async function me(i){return await new Promise((e,t)=>{switch(i.type){case"feature":case"ogc-feature":case"stream":e(i.fields);break;case"sublayer":{let s=i,r=s?.layer;r?.portalItem&&r.url.includes("https://demographics")&&r.url.includes(".arcgis.com")?r.portalItem?.fetchData().then(a=>{if(a?.thematicGroup){let o=new Map(s.fields.map(n=>[n.name,n])),c=a.thematicGroup.fieldNames,p=[];c.forEach(n=>{o.has(n)&&p.push(o.get(n))}),e(p)}else e(s.fields)}).catch(a=>{t(new Error(a))}):e(s.fields);break}case"imagery":case"imagery-tile":case"wcs":e(i.rasterFields);break;default:e("fields"in i?i.fields??[]:[])}})}function d(i,e){return!i||!e?!1:i.toLocaleLowerCase()===e.toLocaleLowerCase()}async function ae(i,e,t,s){if(!t)return!1;let r=["feature","oriented-imagery"].includes(e.type),a=s?.item??e.portalItem,o=e.sourceJSON;if(!r||!a||!a.portal.user||!U(a)||V(a)||_(a)||H(o)||a.portal.isPortal&&z(a)||["oid","global-id","geometry"].includes(t.type)||await ue(e,t.name,s))return!1;let c=e.sourceJSON.geometryProperties,p=c?.shapeLengthFieldName,n=c?.shapeAreaFieldName;if(d(p,t.name)||d(n,t.name))return!1;let l=e.editFieldsInfo;if(l&&(d(l.creationDateField,t.name)||d(l.creatorField,t.name)||d(l.editDateField,t.name)||d(l.editorField,t.name))||d(e.objectIdField,t.name)||d(e.displayField,t.name)||d(e.typeIdField,t.name)||d(e.subtypeField,t.name)||e.timeInfo&&(d(e.timeInfo.startField,t.name)||d(e.timeInfo.endField,t.name)||d(e.timeInfo.trackIdField,t.name)))return!1;if(!s?.ignoreLayerRenderer&&e.featureReduction){let f=new Set;if(await I.collectFeatureReductionFields(f,e,e.featureReduction),Array.from(f).some(b=>d(b,t.name)))return!1}if(!s?.ignoreLayerRenderer&&(await I.getRendererFields(e.renderer,e.fieldsIndex)).some(f=>d(f,t.name)))return!1;if(!s?.ignoreLayerLabelingInfo){let f=e.labelingInfo?.map(b=>b.labelExpressionInfo?.expression);if(f&&((await I.getExpressionFields(e,f)).some(b=>d(b,t.name))||await oe(e,t,"layer")))return!1}if(!s?.ignoreLayerDefinitionExpression&&e.definitionExpression&&(await $.parseWhereClause(e.definitionExpression,e.fieldsIndex)).fieldNames.some(f=>d(f,t.name))||await ge(e,t,s)||await ye(e,t))return!1;if(await be(e,t))return await Promise.resolve(!1);if(await we(e,t))return await Promise.resolve(!1);if(he(i,e,t)||e.relationships?.map(f=>f.keyField)?.some(f=>d(f,t.name)))return!1;let u=G(a,a.portal.user),v=s?.userItemInfo?.userGroups??await K(e)??[],g=s?.userItemInfo?.itemGroups??await Q(e)??[],w=Y(v,g);if(!u&&!w)return!1;let m=s?.userItemInfo?.relatedItems??await X(a.id,a.portal,{relationshipType:"Service2Service"});return!(m?.data?.relatedItems&&m.data.relatedItems.some(f=>["WMTS","Map Service","Vector Tile Service"].includes(f.type)))}async function ue(i,e,t){let s=`${i.url}/${i.layerId}/fieldGroups`;try{let r=t?.userItemInfo&&"fieldGroups"in t.userItemInfo?t.userItemInfo.fieldGroups:(await Z(s,{query:{f:"json"},responseType:"json"}))?.data?.fieldGroups;return r?r.some(a=>a.fields.some(o=>d(o,e))):!1}catch{return!1}}function he(i,e,t){if(!i)return!1;let s=i.map?.applicationProperties?.viewing?.search;if(s){let r=s.layers?.find(a=>a.id===e.id);if(r){let a=r?.field?.name;if(a)return d(a,t.name)}}return!1}async function oe(i,e,t){let s=t==="layer"?i.labelingInfo?.filter(o=>F(o.where)):i.sourceJSON?.drawingInfo?.labelingInfo?.filter(o=>F(o.where));if(!s?.length)return!1;let r=[...await Promise.all(s.map(async o=>await $.parseWhereClause(o.where,i.fieldsIndex)))],a=!1;for(let o=0;o<r.length;o++){let c=r[o].fieldNames?.some(p=>d(p,e.name));if(!a&&c){a=!0;break}}return await Promise.resolve(a)}async function ge(i,e,t){let s=i.portalItem;if(!s)return!1;let r=`${T(s.portal)}content/items/${s.id}/data`,a=(t?.userItemInfo?.itemData??await Z(r,{query:{f:"json"},responseType:"json"}))?.data;if(!a)return!1;if(a?.layers){let o=a.layers.find(l=>l.id===i.layerId),c=o?.layerDefinition?.drawingInfo?.renderer,p=o?.layerDefinition?.featureReduction,n=o?.layerDefinition?.definitionExpression;if(!c&&!p&&!n)return!1;if(!t?.ignoreItemRenderer&&c){let l=L.fromJSON(c);if((await I.getRendererFields(l,i.fieldsIndex)).some(u=>d(u,e.name)))return!0}if(!t?.ignoreItemFeatureReduction&&p&&await ne(i,e,p)||n&&(await $.parseWhereClause(n,i.fieldsIndex)).fieldNames.some(l=>d(l,e.name)))return!0}return!1}async function ye(i,e){let t=i.sourceJSON,s=t?.drawingInfo?.renderer,r=t?.featureReduction;if(!s&&!r)return!1;if(s){let a=L.fromJSON(s);if((await I.getRendererFields(a,i.fieldsIndex)).some(o=>d(o,e.name)))return!0}return!!(r&&await ne(i,e,r))}async function be(i,e){let t=i.sourceJSON?.drawingInfo?.labelingInfo;if(!t)return await Promise.resolve(!1);let s=t?.map(r=>r.labelExpressionInfo?.expression);if(s){if((await I.getExpressionFields(i,s)).some(r=>d(r,e.name)))return await Promise.resolve(!0);if(await oe(i,e,"service"))return await Promise.resolve(!0)}return await Promise.resolve(!1)}async function we(i,e){let t=i.sourceJSON?.definitionQuery;return t?(await $.parseWhereClause(t,i.fieldsIndex)).fieldNames.some(s=>d(s,e.name))?await Promise.resolve(!0):await Promise.resolve(!1):await Promise.resolve(!1)}async function ne(i,e,t){let s=t.type==="binning"?pe.fromJSON(t):fe.fromJSON(t),r=new Set;return await I.collectFeatureReductionFields(r,i,s),!!Array.from(r).some(a=>d(a,e.name))}var h=new Map;h.set("oid","key");h.set("guid","key");h.set("global-id","key");h.set("blob","binary");h.set("integer","integer");h.set("small-integer","integer");h.set("big-integer","integer");h.set("single","number");h.set("double","number");h.set("long","number");h.set("number","number");h.set("date","date-time");h.set("date-only","calendar");h.set("time-only","clock");h.set("timestamp-offset","time-zone");h.set("string","string");var Ne=({fieldType:i})=>y`<calcite-icon scale=s .icon=${h.get(i)}></calcite-icon>`,Ee=R`.dialog{--calcite-dialog-max-size-y: 60%}.dialog-content-wrapper{position:relative;min-height:100px}.hide-overflow{overflow:hidden}.field-icons{padding:0 var(--calcite-spacing-lg);display:flex;align-items:center}.warning{border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);margin-bottom:var(--calcite-spacing-md)}.warning-message{font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold)}.loader-container{position:absolute;height:100%;width:100%;top:0;right:0;display:none;z-index:40;overflow:hidden;background:#fffffff2;padding:0}.active{display:flex;flex-direction:column;align-items:center;justify-content:center}.loader{padding:0}.loader-text{font-weight:var(--calcite-font-weight-medium);text-align:center;margin-right:6.25rem;margin-left:6.25rem}`,O=class extends J{constructor(){super(...arguments),this.arcadeExpMap=new Map,this.cancelNode=C(),this.dialogNode=C(),this.layerFields=[],this.layerFieldsMap=new Map,this.messages=q({blocking:!0}),this.deleteInProgress=!1,this.fieldsAreDeletable=!1,this._propWatcherTask=new W(this,{task:async([e,t])=>{let s=F(e)&&F(t);if(F(e)||N("error",this,S("layer")),F(t)||N("error",this,S("fieldNames")),!s)throw new Error("Required properties are missing");this._propWatcherTask.autoRun=!1,await this.processProps()},args:()=>[this.layer,this.fieldNames]}),this.arcgisBeforeModalClose=E(),this.arcgisClose=E(),this.arcgisBeforeDelete=E(),this.arcgisFieldsDeleted=E()}static{this.properties={config:0,fieldNames:0,layer:0,mapView:0,options:0}}static{this.styles=Ee}async processProps(){let{layer:e,mapView:t,fieldNames:s}=this;if(!e||!s){this.fieldsAreDeletable=!1;return}e.loaded||await e.load(),this.layerFields=e.fields.filter(a=>s.includes(a.name));let r=s.some(a=>!e.fields.find(o=>o.name===a));if(!this.layerFields?.length||r)this.fieldsAreDeletable=!1;else{let a=await Promise.all(this.layerFields.map(async o=>await ae(t,e,o,this.options)));if(this.fieldsAreDeletable=a.every(o=>o),!this.fieldsAreDeletable)return}if(this.layerFieldsMap=await ie(e),this.options?.ignorePopupTemplate||(this.arcadeExpMap=re(e.popupTemplate)),this.portal=e.portalItem?.portal??this.options?.portal,this.item=e.portalItem??this.options?.item,!this.item){this.fieldsAreDeletable=!1;return}await Fe.getCredential(this.item.url.replace("rest/services","rest/admin/services"))}getFieldLabel(e){let{layer:t,arcadeExpMap:s}=this;if(this.options?.ignorePopupTemplate)return this.getFieldDisplayNameFromLayerFields(e);{let r=(t.popupTemplate??t.createPopupTemplate()).fieldInfos?.find(a=>a.fieldName===e);return r?te(t,r,s):this.getFieldDisplayNameFromLayerFields(e)}}getFieldDisplayNameFromLayerFields(e){let{layer:t}=this,s=this.layerFieldsMap.get(e);return de.supportsFieldConfiguration(t)?t.getFieldAlias(e):s.alias??s.name}async deleteFields(){let{layer:e,fieldNames:t}=this,s=`${e.url.replace("/rest/services","/rest/admin/services")}/${e.layerId}/deleteFromDefinition`,r={fields:t.map(o=>({name:o}))},a={deleteFromDefinition:JSON.stringify(r)};await x(s,{query:{...a,f:"json",async:!1},method:"post",responseType:"json"}).then(async o=>{if(o.data?.success){let c=`${e.url}/${e.layerId}`;t.forEach(n=>{e.type==="feature"&&e.floorInfo?.floorField===n&&(e.floorInfo=null)});let p=await x(c,{query:{f:"json"},responseType:"json"});if(p){let n=p.data;this.currentLayerInfo=p.data,n&&(this.updateTypesAndTemplatesOnLayer(),t.forEach(l=>{n.templates?.length?n.templates.forEach(u=>delete u.prototype.attributes[l]):n.types?.forEach(u=>{u.templates.forEach(v=>delete v.prototype.attributes[l])})}),this.updateFeatureService(n))}else this.handleError()}},()=>this.handleError())}updateTypesAndTemplatesOnLayer(){let{currentLayerInfo:e}=this,t=e;if(t.templates?.length){let s=this.updateTemplatesList(t.templates);t.templates=s}else if(t.types){let s=t.types;t.types=[],s.forEach(r=>{r.templates=this.updateTemplatesList(r.templates),this.addType(t,r)})}}updateTemplatesList(e){let{currentLayerInfo:t,messages:s}=this,r=[];return(e??[]).forEach(a=>{let o=new Ie;o.description=a.description??"",o.name=a.name||s.newFeature,o.drawingTool=a.drawingTool||"point";let c={};t.fields.forEach(n=>{let l=!1;for(let u=0;u<a.prototype.attributes.length;u++)if(a.prototype.attributes[u]===n.name){l=!0,c[n.name]=a.prototype.attributes[n.name];break}!l&&n.editable&&(c[n.name]=n.defaultValue||null)});let p=new ve({attributes:c});o.prototype=p,r.push(o)}),r}addType(e,t){e.types?e.types.some(s=>s.id===t.id)||e.types.push(t):e.types=[t]}async updateFeatureService(e){let{layer:t,fieldNames:s}=this,r={templates:e.templates,types:e.types},a=`${t.url.replace("/rest/services","/rest/admin/services")}/${t.layerId}/updateDefinition`,o={f:"json",updateDefinition:JSON.stringify(r)};await x(a,{query:{...o,f:"json"},method:"post",responseType:"json"}).then(async c=>{if(c.data?.success){let p=`${T(this.portal)}content/items/${this.item.id}/data`;if(this.options?.ignorePopupTemplate||s.forEach(n=>{t.popupTemplate?.fieldInfos&&(t.popupTemplate.fieldInfos=t.popupTemplate.fieldInfos.filter(l=>l.fieldName!==n)),t.popupTemplate?.content?.forEach((l,u)=>{l.type==="fields"&&l.fieldInfos&&((t.popupTemplate?.content)[u].fieldInfos=(t.popupTemplate?.content)[u].fieldInfos?.filter(v=>v.fieldName!==n))})}),t.attributeTableTemplate){let n=t.attributeTableTemplate.clone();n.elements=n.elements.filter(l=>!(l.type==="field"&&s.includes(l.fieldName))),n.orderByFields=n.orderByFields.filter(l=>!s.includes(l.field)),t.attributeTableTemplate=n}if(t.fieldConfigurations?.length){let n=le.clone(t.fieldConfigurations).filter(l=>!s.includes(l.name));t.fieldConfigurations=n}await x(p,{query:{f:"json"},responseType:"json"}).then(async n=>{let l=n.data;if(l?.layers||l?.tables){let u=t.isTable,v=u?l.tables:l.layers,g=v?.find(w=>w.id===t.layerId);if(s.forEach(w=>{g?.attributeTableInfo?.attributeTableElements&&(g.attributeTableInfo.attributeTableElements=g.attributeTableInfo.attributeTableElements.map(m=>{if(m.type==="field")return m.fieldName===w?void 0:m;if(m.type==="group"&&Array.isArray(m.attributeTableElements)){let f=m.attributeTableElements.filter(b=>!(b.type==="field"&&b.fieldName===w));return f.length?{...m,attributeTableElements:f}:void 0}return m}).filter(Boolean),g.attributeTableInfo.orderByFields=g.attributeTableInfo.orderByFields.filter(m=>m.field!==w))}),g?.layerDefinition?.fieldConfigurations&&(g.layerDefinition.fieldConfigurations=g.layerDefinition.fieldConfigurations.filter(w=>!s.includes(w.name))),g?.popupInfo){s.forEach(b=>{g.popupInfo.fieldInfos=g.popupInfo.fieldInfos.filter(D=>D.fieldName!==b),g.popupInfo.popupElements?.forEach((D,M)=>{D.type==="fields"&&D.fieldInfos&&(g.popupInfo.popupElements[M].fieldInfos=g.popupInfo.popupElements[M].fieldInfos.filter(ce=>ce.fieldName!==b))})});let w=`${T(this.portal)}content/users/${this.item.owner}/items/${this.item.id}/update`,m={};u?(m.tables=v,l.layers&&(m.layers=l.layers)):(m.layers=v,l.tables&&(m.tables=l.tables));let f={f:"json",text:JSON.stringify(m)};await x(w,{query:{...f},method:"post",responseType:"json"}).then(b=>{b.data?.success?this.handleSuccess():this.handleError()},()=>this.handleError())}else this.handleSuccess()}else n.httpStatus===200&&(!n.data||JSON.stringify(n.data)==="{}")?this.handleSuccess():this.handleError()},()=>this.handleError())}},()=>this.handleError())}handleSuccess(){this.arcgisFieldsDeleted.emit(),this.dialogNode?.value&&(this.dialogNode.value.open=!1),this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("success"):this.displaySuccessAlert()}handleError(e){this.dialogNode?.value&&(this.dialogNode.value.open=!1),e?this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("read-only-error"):this.displayReadOnlyErrorAlert():this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("error"):this.displayErrorAlert()}displaySuccessAlert(){let{messages:e,fieldNames:t}=this;this.successAlertNode&&(this.successAlertNode.parentElement?.removeChild(this.successAlertNode),this.successAlertNode=void 0),this.successAlertNode=A(y`<calcite-alert .label=${t.length===1?e.fieldDeleted:e.fieldsDeleted} kind=success icon=check-circle auto-close open><div slot=message>${t.length===1?e.fieldDeleted:e.fieldsDeleted}</div></calcite-alert>`),document.body.append(this.successAlertNode)}displayErrorAlert(){let{messages:e}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=A(y`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close open><div slot=message>${e.fieldDeletionUnsuccessful}</div></calcite-alert>`),document.body.append(this.errorAlertNode)}displayReadOnlyErrorAlert(){let{messages:e,portal:t}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=A(y`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close auto-close-duration=slow open><div slot=title>${e.error}</div><div slot=message>${t.isPortal?e.readOnlyErrorMessageEnterprise:e.readOnlyErrorMessage}</div>${!t.isPortal&&y`<calcite-link slot=link target=_blank href=https://status.arcgis.com>${e.healthDashboard}</calcite-link>`||""}</calcite-alert>`),document.body.append(this.errorAlertNode)}render(){let{messages:e,fieldsAreDeletable:t,fieldNames:s,deleteInProgress:r}=this;return this._propWatcherTask.render({complete:()=>(t||(s?.length?s?.length===1?N("error",this,"Field cannot be deleted"):N("error",this,"One or more fields cannot be deleted"):N("error",this,j("fieldNames"))),y`<calcite-dialog class="dialog" width=s open modal outside-close-disabled escape-disabled @calciteDialogClose=${()=>this.arcgisClose.emit()} .heading=${s?.length===1?e.deleteField:e.deleteFields} ${P(this.dialogNode)}>${t?y`<div class=${`dialog-content-wrapper ${r?"hide-overflow":""}`}>${this.renderDeleteLoader()}<calcite-label>${s.length===1?e.deletePrompt:e.deleteMultiplePrompt}</calcite-label>${this.renderFieldsPreview()}</div>${this.renderCancelButton()}${this.renderDeleteButton()}`:this.renderError()}</calcite-dialog>`)})}renderError(){let{messages:e}=this;return y`<div class="loader-container active"><div class="loader-text">${e.errorOccurred}</div></div>`}renderDeleteLoader(){let{messages:e,fieldNames:t,deleteInProgress:s}=this;return y`<div class=${`loader-container ${s?"active":""}`}><calcite-loader class="loader" .label=${t.length===1?e.deletingField:e.deletingFields} .hidden=${!s}></calcite-loader><div class="loader-text">${t.length===1?e.deletingField:e.deletingFields}</div></div>`}renderFieldsPreview(){let{fieldNames:e,layerFields:t,layerFieldsMap:s,arcadeExpMap:r,messages:a}=this;return y`<calcite-list .label=${a.fields}>${e.map(o=>{let c=t.find(p=>p.name===o);return y`<calcite-list-item .label=${this.getFieldLabel(o)} .description=${`{${o}}`} .value=${o} .disabled=${!c.editable}><div slot=actions-end class="field-icons">${Ne({fieldType:se(o,s,r)})}</div></calcite-list-item>`})}</calcite-list>`}renderCancelButton(){let{messages:e}=this;return y`<calcite-button @click=${()=>this.dialogNode.value.open=!1} slot=footer-end appearance=outline ${P(this.cancelNode)}>${e.cancel}</calcite-button>`}renderDeleteButton(){let{messages:e,fieldNames:t}=this;return y`<calcite-button kind=danger slot=footer-end @click=${async s=>{let{portal:r}=this;s.currentTarget.disabled=!0,this.cancelNode.value.disabled=!0,this.dialogNode.value.closeDisabled=!0,r.sourceJSON?.isReadOnly?this.handleError(!0):(this.deleteInProgress=!0,this.requestUpdate(),this.arcgisBeforeDelete.emit(),await this.deleteFields())}}>${t.length===1?e.deleteField:e.deleteFieldsWithNumber.replace("${number}",`${t.length}`)}</calcite-button>`}};B("arcgis-portal-field-delete",O);return O},"core/lang","layers/support/FeatureTemplate","Graphic","identity/IdentityManager","request","applications/PortalApp/layerUtils","layers/support/fieldUtils","layers/support/FeatureReductionBinning","layers/support/FeatureReductionCluster","renderers/support/jsonUtils","request","core/sql","applications/PortalApp/layerUtils",a)
2
+ import a from"./SXZRHHXC.js";import{a as T}from"./6W2IHKCA.js";import{b as W}from"./Z73H62GB.js";import{a as q}from"./YKHMRMUE.js";import"./GS6MPCDK.js";import{H as C,I as P,J,N as A,P as B,h as R,j as y,o as N,q as S,r as j,v as E}from"./BMUU2S5H.js";import"./YIMNOUTF.js";export default $arcgis.t(([le,Ie,ve,Fe,x,de,I,pe,fe,L,Z,$,ee,{g:G,i:z,j:V,k:U,l:_,m:H,n:K,o:Q,p:X,q:Y}])=>{var k=(i=>(i.expression="expression/",i))(k||{});function F(i){return i!=null}function te(i,e,t){let s=e.fieldName;if(s.includes(k.expression)){let r=t.get(s);return r?.title?r.title:s}else return ee.supportsFieldConfiguration(i)&&i.getFieldConfiguration(s)?i.getFieldAlias(s)||s:e.label||s}function se(i,e,t){let s="";if(/^raster.(?:item|service)pixelvalue/iu.test(i))s="number";else if(e.has(i)){let r=e.get(i);s=r.type?r.type.toLowerCase():""}else if(t.has(i)){let r=t.get(i);s=r.returnType?r.returnType.toLowerCase():""}else s="number";return s}async function ie(i){return new Map((await me(i)).filter(e=>e.visible).map(e=>[e.name,e]))}function re(i){let e=new Map;return i?.expressionInfos&&i.expressionInfos.forEach(t=>{let s=`${k.expression}${t.name}`;e.set(s,t)}),e}async function me(i){return await new Promise((e,t)=>{switch(i.type){case"feature":case"ogc-feature":case"stream":e(i.fields);break;case"sublayer":{let s=i,r=s?.layer;r?.portalItem&&r.url.includes("https://demographics")&&r.url.includes(".arcgis.com")?r.portalItem?.fetchData().then(a=>{if(a?.thematicGroup){let o=new Map(s.fields.map(n=>[n.name,n])),c=a.thematicGroup.fieldNames,p=[];c.forEach(n=>{o.has(n)&&p.push(o.get(n))}),e(p)}else e(s.fields)}).catch(a=>{t(new Error(a))}):e(s.fields);break}case"imagery":case"imagery-tile":case"wcs":e(i.rasterFields);break;default:e("fields"in i?i.fields??[]:[])}})}function d(i,e){return!i||!e?!1:i.toLocaleLowerCase()===e.toLocaleLowerCase()}async function ae(i,e,t,s){if(!t)return!1;let r=["feature","oriented-imagery"].includes(e.type),a=s?.item??e.portalItem,o=e.sourceJSON;if(!r||!a||!a.portal.user||!U(a)||V(a)||_(a)||H(o)||a.portal.isPortal&&z(a)||["oid","global-id","geometry"].includes(t.type)||await ue(e,t.name,s))return!1;let c=e.sourceJSON.geometryProperties,p=c?.shapeLengthFieldName,n=c?.shapeAreaFieldName;if(d(p,t.name)||d(n,t.name))return!1;let l=e.editFieldsInfo;if(l&&(d(l.creationDateField,t.name)||d(l.creatorField,t.name)||d(l.editDateField,t.name)||d(l.editorField,t.name))||d(e.objectIdField,t.name)||d(e.displayField,t.name)||d(e.typeIdField,t.name)||d(e.subtypeField,t.name)||e.timeInfo&&(d(e.timeInfo.startField,t.name)||d(e.timeInfo.endField,t.name)||d(e.timeInfo.trackIdField,t.name)))return!1;if(!s?.ignoreLayerRenderer&&e.featureReduction){let f=new Set;if(await I.collectFeatureReductionFields(f,e,e.featureReduction),Array.from(f).some(b=>d(b,t.name)))return!1}if(!s?.ignoreLayerRenderer&&(await I.getRendererFields(e.renderer,e.fieldsIndex)).some(f=>d(f,t.name)))return!1;if(!s?.ignoreLayerLabelingInfo){let f=e.labelingInfo?.map(b=>b.labelExpressionInfo?.expression);if(f&&((await I.getExpressionFields(e,f)).some(b=>d(b,t.name))||await oe(e,t,"layer")))return!1}if(!s?.ignoreLayerDefinitionExpression&&e.definitionExpression&&(await $.parseWhereClause(e.definitionExpression,e.fieldsIndex)).fieldNames.some(f=>d(f,t.name))||await ge(e,t,s)||await ye(e,t))return!1;if(await be(e,t))return await Promise.resolve(!1);if(await we(e,t))return await Promise.resolve(!1);if(he(i,e,t)||e.relationships?.map(f=>f.keyField)?.some(f=>d(f,t.name)))return!1;let u=G(a,a.portal.user),v=s?.userItemInfo?.userGroups??await K(e)??[],g=s?.userItemInfo?.itemGroups??await Q(e)??[],w=Y(v,g);if(!u&&!w)return!1;let m=s?.userItemInfo?.relatedItems??await X(a.id,a.portal,{relationshipType:"Service2Service"});return!(m?.data?.relatedItems&&m.data.relatedItems.some(f=>["WMTS","Map Service","Vector Tile Service"].includes(f.type)))}async function ue(i,e,t){let s=`${i.url}/${i.layerId}/fieldGroups`;try{let r=t?.userItemInfo&&"fieldGroups"in t.userItemInfo?t.userItemInfo.fieldGroups:(await Z(s,{query:{f:"json"},responseType:"json"}))?.data?.fieldGroups;return r?r.some(a=>a.fields.some(o=>d(o,e))):!1}catch{return!1}}function he(i,e,t){if(!i)return!1;let s=i.map?.applicationProperties?.viewing?.search;if(s){let r=s.layers?.find(a=>a.id===e.id);if(r){let a=r?.field?.name;if(a)return d(a,t.name)}}return!1}async function oe(i,e,t){let s=t==="layer"?i.labelingInfo?.filter(o=>F(o.where)):i.sourceJSON?.drawingInfo?.labelingInfo?.filter(o=>F(o.where));if(!s?.length)return!1;let r=[...await Promise.all(s.map(async o=>await $.parseWhereClause(o.where,i.fieldsIndex)))],a=!1;for(let o=0;o<r.length;o++){let c=r[o].fieldNames?.some(p=>d(p,e.name));if(!a&&c){a=!0;break}}return await Promise.resolve(a)}async function ge(i,e,t){let s=i.portalItem;if(!s)return!1;let r=`${T(s.portal)}content/items/${s.id}/data`,a=(t?.userItemInfo?.itemData??await Z(r,{query:{f:"json"},responseType:"json"}))?.data;if(!a)return!1;if(a?.layers){let o=a.layers.find(l=>l.id===i.layerId),c=o?.layerDefinition?.drawingInfo?.renderer,p=o?.layerDefinition?.featureReduction,n=o?.layerDefinition?.definitionExpression;if(!c&&!p&&!n)return!1;if(!t?.ignoreItemRenderer&&c){let l=L.fromJSON(c);if((await I.getRendererFields(l,i.fieldsIndex)).some(u=>d(u,e.name)))return!0}if(!t?.ignoreItemFeatureReduction&&p&&await ne(i,e,p)||n&&(await $.parseWhereClause(n,i.fieldsIndex)).fieldNames.some(l=>d(l,e.name)))return!0}return!1}async function ye(i,e){let t=i.sourceJSON,s=t?.drawingInfo?.renderer,r=t?.featureReduction;if(!s&&!r)return!1;if(s){let a=L.fromJSON(s);if((await I.getRendererFields(a,i.fieldsIndex)).some(o=>d(o,e.name)))return!0}return!!(r&&await ne(i,e,r))}async function be(i,e){let t=i.sourceJSON?.drawingInfo?.labelingInfo;if(!t)return await Promise.resolve(!1);let s=t?.map(r=>r.labelExpressionInfo?.expression);if(s){if((await I.getExpressionFields(i,s)).some(r=>d(r,e.name)))return await Promise.resolve(!0);if(await oe(i,e,"service"))return await Promise.resolve(!0)}return await Promise.resolve(!1)}async function we(i,e){let t=i.sourceJSON?.definitionQuery;return t?(await $.parseWhereClause(t,i.fieldsIndex)).fieldNames.some(s=>d(s,e.name))?await Promise.resolve(!0):await Promise.resolve(!1):await Promise.resolve(!1)}async function ne(i,e,t){let s=t.type==="binning"?pe.fromJSON(t):fe.fromJSON(t),r=new Set;return await I.collectFeatureReductionFields(r,i,s),!!Array.from(r).some(a=>d(a,e.name))}var h=new Map;h.set("oid","key");h.set("guid","key");h.set("global-id","key");h.set("blob","binary");h.set("integer","integer");h.set("small-integer","integer");h.set("big-integer","integer");h.set("single","number");h.set("double","number");h.set("long","number");h.set("number","number");h.set("date","date-time");h.set("date-only","calendar");h.set("time-only","clock");h.set("timestamp-offset","time-zone");h.set("string","string");var Ne=({fieldType:i})=>y`<calcite-icon scale=s .icon=${h.get(i)}></calcite-icon>`,Ee=R`.dialog{--calcite-dialog-max-size-y: 60%}.dialog-content-wrapper{position:relative;min-height:100px}.hide-overflow{overflow:hidden}.field-icons{padding:0 var(--calcite-spacing-lg);display:flex;align-items:center}.warning{border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);margin-bottom:var(--calcite-spacing-md)}.warning-message{font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold)}.loader-container{position:absolute;height:100%;width:100%;top:0;right:0;display:none;z-index:40;overflow:hidden;background:#fffffff2;padding:0}.active{display:flex;flex-direction:column;align-items:center;justify-content:center}.loader{padding:0}.loader-text{font-weight:var(--calcite-font-weight-medium);text-align:center;margin-right:6.25rem;margin-left:6.25rem}`,O=class extends J{constructor(){super(...arguments),this.arcadeExpMap=new Map,this.cancelNode=C(),this.dialogNode=C(),this.layerFields=[],this.layerFieldsMap=new Map,this.messages=q({blocking:!0}),this.deleteInProgress=!1,this.fieldsAreDeletable=!1,this._propWatcherTask=new W(this,{task:async([e,t])=>{let s=F(e)&&F(t);if(F(e)||N("error",this,S("layer")),F(t)||N("error",this,S("fieldNames")),!s)throw new Error("Required properties are missing");this._propWatcherTask.autoRun=!1,await this.processProps()},args:()=>[this.layer,this.fieldNames]}),this.arcgisBeforeModalClose=E(),this.arcgisClose=E(),this.arcgisBeforeDelete=E(),this.arcgisFieldsDeleted=E()}static{this.properties={config:0,fieldNames:0,layer:0,mapView:0,options:0}}static{this.styles=Ee}async processProps(){let{layer:e,mapView:t,fieldNames:s}=this;if(!e||!s){this.fieldsAreDeletable=!1;return}e.loaded||await e.load(),this.layerFields=e.fields.filter(a=>s.includes(a.name));let r=s.some(a=>!e.fields.find(o=>o.name===a));if(!this.layerFields?.length||r)this.fieldsAreDeletable=!1;else{let a=await Promise.all(this.layerFields.map(async o=>await ae(t,e,o,this.options)));if(this.fieldsAreDeletable=a.every(o=>o),!this.fieldsAreDeletable)return}if(this.layerFieldsMap=await ie(e),this.options?.ignorePopupTemplate||(this.arcadeExpMap=re(e.popupTemplate)),this.portal=e.portalItem?.portal??this.options?.portal,this.item=e.portalItem??this.options?.item,!this.item){this.fieldsAreDeletable=!1;return}await Fe.getCredential(this.item.url.replace("rest/services","rest/admin/services"))}getFieldLabel(e){let{layer:t,arcadeExpMap:s}=this;if(this.options?.ignorePopupTemplate)return this.getFieldDisplayNameFromLayerFields(e);{let r=(t.popupTemplate??t.createPopupTemplate()).fieldInfos?.find(a=>a.fieldName===e);return r?te(t,r,s):this.getFieldDisplayNameFromLayerFields(e)}}getFieldDisplayNameFromLayerFields(e){let{layer:t}=this,s=this.layerFieldsMap.get(e);return de.supportsFieldConfiguration(t)?t.getFieldAlias(e):s.alias??s.name}async deleteFields(){let{layer:e,fieldNames:t}=this,s=`${e.url.replace("/rest/services","/rest/admin/services")}/${e.layerId}/deleteFromDefinition`,r={fields:t.map(o=>({name:o}))},a={deleteFromDefinition:JSON.stringify(r)};await x(s,{query:{...a,f:"json",async:!1},method:"post",responseType:"json"}).then(async o=>{if(o.data?.success){let c=`${e.url}/${e.layerId}`;t.forEach(n=>{e.type==="feature"&&e.floorInfo?.floorField===n&&(e.floorInfo=null)});let p=await x(c,{query:{f:"json"},responseType:"json"});if(p){let n=p.data;this.currentLayerInfo=p.data,n&&(this.updateTypesAndTemplatesOnLayer(),t.forEach(l=>{n.templates?.length?n.templates.forEach(u=>delete u.prototype.attributes[l]):n.types?.forEach(u=>{u.templates.forEach(v=>delete v.prototype.attributes[l])})}),this.updateFeatureService(n))}else this.handleError()}},()=>this.handleError())}updateTypesAndTemplatesOnLayer(){let{currentLayerInfo:e}=this,t=e;if(t.templates?.length){let s=this.updateTemplatesList(t.templates);t.templates=s}else if(t.types){let s=t.types;t.types=[],s.forEach(r=>{r.templates=this.updateTemplatesList(r.templates),this.addType(t,r)})}}updateTemplatesList(e){let{currentLayerInfo:t,messages:s}=this,r=[];return(e??[]).forEach(a=>{let o=new Ie;o.description=a.description??"",o.name=a.name||s.newFeature,o.drawingTool=a.drawingTool||"point";let c={};t.fields.forEach(n=>{let l=!1;for(let u=0;u<a.prototype.attributes.length;u++)if(a.prototype.attributes[u]===n.name){l=!0,c[n.name]=a.prototype.attributes[n.name];break}!l&&n.editable&&(c[n.name]=n.defaultValue||null)});let p=new ve({attributes:c});o.prototype=p,r.push(o)}),r}addType(e,t){e.types?e.types.some(s=>s.id===t.id)||e.types.push(t):e.types=[t]}async updateFeatureService(e){let{layer:t,fieldNames:s}=this,r={templates:e.templates,types:e.types},a=`${t.url.replace("/rest/services","/rest/admin/services")}/${t.layerId}/updateDefinition`,o={f:"json",updateDefinition:JSON.stringify(r)};await x(a,{query:{...o,f:"json"},method:"post",responseType:"json"}).then(async c=>{if(c.data?.success){let p=`${T(this.portal)}content/items/${this.item.id}/data`;if(this.options?.ignorePopupTemplate||s.forEach(n=>{t.popupTemplate?.fieldInfos&&(t.popupTemplate.fieldInfos=t.popupTemplate.fieldInfos.filter(l=>l.fieldName!==n)),t.popupTemplate?.content?.forEach((l,u)=>{l.type==="fields"&&l.fieldInfos&&((t.popupTemplate?.content)[u].fieldInfos=(t.popupTemplate?.content)[u].fieldInfos?.filter(v=>v.fieldName!==n))})}),t.attributeTableTemplate){let n=t.attributeTableTemplate.clone();n.elements=n.elements.filter(l=>!(l.type==="field"&&s.includes(l.fieldName))),n.orderByFields=n.orderByFields.filter(l=>!s.includes(l.field)),t.attributeTableTemplate=n}if(t.fieldConfigurations?.length){let n=le.clone(t.fieldConfigurations).filter(l=>!s.includes(l.name));t.fieldConfigurations=n}await x(p,{query:{f:"json"},responseType:"json"}).then(async n=>{let l=n.data;if(l?.layers||l?.tables){let u=t.isTable,v=u?l.tables:l.layers,g=v?.find(w=>w.id===t.layerId);if(s.forEach(w=>{g?.attributeTableInfo?.attributeTableElements&&(g.attributeTableInfo.attributeTableElements=g.attributeTableInfo.attributeTableElements.map(m=>{if(m.type==="field")return m.fieldName===w?void 0:m;if(m.type==="group"&&Array.isArray(m.attributeTableElements)){let f=m.attributeTableElements.filter(b=>!(b.type==="field"&&b.fieldName===w));return f.length?{...m,attributeTableElements:f}:void 0}return m}).filter(Boolean),g.attributeTableInfo.orderByFields=g.attributeTableInfo.orderByFields.filter(m=>m.field!==w))}),g?.layerDefinition?.fieldConfigurations&&(g.layerDefinition.fieldConfigurations=g.layerDefinition.fieldConfigurations.filter(w=>!s.includes(w.name))),g?.popupInfo){s.forEach(b=>{g.popupInfo.fieldInfos=g.popupInfo.fieldInfos.filter(D=>D.fieldName!==b),g.popupInfo.popupElements?.forEach((D,M)=>{D.type==="fields"&&D.fieldInfos&&(g.popupInfo.popupElements[M].fieldInfos=g.popupInfo.popupElements[M].fieldInfos.filter(ce=>ce.fieldName!==b))})});let w=`${T(this.portal)}content/users/${this.item.owner}/items/${this.item.id}/update`,m={};u?(m.tables=v,l.layers&&(m.layers=l.layers)):(m.layers=v,l.tables&&(m.tables=l.tables));let f={f:"json",text:JSON.stringify(m)};await x(w,{query:{...f},method:"post",responseType:"json"}).then(b=>{b.data?.success?this.handleSuccess():this.handleError()},()=>this.handleError())}else this.handleSuccess()}else n.httpStatus===200&&(!n.data||JSON.stringify(n.data)==="{}")?this.handleSuccess():this.handleError()},()=>this.handleError())}},()=>this.handleError())}handleSuccess(){this.arcgisFieldsDeleted.emit(),this.dialogNode?.value&&(this.dialogNode.value.open=!1),this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("success"):this.displaySuccessAlert()}handleError(e){this.dialogNode?.value&&(this.dialogNode.value.open=!1),e?this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("read-only-error"):this.displayReadOnlyErrorAlert():this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("error"):this.displayErrorAlert()}displaySuccessAlert(){let{messages:e,fieldNames:t}=this;this.successAlertNode&&(this.successAlertNode.parentElement?.removeChild(this.successAlertNode),this.successAlertNode=void 0),this.successAlertNode=A(y`<calcite-alert .label=${t.length===1?e.fieldDeleted:e.fieldsDeleted} kind=success icon=check-circle auto-close open><div slot=message>${t.length===1?e.fieldDeleted:e.fieldsDeleted}</div></calcite-alert>`),document.body.append(this.successAlertNode)}displayErrorAlert(){let{messages:e}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=A(y`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close open><div slot=message>${e.fieldDeletionUnsuccessful}</div></calcite-alert>`),document.body.append(this.errorAlertNode)}displayReadOnlyErrorAlert(){let{messages:e,portal:t}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=A(y`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close auto-close-duration=slow open><div slot=title>${e.error}</div><div slot=message>${t.isPortal?e.readOnlyErrorMessageEnterprise:e.readOnlyErrorMessage}</div>${!t.isPortal&&y`<calcite-link slot=link target=_blank href=https://status.arcgis.com>${e.healthDashboard}</calcite-link>`||""}</calcite-alert>`),document.body.append(this.errorAlertNode)}render(){let{messages:e,fieldsAreDeletable:t,fieldNames:s,deleteInProgress:r}=this;return this._propWatcherTask.render({complete:()=>(t||(s?.length?s?.length===1?N("error",this,"Field cannot be deleted"):N("error",this,"One or more fields cannot be deleted"):N("error",this,j("fieldNames"))),y`<calcite-dialog class="dialog" width=s open modal outside-close-disabled escape-disabled @calciteDialogClose=${()=>this.arcgisClose.emit()} .heading=${s?.length===1?e.deleteField:e.deleteFields} ${P(this.dialogNode)}>${t?y`<div class=${`dialog-content-wrapper ${r?"hide-overflow":""}`}>${this.renderDeleteLoader()}<calcite-label>${s.length===1?e.deletePrompt:e.deleteMultiplePrompt}</calcite-label>${this.renderFieldsPreview()}</div>${this.renderCancelButton()}${this.renderDeleteButton()}`:this.renderError()}</calcite-dialog>`)})}renderError(){let{messages:e}=this;return y`<div class="loader-container active"><div class="loader-text">${e.errorOccurred}</div></div>`}renderDeleteLoader(){let{messages:e,fieldNames:t,deleteInProgress:s}=this;return y`<div class=${`loader-container ${s?"active":""}`}><calcite-loader class="loader" .label=${t.length===1?e.deletingField:e.deletingFields} .hidden=${!s}></calcite-loader><div class="loader-text">${t.length===1?e.deletingField:e.deletingFields}</div></div>`}renderFieldsPreview(){let{fieldNames:e,layerFields:t,layerFieldsMap:s,arcadeExpMap:r,messages:a}=this;return y`<calcite-list .label=${a.fields}>${e.map(o=>{let c=t.find(p=>p.name===o);return y`<calcite-list-item .label=${this.getFieldLabel(o)} .description=${`{${o}}`} .value=${o} .disabled=${!c.editable}><div slot=actions-end class="field-icons">${Ne({fieldType:se(o,s,r)})}</div></calcite-list-item>`})}</calcite-list>`}renderCancelButton(){let{messages:e}=this;return y`<calcite-button @click=${()=>this.dialogNode.value.open=!1} slot=footer-end appearance=outline ${P(this.cancelNode)}>${e.cancel}</calcite-button>`}renderDeleteButton(){let{messages:e,fieldNames:t}=this;return y`<calcite-button kind=danger slot=footer-end @click=${async s=>{let{portal:r}=this;s.currentTarget.disabled=!0,this.cancelNode.value.disabled=!0,this.dialogNode.value.closeDisabled=!0,r.sourceJSON?.isReadOnly?this.handleError(!0):(this.deleteInProgress=!0,this.requestUpdate(),this.arcgisBeforeDelete.emit(),await this.deleteFields())}}>${t.length===1?e.deleteField:e.deleteFieldsWithNumber.replace("${number}",`${t.length}`)}</calcite-button>`}};B("arcgis-portal-field-delete",O);return O},"core/lang","layers/support/FeatureTemplate","Graphic","identity/IdentityManager","request","applications/PortalApp/layerUtils","layers/support/fieldUtils","layers/support/FeatureReductionBinning","layers/support/FeatureReductionCluster","renderers/support/jsonUtils","request","core/sql","applications/PortalApp/layerUtils",a)
@@ -0,0 +1,3 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as z}from"./35SKVD6F.js";import a from"./WSNLUGEP.js";import{a as x}from"./6W2IHKCA.js";import{a as L}from"./DFTUMKSN.js";import{a as B}from"./YKHMRMUE.js";import"./GS6MPCDK.js";import{H as y,I as U,J as A,K as I,L as R,P as N,h as P,j as u,v as k}from"./BMUU2S5H.js";import"./YIMNOUTF.js";export default $arcgis.t(([{a:w,b:v,c:_}])=>{function q(e){let r=/(https?:\/\/[^\s]+)/gu;return e?.replace(r,t=>`<a href="${t}" target="_blank">${t}</a>`)}function S(e){return e?.replace(/(?:\r)/gu,"&#10;").replace(/(?:\n)/gu,"&#13;")}function E(e){return e?.replace(/(?:&#10;)/gu,"\r").replace(/(?:&#13;)/gu,`
3
+ `)}function F(e){return e?.replace(/&#10;&#13;|&#10;|&#13;|\r\n|\r|\n/gu,"<br>")}function H(e){return F(S(q(E(e))))}function G(e){return e?.endsWith("/")?e.slice(0,e.length-1):e}var J=P`:host{display:flex}.button{display:flex;align-items:center;max-width:100%;cursor:pointer;white-space:normal;border-style:none;padding:0;font-size:.75rem;color:var(--calcite-color-text-2);outline:2px solid transparent;outline-offset:2px;transition-property:all;outline-color:transparent;background:transparent;font-family:inherit;line-height:1.5;&:focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px}}.button--outline{box-sizing:border-box;width:100%;padding:.5rem .75rem;transition-property:all;border:1px solid var(--calcite-color-border-3);&:hover{box-shadow:inset 0 0 0 1px var(--calcite-color-foreground-3)}}.name{overflow:hidden;white-space:nowrap;margin-inline-start:.5rem;text-overflow:ellipsis}.popover__wrapper{background-color:var(--calcite-color-foreground-1);width:min(32rem,80vw)}.popover__header{padding:1.25rem 1rem}.popover__avatar{max-width:100%}.popover__content{padding:.5rem 1rem 1.25rem}.popover__description{margin:0;overflow:auto;padding:0;padding-bottom:1rem;font-size:.875rem;color:var(--calcite-color-text-2);max-height:21.25rem}.popover__fade{position:relative;z-index:10;margin-bottom:.25rem;display:block;height:1rem;width:100%;background:linear-gradient(to bottom,transparent,var(--calcite-color-foreground-1) 100%);margin-top:-1rem}.popover__buttons{display:grid;grid-auto-flow:column;grid-gap:.5rem}.popover__buttons--no-description{padding-top:1rem}.popover__button{min-width:0px}.popover__loader{--calcite-loader-padding: 0}`;function M(e){return new L().sanitize(e)}function D(e){let r=M(e),t=document.createElement("div");return t.innerHTML=r,t.textContent||t.innerText||""}async function K(e,r,t,a,o){let s=e.portal?.portalHostname||a?.portalHostname||a?.restUrl?.replace("/sharing/rest",""),n=o?`https://www.arcgis.com/sharing/rest/portals/${r}`:`https://${s}/sharing/rest/portals/${r}`;if(!s&&!o)return null;let i=o?{disableIdentityLookup:!0,addTokenManually:!1}:{},l=await v({url:n,portal:a,options:i}),{urlKey:p,thumbnail:h,customBaseUrl:c}=l,f=`https://${p}.${c}/`,d=h?`${f}sharing/rest/portals/self/resources/${h}`:null,m="",$="";try{let g=await v({url:`${n}/resources/localizedOrgProperties`,portal:a,params:{start:1,num:100},options:i});if(g){let b=g[t]||g.default;m=b.name,$=b.description}}catch{}return{name:m||l.name,description:D($||l.description),url:`${f}home/`,thumbnail:d}}async function W(e,r,t,a){let o=e.sourceJSON?.orgId??e.portal?.id??t?.id;return await w({requester:async()=>await K(e,o,r,t,a),key:"verified",id:o})}var T=e=>e?.sourceJSON?.contentStatus==="public_authoritative";async function j(e,r,t,a){if(T(e)){let o=e.owner||"",s=await W(e,t,r,a);if(!s)return await _(o,r,a);let{description:n,name:i,thumbnail:l,url:p}=s;return{description:n?M(n):"",fullName:i,username:o,thumbnail:l,id:e.portal.id,url:p}}return await _(e.owner||"",r,a)}async function V(e,r,t){let a=t?"https://www.arcgis.com/sharing/rest/":x(r),o=t?{disableIdentityLookup:!0,addTokenManually:!1}:{};return await w({requester:async()=>await v({url:`${a}community/groups`,portal:r,params:{q:`(owner:"${e}")`,num:100},options:o}),key:"userGroups",id:e})}async function X(e,r,t){let a=t?"https://www.arcgis.com/sharing/rest/":x(r),o=t?{disableIdentityLookup:!0,addTokenManually:!1}:{};return await w({requester:async()=>(await v({url:`${a}search`,portal:r,params:{q:`(owner:"${e}") -typekeywords:"recyclebin"`,num:1},options:o})).total,key:"userItemsTotal",id:e})}function C({baseUrl:e,user:r,type:t}){let a=G(e),o=encodeURIComponent(r.username||"");return o?`${a}/${t}.html?user=${o}`:`${a}/${t}.html`}var O=class extends A{constructor(){super(...arguments),this.messages=B({blocking:!0}),this.buttonRef=y(),this.popoverRef=y(),this.isPopoverOpen=!1,this.scale="m",this.showAvatar=!0,this.showName=!0,this.showUsername=!1,this.appearance="transparent",this.arcgisUserPopupInternalUIAction=k(),this.arcgisUserPopupClose=k()}static{this.properties={itemUserInfo:16,groups:16,total:16,isPopoverOpen:16,user:0,username:1,fullName:1,item:0,scale:3,portal:0,baseUrl:1,underline:5,showAvatar:5,showName:5,showUsername:5,wrap:5,appearance:1,zIndex:9,avatarAriaHidden:5,checkOnline:5}}static{this.styles=J}async setFocus(){this.buttonRef.value?.focus()}async openPopup(){this.buttonRef.value?.click()}connectedCallback(){super.connectedCallback(),this.init()}updated(r){r.has("isPopoverOpen")&&this.isPopoverOpen&&this.setPopoverOpen(!0)}get resolvedBaseUrl(){return this.baseUrl||`${this.portal.url}/home`}async init(){let{item:r,username:t,portal:a,fullName:o,messages:s}=this;if(!(!s._lang||!a)){if(r){this.itemUserInfo=await j(r,a,s._lang,this.checkOnline);return}if(t){let n=await _(t,a,this.checkOnline);!n.fullName&&o&&(n.fullName=o),this.itemUserInfo=n}}}async fetchItemsAndGroups(){let{user:r,itemUserInfo:t,item:a,portal:o,username:s,checkOnline:n}=this,i=s||r?.username||a?.owner||t?.username;if(!(!i||!o)){if(!this.groups){let l=await V(i,o,n);this.groups=l}this.total=await X(i,o,n)}}setPopoverOpen(r){requestAnimationFrame(()=>{this.popoverRef.value&&(this.popoverRef.value.open=r)})}openLink(r,t){r.preventDefault(),window.open(t,"_blank")}renderOrgButtons(r){let{messages:t}=this,a=(r.url||this.resolvedBaseUrl).replace(/\/$/u,"");return u`<calcite-button appearance=outline-fill kind=neutral .href=${a} target=_blank @click=${o=>this.openLink(o,a)}>${t.homepage}</calcite-button><calcite-button appearance=outline-fill kind=neutral .href=${`${a}/gallery.html`} target=_blank @click=${o=>this.openLink(o,`${a}/gallery.html`)}>${t.gallery}</calcite-button>`}renderUserButtons(r){let{total:t,groups:a,messages:o}=this,s=r.username||"";if(typeof t!="number"||!a)return u`<calcite-loader .label=${o.loadingUserInformation} scale=s class="popover__loader"></calcite-loader>`;let n=C({baseUrl:this.resolvedBaseUrl,user:{username:s},type:"groups"}),i=C({baseUrl:this.resolvedBaseUrl,user:{username:s},type:"content"}),l=`${this.resolvedBaseUrl.replace(/\/$/u,"")}/user.html?user=${encodeURIComponent(s)}`;return u`${!!a.total&&u`<calcite-button class="popover__button" appearance=outline-fill kind=neutral .href=${n} target=_blank @click=${p=>{this.openLink(p,n),this.arcgisUserPopupInternalUIAction.emit({category:"profile popup",action:"view all groups"})}}>${o.groups.replace("${number}",new Intl.NumberFormat(o._lang).format(a.total))}</calcite-button>`||""}${!!t&&u`<calcite-button class="popover__button" appearance=outline-fill kind=neutral .href=${i} target=_blank @click=${p=>{this.openLink(p,i),this.arcgisUserPopupInternalUIAction.emit({category:"profile popup",action:"view all content"})}}>${o.items.replace("${number}",new Intl.NumberFormat(o._lang).format(t))}</calcite-button>`||""}<calcite-button class="popover__button" appearance=outline-fill kind=neutral .href=${l} target=_blank @click=${p=>{this.openLink(p,l),this.arcgisUserPopupInternalUIAction.emit({category:"profile popup",action:"view profile"})}}>${o.profile}</calcite-button>`}render(){let{user:r,itemUserInfo:t,portal:a,item:o,appearance:s,scale:n,isPopoverOpen:i,showName:l,showUsername:p,messages:h}=this,c=r||t;if(!h._lang||!c)return u`<arcgis-portal-user-avatar scale=s show-name .checkOnline=${this.checkOnline}></arcgis-portal-user-avatar>`;let f=T(o),d=c.username||"",m=H(c.description||"")||"",$=z(c,h._lang),g=f?h.itemManagedBy.replace("${username}",d):d;return u`<button class=${I({button:!0,"button--outline":s==="outline"})} @click=${()=>{this.isPopoverOpen||(this.isPopoverOpen=!0),this.fetchItemsAndGroups()}} ${U(this.buttonRef)}><slot><arcgis-portal-user-avatar .user=${c} .scale=${n} .portal=${a} .showName=${l} .description=${p?d:""} .hideAvatar=${!this.showAvatar} .underline=${this.underline} .checkOnline=${this.checkOnline} .wrap=${this.wrap}></arcgis-portal-user-avatar></slot></button>${i&&this.buttonRef.value&&c&&u`<calcite-popover class="popover" .label=${$} pointer-disabled .referenceElement=${this.buttonRef.value} placement=auto .id=${`${d}-popover`} auto-close style=${R({"--calcite-popover-z-index":this.zIndex?.toString()||"12"})} @calcitePopoverOpen=${()=>{this.arcgisUserPopupInternalUIAction.emit({category:"profile popup",action:"open profile popup"})}} @calcitePopoverClose=${()=>{this.isPopoverOpen=!1,this.arcgisUserPopupClose.emit()}} @keydown=${b=>{b.key==="Escape"&&setTimeout(()=>{this.buttonRef.value?.focus()},200)}} ${U(this.popoverRef)}><div class="popover__wrapper"><div class="popover__header"><arcgis-portal-user-avatar class="popover__avatar" .user=${c} scale=l .portal=${a} show-name .description=${g} .checkOnline=${this.checkOnline}></arcgis-portal-user-avatar></div><div class="popover__content">${!!m&&u`<p class="popover__description">${m}</p>`||""}${!!m&&u`<div class="popover__fade"></div>`||""}<div class=${I({popover__buttons:!0,"popover__buttons--no-description":!m})}>${f?this.renderOrgButtons(c):this.renderUserButtons(c)}</div></div></div></calcite-popover>`||""}`}};N("arcgis-portal-user-popup",O);return O},a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{d as m}from"./KEKBRUUC.js";import{H as d,I as p,J as u,K as s,M as o,P as h,h as n,j as a,v as c}from"./DHHSKOUY.js";import"./YIMNOUTF.js";var v=n`.coord-field{margin-bottom:var(--calcite-spacing-sm)}.coord-label{display:block;margin-bottom:var(--calcite-spacing-sm);font-size:14px}.coordinate-input{width:100%;block-size:var(--calcite-spacing-xxxl);box-sizing:border-box;padding-inline:var(--calcite-spacing-md);font-size:14px;color:var(--calcite-color-text-3);outline-color:var(--calcite-color-brand)}.coordinate-input--error{border:1px solid var(--calcite-color-status-danger)}.coord-error-message{position:relative;max-width:100%;margin:var(--calcite-spacing-sm) 0;display:flex;font-size:14px;padding:6px 7px;background-color:var(--calcite-color-foreground-1);border:1px solid var(--calcite-color-status-danger);box-shadow:0 1px 2px #00000054}.coord-error-message:before{pointer-events:none;content:"";position:absolute;left:11px;top:-16px;width:0;height:0;border:8px solid transparent;border-bottom-color:var(--calcite-color-status-danger)}.coord-error-message:after{position:absolute;pointer-events:none;content:"";left:11px;top:-15px;width:0;height:0;border:8px solid transparent;border-bottom-color:var(--calcite-color-foreground-1)}.is-rtl .coord-error-message:before,.is-rtl .coord-error-message:after{left:initial;right:11px}.coord-error-message calcite-icon{color:var(--calcite-color-status-danger)}.coord-error-message__text{margin-left:var(--calcite-spacing-sm);margin-right:var(--calcite-spacing-sm);line-height:var(--calcite-spacing-xl)}`,l=class extends u{constructor(){super(...arguments),this._direction=m(),this.inputEl=d(),this.isInvalid=!1,this.currentError="",this.inputValue="",this.label="",this.value="",this.errorMessage="",this.min=-180,this.max=180,this.validateRelated=()=>!0,this.relatedErrorMessage="",this.inputId="",this.arcgisCoordChange=c()}static{this.properties={isInvalid:16,currentError:16,inputValue:16,label:1,value:1,errorMessage:1,min:9,max:9,validateRelated:0,relatedErrorMessage:1,inputId:1}}static{this.styles=v}checkRelatedField(){return!this.inputValue||!this.isInvalid||!this.validate(this.inputValue)?"":this.inputValue}isValid(){return!this.isInvalid}setFocus(){this.inputEl.value?.focus()}willUpdate(t){t.has("value")&&this.validate(t.get("value"))}isValidCoord(t,r,i){if(!t?.match(/^-?[0-9]*(\.|,)?[0-9]+$/u))return!1;let e=this.parseNumber(t);return e>=r&&e<=i}validate(t){if(this.isInvalid=!this.isValidCoord(t,this.min,this.max),this.isInvalid)return this.currentError=this.errorMessage,!1;let r=this.parseNumber(t);return this.isInvalid=!this.validateRelated(r),this.isInvalid?(this.currentError=this.relatedErrorMessage,!1):!0}parseNumber(t){let r=`-${Array.from({length:10},(e,g)=>g.toString()).join("")}`,i=t.replace(",",".");return i=Array.from(i).filter(e=>r.includes(e)||e===".").join(""),parseFloat(i)}render(){return a`<div class=${s({"coord-field":!0,"is-rtl":this._direction==="rtl"})}><label class="coord-label" for=${this.inputId??o}>${this.label}</label><calcite-input-number number-button-type=none id=${this.inputId??o} class=${s({"coordinate-input":!0})} .value=${`${this.parseNumber(this.value)}`} @calciteInputNumberChange=${t=>{this.inputValue=t.target.value,this.validate(this.inputValue)&&this.arcgisCoordChange.emit(this.inputValue)}} .status=${this.isInvalid?"invalid":"valid"} ${p(this.inputEl)}></calcite-input-number>${this.isInvalid&&a`<div class="coord-error-message"><calcite-icon icon=exclamation-mark-triangle scale=s></calcite-icon><div class="coord-error-message__text">${this.currentError}</div></div>`||""}</div>`}};h("arcgis-portal-extent-picker-coord-field",l);export{l as ArcgisPortalExtentPickerCoordField};
2
+ import{d as m}from"./GS6MPCDK.js";import{H as d,I as p,J as u,K as s,M as o,P as h,h as n,j as a,v as c}from"./BMUU2S5H.js";import"./YIMNOUTF.js";var v=n`.coord-field{margin-bottom:var(--calcite-spacing-sm)}.coord-label{display:block;margin-bottom:var(--calcite-spacing-sm);font-size:14px}.coordinate-input{width:100%;block-size:var(--calcite-spacing-xxxl);box-sizing:border-box;padding-inline:var(--calcite-spacing-md);font-size:14px;color:var(--calcite-color-text-3);outline-color:var(--calcite-color-brand)}.coordinate-input--error{border:1px solid var(--calcite-color-status-danger)}.coord-error-message{position:relative;max-width:100%;margin:var(--calcite-spacing-sm) 0;display:flex;font-size:14px;padding:6px 7px;background-color:var(--calcite-color-foreground-1);border:1px solid var(--calcite-color-status-danger);box-shadow:0 1px 2px #00000054}.coord-error-message:before{pointer-events:none;content:"";position:absolute;left:11px;top:-16px;width:0;height:0;border:8px solid transparent;border-bottom-color:var(--calcite-color-status-danger)}.coord-error-message:after{position:absolute;pointer-events:none;content:"";left:11px;top:-15px;width:0;height:0;border:8px solid transparent;border-bottom-color:var(--calcite-color-foreground-1)}.is-rtl .coord-error-message:before,.is-rtl .coord-error-message:after{left:initial;right:11px}.coord-error-message calcite-icon{color:var(--calcite-color-status-danger)}.coord-error-message__text{margin-left:var(--calcite-spacing-sm);margin-right:var(--calcite-spacing-sm);line-height:var(--calcite-spacing-xl)}`,l=class extends u{constructor(){super(...arguments),this._direction=m(),this.inputEl=d(),this.isInvalid=!1,this.currentError="",this.inputValue="",this.label="",this.value="",this.errorMessage="",this.min=-180,this.max=180,this.validateRelated=()=>!0,this.relatedErrorMessage="",this.inputId="",this.arcgisCoordChange=c()}static{this.properties={isInvalid:16,currentError:16,inputValue:16,label:1,value:1,errorMessage:1,min:9,max:9,validateRelated:0,relatedErrorMessage:1,inputId:1}}static{this.styles=v}checkRelatedField(){return!this.inputValue||!this.isInvalid||!this.validate(this.inputValue)?"":this.inputValue}isValid(){return!this.isInvalid}setFocus(){this.inputEl.value?.focus()}willUpdate(t){t.has("value")&&this.validate(t.get("value"))}isValidCoord(t,r,i){if(!t?.match(/^-?[0-9]*(\.|,)?[0-9]+$/u))return!1;let e=this.parseNumber(t);return e>=r&&e<=i}validate(t){if(this.isInvalid=!this.isValidCoord(t,this.min,this.max),this.isInvalid)return this.currentError=this.errorMessage,!1;let r=this.parseNumber(t);return this.isInvalid=!this.validateRelated(r),this.isInvalid?(this.currentError=this.relatedErrorMessage,!1):!0}parseNumber(t){let r=`-${Array.from({length:10},(e,g)=>g.toString()).join("")}`,i=t.replace(",",".");return i=Array.from(i).filter(e=>r.includes(e)||e===".").join(""),parseFloat(i)}render(){return a`<div class=${s({"coord-field":!0,"is-rtl":this._direction==="rtl"})}><label class="coord-label" for=${this.inputId??o}>${this.label}</label><calcite-input-number number-button-type=none id=${this.inputId??o} class=${s({"coordinate-input":!0})} .value=${`${this.parseNumber(this.value)}`} @calciteInputNumberChange=${t=>{this.inputValue=t.target.value,this.validate(this.inputValue)&&this.arcgisCoordChange.emit(this.inputValue)}} .status=${this.isInvalid?"invalid":"valid"} ${p(this.inputEl)}></calcite-input-number>${this.isInvalid&&a`<div class="coord-error-message"><calcite-icon icon=exclamation-mark-triangle scale=s></calcite-icon><div class="coord-error-message__text">${this.currentError}</div></div>`||""}</div>`}};h("arcgis-portal-extent-picker-coord-field",l);export{l as ArcgisPortalExtentPickerCoordField};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{b as P}from"./QNUYUNEY.js";import a from"./O3KBWLGU.js";import{a as E}from"./KEKBRUUC.js";import{n as v,s as g,t as C,x as w}from"./DHHSKOUY.js";export default $arcgis.t(([j,{property:p,subclass:I},{on:Y,watch:M},{createObservable:D,trackAccess:O},{property:J,subclass:Q},z,{a:b,b:x}])=>{var A=(t,o)=>i=>U(i,t),u=class extends w{constructor(o,i){super(o),this.Y=new Map,this.A=void 0,this.#e=D();let e=this;e.#t=i,e.Z(),e.setProvisionalExports(S(o,new WeakRef(e),o.M.length-1,e.instance,e.Y),!1),g(o,r=>{if(r){let n=M(()=>o[r],s=>{if(s===e.instance)return;let c=e.instance;e.exports=s,e.instance=s,e.Y.forEach((d,m)=>o.requestUpdate(d,c[m])),e.#o&&c.destroy(),e.#o=!1},{sync:!0});e.onDestroy(n.remove)}},e.exports)}#o;#e;#t;get exports(){return O(this.#e),super.exports}set exports(o){super.exports=o,this.#e.notify()}Z(){let o=this;o.instance="prototype"in o.#t&&"declaredClass"in o.#t.prototype?new o.#t:o.#t(),o.#o=!0}hostConnected(){this.exports=this.instance}hostDestroy(){this.#o&&this.instance.destroy?.()}},U=E(u),S=(t,o,i,e,r)=>new Proxy(e,{get:(n,s)=>{let c=n[s];if(typeof s=="symbol"||r.has(s))return c;let d=t.M[i];return d.A=s,C(t,m=>{if(d.A=void 0,m!==void 0){let f=m.key;r.set(s,f);let h=t.constructor.getPropertyOptions(f),y=s!==f&&f.toLowerCase().includes("disable");$(o,h,s,f,y),h.i===void 0&&N(h,i,s,y)}},c)}}),$=(t,o,i,e,r,n)=>n=M(()=>{let s=t.deref();return s===void 0||s.component.manager.destroyed?n=n.remove():s.exports[i]},(s,c)=>{if(!n)return;t.deref().component?.requestUpdate(e,r?!c:c),o.c=!1},{sync:!0}),N=(t,o,i,e)=>{t.d.get=function(){let r=this.M[o]?.exports[i];return e?!r:r},t.d.set=function(r){let n=this.M[o];n.A!==i&&(n.exports[i]=e?!r:r)}};var L=Object.defineProperty,V=Object.getOwnPropertyDescriptor,l=(t,o,i,e)=>{for(var r=e>1?void 0:e?V(o,i):o,n=t.length-1,s;n>=0;n--)(s=t[n])&&(r=(e?s(o,i,r):s(r))||r);return e&&r&&L(o,i,r),r},a=class extends j{constructor(){super(...arguments),this.fetching=!1,this.status="idle",this.error=void 0,this.portalUrl=void 0,this._itemClassificationValidationErrors=new Map,this.fetchingPromise=new v}get primaryAttribute(){return this.portalClassificationSchema?.classificationMetadata.primaryAttribute}setPortalClassificationData({portalUrl:t,schema:o}){this.portalUrl=t,this.portalClassificationSchema=o,this.status="loaded",this.fetchingPromise.resolve(!0)}setFetching(t){this.fetching=t}async loadPortalClassificationData(t,{signal:o}){this.status="loading";let{result:i,error:e}=await b(t,o);if(e){e.name==="AbortError"?console.log("Request aborted."):(this.error=e,this.status="error",this.fetchingPromise.reject(e));return}else this.setPortalClassificationData({schema:i,portalUrl:t})}async validateClassification(t,o,i,e){if(!o)return"";let r=t?this._itemClassificationValidationErrors.get(t):void 0;if(r)return await r;let n=(async()=>{let{error:s}=await x(i,o,e??{});return s?s?.details.raw.messages.join(", "):""})();return t&&this._itemClassificationValidationErrors.set(t,n),t?await this._itemClassificationValidationErrors.get(t):await n}};l([p()],a.prototype,"portalClassificationSchema",2);l([p()],a.prototype,"fetching",2);l([p()],a.prototype,"status",2);l([p()],a.prototype,"error",2);l([p()],a.prototype,"portalUrl",2);l([p()],a.prototype,"_itemClassificationValidationErrors",2);a=l([I("custom.ClassificationModel")],a);var k;function _(t){return k??=new a(t),k}var at=A(_),ct=t=>new P(t,{task:async([o],{signal:i})=>{if(!o)throw new Error("Portal item is required to load classification data");if(o.loaded||await o.load({signal:i}),t.itemClassification=o.classification,t.classificationModel.status==="loading"&&await t.classificationModel.fetchingPromise.promise,!t.portalItem?.portal.hasClassificationSchema){t.classificationModel.setPortalClassificationData({portalUrl:o.portal.restUrl,schema:void 0});return}(t.classificationModel.status==="idle"||t.classificationModel.status==="loaded"&&t.classificationModel.portalUrl!==o.portal.restUrl)&&await t.classificationModel.loadPortalClassificationData(o.portal.restUrl,{signal:i})},args:()=>[t.portalItem]});return{a:at,b:ct}},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils","applications/Components/reactiveUtils","core/accessorSupport/decorators","core/Accessor",a)
2
+ import{b as P}from"./Z73H62GB.js";import a from"./O3KBWLGU.js";import{a as E}from"./GS6MPCDK.js";import{n as v,s as g,t as C,x as w}from"./BMUU2S5H.js";export default $arcgis.t(([j,{property:p,subclass:I},{on:Y,watch:M},{createObservable:D,trackAccess:O},{property:J,subclass:Q},z,{a:b,b:x}])=>{var A=(t,o)=>i=>U(i,t),u=class extends w{constructor(o,i){super(o),this.Y=new Map,this.A=void 0,this.#e=D();let e=this;e.#t=i,e.Z(),e.setProvisionalExports(S(o,new WeakRef(e),o.M.length-1,e.instance,e.Y),!1),g(o,r=>{if(r){let n=M(()=>o[r],s=>{if(s===e.instance)return;let c=e.instance;e.exports=s,e.instance=s,e.Y.forEach((d,m)=>o.requestUpdate(d,c[m])),e.#o&&c.destroy(),e.#o=!1},{sync:!0});e.onDestroy(n.remove)}},e.exports)}#o;#e;#t;get exports(){return O(this.#e),super.exports}set exports(o){super.exports=o,this.#e.notify()}Z(){let o=this;o.instance="prototype"in o.#t&&"declaredClass"in o.#t.prototype?new o.#t:o.#t(),o.#o=!0}hostConnected(){this.exports=this.instance}hostDestroy(){this.#o&&this.instance.destroy?.()}},U=E(u),S=(t,o,i,e,r)=>new Proxy(e,{get:(n,s)=>{let c=n[s];if(typeof s=="symbol"||r.has(s))return c;let d=t.M[i];return d.A=s,C(t,m=>{if(d.A=void 0,m!==void 0){let f=m.key;r.set(s,f);let h=t.constructor.getPropertyOptions(f),y=s!==f&&f.toLowerCase().includes("disable");$(o,h,s,f,y),h.i===void 0&&N(h,i,s,y)}},c)}}),$=(t,o,i,e,r,n)=>n=M(()=>{let s=t.deref();return s===void 0||s.component.manager.destroyed?n=n.remove():s.exports[i]},(s,c)=>{if(!n)return;t.deref().component?.requestUpdate(e,r?!c:c),o.c=!1},{sync:!0}),N=(t,o,i,e)=>{t.d.get=function(){let r=this.M[o]?.exports[i];return e?!r:r},t.d.set=function(r){let n=this.M[o];n.A!==i&&(n.exports[i]=e?!r:r)}};var L=Object.defineProperty,V=Object.getOwnPropertyDescriptor,l=(t,o,i,e)=>{for(var r=e>1?void 0:e?V(o,i):o,n=t.length-1,s;n>=0;n--)(s=t[n])&&(r=(e?s(o,i,r):s(r))||r);return e&&r&&L(o,i,r),r},a=class extends j{constructor(){super(...arguments),this.fetching=!1,this.status="idle",this.error=void 0,this.portalUrl=void 0,this._itemClassificationValidationErrors=new Map,this.fetchingPromise=new v}get primaryAttribute(){return this.portalClassificationSchema?.classificationMetadata.primaryAttribute}setPortalClassificationData({portalUrl:t,schema:o}){this.portalUrl=t,this.portalClassificationSchema=o,this.status="loaded",this.fetchingPromise.resolve(!0)}setFetching(t){this.fetching=t}async loadPortalClassificationData(t,{signal:o}){this.status="loading";let{result:i,error:e}=await b(t,o);if(e){e.name==="AbortError"?console.log("Request aborted."):(this.error=e,this.status="error",this.fetchingPromise.reject(e));return}else this.setPortalClassificationData({schema:i,portalUrl:t})}async validateClassification(t,o,i,e){if(!o)return"";let r=t?this._itemClassificationValidationErrors.get(t):void 0;if(r)return await r;let n=(async()=>{let{error:s}=await x(i,o,e??{});return s?s?.details.raw.messages.join(", "):""})();return t&&this._itemClassificationValidationErrors.set(t,n),t?await this._itemClassificationValidationErrors.get(t):await n}};l([p()],a.prototype,"portalClassificationSchema",2);l([p()],a.prototype,"fetching",2);l([p()],a.prototype,"status",2);l([p()],a.prototype,"error",2);l([p()],a.prototype,"portalUrl",2);l([p()],a.prototype,"_itemClassificationValidationErrors",2);a=l([I("custom.ClassificationModel")],a);var k;function _(t){return k??=new a(t),k}var at=A(_),ct=t=>new P(t,{task:async([o],{signal:i})=>{if(!o)throw new Error("Portal item is required to load classification data");if(o.loaded||await o.load({signal:i}),t.itemClassification=o.classification,t.classificationModel.status==="loading"&&await t.classificationModel.fetchingPromise.promise,!t.portalItem?.portal.hasClassificationSchema){t.classificationModel.setPortalClassificationData({portalUrl:o.portal.restUrl,schema:void 0});return}(t.classificationModel.status==="idle"||t.classificationModel.status==="loaded"&&t.classificationModel.portalUrl!==o.portal.restUrl)&&await t.classificationModel.loadPortalClassificationData(o.portal.restUrl,{signal:i})},args:()=>[t.portalItem]});return{a:at,b:ct}},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils","applications/Components/reactiveUtils","core/accessorSupport/decorators","core/Accessor",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as b,b as k}from"./6W2IHKCA.js";import{H as c,I as h,J as g,L as f,M as $,P as d,h as m,j as l}from"./BMUU2S5H.js";import"./YIMNOUTF.js";var E=/^#[0-9a-f]{3}$/iu,x=/^#[0-9a-f]{6}$/iu;function u(o){return I(o)||v(o)}function I(o){return o?.length===4&&E.test(o)}function v(o){return o?.length===7&&x.test(o)}function O(o){if(!u(o))return null;let t=o.replace("#","");if(t.length===3){let[e,i,r]=t.split("");return{r:Number.parseInt(`${e}${e}`,16),g:Number.parseInt(`${i}${i}`,16),b:Number.parseInt(`${r}${r}`,16)}}return{r:Number.parseInt(t.slice(0,2),16),g:Number.parseInt(t.slice(2,4),16),b:Number.parseInt(t.slice(4,6),16)}}function w(o){let t=0;for(let i=0;i<o.length;i++)t=o.charCodeAt(i)+((t<<5)-t);let e="#";for(let i=0;i<3;i++){let r=t>>i*8&255;e+=`00${r.toString(16)}`.slice(-2)}return e}function y(o){let{r:t,g:e,b:i}=o;t/=255,e/=255,i/=255;let r=Math.max(t,e,i),n=Math.min(t,e,i),s=r-n;if(s===0)return 0;let a=0;switch(r){case t:a=(e-i)/s+(e<i?6:0);break;case e:a=(i-t)/s+2;break;default:a=(t-e)/s+4;break}return Math.round(a*60)}function M(o){let t=O(o);return t?y(t):0}var T=m`:host{display:inline-block}:host([scale="s"]){height:1.5rem;width:1.5rem;font-size:.625rem}:host([scale="m"]){height:2rem;width:2rem;font-size:.75rem}:host([scale="l"]){font-size:1rem;height:2.75rem;width:2.75rem}:host([scale="xl"]){font-size:1.25rem;height:4rem;width:4rem}.icon{display:flex;color:var(--calcite-color-text-3)}.background{position:relative;display:flex;height:100%;width:100%;align-items:center;justify-content:center}.initials{position:absolute;font-weight:700;text-transform:uppercase;color:var(--calcite-color-text-2)}.thumbnail{height:100%;width:100%}.tooltip-text{margin:0;padding:0;font-size:.75rem;color:var(--calcite-color-text-2)}calcite-tooltip{pointer-events:none}`,p=class extends g{constructor(){super(...arguments),this.imageEl=c(),this.fallbackEl=c(),this.tooltipEl=c(),this.imageError=!1,this.tooltipOpen=!1,this.tooltip=!1,this.scale="m"}static{this.properties={imageError:16,tooltipOpen:16,group:0,portal:0,tooltip:5,scale:3}}static{this.styles=T}willUpdate(t){t.has("group")&&(this.imageError=!1)}updated(){let t=this.tooltipEl.value,e=this.imageEl.value||this.fallbackEl.value;t&&e&&(t.referenceElement=e)}isDarkMode(){return!!this.el.closest(".calcite-mode-dark")}getThumbnailURI(){let{group:t,portal:e}=this;if(!t)return null;if(t.thumbnailUrl)return t.thumbnailUrl;let i=t.thumbnail;if(!i)return null;if(i.startsWith("http"))return i;if(!e||!t.id)return null;let r=k(e),n=r?`?token=${r}`:"";return`${b(e)}community/groups/${t.id}/info/${i}${n}`}generateFillColor(){let{id:t,title:e}=this.group||{},i=t?`#${t.slice(Math.max(0,t.length-6))}`:"",r=t&&u(i)?i:w(e||"");if(!t&&!e||!u(r))return"var(--calcite-color-foreground-2)";let n=M(r),s=this.isDarkMode()?20:90;return`hsl(${n}, 60%, ${s}%)`}generateInitials(){let t=this.group?.title?.trim().charAt(0);return t?.match(/^\w+$/u)?t:null}getIconScale(){return this.scale==="xl"?"l":this.scale==="xs"?"s":this.scale}renderTooltip(){return!this.tooltip||!this.group?.title?null:l`<calcite-tooltip .open=${this.tooltipOpen} close-on-click placement=bottom-start offset-distance=6 offset-skidding=0 ${h(this.tooltipEl)}><p class="tooltip-text">${this.group.title}</p></calcite-tooltip>`}render(){let t=this.getThumbnailURI();if(t&&!this.imageError)return l`<img class="thumbnail" src=${t??$} alt @error=${()=>{this.imageError=!0}} @mouseenter=${()=>{this.tooltipOpen=!0}} @mouseleave=${()=>{this.tooltipOpen=!1}} @focusin=${()=>{this.tooltipOpen=!0}} @focusout=${()=>{this.tooltipOpen=!1}} ${h(this.imageEl)}>${this.renderTooltip()}`;let e=this.generateInitials();return l`<span class="background" style=${f({backgroundColor:this.generateFillColor()})} @mouseenter=${()=>{this.tooltipOpen=!0}} @mouseleave=${()=>{this.tooltipOpen=!1}} @focusin=${()=>{this.tooltipOpen=!0}} @focusout=${()=>{this.tooltipOpen=!1}} ${h(this.fallbackEl)}>${e?l`<span aria-hidden=true class="initials">${e}</span>`:l`<calcite-icon class="icon" icon=users .scale=${this.getIconScale()}></calcite-icon>`}</span>${this.renderTooltip()}`}};d("arcgis-portal-group-thumbnail",p);export{p as ArcgisPortalGroupThumbnail};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as i}from"./5VSDGPHH.js";export default $arcgis.t(([a])=>{function w(e){return e.typeKeywords?.includes("Hosted Service")&&e.type!=="Insights Workbook"&&e.type!=="Insights Data Engineering Workbook"&&e.type!=="Insights Page"}function g(e){return e.typeKeywords?.includes("View Service")}function h(e){return e.typeKeywords?.includes("Service Proxy")&&e.typeKeywords.includes("Geocoding filter")}function v(e){return e.type==="Image Collection"&&e.typeKeywords?.includes("Photo locations")}function p(e){return e?.sourceType==="mosaic-dataset"||e?.serviceSourceType==="esriImageServiceSourceTypeMosaicDataset"}function P(e,t){return e.typeKeywords?.includes("Managed Image Collection")||p(t)&&!e.typeKeywords?.includes("Tiled Imagery")}function I(e,t){return!!((e.sourceJSON?.serviceProperties?.tags||e?.serviceProperties?.tags)?.includes("hasMultidimensions")||t?.hasMultidimensions)}function S(e,t){return c(e,t)||y(e,t)}function c(e,t){return e.owner===t.username}function y(e,t){let r=e.owner,n=e.itemControl==="admin",s=["esri_livingatlas","esri_demographics","esri_boundaries"];return e.portal?.isPortal&&!c(e,t)&&n&&r?.includes("esri_")&&!s.includes(r)?!1:n}var K=(e,t)=>!!t.orgId&&e.every(r=>r.isOrgItem);function j(e){return e.typeKeywords?.includes("Spatiotemporal")}function k(e){return e.typeKeywords?.includes("View Service")}function T(e){return e.typeKeywords?.includes("Hosted Service")}function b(e){return e.typeKeywords?.includes("Multi Services View")}function M(e){return e?.hasViews&&!e.sourceSchemaChangesAllowed}async function $(e){let t=e?.portalItem;if(!t)return await Promise.resolve(null);let r=t.portal;if(r?.user){let n=`${i(r)}community/users/${r.user.username}`;return await a(n,{query:{f:"json",token:t.portal.credential?.token},responseType:"json"}).then(async s=>{let o=s.data?.groups??[];return await Promise.resolve(o)},async()=>await Promise.reject(new Error("Failed to fetch user groups")))}return await Promise.resolve(null)}async function C(e){let t=e?.portalItem;if(!t)return await Promise.resolve(null);let r=t.portal,n=`${i(r)}content/items/${t.id}/groups`;return await a(n,{query:{f:"json",token:t.portal.credential?.token},responseType:"json"}).then(async s=>{let o=s.data?.admin??[],u=s.data?.member??[],l=s.data?.other??[],d=[...o,...u,...l];return await Promise.resolve(d)},async()=>await Promise.reject(new Error("Failed to fetch item groups")))}async function V(e,t,{relationshipType:r,direction:n},s=!1){let o=`${i(t)}content/items/${e}/relatedItems`;return await a(o,{query:{f:"json",relationshipType:r,direction:n,includeRecycleBin:s},responseType:"json"})}function _(e,t){return e?.some(r=>t?.some(n=>r.id===n.id&&r.capabilities.includes("updateitemcontrol")))}return{a:w,b:g,c:h,d:v,e:P,f:I,g:S,h:K,i:j,j:k,k:T,l:b,m:M,n:$,o:C,p:V,q:_}},"request")
2
+ import{a as i}from"./6W2IHKCA.js";export default $arcgis.t(([a])=>{function w(e){return e.typeKeywords?.includes("Hosted Service")&&e.type!=="Insights Workbook"&&e.type!=="Insights Data Engineering Workbook"&&e.type!=="Insights Page"}function g(e){return e.typeKeywords?.includes("View Service")}function h(e){return e.typeKeywords?.includes("Service Proxy")&&e.typeKeywords.includes("Geocoding filter")}function v(e){return e.type==="Image Collection"&&e.typeKeywords?.includes("Photo locations")}function p(e){return e?.sourceType==="mosaic-dataset"||e?.serviceSourceType==="esriImageServiceSourceTypeMosaicDataset"}function P(e,t){return e.typeKeywords?.includes("Managed Image Collection")||p(t)&&!e.typeKeywords?.includes("Tiled Imagery")}function I(e,t){return!!((e.sourceJSON?.serviceProperties?.tags||e?.serviceProperties?.tags)?.includes("hasMultidimensions")||t?.hasMultidimensions)}function S(e,t){return c(e,t)||y(e,t)}function c(e,t){return e.owner===t.username}function y(e,t){let r=e.owner,n=e.itemControl==="admin",s=["esri_livingatlas","esri_demographics","esri_boundaries"];return e.portal?.isPortal&&!c(e,t)&&n&&r?.includes("esri_")&&!s.includes(r)?!1:n}var K=(e,t)=>!!t.orgId&&e.every(r=>r.isOrgItem);function j(e){return e.typeKeywords?.includes("Spatiotemporal")}function k(e){return e.typeKeywords?.includes("View Service")}function T(e){return e.typeKeywords?.includes("Hosted Service")}function b(e){return e.typeKeywords?.includes("Multi Services View")}function M(e){return e?.hasViews&&!e.sourceSchemaChangesAllowed}async function $(e){let t=e?.portalItem;if(!t)return await Promise.resolve(null);let r=t.portal;if(r?.user){let n=`${i(r)}community/users/${r.user.username}`;return await a(n,{query:{f:"json",token:t.portal.credential?.token},responseType:"json"}).then(async s=>{let o=s.data?.groups??[];return await Promise.resolve(o)},async()=>await Promise.reject(new Error("Failed to fetch user groups")))}return await Promise.resolve(null)}async function C(e){let t=e?.portalItem;if(!t)return await Promise.resolve(null);let r=t.portal,n=`${i(r)}content/items/${t.id}/groups`;return await a(n,{query:{f:"json",token:t.portal.credential?.token},responseType:"json"}).then(async s=>{let o=s.data?.admin??[],u=s.data?.member??[],l=s.data?.other??[],d=[...o,...u,...l];return await Promise.resolve(d)},async()=>await Promise.reject(new Error("Failed to fetch item groups")))}async function V(e,t,{relationshipType:r,direction:n},s=!1){let o=`${i(t)}content/items/${e}/relatedItems`;return await a(o,{query:{f:"json",relationshipType:r,direction:n,includeRecycleBin:s},responseType:"json"})}function _(e,t){return e?.some(r=>t?.some(n=>r.id===n.id&&r.capabilities.includes("updateitemcontrol")))}return{a:w,b:g,c:h,d:v,e:P,f:I,g:S,h:K,i:j,j:k,k:T,l:b,m:M,n:$,o:C,p:V,q:_}},"request")
@@ -97,6 +97,20 @@ Do not reinterpret the request into a different form.
97
97
 
98
98
  ---
99
99
 
100
+ ## Follow-up Reference Resolution
101
+
102
+ If the latest user request refers to prior results or prior context using a referential phrase such as "these", "those", "them", "that set", or "the previous results", then the request depends on earlier context.
103
+
104
+ This also applies to equivalent referential wording in other languages.
105
+
106
+ Resolve the reference using the most recent relevant chat history or successful prior step.
107
+
108
+ In this case, the \`assignedTask\` should be standalone and should preserve the referenced prior constraints while adding only the new constraint or question from the latest user request.
109
+
110
+ Do not leave ambiguous references like "these", "those", or "them" in \`assignedTask\` when they can be resolved from context.
111
+
112
+ ---
113
+
100
114
  ## Assigned Task Guidelines (IMPORTANT)
101
115
 
102
116
  - The \`assignedTask\` must match the user\u2019s request exactly in meaning
@@ -106,6 +120,8 @@ Do not reinterpret the request into a different form.
106
120
 
107
121
  - Keep the task short, specific, and directly executable
108
122
  - Keep wording close to the user\u2019s request with minimal transformation
123
+ - When resolving follow-up references, only replace the ambiguous reference with the resolved prior context; keep the rest of the user\u2019s wording as close as possible.
124
+
109
125
  - Use only information explicitly present in the user request or provided context
110
126
 
111
127
  - The \`assignedTask\` may represent only part of the user\u2019s request when multiple steps are necessary
@@ -0,0 +1,65 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as ce}from"./DB6O5DIG.js";import{a as oe}from"./DFTUMKSN.js";import{a as ae}from"./V2EOXGK2.js";import{a as le}from"./YKHMRMUE.js";import"./GS6MPCDK.js";import{J as se,P as ie,h as ne,j as S,v as Q}from"./BMUU2S5H.js";import"./YIMNOUTF.js";function N(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var z=N();function xe(r){z=r}var R={exec:()=>null};function A(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 Ie=((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:A(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:A(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:A(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:A(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:A(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:A(r=>new RegExp(`^ {0,${r}}>`))},Le=/^(?:[ \t]*(?:\n|$))+/,Pe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ve=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,v=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ce=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,G=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,be=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,me=u(be).replace(/bull/g,G).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(),Ee=u(be).replace(/bull/g,G).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(),X=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Be=/^[^\n]+/,W=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qe=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",W).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ze=u(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,G).getRegex(),Z="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",F=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,De=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",F).replace("tag",Z).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),we=u(X).replace("hr",v).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",Z).getRegex(),Me=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",we).getRegex(),U={blockquote:Me,code:Pe,def:qe,fences:ve,heading:Ce,hr:v,html:De,lheading:me,list:Ze,newline:Le,paragraph:we,table:R,text:Be},he=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",v).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",Z).getRegex(),Qe={...U,lheading:Ee,table:he,paragraph:u(X).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",he).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",Z).getRegex()},He={...U,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",F).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(X).replace("hr",v).replace("heading",` *#{1,6} *[^
3
+ ]`).replace("lheading",me).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},je=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Oe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ye=/^( {2,}|\\)\n(?!\s*$)/,Ne=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_=/[\p{P}\p{S}]/u,D=/[\s\p{P}\p{S}]/u,J=/[^\s\p{P}\p{S}]/u,Ge=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,D).getRegex(),$e=/(?!~)[\p{P}\p{S}]/u,Xe=/(?!~)[\s\p{P}\p{S}]/u,We=/(?:[^\s\p{P}\p{S}]|~)/u,Fe=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ie?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Se=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ue=u(Se,"u").replace(/punct/g,_).getRegex(),Je=u(Se,"u").replace(/punct/g,$e).getRegex(),Re="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ke=u(Re,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,D).replace(/punct/g,_).getRegex(),Ve=u(Re,"gu").replace(/notPunctSpace/g,We).replace(/punctSpace/g,Xe).replace(/punct/g,$e).getRegex(),Ye=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,D).replace(/punct/g,_).getRegex(),et=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_).getRegex(),tt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",rt=u(tt,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,D).replace(/punct/g,_).getRegex(),nt=u(/\\(punct)/,"gu").replace(/punct/g,_).getRegex(),st=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(),it=u(F).replace("(?:-->|$)","-->").getRegex(),lt=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",it).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),E=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,at=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",E).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Te=u(/^!?\[(label)\]\[(ref)\]/).replace("label",E).replace("ref",W).getRegex(),ze=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",W).getRegex(),ot=u("reflink|nolink(?!\\()","g").replace("reflink",Te).replace("nolink",ze).getRegex(),pe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,K={_backpedal:R,anyPunctuation:nt,autolink:st,blockSkip:Fe,br:ye,code:Oe,del:R,delLDelim:R,delRDelim:R,emStrongLDelim:Ue,emStrongRDelimAst:Ke,emStrongRDelimUnd:Ye,escape:je,link:at,nolink:ze,punctuation:Ge,reflink:Te,reflinkSearch:ot,tag:lt,text:Ne,url:R},ct={...K,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",E).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",E).getRegex()},H={...K,emStrongRDelimAst:Ve,emStrongLDelim:Je,delLDelim:et,delRDelim:rt,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",pe).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",pe).getRegex()},ht={...H,br:u(ye).replace("{2,}","*").getRegex(),text:u(H.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},C={normal:U,gfm:Qe,pedantic:He},L={normal:K,gfm:H,breaks:ht,pedantic:ct},pt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ue=r=>pt[r];function w(r,e){if(e){if(x.escapeTest.test(r))return r.replace(x.escapeReplace,ue)}else if(x.escapeTestNoEncode.test(r))return r.replace(x.escapeReplaceNoEncode,ue);return r}function ge(r){try{r=encodeURI(r).replace(x.percentDecode,"%")}catch{return null}return r}function ke(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 de(r){let e=r.split(`
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
+ `)}function ut(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 gt(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 fe(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 kt(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
6
+ `).map(i=>{let l=i.match(t.other.beginningSpace);if(l===null)return i;let[a]=l;return a.length>=n.length?i.slice(n.length):i}).join(`
7
+ `)}var B=class{options;rules;lexer;constructor(r){this.options=r||z}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:de(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=kt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=$(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:$(e[0],`
8
+ `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:$(e[0],`
9
+ `)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=$(e[0],`
10
+ `).split(`
11
+ `),s="",n="",i=[];for(;t.length>0;){let l=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),l=!0;else if(!l)a.push(t[c]);else break;t=t.slice(c);let o=a.join(`
12
+ `),p=o.replace(this.rules.other.blockquoteSetextReplace,`
13
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
14
+ ${o}`:o,n=n?`${n}
15
+ ${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=h,t.length===0)break;let g=i.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let f=g,d=f.raw+`
16
+ `+t.join(`
17
+ `),y=this.blockquote(d);i[i.length-1]=y,s=s.substring(0,s.length-f.raw.length)+y.raw,n=n.substring(0,n.length-f.text.length)+y.text;break}else if(g?.type==="list"){let f=g,d=f.raw+`
18
+ `+t.join(`
19
+ `),y=this.list(d);i[i.length-1]=y,s=s.substring(0,s.length-g.raw.length)+y.raw,n=n.substring(0,n.length-f.raw.length)+y.raw,t=d.substring(i.at(-1).raw.length).split(`
20
+ `);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,n={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let i=this.rules.other.listItemRegex(t),l=!1;for(;r;){let c=!1,o="",p="";if(!(e=i.exec(r))||this.rules.block.hr.test(r))break;o=e[0],r=r.substring(o.length);let h=gt(e[2].split(`
21
+ `,1)[0],e[1].length),g=r.split(`
22
+ `,1)[0],f=!h.trim(),d=0;if(this.options.pedantic?(d=2,p=h.trimStart()):f?d=e[1].length+1:(d=h.search(this.rules.other.nonSpaceChar),d=d>4?1:d,p=h.slice(d),d+=e[1].length),f&&this.rules.other.blankLine.test(g)&&(o+=g+`
23
+ `,r=r.substring(g.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(d),ee=this.rules.other.hrRegex(d),te=this.rules.other.fencesBeginRegex(d),re=this.rules.other.headingBeginRegex(d),Ae=this.rules.other.htmlBeginRegex(d),_e=this.rules.other.blockquoteBeginRegex(d);for(;r;){let M=r.split(`
24
+ `,1)[0],I;if(g=M,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),I=g):I=g.replace(this.rules.other.tabCharGlobal," "),te.test(g)||re.test(g)||Ae.test(g)||_e.test(g)||y.test(g)||ee.test(g))break;if(I.search(this.rules.other.nonSpaceChar)>=d||!g.trim())p+=`
25
+ `+I.slice(d);else{if(f||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||te.test(h)||re.test(h)||ee.test(h))break;p+=`
26
+ `+g}f=!g.trim(),o+=M+`
27
+ `,r=r.substring(M.length+1),h=I.slice(d)}}n.loose||(l?n.loose=!0:this.rules.other.doubleBlankLine.test(o)&&(l=!0)),n.items.push({type:"list_item",raw:o,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),n.raw+=o}let a=n.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let c of n.items){this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]);let o=c.tokens[0];if(c.task&&(o?.type==="text"||o?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),o.raw=o.raw.replace(this.rules.other.listReplaceTask,""),o.text=o.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=h.checked,n.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=h.raw+c.tokens[0].raw,c.tokens[0].text=h.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(h)):c.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):c.tokens.unshift(h)}}else c.task&&(c.task=!1);if(!n.loose){let p=c.tokens.filter(g=>g.type==="space"),h=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));n.loose=h}}if(n.loose)for(let c of n.items){c.loose=!0;for(let o of c.tokens)o.type==="text"&&(o.type="paragraph")}return n}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=de(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:$(e[0],`
28
+ `),href:s,title:n}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=ke(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
29
+ `):[],i={type:"table",raw:$(e[0],`
30
+ `),header:[],align:[],rows:[]};if(t.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of n)i.rows.push(ke(l,i.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[c]})));return i}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:$(e[0],`
31
+ `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
32
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=$(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=ut(e[2],"()");if(i===-2)return;if(i>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let s=e[2],n="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],n=i[3])}else n=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),fe(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[s.toLowerCase()];if(!n){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return fe(t,n,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,l,a=n,c=0,o=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(o.lastIndex=0,e=e.slice(-1*r.length+n);(s=o.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(l=[...i].length,s[3]||s[4]){a+=l;continue}else if((s[5]||s[6])&&n%3&&!((n+l)%3)){c+=l;continue}if(a-=l,a>0)continue;l=Math.min(l,l+a+c);let p=[...s[0]][0].length,h=r.slice(0,n+s.index+p+l);if(Math.min(n,l)%2){let f=h.slice(1,-1);return{type:"em",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}let g=h.slice(2,-2);return{type:"strong",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,l,a=n,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*r.length+n);(s=c.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==n))continue;if(s[3]||s[4]){a+=l;continue}if(a-=l,a>0)continue;l=Math.min(l,l+a);let o=[...s[0]][0].length,p=r.slice(0,n+s.index+o+l),h=p.slice(n,-n);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},b=class j{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||z,this.options.tokenizer=this.options.tokenizer||new B,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:x,block:C.normal,inline:L.normal};this.options.pedantic?(t.block=C.pedantic,t.inline=L.pedantic):this.options.gfm&&(t.block=C.gfm,this.options.breaks?t.inline=L.breaks:t.inline=L.gfm),this.tokenizer.rules=t}static get rules(){return{block:C,inline:L}}static lex(e,t){return new j(t).lex(e)}static lexInline(e,t){return new j(t).inlineTokens(e)}lex(e){e=e.replace(x.carriageReturn,`
33
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(x.tabCharGlobal," ").replace(x.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(a=>(i=a.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let a=t.at(-1);i.raw.length===1&&a!==void 0?a.raw+=`
34
+ `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
35
+ `)?"":`
36
+ `)+i.raw,a.text+=`
37
+ `+i.text,this.inlineQueue.at(-1).src=a.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
38
+ `)?"":`
39
+ `)+i.raw,a.text+=`
40
+ `+i.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let l=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),o;this.options.extensions.startBlock.forEach(p=>{o=p.call({lexer:this},c),typeof o=="number"&&o>=0&&(a=Math.min(a,o))}),a<1/0&&a>=0&&(l=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(l))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
41
+ `)?"":`
42
+ `)+i.raw,a.text+=`
43
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(i),s=l.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
44
+ `)?"":`
45
+ `)+i.raw,a.text+=`
46
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e,n=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)o.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,n.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)i=n[2]?n[2].length:0,s=s.slice(0,n.index+i)+"["+"a".repeat(n[0].length-i-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let l=!1,a="",c=1/0;for(;e;){if(e.length<c)c=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}l||(a=""),l=!1;let o;if(this.options.extensions?.inline?.some(h=>(o=h.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let h=t.at(-1);o.type==="text"&&h?.type==="text"?(h.raw+=o.raw,h.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,s,a)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,s,a)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let p=e;if(this.options.extensions?.startInline){let h=1/0,g=e.slice(1),f;this.options.extensions.startInline.forEach(d=>{f=d.call({lexer:this},g),typeof f=="number"&&f>=0&&(h=Math.min(h,f))}),h<1/0&&h>=0&&(p=e.substring(0,h+1))}if(o=this.tokenizer.inlineText(p)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(a=o.raw.slice(-1)),l=!0;let h=t.at(-1);h?.type==="text"?(h.raw+=o.raw,h.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},q=class{options;parser;constructor(r){this.options=r||z}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(x.notSpaceStart)?.[0],n=r.replace(x.endingNewline,"")+`
47
+ `;return s?'<pre><code class="language-'+w(s)+'">'+(t?n:w(n,!0))+`</code></pre>
48
+ `:"<pre><code>"+(t?n:w(n,!0))+`</code></pre>
49
+ `}blockquote({tokens:r}){return`<blockquote>
50
+ ${this.parser.parse(r)}</blockquote>
51
+ `}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
52
+ `}hr(r){return`<hr>
53
+ `}list(r){let e=r.ordered,t=r.start,s="";for(let l=0;l<r.items.length;l++){let a=r.items[l];s+=this.listitem(a)}let n=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+n+i+`>
54
+ `+s+"</"+n+`>
55
+ `}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
56
+ `}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
57
+ `}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let i=r.rows[n];t="";for(let l=0;l<i.length;l++)t+=this.tablecell(i[l]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
58
+ <thead>
59
+ `+e+`</thead>
60
+ `+s+`</table>
61
+ `}tablerow({text:r}){return`<tr>
62
+ ${r}</tr>
63
+ `}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
64
+ `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${w(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),n=ge(r);if(n===null)return s;r=n;let i='<a href="'+r+'"';return e&&(i+=' title="'+w(e)+'"'),i+=">"+s+"</a>",i}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=ge(r);if(n===null)return w(t);r=n;let i=`<img src="${r}" alt="${w(t)}"`;return e&&(i+=` title="${w(e)}"`),i+=">",i}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:w(r.text)}},V=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},m=class O{options;renderer;textRenderer;constructor(e){this.options=e||z,this.options.renderer=this.options.renderer||new q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new V}static parse(e,t){return new O(t).parse(e)}static parseInline(e,t){return new O(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let l=n,a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=a||"";continue}}let i=n;switch(i.type){case"space":{t+=this.renderer.space(i);break}case"hr":{t+=this.renderer.hr(i);break}case"heading":{t+=this.renderer.heading(i);break}case"code":{t+=this.renderer.code(i);break}case"table":{t+=this.renderer.table(i);break}case"blockquote":{t+=this.renderer.blockquote(i);break}case"list":{t+=this.renderer.list(i);break}case"checkbox":{t+=this.renderer.checkbox(i);break}case"html":{t+=this.renderer.html(i);break}case"def":{t+=this.renderer.def(i);break}case"paragraph":{t+=this.renderer.paragraph(i);break}case"text":{t+=this.renderer.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let n=0;n<e.length;n++){let i=e[n];if(this.options.extensions?.renderers?.[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){s+=a||"";continue}}let l=i;switch(l.type){case"escape":{s+=t.text(l);break}case"html":{s+=t.html(l);break}case"link":{s+=t.link(l);break}case"image":{s+=t.image(l);break}case"checkbox":{s+=t.checkbox(l);break}case"strong":{s+=t.strong(l);break}case"em":{s+=t.em(l);break}case"codespan":{s+=t.codespan(l);break}case"br":{s+=t.br(l);break}case"del":{s+=t.del(l);break}case"text":{s+=t.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},P=class{options;block;constructor(r){this.options=r||z}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?b.lex:b.lexInline}provideParser(r=this.block){return r?m.parse:m.parseInline}},dt=class{defaults=N();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=m;Renderer=q;TextRenderer=V;Lexer=b;Tokenizer=B;Hooks=P;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let n=s;for(let i of n.header)t=t.concat(this.walkTokens(i.tokens,e));for(let i of n.rows)for(let l of i)t=t.concat(this.walkTokens(l.tokens,e));break}case"list":{let n=s;t=t.concat(this.walkTokens(n.items,e));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(i=>{let l=n[i].flat(1/0);t=t.concat(this.walkTokens(l,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let i=e.renderers[n.name];i?e.renderers[n.name]=function(...l){let a=n.renderer.apply(this,l);return a===!1&&(a=i.apply(this,l)),a}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[n.level];i?i.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),t.renderer){let n=this.defaults.renderer||new q(this.defaults);for(let i in t.renderer){if(!(i in n))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,a=t.renderer[l],c=n[l];n[l]=(...o)=>{let p=a.apply(n,o);return p===!1&&(p=c.apply(n,o)),p||""}}s.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new B(this.defaults);for(let i in t.tokenizer){if(!(i in n))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,a=t.tokenizer[l],c=n[l];n[l]=(...o)=>{let p=a.apply(n,o);return p===!1&&(p=c.apply(n,o)),p}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new P;for(let i in t.hooks){if(!(i in n))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,a=t.hooks[l],c=n[l];P.passThroughHooks.has(i)?n[l]=o=>{if(this.defaults.async&&P.passThroughHooksRespectAsync.has(i))return(async()=>{let h=await a.call(n,o);return c.call(n,h)})();let p=a.call(n,o);return c.call(n,p)}:n[l]=(...o)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(n,o);return h===!1&&(h=await c.apply(n,o)),h})();let p=a.apply(n,o);return p===!1&&(p=c.apply(n,o)),p}}s.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(l){let a=[];return a.push(i.call(this,l)),n&&(a=a.concat(n.call(this,l))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return b.lex(r,e??this.defaults)}parser(r,e){return m.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},n={...this.defaults,...s},i=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=r),n.async)return(async()=>{let l=n.hooks?await n.hooks.preprocess(e):e,a=await(n.hooks?await n.hooks.provideLexer(r):r?b.lex:b.lexInline)(l,n),c=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(c,n.walkTokens));let o=await(n.hooks?await n.hooks.provideParser(r):r?m.parse:m.parseInline)(c,n);return n.hooks?await n.hooks.postprocess(o):o})().catch(i);try{n.hooks&&(e=n.hooks.preprocess(e));let l=(n.hooks?n.hooks.provideLexer(r):r?b.lex:b.lexInline)(e,n);n.hooks&&(l=n.hooks.processAllTokens(l)),n.walkTokens&&this.walkTokens(l,n.walkTokens);let a=(n.hooks?n.hooks.provideParser(r):r?m.parse:m.parseInline)(l,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(l){return i(l)}}}onError(r,e){return t=>{if(t.message+=`
65
+ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+w(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},T=new dt;function k(r,e){return T.parse(r,e)}k.options=k.setOptions=function(r){return T.setOptions(r),k.defaults=T.defaults,xe(k.defaults),k};k.getDefaults=N;k.defaults=z;k.use=function(...r){return T.use(...r),k.defaults=T.defaults,xe(k.defaults),k};k.walkTokens=function(r,e){return T.walkTokens(r,e)};k.parseInline=T.parseInline;k.Parser=m;k.parser=m.parse;k.Renderer=q;k.TextRenderer=V;k.Lexer=b;k.lexer=b.lex;k.Tokenizer=B;k.Hooks=P;k.parse=k;var bt=k.options,mt=k.setOptions,wt=k.use,yt=k.walkTokens,$t=k.parseInline;var St=m.parse,Rt=b.lex;var ft=ne`.interrupt-container{display:flex;flex-direction:column;gap:.75rem}.interrupt-actions{display:flex;justify-content:flex-end;gap:.5rem}.interrupt-message{white-space:normal}.interrupt-message :where(p){margin:0}.interrupt-message :where(ul,ol){margin:0;padding-inline-start:1.25rem}`;k.use({gfm:!0,breaks:!0,async:!1});var xt=new oe,Y=class extends se{constructor(){super(...arguments),this.#e=[],this._messages=le({blocking:!0}),this.arcgisCancel=Q(),this.arcgisSubmit=Q()}static{this.properties={type:1,message:1,options:0}}static{this.styles=ft}#e;_renderMessageContent(){let e=this.message??"",t=k.parse(e,{async:!1});return xt.sanitize(t)}_renderInterruptInput(){let{_messages:e,type:t,options:s}=this;switch(t){case"single-select":return S`<calcite-list class="interrupt-list" .label=${e.singleSelectLabel} selection-mode=single-persist @calciteListChange=${n=>this.#e=n.target.selectedItems[0]?.value}>${s?.map(n=>S`<calcite-list-item .label=${n} .value=${n}></calcite-list-item>`)}</calcite-list>`;case"multi-select":return S`<calcite-list class="interrupt-list" .label=${e.multiSelectLabel} selection-mode=multiple @calciteListChange=${n=>this.#e=n.target.selectedItems.map(i=>i.value)}>${s?.map(n=>S`<calcite-list-item .label=${n} .value=${n}></calcite-list-item>`)}</calcite-list>`;case"text-input":return S`<calcite-input class="interrupt-input" .label=${e.textInputLabel} @calciteInputInput=${n=>this.#e=n.target.value}></calcite-input>`;case"boolean-choice":return null;default:return ae(t)}}render(){let{_messages:e,type:t}=this,s=t==="boolean-choice";return S`<div class="interrupt-container"><calcite-notice open kind=neutral width=full><div slot=title>${s?e.titleConfirm:e.titleInput}</div><div slot=message class="interrupt-message">${ce(this._renderMessageContent())}</div></calcite-notice>${this._renderInterruptInput()}<div class="interrupt-actions"><calcite-button appearance=outline @click=${()=>this.arcgisCancel.emit()}>${s?e.cancelButton:e.skipButton}</calcite-button><calcite-button appearance=solid @click=${()=>this.arcgisSubmit.emit(t==="boolean-choice"?!0:this.#e)}>${s?e.confirmButton:e.submitButton}</calcite-button></div></div>`}};ie("arcgis-portal-ai-assistant-interrupt",Y);export{Y as ArcgisPortalAiAssistantInterrupt};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as m}from"./LAFNDBTQ.js";import{a as h}from"./LQ3DMZ3K.js";import"./KEKBRUUC.js";import{J as b,M as a,P as d,h as c,j as i,v as u}from"./DHHSKOUY.js";import"./YIMNOUTF.js";var g=c`.spacing-y{margin:var(--calcite-spacing-md) 0}.portal-classification-form-element-tooltip{display:flex;justify-content:space-between;align-items:center}`;function s(o,e){return o.uiElement===e}var n=class extends b{constructor(){super(...arguments),this.messages=h(),this.isRequiredErrors=new Set,this.arcgisAttributeValueChange=u()}static{this.properties={validationMsg:16,attributeKey:1,attribute:0,value:0,renderingInfo:0,isRequiredErrors:0}}static{this.styles=g}willUpdate(e){(e.has("renderingInfo")||e.has("isRequiredErrors"))&&(this.validationMsg=this._getValidationMessage())}_getValidationMessage(){if(this.renderingInfo?.attributeValidationResult)return this.renderingInfo.attributeValidationResult;if(this.isRequiredErrors.has(this.attributeKey))return this.messages.requiredfield??"This is a required field."}renderCheckbox(){return s(this.attribute,"checkbox")?i`<calcite-label class="spacing-y" .for=${this.attributeKey} layout=inline><calcite-checkbox .checked=${this.value} id=${this.attributeKey??a} @calciteCheckboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.checked})} .required=${this.attribute.isRequired??!1} .status=${this.validationMsg?"invalid":"valid"}></calcite-checkbox>${this.attribute.label}</calcite-label>`:null}renderDateInput(){return s(this.attribute,"date")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-input-date-picker id=${this.attributeKey??a} .name=${this.attribute.label} @calciteInputDatePickerChange=${e=>this.isConnected&&this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} overlay-positioning=fixed .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-date-picker></calcite-label>`:null}renderTextInput(){if(!s(this.attribute,"text"))return null;let e=this.attribute.label,t=this.attribute.description;return i`<calcite-label .for=${this.attributeKey}><div class="portal-classification-form-element-tooltip">${e}${this.attribute.labelTooltip&&i`<div><calcite-icon scale=s icon=information .id=${`tooltip-button-${this.attribute.bannerLabel}`} text-label=${this.messages.information??"Information"??a}></calcite-icon><calcite-tooltip .referenceElement=${`tooltip-button-${this.attribute.bannerLabel}`} placement=right>${this.attribute.labelTooltip}</calcite-tooltip></div>`||""}</div><calcite-input-text id=${this.attributeKey??a} .label=${e} .name=${this.attributeKey} @calciteInputTextChange=${r=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:r.target.value})} .placeholder=${t} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-text></calcite-label>`}renderSingleSelect(){return s(this.attribute,"single-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox selection-mode=single id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} .placeholder=${this.attribute.description??this.messages.selectanoption} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} overlay-positioning=fixed validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value} data-testid=${`single-select-${this.attributeKey}`}>${this._renderSingleSelectComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderSingleSelectComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return m(this.renderingInfo?.valueExpressionResult,t=>t.label,t=>i`<calcite-combobox-item .selected=${e===t.value} .heading=${t.label} .value=${t.value} data-testid=${`single-combobox-item-${t.value}`}></calcite-combobox-item>`)}_renderComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return this.renderingInfo?.valueExpressionResult.map(t=>i`<calcite-combobox-item .selected=${e?.includes(t.value)} .heading=${t.label} .value=${t.value} data-testid=${`combobox-item-${t.value}`}></calcite-combobox-item>`)}renderMultiSelect(){return s(this.attribute,"multi-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderGroupedComboboxOptions(){if(!this.renderingInfo?.valueExpressionResult||Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return Object.entries(this.renderingInfo?.valueExpressionResult).map(([t,r])=>i`<calcite-combobox-item .selected=${e?.includes(t)} .heading=${t} .value=${t}>${r.map(l=>i`<calcite-combobox-item .selected=${e?.includes(l.value)} .heading=${l.label} .value=${l.value} data-testid=${`grouped-combobox-item-${l.value}`}></calcite-combobox-item>`)}</calcite-combobox-item>`)}renderMultiGroupedSelectNested(){return s(this.attribute,"multi-grouped-select-nested")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderGroupedComboboxOptions()}</calcite-combobox></calcite-label>`:null}render(){switch(this.attribute.uiElement){case"checkbox":return this.renderCheckbox();case"date":return this.renderDateInput();case"multi-select":return this.renderMultiSelect();case"multi-grouped-select-nested":return this.renderMultiGroupedSelectNested();case"single-select":return this.renderSingleSelect();case"text":return this.renderTextInput();default:return i`<div>Not Implemented Yet.</div>`}}};d("arcgis-portal-classification-form-element",n);export{n as ArcgisPortalClassificationFormElement};
2
+ import{a as m}from"./4BGBBW4V.js";import{a as h}from"./YKHMRMUE.js";import"./GS6MPCDK.js";import{J as b,M as a,P as d,h as c,j as i,v as u}from"./BMUU2S5H.js";import"./YIMNOUTF.js";var g=c`.spacing-y{margin:var(--calcite-spacing-md) 0}.portal-classification-form-element-tooltip{display:flex;justify-content:space-between;align-items:center}`;function s(o,e){return o.uiElement===e}var n=class extends b{constructor(){super(...arguments),this.messages=h(),this.isRequiredErrors=new Set,this.arcgisAttributeValueChange=u()}static{this.properties={validationMsg:16,attributeKey:1,attribute:0,value:0,renderingInfo:0,isRequiredErrors:0}}static{this.styles=g}willUpdate(e){(e.has("renderingInfo")||e.has("isRequiredErrors"))&&(this.validationMsg=this._getValidationMessage())}_getValidationMessage(){if(this.renderingInfo?.attributeValidationResult)return this.renderingInfo.attributeValidationResult;if(this.isRequiredErrors.has(this.attributeKey))return this.messages.requiredfield??"This is a required field."}renderCheckbox(){return s(this.attribute,"checkbox")?i`<calcite-label class="spacing-y" .for=${this.attributeKey} layout=inline><calcite-checkbox .checked=${this.value} id=${this.attributeKey??a} @calciteCheckboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.checked})} .required=${this.attribute.isRequired??!1} .status=${this.validationMsg?"invalid":"valid"}></calcite-checkbox>${this.attribute.label}</calcite-label>`:null}renderDateInput(){return s(this.attribute,"date")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-input-date-picker id=${this.attributeKey??a} .name=${this.attribute.label} @calciteInputDatePickerChange=${e=>this.isConnected&&this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} overlay-positioning=fixed .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-date-picker></calcite-label>`:null}renderTextInput(){if(!s(this.attribute,"text"))return null;let e=this.attribute.label,t=this.attribute.description;return i`<calcite-label .for=${this.attributeKey}><div class="portal-classification-form-element-tooltip">${e}${this.attribute.labelTooltip&&i`<div><calcite-icon scale=s icon=information .id=${`tooltip-button-${this.attribute.bannerLabel}`} text-label=${this.messages.information??"Information"??a}></calcite-icon><calcite-tooltip .referenceElement=${`tooltip-button-${this.attribute.bannerLabel}`} placement=right>${this.attribute.labelTooltip}</calcite-tooltip></div>`||""}</div><calcite-input-text id=${this.attributeKey??a} .label=${e} .name=${this.attributeKey} @calciteInputTextChange=${r=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:r.target.value})} .placeholder=${t} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-text></calcite-label>`}renderSingleSelect(){return s(this.attribute,"single-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox selection-mode=single id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} .placeholder=${this.attribute.description??this.messages.selectanoption} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} overlay-positioning=fixed validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value} data-testid=${`single-select-${this.attributeKey}`}>${this._renderSingleSelectComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderSingleSelectComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return m(this.renderingInfo?.valueExpressionResult,t=>t.label,t=>i`<calcite-combobox-item .selected=${e===t.value} .heading=${t.label} .value=${t.value} data-testid=${`single-combobox-item-${t.value}`}></calcite-combobox-item>`)}_renderComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return this.renderingInfo?.valueExpressionResult.map(t=>i`<calcite-combobox-item .selected=${e?.includes(t.value)} .heading=${t.label} .value=${t.value} data-testid=${`combobox-item-${t.value}`}></calcite-combobox-item>`)}renderMultiSelect(){return s(this.attribute,"multi-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderGroupedComboboxOptions(){if(!this.renderingInfo?.valueExpressionResult||Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return Object.entries(this.renderingInfo?.valueExpressionResult).map(([t,r])=>i`<calcite-combobox-item .selected=${e?.includes(t)} .heading=${t} .value=${t}>${r.map(l=>i`<calcite-combobox-item .selected=${e?.includes(l.value)} .heading=${l.label} .value=${l.value} data-testid=${`grouped-combobox-item-${l.value}`}></calcite-combobox-item>`)}</calcite-combobox-item>`)}renderMultiGroupedSelectNested(){return s(this.attribute,"multi-grouped-select-nested")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderGroupedComboboxOptions()}</calcite-combobox></calcite-label>`:null}render(){switch(this.attribute.uiElement){case"checkbox":return this.renderCheckbox();case"date":return this.renderDateInput();case"multi-select":return this.renderMultiSelect();case"multi-grouped-select-nested":return this.renderMultiGroupedSelectNested();case"single-select":return this.renderSingleSelect();case"text":return this.renderTextInput();default:return i`<div>Not Implemented Yet.</div>`}}};d("arcgis-portal-classification-form-element",n);export{n as ArcgisPortalClassificationFormElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./OQDPULPD.js";import"./QNUYUNEY.js";import a from"./O3KBWLGU.js";import{a as f}from"./LQ3DMZ3K.js";import"./KEKBRUUC.js";import{J as n,L as c,P as l,h as e,j as s,p as o}from"./DHHSKOUY.js";import"./YIMNOUTF.js";export default $arcgis.t(([,{a:d,b:h}])=>{var p=e`.banner{box-sizing:border-box;width:100%;left:0;text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);text-transform:uppercase;overflow-wrap:break-word}.invalid-container{background-color:#fff;color:#000;display:flex;align-items:center;justify-content:center;gap:8px}.invalid-icon{--calcite-icon-color: var(--calcite-color-status-danger)}.invalid-message{text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);overflow-wrap:break-word}`,r=class extends n{constructor(){super(...arguments),this.classificationModel=d(this),this.messages=f(),this._classificationDataTask=h(this),this.portalClassificationSchema=this.classificationModel.portalClassificationSchema,this.status=this.classificationModel.status,this.missingExistingClassification=!1,this.variant="full",this.autoDestroyDisabled=!1,this.validationErrors=""}static{this.properties={portalClassificationSchema:16,status:16,itemClassification:16,portalItem:0,missingExistingClassification:5,variant:1,autoDestroyDisabled:5,validationErrors:1}}static{this.styles=p}async destroy(){await this.manager.destroy()}willUpdate(a){if(a.has("portalItem")){let{portalItem:i}=this;i?.load().then(()=>{i?.id&&i?.loaded&&i?.classification&&!this.missingExistingClassification?this.classificationModel.validateClassification(this.variant==="preview"?null:i.id,i.classification,i?.portal.restUrl).catch(o(this)).then(t=>{this.validationErrors=t??""}):this.validationErrors=""}).catch(o(this))}}getStyle(){let a={};if(this.variant==="preview"&&(a.fontSize="var(--calcite-font-size-sm)",a.padding="var(--calcite-spacing-xs)"),this.itemClassification&&this.portalClassificationSchema){let i=this.itemClassification.classification,t=this.portalClassificationSchema.classificationMetadata.classificationValueProperties.find(({value:m})=>m===i);t?.backgroundColor&&(a.backgroundColor=t.backgroundColor),t?.textColor&&(a.color=t.textColor)}return a}render(){return this._classificationDataTask.render({pending:void 0,error:void 0,complete:()=>this.portalClassificationSchema&&this.portalItem?.portal.authMode!=="anonymous"?this.validationErrors&&this.variant==="full"?s`<div class="invalid-container"><calcite-icon class="invalid-icon" scale=s icon=exclamation-mark-triangle .textLabel=${this.messages.invalidclassificationerror}></calcite-icon><span class="invalid-message">${this.messages.invalidclassificationerror}</span></div>`:s`<div class="banner" style=${c(this.getStyle())}>${this.itemClassification?.banner??this.messages.notyetclassified??"Not yet classified"}</div>`:""})}};l("arcgis-portal-classification-banner",r);return r},a,b)
2
+ import b from"./ROCZLAYA.js";import"./Z73H62GB.js";import a from"./O3KBWLGU.js";import{a as f}from"./YKHMRMUE.js";import"./GS6MPCDK.js";import{J as n,L as c,P as l,h as e,j as s,p as o}from"./BMUU2S5H.js";import"./YIMNOUTF.js";export default $arcgis.t(([,{a:d,b:h}])=>{var p=e`.banner{box-sizing:border-box;width:100%;left:0;text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);text-transform:uppercase;overflow-wrap:break-word}.invalid-container{background-color:#fff;color:#000;display:flex;align-items:center;justify-content:center;gap:8px}.invalid-icon{--calcite-icon-color: var(--calcite-color-status-danger)}.invalid-message{text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);overflow-wrap:break-word}`,r=class extends n{constructor(){super(...arguments),this.classificationModel=d(this),this.messages=f(),this._classificationDataTask=h(this),this.portalClassificationSchema=this.classificationModel.portalClassificationSchema,this.status=this.classificationModel.status,this.missingExistingClassification=!1,this.variant="full",this.autoDestroyDisabled=!1,this.validationErrors=""}static{this.properties={portalClassificationSchema:16,status:16,itemClassification:16,portalItem:0,missingExistingClassification:5,variant:1,autoDestroyDisabled:5,validationErrors:1}}static{this.styles=p}async destroy(){await this.manager.destroy()}willUpdate(a){if(a.has("portalItem")){let{portalItem:i}=this;i?.load().then(()=>{i?.id&&i?.loaded&&i?.classification&&!this.missingExistingClassification?this.classificationModel.validateClassification(this.variant==="preview"?null:i.id,i.classification,i?.portal.restUrl).catch(o(this)).then(t=>{this.validationErrors=t??""}):this.validationErrors=""}).catch(o(this))}}getStyle(){let a={};if(this.variant==="preview"&&(a.fontSize="var(--calcite-font-size-sm)",a.padding="var(--calcite-spacing-xs)"),this.itemClassification&&this.portalClassificationSchema){let i=this.itemClassification.classification,t=this.portalClassificationSchema.classificationMetadata.classificationValueProperties.find(({value:m})=>m===i);t?.backgroundColor&&(a.backgroundColor=t.backgroundColor),t?.textColor&&(a.color=t.textColor)}return a}render(){return this._classificationDataTask.render({pending:void 0,error:void 0,complete:()=>this.portalClassificationSchema&&this.portalItem?.portal.authMode!=="anonymous"?this.validationErrors&&this.variant==="full"?s`<div class="invalid-container"><calcite-icon class="invalid-icon" scale=s icon=exclamation-mark-triangle .textLabel=${this.messages.invalidclassificationerror}></calcite-icon><span class="invalid-message">${this.messages.invalidclassificationerror}</span></div>`:s`<div class="banner" style=${c(this.getStyle())}>${this.itemClassification?.banner??this.messages.notyetclassified??"Not yet classified"}</div>`:""})}};l("arcgis-portal-classification-banner",r);return r},a,b)