@esri/solutions-components 5.1.0-next.154 → 5.1.0-next.155
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.
- package/dist/cdn/2C6OKRTL.js +2 -0
- package/dist/cdn/{4D4UXCEU.js → 2K4FSWCI.js} +1 -1
- package/dist/cdn/2L62YUIH.js +2 -0
- package/dist/cdn/2UIPY2ED.js +2 -0
- package/dist/cdn/{DN3PZCF4.js → 37SYO65U.js} +1 -1
- package/dist/cdn/{XK36P3C4.js → 3N4FGXFE.js} +1 -1
- package/dist/cdn/{2IGILR4T.js → 5KWJUQRY.js} +1 -1
- package/dist/cdn/66VSNZFA.js +2 -0
- package/dist/cdn/{GCEPKR7I.js → 6LDTUOZL.js} +1 -1
- package/dist/cdn/6OJALTOU.js +2 -0
- package/dist/cdn/6RNSFI2J.js +2 -0
- package/dist/cdn/{3JZVI5AM.js → 6RONZCGM.js} +1 -1
- package/dist/cdn/{DMM5WA5Q.js → 6Y47Z4QA.js} +1 -1
- package/dist/cdn/{UNBTFJYB.js → 7IXJB2CS.js} +1 -1
- package/dist/cdn/7JC52SFZ.js +2 -0
- package/dist/cdn/{IFONVCBL.js → 7LKPG6HJ.js} +1 -1
- package/dist/cdn/{VY5TD3VS.js → 7ZEDJMU7.js} +1 -1
- package/dist/cdn/{YXHO47AZ.js → 7ZJQQBSR.js} +1 -1
- package/dist/cdn/{PNESECPO.js → A6VVARNG.js} +1 -1
- package/dist/cdn/{JYUZPAPI.js → A7PEHKA2.js} +1 -1
- package/dist/cdn/{SYQ5E5TV.js → AKQEDHUS.js} +1 -1
- package/dist/cdn/{TOIBA2KF.js → ALQFRJNC.js} +1 -1
- package/dist/cdn/{FWRT4BPD.js → ARFCWGCB.js} +1 -1
- package/dist/cdn/{PPRV6EZZ.js → AVBZ2B75.js} +1 -1
- package/dist/cdn/{SZRVESYE.js → AXFB53AQ.js} +1 -1
- package/dist/cdn/{4ASIXXDP.js → AZDHGEBN.js} +1 -1
- package/dist/cdn/{JNE3LBQU.js → BFC6PQCO.js} +1 -1
- package/dist/cdn/BLR4MTOP.js +2 -0
- package/dist/cdn/{LHG6NOEP.js → BM4VSEDV.js} +1 -1
- package/dist/cdn/{DDJSF2M3.js → BWRBYYGI.js} +1 -1
- package/dist/cdn/C4F2OOUL.js +2 -0
- package/dist/cdn/C4T4HSG2.js +2 -0
- package/dist/cdn/C5KDPY7R.js +2 -0
- package/dist/cdn/{FZKGL66L.js → C76SZF3J.js} +1 -1
- package/dist/cdn/{TB33W36T.js → CEPWTLDN.js} +1 -1
- package/dist/cdn/{XO54BFTC.js → CFQKZMGC.js} +1 -1
- package/dist/cdn/CJ3EZE7U.js +2 -0
- package/dist/cdn/CPBEDBQJ.js +2 -0
- package/dist/cdn/{UWSHU7MG.js → CQQH3XK5.js} +1 -1
- package/dist/cdn/{WC37HMOI.js → CSAXBV46.js} +1 -1
- package/dist/cdn/{TLM7N22U.js → DF7TCZUS.js} +1 -1
- package/dist/cdn/{QFFHU77I.js → DMX66TUK.js} +1 -1
- package/dist/cdn/{NKX2EIDR.js → DOXKOGC2.js} +1 -1
- package/dist/cdn/{BJAEUZFB.js → EF4LWVLU.js} +1 -1
- package/dist/cdn/{IEC46RE7.js → EKFKOS5K.js} +1 -1
- package/dist/cdn/{ZCPVOS4Q.js → ENTBR5YC.js} +1 -1
- package/dist/cdn/EPKRNLRL.js +2 -0
- package/dist/cdn/{LGZDNUGT.js → FS5WR74E.js} +1 -1
- package/dist/cdn/{JOAEH3CI.js → G4ADX65Y.js} +1 -1
- package/dist/cdn/{NV2DLQDN.js → G5PL37M5.js} +1 -1
- package/dist/cdn/{RRD4QUQS.js → GBDBGOCT.js} +1 -1
- package/dist/cdn/{OAEWZFWV.js → GDX4FWG7.js} +1 -1
- package/dist/cdn/{GG4IIHQE.js → GFEDQ7WH.js} +1 -1
- package/dist/cdn/{G6EZOEPB.js → GJ7QMCFT.js} +1 -1
- package/dist/cdn/GXIGM56I.js +2 -0
- package/dist/cdn/{DD2Y5NOB.js → GYTMAAVH.js} +1 -1
- package/dist/cdn/HRH3YBW4.js +2 -0
- package/dist/cdn/{KV76ATT5.js → HS55CSUO.js} +1 -1
- package/dist/cdn/HVT2WBVC.js +2 -0
- package/dist/cdn/{QD22B6N2.js → I3A27HFS.js} +1 -1
- package/dist/cdn/IADXB53D.js +2 -0
- package/dist/cdn/{DXQQQNOF.js → IBAJ7OFO.js} +1 -1
- package/dist/cdn/{PX6AYCC4.js → IM3C52I6.js} +1 -1
- package/dist/cdn/{EVO7B63R.js → IR55PBAU.js} +1 -1
- package/dist/cdn/{JXTZNXTZ.js → IUNUJ6GU.js} +1 -1
- package/dist/cdn/{GMSG7ZRV.js → IZ7DJL5P.js} +1 -1
- package/dist/cdn/{FNTXI57U.js → IZDAQGZD.js} +1 -1
- package/dist/cdn/{UIGRRD7P.js → JET6MYZJ.js} +1 -1
- package/dist/cdn/{NYQQSL25.js → JM4BUUFY.js} +1 -1
- package/dist/cdn/JQANOMEB.js +2 -0
- package/dist/cdn/JTENM3PQ.js +2 -0
- package/dist/cdn/KGU32CDZ.js +2 -0
- package/dist/cdn/{EKUENEEW.js → L2XO4YLV.js} +1 -1
- package/dist/cdn/{LWT3JEQ6.js → LJIX7K76.js} +5 -5
- package/dist/cdn/{ZOF7AUSS.js → LOPXSWVG.js} +1 -1
- package/dist/cdn/M5ZEJF3J.js +2 -0
- package/dist/cdn/{WG5NM5XY.js → MDMFIEM7.js} +1 -1
- package/dist/cdn/MPSNK45A.js +2 -0
- package/dist/cdn/{XJAXXELZ.js → N2LDQKCJ.js} +1 -1
- package/dist/cdn/{L5YT5FRJ.js → O4YFJXGF.js} +1 -1
- package/dist/cdn/OOP3DI7Y.js +2 -0
- package/dist/cdn/ORMBTE2Z.js +2 -0
- package/dist/cdn/OUNL2UWX.js +7 -0
- package/dist/cdn/OVKPT3QA.js +2 -0
- package/dist/cdn/{RUVOSMTB.js → OZFVLORO.js} +1 -1
- package/dist/cdn/{SHEPQVUX.js → PCP5UFZR.js} +1 -1
- package/dist/cdn/{3CDO3ATJ.js → PJTHEJG4.js} +1 -1
- package/dist/cdn/PRM47E4O.js +2 -0
- package/dist/cdn/{ZCLYSOQM.js → Q7GMS6X2.js} +1 -1
- package/dist/cdn/{2HAYT46E.js → QA3SYWWX.js} +1 -1
- package/dist/cdn/{3S5PVZVU.js → QCCLUBLV.js} +1 -1
- package/dist/cdn/{3KYQE6O5.js → QCNGBMWJ.js} +1 -1
- package/dist/cdn/{X6JL6SAH.js → QLRGY4WQ.js} +1 -1
- package/dist/cdn/{D6VR7GCD.js → QSGVCMF2.js} +1 -1
- package/dist/cdn/{ZTRQVOAR.js → QX7YVGEN.js} +1 -1
- package/dist/cdn/{S4VDUHA7.js → RCOHFQC5.js} +1 -1
- package/dist/cdn/{U56TK45K.js → RFSPNC4B.js} +13 -13
- package/dist/cdn/RLV5JHIU.js +2 -0
- package/dist/cdn/RXOPHYUF.js +2 -0
- package/dist/cdn/{M73VTGBI.js → S2A7SDYB.js} +1 -1
- package/dist/cdn/{RYBSWXQQ.js → S2Y44VZV.js} +1 -1
- package/dist/cdn/{3ZYEIYTY.js → S6J35GRM.js} +1 -1
- package/dist/cdn/SIODWUWX.js +2 -0
- package/dist/cdn/{WZCJ2VDD.js → SNJPMQCE.js} +1 -1
- package/dist/cdn/{DUXRJBCP.js → SRLQU37I.js} +1 -1
- package/dist/cdn/TCUNTTNI.js +2 -0
- package/dist/cdn/{AOWNMC3W.js → TK235QG4.js} +1 -1
- package/dist/cdn/TM6TYAW2.js +90 -0
- package/dist/cdn/{ITSA4WXG.js → TRXDA7G2.js} +1 -1
- package/dist/cdn/U2ZKJCSY.js +27 -0
- package/dist/cdn/UBPOT5V3.js +2 -0
- package/dist/cdn/{QGDR24DC.js → UY66XIX3.js} +1 -1
- package/dist/cdn/{BAFYN4RD.js → V2DYKK6V.js} +1 -1
- package/dist/cdn/{QEPO225M.js → V6VJJHYJ.js} +1 -1
- package/dist/cdn/{YM2IDMZO.js → V73HMWMC.js} +1 -1
- package/dist/cdn/{7WIFBTQF.js → VCL4OTSQ.js} +6 -14
- package/dist/cdn/{Z23BVIGQ.js → VYCVNEK2.js} +1 -1
- package/dist/cdn/{2BM4W44V.js → WAJG744H.js} +1 -1
- package/dist/cdn/{CDJCXGBN.js → WFWEWVGR.js} +1 -1
- package/dist/cdn/WRLN7DLT.js +2 -0
- package/dist/cdn/X3CDW2ME.js +78 -0
- package/dist/cdn/{3TIQRBWC.js → XDONARND.js} +1 -1
- package/dist/cdn/{MGEDATQ7.js → XF5N3NI5.js} +1 -1
- package/dist/cdn/{63ZMLOEP.js → XKBOPER7.js} +1 -1
- package/dist/cdn/XOEFU24R.js +2 -0
- package/dist/cdn/{U6JZYJ4D.js → Y3Q6SFIV.js} +1 -1
- package/dist/cdn/Y6KZTCZD.js +2 -0
- package/dist/cdn/{WI67R264.js → YKSW755L.js} +1 -1
- package/dist/cdn/YM4U4HSN.js +2 -0
- package/dist/cdn/{OQOCOC5R.js → ZQAD6SUE.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/assessBuildRequest.js +13 -13
- package/dist/chunks/assessUpdateRequest.js +29 -26
- package/dist/chunks/assistantResponse.js +6 -14
- package/dist/chunks/classifyIntent.js +5 -5
- package/dist/chunks/updateDesign.js +1 -1
- package/dist/components/arcgis-solutions-assistant/customElement.js +449 -446
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/solutions-components_commit.txt +8 -5
- package/package.json +3 -3
- package/dist/cdn/4MAZNAHZ.js +0 -2
- package/dist/cdn/4RU3GWUU.js +0 -2
- package/dist/cdn/6IBUETLU.js +0 -2
- package/dist/cdn/6ZN2VAXG.js +0 -2
- package/dist/cdn/7CAFUU5D.js +0 -2
- package/dist/cdn/APL6U736.js +0 -2
- package/dist/cdn/BBECVTV3.js +0 -2
- package/dist/cdn/BG4LNU44.js +0 -2
- package/dist/cdn/BZLMMSFW.js +0 -2
- package/dist/cdn/CUOHPTI7.js +0 -2
- package/dist/cdn/CVHXDPJO.js +0 -2
- package/dist/cdn/DVWIWECZ.js +0 -27
- package/dist/cdn/F2V6IA23.js +0 -2
- package/dist/cdn/GWJRCE5C.js +0 -90
- package/dist/cdn/JGMNZLH4.js +0 -7
- package/dist/cdn/JMYENPUQ.js +0 -2
- package/dist/cdn/LBY3ZNJE.js +0 -2
- package/dist/cdn/LZDMYPQ2.js +0 -75
- package/dist/cdn/PYBOC3DB.js +0 -2
- package/dist/cdn/RMEDO4JC.js +0 -2
- package/dist/cdn/SO27FVOH.js +0 -2
- package/dist/cdn/SWM5KEF6.js +0 -2
- package/dist/cdn/TDH6R4JP.js +0 -2
- package/dist/cdn/TWJSFINX.js +0 -2
- package/dist/cdn/UQDRAXO2.js +0 -2
- package/dist/cdn/UQN2JCKP.js +0 -2
- package/dist/cdn/WDRZR4N3.js +0 -2
- package/dist/cdn/WW6SEFWM.js +0 -2
- package/dist/cdn/XDF5MAGN.js +0 -2
- package/dist/cdn/Y7F2QFO6.js +0 -2
- package/dist/cdn/YCJJWOTP.js +0 -2
- package/dist/cdn/ZWKTEPK3.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{a as In}from"./S37TPZAO.js";import{b as gn,c as yn}from"./SJ7HTNAT.js";import a from"./UBEU6ULP.js";import{b as Po}from"./2B4SGB3I.js";import{b as yo}from"./I2NTSKBD.js";import{$ as Qe,$a as gr,$b as Mt,A as Oo,Aa as Zo,Ab as Ar,B as Ro,Ba as Qo,Bb as Ur,C as Ie,Ca as Yo,Cb as Mr,D as M,Da as kt,E as Co,Ea as Ot,Eb as Nr,F as Je,Fa as Xo,G as _e,Ga as er,Gb as $r,H as S,Ha as ye,Hb as Wr,I as Et,Ia as Rt,Ib as Lr,J as Ao,Ja as tr,Jb as Vr,K as p,Ka as or,Kb as ne,L as Uo,La as rr,Lb as Br,Ma as nr,Mb as zr,N as Te,Na as ir,Nb as jr,O as b,Oa as sr,Ob as Dr,P as ve,Pa as ar,Pb as Gr,Q as Mo,Qa as mr,Qb as Kr,R as _t,Ra as cr,Rb as Hr,S as Tt,Sa as dr,Sb as qr,T as Ze,Ta as pr,Tb as Jr,U as q,Ua as lr,Ub as Zr,V as No,Va as ur,Vb as Qr,W as $o,Wa as fr,Wb as Yr,X as Wo,Xa as Ct,Xb as Xr,Y as B,Ya as tt,Yb as en,Z as Lo,Za as hr,Zb as tn,_ as D,_a as Ir,_b as on,a as Le,aa as Vo,ab as re,ac as rt,ba as vt,bb as yr,bc as Nt,c as W,ca as oe,cb as Pr,cc as ke,da as w,db as wr,dc as nt,e as ee,ea as _,eb as Sr,ec as rn,f as Eo,fa as Y,fb as xr,fc as nn,g as me,ga as Ye,gb as br,gc as sn,h as u,ha as Bo,hb as Er,hc as an,i as xt,ia as zo,ib as _r,ic as mn,j as le,ja as Ft,jb as Tr,jc as cn,k as je,ka as jo,kb as vr,kc as dn,l as fe,lb as Fe,lc as Oe,m as De,ma as Do,mb as F,mc as it,n as Ge,na as Go,nb as ot,nc as st,o as bt,oa as Ko,oc as pn,p as To,pa as Ho,pc as at,qa as qo,qb as Fr,qc as ln,r as Ke,ra as C,rb as kr,s as vo,sa as ge,sb as z,t as He,ta as J,tb as Or,u as qe,ub as Pe,v as te,va as Xe,vb as Z,w as Fo,wa as et,wb as Rr,x as he,xa as Jo,xb as At,y as ko,yb as Cr,z as I,zb as Ut}from"./AE5HNAOV.js";import{a as go}from"./MGEDATQ7.js";import{a as ue,g as Ee}from"./IHG7KTNC.js";import{a as L}from"./ZCU2WWVN.js";import{a as H,b as Ve,c as Be,d as ze}from"./KOIDWEP3.js";import{e as K,f as xo,j as Ne,l as $e,o as bo,s as We}from"./AYSQIO6L.js";import{b as wo,h as So}from"./YQHYMLC7.js";import{a as _o}from"./5O53T3SW.js";import{a as V}from"./AJZDBHB6.js";import{b as Io}from"./2I5LGZNX.js";import{E as Me,F as be,G as fo,K as ho,h as uo,i as G,q as pe}from"./FFF5HUPM.js";import{c as $}from"./QPIMTXPL.js";export default $arcgis.t(([{g:un,h:fn,i:hn}])=>{function we(e,t="application/octet-stream"){if(typeof Blob<"u"){let o=[];for(let n=0;n<e.length;n++)o[n]=e.charCodeAt(n);let r=new Uint8Array(o);return new Blob([r],{type:t})}else throw new Error("stringToBlob is not currently supported on Node")}function Pn(e){if(typeof Blob<"u")return new Blob([JSON.stringify(e)],{type:"application/json"});throw new Error("objectToJsonBlob is not currently supported on Node")}var mt={};$(mt,{_mostRecentlyEditedLayer:()=>$t,convertItemToTemplate:()=>ss,createItemFromTemplate:()=>as,postProcess:()=>ms});function ss(e,t,o,r){return new Promise((n,i)=>{let s=D(e);Tr(e.groupDesignations)?rr(s,o).then(m=>n(m),m=>i(S(m))):(s.estimatedDeploymentCostFactor=10,J(s.item.id,o).then(m=>{s.data=m,br(s,o).then(c=>{c.item.modified=Math.max(c.item.modified,$t(s.properties.layers),$t(s.properties.tables)),wr(c,o).then(d=>{c.dependencies=d.map(l=>l.id),n(Xo(c,d,!1,r))},d=>i(S(d)))},c=>i(S(c)))}))})}function as(e,t,o,r){return new Promise(n=>{if(!r(e.itemId,u.Started,0)){r(e.itemId,u.Ignored,0),n(I(e.type));return}let i=M(e);i=w(i,t),delete i.item.thumbnail,Je(i,"properties.service.size");let s=er(i.data);gr(i,o,t).then(a=>{a.success?r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,a.serviceItemId)?(i=Rt(i,t,a),sr(i,t,s,o).then(()=>{i=Rt(i,t,a),Pe({...i.item,url:void 0},i.data,o,e.item.thumbnail,void 0,t).then(()=>{r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor/2,a.serviceItemId)?C(i.itemId,o).then(m=>{i.item=m,p(i,"item.url")&&!i.item.url.endsWith("/")&&(i.item.url+="/"),n({item:i,id:a.serviceItemId,type:i.type,postProcess:oe({item:i.item,data:i.data})||Ct(i)})},()=>{r(e.itemId,u.Failed,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type)))}):(r(e.itemId,u.Cancelled,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type))))},()=>{r(e.itemId,u.Failed,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type)))})},()=>{r(e.itemId,u.Failed,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type)))})):(r(e.itemId,u.Cancelled,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type)))):(r(e.itemId,u.Failed,0),n(I(e.type)))},()=>{r(e.itemId,u.Failed,0),n(I(e.type))})})}function ms(e,t,o,r,n,i,s){return new Promise((a,m)=>{Z(e,i,s).then(c=>{Ct(r)?(r=w(r,i),tt(r,s,r.item.url,i).then(a,m)):a(c)},m)})}function $t(e){let t=0;return e.forEach(o=>{t=o.editingInfo?.lastEditDate?Math.max(t,o.editingInfo.lastEditDate):t}),t}var f={};$(f,{convertItemToTemplate:()=>cs,createItemFromTemplate:()=>ds});function cs(e,t,o){return new Promise(r=>{let n=D(e);n.item.id=_(n.item.id,n.item.id,".itemId");let i=new Promise(a=>{ge(n.itemId,n.item.name,o).then(m=>{!m||m.size===0?a(null):a(m)})}),s=Promise.resolve({});Promise.all([i,s]).then(a=>{let[m]=a;if(m){let c=rn(m,n.item.name);n.properties[c.filename]=c.mimeType;let d=nt(n.itemId,c.blob.name,1,c.blob.name===c.filename?ke.data:ke.fakezip),l={itemId:n.itemId,file:c.blob,folder:d.folder,filename:d.filename};n.dataFile=l,n.resources.push(d.folder+"/"+d.filename),r(n)}else r(n)})})}function ds(e,t,o,r){return new Promise(n=>{if(!r(e.itemId,u.Started,0)){r(e.itemId,u.Ignored,0),n(I(e.type));return}let i=M(e);i=w(i,t),e.item.thumbnail&&(i.item.thumbnail=e.item.thumbnail),re(i.item,i.data,o,t.folderId).then(s=>{r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,s.id)?(i.itemId=s.id,t[e.itemId]={itemId:s.id},r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor/2,s.id),n({item:i,id:s.id,type:i.type,postProcess:!1})):(r(e.itemId,u.Cancelled,0),F(s.id,o).then(()=>n(I(e.type)),()=>n(I(e.type))))},()=>{r(e.itemId,u.Failed,0),n(I(e.type))})})}var Xt={};$(Xt,{_getFormDataFilename:()=>ri,_replaceFeatureServiceURLs:()=>Zn,_replaceItemIds:()=>Qn,_replacePortalBaseUrls:()=>Yn,_replaceWorkflowManagerBaseUrls:()=>Xn,_updateZipObjectTextContent:()=>ei,convertItemToTemplate:()=>Ks,createItemFromTemplate:()=>Hs,postProcess:()=>oi,postProcessFormItems:()=>Js,swizzleFormObject:()=>Qt,templatizeFormData:()=>Yt});function xn(e,t){return ps(e,t)}function ps(e,t){return["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"].forEach(r=>{let n=p(e,r);Array.isArray(n)&&n.forEach(i=>{i.type==="mapWidget"&&(e.dependencies.indexOf(i.itemId)<0&&e.dependencies.push(i.itemId),i.itemId=_(i.itemId,i.itemId,".itemId")),Array.isArray(i.datasets)&&ls(i,e,t)})}),e}function ls(e,t,o){e.datasets.forEach(r=>{if(p(r,"dataSource.type")!=="arcadeDataSource"){let i=p(r,"dataSource.itemId");if(i){t.dependencies.indexOf(i)<0&&t.dependencies.push(i);let s=p(r,"dataSource.layerId");ye(s?.toString(),i,"",o),r.dataSource.itemId=_(i,i,".itemId")}}})}function bn(e,t){let o=["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"];return o.forEach(r=>{let n=p(e,r);us(n,t)}),o.forEach(r=>{fs(e,r,t)}),e}function us(e,t){e&&Array.isArray(e)&&e.forEach(o=>{Array.isArray(o.datasets)&&o.datasets.forEach(r=>{let n=_t(p(r,"dataSource.itemId"));if(n){let i=Tt(p(r,"dataSource.layerId"));t.some(s=>s.itemId===n&&s.layerId===i?(Sn(s,o.id),!0):!1)}else{let i=p(r,"dataSource.id");if(i){let s=i.split("#")[1];t.some(a=>a.ids.indexOf(s)>-1?(Sn(a,o.id),!0):!1)}}})})}function fs(e,t,o){let r=p(e,t);r&&b(e,t,hs(r,o))}function hs(e,t){return Array.isArray(e)?e.map(o=>{let r=o;return Array.isArray(r.events)&&(r.events=r.events.map(n=>{let i=n;return Array.isArray(i.actions)&&(i.actions=i.actions.map(s=>{let a=s;if(a.fieldMap&&a.targetId&&a.targetId.indexOf("#")>-1){let m=wn(a,t);if(m){let c=p(m,"fields"),d=p(m,"basePath");Array.isArray(c)&&d&&(a.fieldMap=a.fieldMap.map(l=>{let h=l;return h.targetName=Y(h.targetName,c,d),h}))}}return a})),i})),Array.isArray(r.datasets)&&(r.datasets=r.datasets.map(n=>{let i=n;if(i.type==="serviceDataset"){let s=wn(n,t);if(s){let a=p(s,"fields"),m=p(s,"basePath");Array.isArray(a)&&m&&(r=Y(r,a,m),i=Y(i,a,m))}}return i})),r}):e}function wn(e,t){let o,r=p(e,"dataSource.id")||p(e,"targetId");if(r){let n=r.split("#")[1];if(!t.some(i=>(o=i.ids.indexOf(n)>-1?i:o,i.ids.indexOf(n)>-1))){let i=r.split("#")[0];t.some(s=>{let m=(s.references||[]).indexOf(i)>-1;return o=m?s:o,m})}}else{let n=_t(p(e,"dataSource.itemId")),i=Tt(p(e,"dataSource.layerId"));n&&t.some(s=>{let a=n===s.itemId&&i===s.layerId;return o=a?s:o,a})}return o}function Sn(e,t){e.references=Array.isArray(e.references)?e.references:[],e.references.indexOf(t)<0&&e.references.push(t)}var Se={};$(Se,{convertItemToTemplate:()=>_s,convertNotebookToTemplate:()=>Ht,createItemFromTemplate:()=>Ts,deleteProps:()=>Un,fineTuneCreatedItem:()=>Kt,postProcess:()=>Fs,postProcessNotebookTemplates:()=>vs});function Tn(e,t,o,r){return new Promise((n,i)=>{let s="";if(e.item.url){let a=e.item.url,m=a.indexOf("//");e.item.url=B(q)+a.substring(a.indexOf("/",m+2),a.lastIndexOf("=")+1)+e.item.id,s=a.replace(a.substring(a.indexOf("/",m+2)),"")}e.dependencies=ys(e),b(e,"data.folderId","{{folderId}}"),Ss(e,["data.map.itemId","data.map.appProxy.mapItemId","data.values.webmap","data.values.group"]),Fn(e,"data.appItemId",e.itemId),Dt(e,["data.logo","data.map.portalUrl","data.portalUrl","data.httpProxy.url"],B(q)),b(e,"data.geometryService",B(No)),Is(e,o,s,r).then(()=>{_n(e,o,s,"data.widgetPool.widgets").then(a=>{_n(a,o,s,"data.widgetOnScreen.widgets",!0).then(m=>{gs(m,o,s,"data.values").then(c=>{n(c)},c=>i(S(c)))},m=>i(S(m)))},a=>i(S(a)))},a=>i(S(a)))})}function Is(e,t,o,r){return new Promise((n,i)=>{let s=p(e,"data.dataSource.dataSources");if(s&&Object.keys(s).length>0){let a=new Array;Object.keys(s).forEach(m=>{let c=s[m];b(c,"portalUrl",B(q));let d=p(c,"itemId");if(p(c,"url")){if(d){let h=c.url.substr(c.url.lastIndexOf("/")+1);ye(h.toString(),d,c.url,r),c.itemId=_(d,d,".layer"+h+".itemId")}let l=jt(c.url,o,[],[],t);a.push(new Promise((h,g)=>{zt(l.serviceRequests,l.requestUrls,l.testString).then(P=>{c.url=P,h()},P=>g(S(P)))}))}else d&&(c.itemId=_(d,d,".itemId"))}),Promise.all(a).then(()=>n(e),m=>i(S(m)))}else n(e)})}function _n(e,t,o,r,n=!1){return new Promise((i,s)=>{let a=p(e,r)||[],m=[],c=[];if(a.forEach(d=>{!n&&p(d,"icon")&&Dt(d,["icon"],B(q));let l=d.config;if(l){let h=JSON.stringify(l),g=jt(h,o,c,m,t);d.config=JSON.parse(g.testString),m=g.serviceRequests,c=g.requestUrls}}),m.length>0){let d=JSON.stringify(a);zt(m,c,d).then(l=>{b(e,r,JSON.parse(l)),i(e)},l=>s(S(l)))}else i(e)})}function gs(e,t,o,r){return new Promise((n,i)=>{let s=p(e,r),a=[],m=[];if(s){p(s,"icon")&&Dt(s,["icon"],B(q));let c=JSON.stringify(s),d=jt(c,o,m,a,t);s=JSON.parse(d.testString),a=d.serviceRequests,m=d.requestUrls}if(a.length>0){let c=JSON.stringify(s);zt(a,m,c).then(d=>{b(e,r,JSON.parse(d)),n(e)},d=>i(S(d)))}else n(e)})}function zt(e,t,o){return new Promise((r,n)=>{if(e&&e.length>0){let i=0;Promise.all(e).then(s=>{s.forEach(a=>{if(p(a,"serviceItemId")){let m="{{"+a.serviceItemId+(a.hasOwnProperty("id")?".layer"+a.id:"")+".url}}";o=ct(o,t[i],m,!0)}i++}),r(o)},s=>n(S(s)))}else r(o)})}function jt(e,t,o,r,n){let i={f:"json",authentication:n},s=e.match(/(\bhttps?:\/\/[-A-Z0-9/._]*)/gim);return s&&s.length&&s.forEach(a=>{a.indexOf("NAServer")>-1?e=ct(e,a,B(Wo)):a.indexOf("GeocodeServer")>-1?e=ct(e,a,B($o)):t&&a.indexOf(t)>-1?e=ct(e,t,B(q)):a.indexOf("FeatureServer")>-1&&o.indexOf(a)===-1&&(o.push(a),r.push(W(a,i)))}),{testString:e,requestUrls:o,serviceRequests:r}}function ct(e,t,o,r=!1){let n=r&&e.indexOf('"')>-1,i=new RegExp(n?'"'+t+'"':t,"gmi");return e.replace(i,n?'"'+o+'"':o)}function Dt(e,t,o){t.forEach(r=>{let n=p(e,r);if(n){let i=n.substring(n.indexOf("/",n.indexOf("//")+2));b(e,r,i!==n?o+i:o)}})}function vn(e,t,o,r){return new Promise(n=>{if(ve(e,["WAB2D","WAB3D","Web AppBuilder"])){let i={id:t.itemId,url:t.item.url,data:t.data},s=z(i,r),a={tags:e.item.tags,title:e.item.title,type:"Code Attachment",typeKeywords:["Code","Javascript","Web Mapping Application"],relationshipType:"WMA2Code",originItemId:t.itemId,url:qe(w(B(q),o))+"sharing/rest/content/items/"+t.itemId+"/package"},m=re(a,{},r,o.folderId);Promise.all([s,m]).then(()=>n(null),()=>n(null))}else n(null)})}function ys(e){let t=Ps;return ve(e,["WAB2D","WAB3D","Web AppBuilder"])&&(t=ws),t(e)}function Ps(e){return Uo(e,["data.values.webmap","data.values.group"])}function ws(e){let t=[],o=p(e,"data.map.itemId");o&&t.push(o);let r=p(e,"data.dataSource.dataSources");return r&&Object.keys(r).forEach(n=>{let i=r[n];i.itemId&&t.push(i.itemId)}),t}function Ss(e,t){t.forEach(o=>{let r=p(e,o);Fn(e,o,r)})}function Fn(e,t,o){b(e,t,_(o,o,".itemId"))}function kn(e,t){let o=p(e,"data.dataSource.dataSources");o&&Object.keys(o).length>0&&(Object.keys(o).forEach(i=>{let s=o[i];o[i]=Vt(s,t)}),b(e,"data.dataSource.dataSources",o)),["data.widgetPool.widgets","data.widgetOnScreen.widgets"].forEach(i=>{let s=p(e,i);s&&b(e,i,xs(s,t))});let n=p(e,"data.values");return n&&b(e,"data.values",Vt(n,t)),e}function Vt(e,t,o=!1){return e=Es(e,t,o),bs(e,t).forEach(n=>{e=Y(e,n.fields,n.basePath,o)}),e}function xs(e,t){let o=["SmartEditor","Screening"];return e.map(r=>{if(r.config){let n=o.indexOf(r.name)>-1;r.config=Vt(r.config,t,n)}return r})}function bs(e,t){let o=JSON.stringify(e);return t.filter(n=>Lt(n,o)<4).sort((n,i)=>Lt(n,o)-Lt(i,o))}function Lt(e,t){let o=e.url,r=e.itemId,n=e.layerId,i;return o&&!isNaN(n)&&(i=new RegExp(o.replace(/[.]/,".layer"+n+"."),"gm")),i&&i.test(t)||e.ids.length>0&&e.ids.some(s=>new RegExp(s,"gm").test(t))?1:o&&new RegExp(o,"gm").test(t)?2:r&&new RegExp(r,"gm").test(t)?3:4}function Es(e,t,o){let r=JSON.stringify(e),n=t.filter(i=>{let s;i.url&&!isNaN(i.layerId)&&(s=new RegExp(i.url.replace(/[.]/,".layer"+i.layerId+"."),"gm"));let a=!1;if(i.ids.length>0&&(a=i.ids.some(m=>new RegExp(m,"gm").test(r))),a||s&&s.test(r))return i});return n.length>0&&n.forEach(i=>{e=Bt(e,i,o),i.ids.length>0&&i.ids.forEach(s=>{e=dt(e,i,s,o)})}),e}function Bt(e,t,o){let r={},n=t.url,i=t.layerId,s;if(n&&!isNaN(i)&&(s=new RegExp(n.replace(/[.]/,".layer"+i+"."),"gm")),Array.isArray(e))r=e.map(a=>Bt(a,t,o));else if(typeof e=="object")for(let a in e)e[a]!=null&&typeof e[a]=="object"?r[a]=Bt(e[a],t,o):(s&&s.test(e[a])&&(e=Y(e,t.fields,t.basePath,o)),r[a]=e[a]);else r=e;return r}function dt(e,t,o,r){let n={},i=new RegExp(o,"gm");if(Array.isArray(e))n=e.map(s=>dt(s,t,o,r));else if(typeof e=="object")for(let s in e)if(e[s]!==null){let a;try{a=JSON.parse(e[s])}catch{a=void 0}a&&typeof a=="object"?n[s]=JSON.stringify(dt(a,t,o,r)):typeof e[s]=="object"?(i.test(s)&&r&&(e[s]=Y(e[s],t.fields,t.basePath,r)),n[s]=dt(e[s],t,o,r)):(i.test(e[s])&&(e=Y(e,t.fields,t.basePath,r)),n[s]=e[s])}else n[s]=e[s];else n=e;return n}function On(e,t,o,r){return fr(e,o,r)}function Rn(e,t,o){return tt(e,t,"",o)}function Q(e,t,o,r,n){return new Promise((i,s)=>{function a(){n&&n.signal.aborted&&s(new Error("Operation was cancelled"))}if(a(),!r(e.itemId,u.Started,0))r(e.itemId,u.Ignored,0),i(I(e.type));else{let m=M(e);m=w(m,t);let c;e.type==="Web Mapping Application"&&e.data?m=JSON.parse(w(JSON.stringify(m),t)):e.type==="QuickCapture Project"&&e.data&&(c=JSON.stringify(m.data.application),delete m.data),e.item.thumbnail&&(m.item.thumbnail=e.item.thumbnail),re(m.item,m.data,o,t.folderId).then(d=>{if(a(),!r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,d.id))r(e.itemId,u.Cancelled,0),F(d.id,o).then(()=>i(I(e.type)),()=>i(I(e.type)));else{t[e.itemId]={itemId:d.id,itemUrl:t.portalBaseUrl+"/sharing/rest/content/items/"+d.id},m.itemId=d.id,m.type==="Web Mapping Application"&&e.data&&b(m,"data.appItemId",d.id);let l=oe(m.data),h=m.item.url;m=w(m,t),a();let g=Promise.resolve([]);if(m.relatedItems){let x=w(Ye(m.relatedItems),t);g=hr(m.itemId,x,o)}a();let P;if(e.type==="Web Mapping Application"&&e.data&&ve(e,["WAB2D","WAB3D","Web AppBuilder"]))P=vn(e,m,t,o);else if(e.type==="Workforce Project")P=Rn(m,o,t);else if(e.type==="QuickCapture Project"){if(c){let x=Ie(w(JSON.parse(c),t),"qc.project.json");P=dn(x,m.itemId,"",x.name,o)}}else e.type==="Notebook"?P=Kt(e,m,t,o):h!==m.item.url?(a(),P=new Promise((x,y)=>{Rr(d.id,m.item.url,o).then(()=>x(),y)})):P=Promise.resolve(null);a(),Promise.all([g,P]).then(()=>{r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor/2,d.id)?i({item:m,id:d.id,type:m.type,postProcess:l}):(r(e.itemId,u.Cancelled,0),F(d.id,o).then(()=>i(I(e.type)),()=>i(I(e.type))))},()=>{r(e.itemId,u.Failed,0),i(I(e.type))})}},()=>{r(e.itemId,u.Failed,0),i(I(e.type))})}})}function _s(e,t,o,r){return X(e,t,o,r)}function Ts(e,t,o,r){return Q(e,t,o,r)}function Ht(e){return new Promise(t=>{Un(e.data),t(e)})}function vs(e,t){if(e.some(r=>r.type==="Notebook")){let r=Object.keys(t).filter(i=>i.indexOf("FeatureServer")>-1).sort().reverse(),n=e.reduce((i,s)=>(i=[...new Set([...i,...s.dependencies,s.itemId])],i),[]);e=e.map(i=>{if(i.type==="Notebook"){let s=i.data&&JSON.stringify(i.data);return n.forEach(a=>{new RegExp(a,"gim").test(s)&&(s=s.replace(a,"{{"+a+".itemId}}"),i.dependencies.indexOf(a)<0&&i.dependencies.push(a))}),r.forEach(a=>{let m=new RegExp(a,"gim");if(m.test(s)){let c=t[a];s=s.replace(m,c);let d=/[0-9A-F]{32}/gim,l=c.match(d)[0];i.dependencies.indexOf(l)<0&&i.dependencies.push(l)}}),i.data=JSON.parse(s),i}})}return e}function Un(e){if(e){let t=["metadata.interpreter","metadata.papermill"];_e(e,t),(e.cells||[]).forEach(o=>{_e(o,t)})}}function Kt(e,t,o,r){return new Promise((n,i)=>{let s={id:t.itemId,url:t.item.url,data:Ie(t.data,t.itemId+".ipynb")};z(s,r).then(()=>n(null),i)})}function Fs(e,t,o,r,n,i,s){return Z(e,i,s)}function Nn(e,t,o){return new Promise((r,n)=>{ks(e,o).then(i=>{e.dependencies=i.dependencies,e.data?.properties&&(e.data.properties.ServiceURL=Mn(e.data.properties.ServiceURL,i.urlHash),e.data.properties.OverviewURL=Mn(e.data.properties.OverviewURL,i.urlHash)),r(e)},i=>n(S(i)))})}function ks(e,t){return new Promise((o,r)=>{let n=[];if(e.data?.properties){let i=[];e.data.properties.ServiceURL&&i.push(e.data.properties.ServiceURL),e.data.properties.OverviewURL&&e.data.properties.OverviewURL!==e.data.properties.ServiceURL&&i.push(e.data.properties.OverviewURL),Os(i,n,t).then(s=>{o(s)},s=>r(S(s)))}else o({dependencies:n,urlHash:{}})})}function Os(e,t,o){return new Promise((r,n)=>{let i={},s={f:"json",authentication:o},a=[],m={},c=e.filter(d=>{if(d){let l=/.+FeatureServer/g.exec(d),h=Array.isArray(l)&&l.length>0?l[0]:void 0;return h?(Object.keys(m).indexOf(h)<0&&(m[h]=W(d,s)),a.push(m[h]),!0):!1}else return!1});a.length>0?Promise.all(a).then(d=>{d.forEach((l,h)=>{if(p(l,"serviceItemId")){let g=l.serviceItemId;t.indexOf(g)<0&&t.push(g),i[c[h]]=g}}),r({dependencies:t,urlHash:i})},d=>n(S(d))):r({dependencies:t,urlHash:i})})}function Mn(e,t){let o=e;if(e){let r=t[e];if(r){let n=e.substr(e.lastIndexOf("/")+1);o=_(r,r,".layer"+n+".url")}o=Ye(o.replace(/.+?(?=\/home)/,"{{portalBaseUrl}}"))}return o}var Re={};$(Re,{_templatizeAdminEmail:()=>Ln,_templatizeApplication:()=>Wn,_templatizeId:()=>qt,_templatizeUrl:()=>Bn,_updateDependencies:()=>Vn,convertItemToTemplate:()=>Cs,convertQuickCaptureToTemplate:()=>Jt,createItemFromTemplate:()=>As});function Cs(e,t,o,r){return X(e,t,o,r)}function Jt(e){return b(e,"data.application",Wn(e.data.application,e)),e}function Wn(e,t){qt(e,"itemId"),Ln(e);let o=e?.dataSources;return o&&Array.isArray(o)&&o.forEach(r=>{let n=r.featureServiceItemId;n&&(Vn(n,t),Bn(r,"featureServiceItemId","url"),qt(r,"featureServiceItemId"))}),e}function Ln(e){p(e,"preferences.adminEmail")&&b(e,"preferences.adminEmail","{{user.email}}")}function Vn(e,t){t.dependencies.indexOf(e)===-1&&t.dependencies.push(e)}function Bn(e,t,o){let r=p(e,t),n=p(e,o);if(n){let i=n.substr(n.lastIndexOf("/")+1);b(e,o,_(r,r,".layer"+i+".url"))}}function qt(e,t){let o=p(e,t);o&&b(e,t,_(o,o,".itemId"))}function As(e,t,o,r){return Q(e,t,o,r)}var Us="home/webmap/viewer.html?webmap=";function zn(e,t,o,r){return new Promise((n,i)=>{e.type!=="Vector Tile Service"&&(e.item.url=e.item.url?qe(B(q))+Us+e.item.id:e.item.url),Ms(e,o).then(s=>{e.dependencies=s.dependencies,e.data&&(e.data.baseMap?.baseMapLayers&&Zt(e.data.baseMap.baseMapLayers,s.urlHash,r),e.data.operationalLayers&&Zt(e.data.operationalLayers,s.urlHash,r),Zt(e.data.tables,s.urlHash,r),Ns(e.data)),n(e)},s=>i(S(s)))})}function Ms(e,t){return new Promise((o,r)=>{let n=[];if(e.data){let i=e.data.baseMap?.baseMapLayers||[],s=e.data.operationalLayers||[],a=e.data.tables||[],m=i.concat(s).concat(a);$s(m,n,t).then(c=>{o(c)},c=>r(S(c)))}else o({dependencies:n,urlHash:{}})})}function Ns(e){Je(e,"initialState")}function $s(e,t,o){return new Promise((r,n)=>{let i={},s={f:"json",authentication:o},a=[],m={},c=e.filter(d=>{if(d.itemId&&d.layerType==="VectorTileLayer")return a.push(C(d.itemId,o)),!0;if(d.url&&d.url.indexOf("{{velocityUrl}}")<0){let l=/.+FeatureServer/g.exec(d.url),h=Array.isArray(l)&&l.length>0?l[0]:void 0;return h?(Object.keys(m).indexOf(h)<0&&(m[h]=W(d.url,s)),a.push(m[h]),!0):!1}else return!1});a.length>0?Promise.all(a).then(d=>{d.forEach((l,h)=>{if(c[h].layerType==="VectorTileLayer"){let g=p(l,"typeKeywords");if(g&&g.includes("Vector Tile Style Editor")){t.indexOf(l.id)<0&&t.push(l.id),c[h].templatizeId=!0;let P=c[h].styleUrl.indexOf(l.id)+l.id.length;c[h].styleUrl=_(c[h].styleUrl.replace(c[h].styleUrl.substring(0,P),l.id),l.id,".itemUrl")}}else if(p(l,"serviceItemId")){let g=l.serviceItemId;t.indexOf(g)<0&&t.push(g),i[c[h].url]=g}}),r({dependencies:t,urlHash:i})},d=>n(S(d))):r({dependencies:t,urlHash:i})})}function Zt(e=[],t,o){e.forEach(r=>{if(r.itemId&&r.layerType==="VectorTileLayer")r.templatizeId&&(r.itemId=_(r.itemId,r.itemId,".itemId"),delete r.templatizeId);else if(r.url){let n=r.url.substr(r.url.lastIndexOf("/")+1),i=Object.keys(t).indexOf(r.url)>-1?t[r.url]:void 0;i&&(ye(n,i,r.url,o),r.url=_(i,i,".layer"+n+".url"),r.itemId=_(i,i,".layer"+n+".itemId"))}})}function jn(e,t){return["data.operationalLayers","data.tables","data.applicationProperties.viewing.search.layers"].forEach(r=>Ws(e,t,r)),e}function Ws(e,t,o){let r=p(e,o);r&&b(e,o,Ls(r,t))}function Ls(e,t){return e.forEach(o=>{let r=Vs(o,t);if(r){let n=r.fields.map(s=>s.name);cr(o,r,r.basePath,r.itemId,n),pr(o,r.basePath,n),o.layerDefinition&&(ur(o.layerDefinition,r.basePath,n),lr(o.layerDefinition,r.basePath,n));let i=p(o,"field.name");i&&b(o,"field.name",dr(i,o,r.itemId,r.basePath))}}),e}function Vs(e,t){let o;return t.some(r=>r.ids.indexOf(e.id)>-1?(o=r,!0):!1),o}function X(e,t,o,r){return new Promise((n,i)=>{let s=D(e);s.item.id=_(s.item.id,s.item.id,".itemId");let a=Xe(s.itemId,"forward",o),m=Promise.resolve({}),c=Promise.resolve([]);switch(e.type){case"Dashboard":case"Data Pipeline":case"Feature Collection":case"Feature Service":case"Hub Initiative":case"Hub Page":case"Hub Site Application":case"Insights Model":case"Oriented Imagery Catalog":case"Project Package":case"Style":case"Workforce Project":case"Web Map":case"Web Mapping Application":case"Web Scene":case"Notebook":m=new Promise(d=>{J(s.itemId,o).then(l=>d(l))});break;case"Form":m=ge(s.itemId,s.item.name,o);break;case"QuickCapture Project":c=et(s.itemId,o);break}Promise.all([m,a,c]).then(d=>{let[l,h,g]=d;ln(s,r),s.data=at(l,e.type,r);let P=h;s.dependencies=[],s.relatedItems=[],P.forEach(y=>{y.relationshipType!=="WMA2Code"&&(s.relatedItems.push(y),y.relatedItemIds.forEach(T=>{s.dependencies.indexOf(T)<0&&s.dependencies.push(T)}))}),e.type==="Data Pipeline"&&(s.dependencies=s.dependencies.concat(Bs(l)));let x=Promise.resolve(s);switch(e.type){case"Dashboard":xn(s,r);break;case"Notebook":x=Ht(s);break;case"Oriented Imagery Catalog":x=Nn(s,t,o);break;case"QuickCapture Project":s.resources=g,x=new Promise(async y=>{let T=null,E=-1;g&&(g.some((ce,ie)=>{let se=ce.name==="qc.project.json";return se&&(T=ce,E=ie),se}),E>=0&&g.splice(E,1)),T&&(s.data={application:{...await He(T)},name:"qc.project.json"}),s.data.application?.basemap?.type==="Web Map"&&s.dependencies.push(s.data.application.basemap.itemId);let j=Jt(s);y(j)});break;case"Vector Tile Service":case"Web Map":case"Web Scene":x=zn(s,t,o,r);break;case"Web Mapping Application":l&&(x=Tn(s,t,o,r));break;case"Workforce Project":x=On(s,t,o,r);break}x.then(n,y=>i(S(y)))})})}function Bs(e){let t=[];return(e?.inputs??[]).concat(e?.outputs??[]).forEach(r=>{if(r.type==="FeatureServiceSource"||r.type==="FeatureServiceSink"){let n=p(r,"parameters.layer.value.itemId");n&&t.push(n)}}),t}var O={};$(O,{convertItemToTemplate:()=>zs,createItemFromTemplate:()=>js,postProcess:()=>Gs,postProcessFieldReferences:()=>Ds});function zs(e,t,o,r){return X(e,t,o,r)}function js(e,t,o,r,n){return n?Q(e,t,o,r,n):Q(e,t,o,r)}function Ds(e,t,o){switch(o){case"Web Mapping Application":kn(e,t);break;case"Dashboard":bn(e,t);break;case"Web Map":jn(e,t);break}return e}async function Gs(e,t,o,r,n,i,s){if(t==="Web Map"&&r.resources.some(a=>a.indexOf(me)>-1)){let a=sn(`${i.portalBaseUrl}/sharing/rest`,r.itemId,me),m={httpMethod:"GET",authentication:s,params:{f:"json"},headers:{Accept:"application/json",Authorization:`Bearer ${s.token}`,"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${s.token}`}};await W(a,m).then(async c=>{let d=JSON.stringify(c),l=w(d,i);if(d!==l){let h=JSON.parse(l),g={id:e,resource:Ie(h,me),name:me,authentication:s,params:{}};await Eo(g)}})}return Z(e,i,s)}function Ks(e,t,o,r){return O.convertItemToTemplate(e,t,o,r)}function pt(e){return!!p(e,"properties.services")}function Kn(e,t="https://survey123.arcgis.com"){let o=`${t}/api/survey/create`,r={credentials:"same-origin",method:"POST",body:wo({f:"json",...e},!0)};return fetch(o,r).then(n=>n.json()).then(n=>{if(!n.success)throw new Error(`Failed to create survey: ${n.error.message}`);return{formId:n.id,featureServiceId:n.featureService.source.itemId,folderId:n.formItemInfo.ownerFolder}})}var Hn=function(t){let o=M(t),r=[["header","content"],["subHeader","content"],["footer","content"],["settings","thankYouScreenContent"]],n=(s,a)=>(s&&s[a]&&(s[a]=encodeURIComponent(s[a])),s);r.forEach(([s,a])=>n(o[s],a));let i=s=>n(s,"description");return o.questions=(o.questions||[]).map(s=>s.questions?{...s,questions:s.questions.map(i)}:i(s)),o};function qn(e,t,o){let{item:{title:r,description:n,tags:i,typeKeywords:s},properties:{form:a}}=e,{user:{username:m},portalBaseUrl:c,organization:{basemapGalleryGroupQuery:d,defaultBasemap:{title:l}}}=t,{token:h}=o.toCredential();return Zo(d,l,o).then(g=>{let P="Survey-",x=Mo(`${P}${r}`,t,"user.folders").replace(P,"");if(a.questions){let T=E=>(E.maps&&(E.maps=E.maps.map(j=>({...j,itemId:g.id}))),E);a.questions=a.questions.map(E=>E.questions?{...E,questions:E.questions.map(T)}:T(E))}let y=Hn(a);return{description:n,form:y,portalUrl:c,tags:i,title:x,token:h,typeKeywords:s,username:m}})}function Jn(e,t,o,r){let n=w(e,t),{survey123Url:i}=t;return qn(n,t,o).then(s=>Kn(s,i)).then(s=>{let{formId:a,featureServiceId:m}=s,c=Promise.resolve(null);return e.item.thumbnail&&(c=Pe({id:a},null,o,e.item.thumbnail)),c.then(()=>C(a,o)).then(d=>(t[n.itemId]={itemId:a},t[n.properties.info.serviceInfo.itemId]={itemId:m},r(n.itemId,u.Finished,n.estimatedDeploymentCostFactor,a),{item:{...e,item:d,itemId:a},id:a,type:"Form",postProcess:!0}))}).catch(s=>{throw r(n.itemId,u.Failed,0),s})}function Hs(e,t,o,r){return pt(e)?Jn(e,t,o,r):O.createItemFromTemplate(e,t,o,r)}async function Qt(e,t){let o=await Ut(e),r=new Date;return r=new Date(r.valueOf()-864e5-r.getTimezoneOffset()*1e3*60),o.forEach(n=>{if(typeof n.content=="string"){let i=ei(n,t);e.file(n.file,i,{date:r})}else n.file.endsWith(".xlsx")&&e.file(n.file,n.content,{date:r})}),Promise.resolve(e)}async function Yt(e,t){return(await Ut(e)).forEach(r=>{if(r.file.endsWith(".info")||r.file.endsWith(".itemInfo")||r.file.endsWith(".json")||r.file.endsWith(".webform")||r.file.endsWith(".xml")){let n=r.content,i=/\b([0-9A-Fa-f]){32}_type/g;n=Qn(n,t,i),n=Zn(n,t,i),n=Yn(n,t),n=Xn(n,t),e.file(r.file,n)}}),Promise.resolve(e)}function Zn(e,t,o){let r=e;return Object.keys(t).filter(i=>i.match(o)&&t[i].type==="Feature Service").forEach(i=>{let s=t[i].url,a=t[s];a&&(r=r.replace(new RegExp(s,"g"),a))}),r}function Qn(e,t,o){let r=e;return Object.keys(t).filter(i=>i.match(o)&&t[i].type!=="Feature Service").map(i=>i.replace("_type","")).forEach(i=>{r=r.replace(new RegExp(i,"g"),`{{${i}.itemId}}`)}),r}function Yn(e,t){let o=e;return t.portalBaseUrl&&(o=o.replace(new RegExp(t.portalBaseUrl,"g"),"{{portalBaseUrl}}")),o}function Xn(e,t){let o=e;return t.workflowBaseUrl&&(o=o.replace(new RegExp(t.workflowBaseUrl,"g"),"{{workflowBaseUrl}}")),o}function ei(e,t){let o=Oo(),r=e.content;return r=w(e.content,t),he(r.match(o)??[]).forEach(i=>{let s=t[i];typeof s?.itemId=="string"&&(r=r.replace(new RegExp(i,"g"),`${s.itemId}`))}),r}function ti(e,t,o,r,n,i,s){let a=r.properties.info.serviceInfo.itemId,{itemId:m}=i[a],c=w(r,i);return C(m,s).then(d=>{let l=[{id:e,title:c.item.title,snippet:c.item.snippet,extent:c.item.extent,culture:c.item.culture},{id:m,extent:c.item.extent,typeKeywords:[`source-${a}`].concat(d.typeKeywords)}],h=P=>z(P,s),g=l.map(h);return Promise.all(g).then(()=>{let P=[e,m],x=T=>K({itemId:T,folderId:i.folderId,authentication:s}),y=P.map(x);return Promise.all(y)}).then(()=>vr(d.ownerFolder,s)).then(()=>{let P=D(d);return n.push(P),r.dependencies.push(d.id),!0})})}async function oi(e,t,o,r,n,i,s){let a=await ge(e,"Form",s);if(a){let m=await At(a),c=await Qt(m,i);rt(c,e,s)}else return await ko(5e3),oi(e,t,o,r,n,i,s);return pt(r)?ti(e,t,o,r,n,i,s):Z(e,i,s)}async function Js(e,t){for(let o of e)if(o.type==="Form"){let r=o.data;if(o.data=null,r){let n=await At(r);n=await Yt(n,t),o.item.name=ri(o.item.name,r.name,`${o.itemId}.zip`);let i=await Ar(n,o.item.name),s=nt(o.itemId,o.item.name,1,ke.data),a={itemId:o.itemId,file:i,folder:s.folder,filename:o.item.name};o.dataFile=a,o.resources.push(s.folder+"/"+s.filename)}}return Promise.resolve(e)}function ri(e,t,o){let r=e||t;return r&&r!=="undefined"?r:o}var eo={};$(eo,{_initializeNewGroup:()=>ni,convertItemToTemplate:()=>Zs,createItemFromTemplate:()=>Qs,postProcess:()=>Ys});function Zs(e,t,o){return new Promise(r=>{let n=Lo(e);n.item.id=_(n.item.id,n.item.id,".itemId"),qo(e.id,o).then(i=>{n.type="Group",Ho(e.id,o).then(s=>{s.id=n.item.id,n.item={...s,type:"Group"},n.dependencies=i.concat(Ao(s.tags)),r(n)},()=>r(n))},()=>r(n))})}function Qs(e,t,o,r){return new Promise(n=>{if(!r(e.itemId,u.Started,0)){r(e.itemId,u.Ignored,0),n(I(e.type));return}let i=M(e);i=w(i,t),i.item.thumbnail=e.item.thumbnail;let s=ni(i.item);Pr(s.title,s,t,o,Ot(i)?t.locationTracking.owner:void 0).then(a=>{if(a.success)if(!r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,a.group.id))r(e.itemId,u.Cancelled,0),Fe(a.group.id,o).then(()=>n(I(e.type)),()=>n(I(e.type)));else if(i.itemId=a.group.id,t[e.itemId]={itemId:a.group.id},i=w(i,t),t[e.itemId].itemId=a.group.id,!r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor/2,a.group.id))r(e.itemId,u.Cancelled,0),Fe(a.group.id,o).then(()=>n(I(e.type)),()=>n(I(e.type)));else if(Ot(i)){let m=t.locationTracking.owner;Fr(a.group.id,m,o).then(c=>{c.success?r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,a.group.id)?kr(a.group.id,[o.username],o).then(d=>{Array.isArray(d.notRemoved)&&d.notRemoved.length===0?r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,a.group.id)?n({item:i,id:a.group.id,type:i.type,postProcess:oe(i)}):(r(e.itemId,u.Cancelled,0),Fe(a.group.id,o).then(()=>n(I(e.type)),()=>n(I(e.type)))):(r(e.itemId,u.Failed,0),n(I(e.type)))}):(r(e.itemId,u.Cancelled,0),Fe(a.group.id,o).then(()=>n(I(e.type)),()=>n(I(e.type)))):(r(e.itemId,u.Failed,0),n(I(e.type)))})}else n({item:i,id:a.group.id,type:i.type,postProcess:oe(i)});else r(e.itemId,u.Failed,0),n(I(e.type))},()=>{r(e.itemId,u.Failed,0),n(I(e.type))})})}function Ys(e,t,o,r,n,i,s){let a=Promise.resolve({success:!0});return o.some(m=>{if(m.id===e){let c=m.item.item;return oe(c)&&(c=w(c,i),a=Or(c,s)),!0}}),a}function ni(e){let t={access:"private",description:e.description,owner:e.owner,snippet:e.snippet,tags:e.tags,thumbnail:e.thumbnail,title:e.title||"",typeKeywords:e.typeKeywords};return["autoJoin","displaySettings","isInvitationOnly","isOpenData","isViewOnly","membershipAccess","properties","sortField","sortOrder"].forEach(r=>{e.hasOwnProperty(r)&&(t[r]=e[r])}),t}var Ce={};$(Ce,{convertItemToTemplate:()=>Xs,createItemFromTemplate:()=>ea,isAPage:()=>oa,postProcess:()=>ta});function ii(e,t,o,r){return e=fe(e,o,{}),Dr(e,{...r,allowList:[]}).then(()=>!0)}function lt(e){let t=H(e);return(e.dependencies||[]).forEach(r=>{let n=new RegExp(r,"g"),i=`{{${r}.itemId}}`;t.item=le(t.item,n,i),t.data=le(t.data,n,i),e.properties&&(t.properties=le(t.properties,n,i))}),t}function ut(e,t,o){let r=L(K,{success:!0}),n=[r({itemId:e.item.id,folderId:t,authentication:o})];return V(e,"item.properties.parentInitiativeId")&&n.push(r({itemId:e.item.properties.parentInitiativeId,folderId:t,authentication:o})),Promise.all(n)}function Xs(e,t,o=null){let r=0,n=0;return Promise.all([Ee(e.id,{authentication:t}),ne(t)]).then(([i,s])=>(r=i.item.created,n=i.item.modified,Kr(i,s))).then(i=>(i.item.created=r,i.item.modified=n,i.item.typeKeywords=Ve(i.item.typeKeywords,"doNotDelete"),i.groups=[],i.estimatedDeploymentCostFactor=2,i.resources=[],V(i,"properties")||(i.properties={}),i=lt(i),i))}function ea(e,t,o,r){if(!r(e.itemId,u.Started,0))return Promise.resolve(I(e.type));if(e.assets&&e.resources&&delete e.assets,t.solutionItemExtent){let c=t.solutionItemExtent.split(",");t.organization.defaultExtentBBox=[[c[0],c[1]],[c[2],c[3]]]}let i={},s,a,m=e.item.thumbnail;return ne(o,t).then(c=>(a=c,Hr(e,t,i,a))).then(c=>{let d=c,l={assets:d.assets||[]};return Gr(d,l,a)}).then(c=>(s=c,ut(c,t.folderId,o))).then(()=>{let c={item:{id:s.item.id},params:{thumbnail:m},authentication:o};return ee(c)}).then(()=>{if(t[e.itemId]={itemId:s.item.id},r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor||2,s.item.id)){let d={item:{...e,...te(s)},id:s.item.id,type:e.type,postProcess:!0};return d.item.itemId=s.item.id,d}else return L(jr,{success:!0})(s,a).then(()=>Promise.resolve(I(e.type)))}).catch(c=>{throw r(e.itemId,u.Failed,0),c})}function ta(e,t,o,r,n,i,s){let a;return ne(s).then(m=>(a=m,Ee(e,{authentication:s}))).then(m=>ii(m,o,i,a))}function oa(e){let t=!1;return(e==="Hub Page"||e==="Site Page")&&(t=!0),t}var Ae={};$(Ae,{convertItemToTemplate:()=>ra,createItemFromTemplate:()=>na,isASite:()=>sa,postProcess:()=>ia});function si(e,t,o){let r=t.filter(n=>n.type.indexOf("Page")>-1).map(n=>n.id);return Promise.all(r.map(n=>Ee(n,o))).then(n=>tn(e,n,o))}function ai(e,t,o,r){let n=t.filter(m=>m.id!==e.item.id),i=n.map(m=>({item:{id:m.id,type:m.type}})),s=[];s=s.concat(en(e,i,r)),s=s.concat(si(e,n,r));let a=n.map(m=>m.id);return e.item.properties.children=a,e=Qr(e,o,{}),s.push(qr(e,{...r,allowList:void 0})),Promise.all(s).then(()=>!0)}function ra(e,t,o=null){let r=0,n=0,i,s,a;return ne(t).then(m=>(a=m,bt(e.id,a))).then(m=>(r=m.item.created,n=m.item.modified,i=m.item.title,s=m.data.values.title,Xr(m,a))).then(m=>(m.item.created=r,m.item.modified=n,m.item.title=i,m.item.typeKeywords=Ve(m.item.typeKeywords,"doNotDelete"),m.data.values.title=s,m.groups=[],m.estimatedDeploymentCostFactor=2,m.resources=[],p(m,"properties")||(m.properties={}),m.dependencies=he(m.dependencies),m=lt(m),m))}function na(e,t,o,r){if(!r(e.itemId,u.Started,0))return Promise.resolve(I(e.type));e.assets&&e.resources&&delete e.assets,t.solution||(t.solution={}),t.solution.title=t.title;let i={},s,a,m=e.item.thumbnail;return ne(o,t).then(c=>(a=c,Yr(e,t,i,a))).then(c=>{let d={assets:c.assets||[]};return Zr(c,d,a)}).then(c=>(s=c,ut(c,t.folderId,o))).then(()=>{let c={item:{id:s.item.id},params:{thumbnail:m},authentication:o};return ee(c)}).then(()=>{if(t[e.itemId]={itemId:s.item.id},r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor||2,s.item.id)){let d={item:{...e,...te(s)},id:s.item.id,type:e.type,postProcess:!0};return d.item.itemId=s.item.id,d}else return L(Jr,{success:!0})(s,a).then(()=>Promise.resolve(I(e.type)))}).catch(c=>{throw r(e.itemId,u.Failed,0),c})}function ia(e,t,o,r,n,i,s){let a;return ne(s,i).then(m=>(a=m,bt(e,a))).then(m=>ai(m,o,i,a)).then(()=>Promise.resolve(!0))}function sa(e){let t=!1;return(e==="Hub Site Application"||e==="Site Application")&&(t=!0),t}var ht={};$(ht,{convertItemToTemplate:()=>ca,createItemFromTemplate:()=>da,isAStoryMap:()=>pa});function mi(e={}){let t=0;return Object.keys(e).reduce((o,r)=>(V(e,`${r}.type`)==="webmap"&&r!==`webmap${t}`&&(o.push({original:r,updated:`webmap${t}`}),t++),o),[])}function ci(e){let t=V(e,"data.resources")||{};return Object.keys(t).reduce((o,r)=>(V(t,`${r}.type`)==="webmap"&&o.push(V(t,`${r}.data.itemId`)),o),[])}function pi(e){let t=Qe(e.item.id,e.item.type);t.key=`${je(e.item.title)}_${Be("i")}`;let o=H(e);t.data=o.data;let r=o.item.created,n=o.item.modified;return t.item=Ge(o.item),t.item.created=r,t.item.modified=n,t.item.url="{{storyMapTemplateUrl}}",mi(t.data.resources).forEach(a=>{t.data.resources[a.updated]=H(t.data.resources[a.original]),delete t.data.resources[a.original],t.data.nodes=le(t.data.nodes,a.original,a.updated)}),t.item.typeKeywords.indexOf(di)!==-1&&(t.item.typeKeywords=[aa].concat(t.item.typeKeywords.filter(a=>a!==di))),t.properties={},t.properties.draftFileName="draft_{{timestamp}}.json",Object.assign(t.properties,ma),t.dependencies=ci(e),Promise.resolve(t)}var di="smstatusunpublishedchanges",aa="smstatuspublished",ma={oembed:{version:"1.0",type:"rich",title:"Example StoryMap",url:"{{storyMapTemplateUrl}}",provider_name:"ArcGIS StoryMaps",provider_url:"{{storyMapBaseUrl}}",width:800,height:600,thumbnail_url:"{{storyMapThumbnailUrl}}",thumbnail_height:"100.5",thumbnail_width:"400",html:'<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',cache_age:86400},oembedXML:`<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
|
2
|
+
import{a as In}from"./S37TPZAO.js";import{b as gn,c as yn}from"./SJ7HTNAT.js";import a from"./UBEU6ULP.js";import{b as Po}from"./2B4SGB3I.js";import{b as yo}from"./I2NTSKBD.js";import{$ as Qe,$a as gr,$b as Mt,A as Oo,Aa as Zo,Ab as Ar,B as Ro,Ba as Qo,Bb as Ur,C as Ie,Ca as Yo,Cb as Mr,D as M,Da as kt,E as Co,Ea as Ot,Eb as Nr,F as Je,Fa as Xo,G as _e,Ga as er,Gb as $r,H as S,Ha as ye,Hb as Wr,I as Et,Ia as Rt,Ib as Lr,J as Ao,Ja as tr,Jb as Vr,K as p,Ka as or,Kb as ne,L as Uo,La as rr,Lb as Br,Ma as nr,Mb as zr,N as Te,Na as ir,Nb as jr,O as b,Oa as sr,Ob as Dr,P as ve,Pa as ar,Pb as Gr,Q as Mo,Qa as mr,Qb as Kr,R as _t,Ra as cr,Rb as Hr,S as Tt,Sa as dr,Sb as qr,T as Ze,Ta as pr,Tb as Jr,U as q,Ua as lr,Ub as Zr,V as No,Va as ur,Vb as Qr,W as $o,Wa as fr,Wb as Yr,X as Wo,Xa as Ct,Xb as Xr,Y as B,Ya as tt,Yb as en,Z as Lo,Za as hr,Zb as tn,_ as D,_a as Ir,_b as on,a as Le,aa as Vo,ab as re,ac as rt,ba as vt,bb as yr,bc as Nt,c as W,ca as oe,cb as Pr,cc as ke,da as w,db as wr,dc as nt,e as ee,ea as _,eb as Sr,ec as rn,f as Eo,fa as Y,fb as xr,fc as nn,g as me,ga as Ye,gb as br,gc as sn,h as u,ha as Bo,hb as Er,hc as an,i as xt,ia as zo,ib as _r,ic as mn,j as le,ja as Ft,jb as Tr,jc as cn,k as je,ka as jo,kb as vr,kc as dn,l as fe,lb as Fe,lc as Oe,m as De,ma as Do,mb as F,mc as it,n as Ge,na as Go,nb as ot,nc as st,o as bt,oa as Ko,oc as pn,p as To,pa as Ho,pc as at,qa as qo,qb as Fr,qc as ln,r as Ke,ra as C,rb as kr,s as vo,sa as ge,sb as z,t as He,ta as J,tb as Or,u as qe,ub as Pe,v as te,va as Xe,vb as Z,w as Fo,wa as et,wb as Rr,x as he,xa as Jo,xb as At,y as ko,yb as Cr,z as I,zb as Ut}from"./AE5HNAOV.js";import{a as go}from"./XF5N3NI5.js";import{a as ue,g as Ee}from"./IHG7KTNC.js";import{a as L}from"./ZCU2WWVN.js";import{a as H,b as Ve,c as Be,d as ze}from"./KOIDWEP3.js";import{e as K,f as xo,j as Ne,l as $e,o as bo,s as We}from"./AYSQIO6L.js";import{b as wo,h as So}from"./YQHYMLC7.js";import{a as _o}from"./5O53T3SW.js";import{a as V}from"./AJZDBHB6.js";import{b as Io}from"./2I5LGZNX.js";import{E as Me,F as be,G as fo,K as ho,h as uo,i as G,q as pe}from"./FFF5HUPM.js";import{c as $}from"./QPIMTXPL.js";export default $arcgis.t(([{g:un,h:fn,i:hn}])=>{function we(e,t="application/octet-stream"){if(typeof Blob<"u"){let o=[];for(let n=0;n<e.length;n++)o[n]=e.charCodeAt(n);let r=new Uint8Array(o);return new Blob([r],{type:t})}else throw new Error("stringToBlob is not currently supported on Node")}function Pn(e){if(typeof Blob<"u")return new Blob([JSON.stringify(e)],{type:"application/json"});throw new Error("objectToJsonBlob is not currently supported on Node")}var mt={};$(mt,{_mostRecentlyEditedLayer:()=>$t,convertItemToTemplate:()=>ss,createItemFromTemplate:()=>as,postProcess:()=>ms});function ss(e,t,o,r){return new Promise((n,i)=>{let s=D(e);Tr(e.groupDesignations)?rr(s,o).then(m=>n(m),m=>i(S(m))):(s.estimatedDeploymentCostFactor=10,J(s.item.id,o).then(m=>{s.data=m,br(s,o).then(c=>{c.item.modified=Math.max(c.item.modified,$t(s.properties.layers),$t(s.properties.tables)),wr(c,o).then(d=>{c.dependencies=d.map(l=>l.id),n(Xo(c,d,!1,r))},d=>i(S(d)))},c=>i(S(c)))}))})}function as(e,t,o,r){return new Promise(n=>{if(!r(e.itemId,u.Started,0)){r(e.itemId,u.Ignored,0),n(I(e.type));return}let i=M(e);i=w(i,t),delete i.item.thumbnail,Je(i,"properties.service.size");let s=er(i.data);gr(i,o,t).then(a=>{a.success?r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,a.serviceItemId)?(i=Rt(i,t,a),sr(i,t,s,o).then(()=>{i=Rt(i,t,a),Pe({...i.item,url:void 0},i.data,o,e.item.thumbnail,void 0,t).then(()=>{r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor/2,a.serviceItemId)?C(i.itemId,o).then(m=>{i.item=m,p(i,"item.url")&&!i.item.url.endsWith("/")&&(i.item.url+="/"),n({item:i,id:a.serviceItemId,type:i.type,postProcess:oe({item:i.item,data:i.data})||Ct(i)})},()=>{r(e.itemId,u.Failed,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type)))}):(r(e.itemId,u.Cancelled,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type))))},()=>{r(e.itemId,u.Failed,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type)))})},()=>{r(e.itemId,u.Failed,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type)))})):(r(e.itemId,u.Cancelled,0),F(a.serviceItemId,o).then(()=>n(I(e.type)),()=>n(I(e.type)))):(r(e.itemId,u.Failed,0),n(I(e.type)))},()=>{r(e.itemId,u.Failed,0),n(I(e.type))})})}function ms(e,t,o,r,n,i,s){return new Promise((a,m)=>{Z(e,i,s).then(c=>{Ct(r)?(r=w(r,i),tt(r,s,r.item.url,i).then(a,m)):a(c)},m)})}function $t(e){let t=0;return e.forEach(o=>{t=o.editingInfo?.lastEditDate?Math.max(t,o.editingInfo.lastEditDate):t}),t}var f={};$(f,{convertItemToTemplate:()=>cs,createItemFromTemplate:()=>ds});function cs(e,t,o){return new Promise(r=>{let n=D(e);n.item.id=_(n.item.id,n.item.id,".itemId");let i=new Promise(a=>{ge(n.itemId,n.item.name,o).then(m=>{!m||m.size===0?a(null):a(m)})}),s=Promise.resolve({});Promise.all([i,s]).then(a=>{let[m]=a;if(m){let c=rn(m,n.item.name);n.properties[c.filename]=c.mimeType;let d=nt(n.itemId,c.blob.name,1,c.blob.name===c.filename?ke.data:ke.fakezip),l={itemId:n.itemId,file:c.blob,folder:d.folder,filename:d.filename};n.dataFile=l,n.resources.push(d.folder+"/"+d.filename),r(n)}else r(n)})})}function ds(e,t,o,r){return new Promise(n=>{if(!r(e.itemId,u.Started,0)){r(e.itemId,u.Ignored,0),n(I(e.type));return}let i=M(e);i=w(i,t),e.item.thumbnail&&(i.item.thumbnail=e.item.thumbnail),re(i.item,i.data,o,t.folderId).then(s=>{r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,s.id)?(i.itemId=s.id,t[e.itemId]={itemId:s.id},r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor/2,s.id),n({item:i,id:s.id,type:i.type,postProcess:!1})):(r(e.itemId,u.Cancelled,0),F(s.id,o).then(()=>n(I(e.type)),()=>n(I(e.type))))},()=>{r(e.itemId,u.Failed,0),n(I(e.type))})})}var Xt={};$(Xt,{_getFormDataFilename:()=>ri,_replaceFeatureServiceURLs:()=>Zn,_replaceItemIds:()=>Qn,_replacePortalBaseUrls:()=>Yn,_replaceWorkflowManagerBaseUrls:()=>Xn,_updateZipObjectTextContent:()=>ei,convertItemToTemplate:()=>Ks,createItemFromTemplate:()=>Hs,postProcess:()=>oi,postProcessFormItems:()=>Js,swizzleFormObject:()=>Qt,templatizeFormData:()=>Yt});function xn(e,t){return ps(e,t)}function ps(e,t){return["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"].forEach(r=>{let n=p(e,r);Array.isArray(n)&&n.forEach(i=>{i.type==="mapWidget"&&(e.dependencies.indexOf(i.itemId)<0&&e.dependencies.push(i.itemId),i.itemId=_(i.itemId,i.itemId,".itemId")),Array.isArray(i.datasets)&&ls(i,e,t)})}),e}function ls(e,t,o){e.datasets.forEach(r=>{if(p(r,"dataSource.type")!=="arcadeDataSource"){let i=p(r,"dataSource.itemId");if(i){t.dependencies.indexOf(i)<0&&t.dependencies.push(i);let s=p(r,"dataSource.layerId");ye(s?.toString(),i,"",o),r.dataSource.itemId=_(i,i,".itemId")}}})}function bn(e,t){let o=["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"];return o.forEach(r=>{let n=p(e,r);us(n,t)}),o.forEach(r=>{fs(e,r,t)}),e}function us(e,t){e&&Array.isArray(e)&&e.forEach(o=>{Array.isArray(o.datasets)&&o.datasets.forEach(r=>{let n=_t(p(r,"dataSource.itemId"));if(n){let i=Tt(p(r,"dataSource.layerId"));t.some(s=>s.itemId===n&&s.layerId===i?(Sn(s,o.id),!0):!1)}else{let i=p(r,"dataSource.id");if(i){let s=i.split("#")[1];t.some(a=>a.ids.indexOf(s)>-1?(Sn(a,o.id),!0):!1)}}})})}function fs(e,t,o){let r=p(e,t);r&&b(e,t,hs(r,o))}function hs(e,t){return Array.isArray(e)?e.map(o=>{let r=o;return Array.isArray(r.events)&&(r.events=r.events.map(n=>{let i=n;return Array.isArray(i.actions)&&(i.actions=i.actions.map(s=>{let a=s;if(a.fieldMap&&a.targetId&&a.targetId.indexOf("#")>-1){let m=wn(a,t);if(m){let c=p(m,"fields"),d=p(m,"basePath");Array.isArray(c)&&d&&(a.fieldMap=a.fieldMap.map(l=>{let h=l;return h.targetName=Y(h.targetName,c,d),h}))}}return a})),i})),Array.isArray(r.datasets)&&(r.datasets=r.datasets.map(n=>{let i=n;if(i.type==="serviceDataset"){let s=wn(n,t);if(s){let a=p(s,"fields"),m=p(s,"basePath");Array.isArray(a)&&m&&(r=Y(r,a,m),i=Y(i,a,m))}}return i})),r}):e}function wn(e,t){let o,r=p(e,"dataSource.id")||p(e,"targetId");if(r){let n=r.split("#")[1];if(!t.some(i=>(o=i.ids.indexOf(n)>-1?i:o,i.ids.indexOf(n)>-1))){let i=r.split("#")[0];t.some(s=>{let m=(s.references||[]).indexOf(i)>-1;return o=m?s:o,m})}}else{let n=_t(p(e,"dataSource.itemId")),i=Tt(p(e,"dataSource.layerId"));n&&t.some(s=>{let a=n===s.itemId&&i===s.layerId;return o=a?s:o,a})}return o}function Sn(e,t){e.references=Array.isArray(e.references)?e.references:[],e.references.indexOf(t)<0&&e.references.push(t)}var Se={};$(Se,{convertItemToTemplate:()=>_s,convertNotebookToTemplate:()=>Ht,createItemFromTemplate:()=>Ts,deleteProps:()=>Un,fineTuneCreatedItem:()=>Kt,postProcess:()=>Fs,postProcessNotebookTemplates:()=>vs});function Tn(e,t,o,r){return new Promise((n,i)=>{let s="";if(e.item.url){let a=e.item.url,m=a.indexOf("//");e.item.url=B(q)+a.substring(a.indexOf("/",m+2),a.lastIndexOf("=")+1)+e.item.id,s=a.replace(a.substring(a.indexOf("/",m+2)),"")}e.dependencies=ys(e),b(e,"data.folderId","{{folderId}}"),Ss(e,["data.map.itemId","data.map.appProxy.mapItemId","data.values.webmap","data.values.group"]),Fn(e,"data.appItemId",e.itemId),Dt(e,["data.logo","data.map.portalUrl","data.portalUrl","data.httpProxy.url"],B(q)),b(e,"data.geometryService",B(No)),Is(e,o,s,r).then(()=>{_n(e,o,s,"data.widgetPool.widgets").then(a=>{_n(a,o,s,"data.widgetOnScreen.widgets",!0).then(m=>{gs(m,o,s,"data.values").then(c=>{n(c)},c=>i(S(c)))},m=>i(S(m)))},a=>i(S(a)))},a=>i(S(a)))})}function Is(e,t,o,r){return new Promise((n,i)=>{let s=p(e,"data.dataSource.dataSources");if(s&&Object.keys(s).length>0){let a=new Array;Object.keys(s).forEach(m=>{let c=s[m];b(c,"portalUrl",B(q));let d=p(c,"itemId");if(p(c,"url")){if(d){let h=c.url.substr(c.url.lastIndexOf("/")+1);ye(h.toString(),d,c.url,r),c.itemId=_(d,d,".layer"+h+".itemId")}let l=jt(c.url,o,[],[],t);a.push(new Promise((h,g)=>{zt(l.serviceRequests,l.requestUrls,l.testString).then(P=>{c.url=P,h()},P=>g(S(P)))}))}else d&&(c.itemId=_(d,d,".itemId"))}),Promise.all(a).then(()=>n(e),m=>i(S(m)))}else n(e)})}function _n(e,t,o,r,n=!1){return new Promise((i,s)=>{let a=p(e,r)||[],m=[],c=[];if(a.forEach(d=>{!n&&p(d,"icon")&&Dt(d,["icon"],B(q));let l=d.config;if(l){let h=JSON.stringify(l),g=jt(h,o,c,m,t);d.config=JSON.parse(g.testString),m=g.serviceRequests,c=g.requestUrls}}),m.length>0){let d=JSON.stringify(a);zt(m,c,d).then(l=>{b(e,r,JSON.parse(l)),i(e)},l=>s(S(l)))}else i(e)})}function gs(e,t,o,r){return new Promise((n,i)=>{let s=p(e,r),a=[],m=[];if(s){p(s,"icon")&&Dt(s,["icon"],B(q));let c=JSON.stringify(s),d=jt(c,o,m,a,t);s=JSON.parse(d.testString),a=d.serviceRequests,m=d.requestUrls}if(a.length>0){let c=JSON.stringify(s);zt(a,m,c).then(d=>{b(e,r,JSON.parse(d)),n(e)},d=>i(S(d)))}else n(e)})}function zt(e,t,o){return new Promise((r,n)=>{if(e&&e.length>0){let i=0;Promise.all(e).then(s=>{s.forEach(a=>{if(p(a,"serviceItemId")){let m="{{"+a.serviceItemId+(a.hasOwnProperty("id")?".layer"+a.id:"")+".url}}";o=ct(o,t[i],m,!0)}i++}),r(o)},s=>n(S(s)))}else r(o)})}function jt(e,t,o,r,n){let i={f:"json",authentication:n},s=e.match(/(\bhttps?:\/\/[-A-Z0-9/._]*)/gim);return s&&s.length&&s.forEach(a=>{a.indexOf("NAServer")>-1?e=ct(e,a,B(Wo)):a.indexOf("GeocodeServer")>-1?e=ct(e,a,B($o)):t&&a.indexOf(t)>-1?e=ct(e,t,B(q)):a.indexOf("FeatureServer")>-1&&o.indexOf(a)===-1&&(o.push(a),r.push(W(a,i)))}),{testString:e,requestUrls:o,serviceRequests:r}}function ct(e,t,o,r=!1){let n=r&&e.indexOf('"')>-1,i=new RegExp(n?'"'+t+'"':t,"gmi");return e.replace(i,n?'"'+o+'"':o)}function Dt(e,t,o){t.forEach(r=>{let n=p(e,r);if(n){let i=n.substring(n.indexOf("/",n.indexOf("//")+2));b(e,r,i!==n?o+i:o)}})}function vn(e,t,o,r){return new Promise(n=>{if(ve(e,["WAB2D","WAB3D","Web AppBuilder"])){let i={id:t.itemId,url:t.item.url,data:t.data},s=z(i,r),a={tags:e.item.tags,title:e.item.title,type:"Code Attachment",typeKeywords:["Code","Javascript","Web Mapping Application"],relationshipType:"WMA2Code",originItemId:t.itemId,url:qe(w(B(q),o))+"sharing/rest/content/items/"+t.itemId+"/package"},m=re(a,{},r,o.folderId);Promise.all([s,m]).then(()=>n(null),()=>n(null))}else n(null)})}function ys(e){let t=Ps;return ve(e,["WAB2D","WAB3D","Web AppBuilder"])&&(t=ws),t(e)}function Ps(e){return Uo(e,["data.values.webmap","data.values.group"])}function ws(e){let t=[],o=p(e,"data.map.itemId");o&&t.push(o);let r=p(e,"data.dataSource.dataSources");return r&&Object.keys(r).forEach(n=>{let i=r[n];i.itemId&&t.push(i.itemId)}),t}function Ss(e,t){t.forEach(o=>{let r=p(e,o);Fn(e,o,r)})}function Fn(e,t,o){b(e,t,_(o,o,".itemId"))}function kn(e,t){let o=p(e,"data.dataSource.dataSources");o&&Object.keys(o).length>0&&(Object.keys(o).forEach(i=>{let s=o[i];o[i]=Vt(s,t)}),b(e,"data.dataSource.dataSources",o)),["data.widgetPool.widgets","data.widgetOnScreen.widgets"].forEach(i=>{let s=p(e,i);s&&b(e,i,xs(s,t))});let n=p(e,"data.values");return n&&b(e,"data.values",Vt(n,t)),e}function Vt(e,t,o=!1){return e=Es(e,t,o),bs(e,t).forEach(n=>{e=Y(e,n.fields,n.basePath,o)}),e}function xs(e,t){let o=["SmartEditor","Screening"];return e.map(r=>{if(r.config){let n=o.indexOf(r.name)>-1;r.config=Vt(r.config,t,n)}return r})}function bs(e,t){let o=JSON.stringify(e);return t.filter(n=>Lt(n,o)<4).sort((n,i)=>Lt(n,o)-Lt(i,o))}function Lt(e,t){let o=e.url,r=e.itemId,n=e.layerId,i;return o&&!isNaN(n)&&(i=new RegExp(o.replace(/[.]/,".layer"+n+"."),"gm")),i&&i.test(t)||e.ids.length>0&&e.ids.some(s=>new RegExp(s,"gm").test(t))?1:o&&new RegExp(o,"gm").test(t)?2:r&&new RegExp(r,"gm").test(t)?3:4}function Es(e,t,o){let r=JSON.stringify(e),n=t.filter(i=>{let s;i.url&&!isNaN(i.layerId)&&(s=new RegExp(i.url.replace(/[.]/,".layer"+i.layerId+"."),"gm"));let a=!1;if(i.ids.length>0&&(a=i.ids.some(m=>new RegExp(m,"gm").test(r))),a||s&&s.test(r))return i});return n.length>0&&n.forEach(i=>{e=Bt(e,i,o),i.ids.length>0&&i.ids.forEach(s=>{e=dt(e,i,s,o)})}),e}function Bt(e,t,o){let r={},n=t.url,i=t.layerId,s;if(n&&!isNaN(i)&&(s=new RegExp(n.replace(/[.]/,".layer"+i+"."),"gm")),Array.isArray(e))r=e.map(a=>Bt(a,t,o));else if(typeof e=="object")for(let a in e)e[a]!=null&&typeof e[a]=="object"?r[a]=Bt(e[a],t,o):(s&&s.test(e[a])&&(e=Y(e,t.fields,t.basePath,o)),r[a]=e[a]);else r=e;return r}function dt(e,t,o,r){let n={},i=new RegExp(o,"gm");if(Array.isArray(e))n=e.map(s=>dt(s,t,o,r));else if(typeof e=="object")for(let s in e)if(e[s]!==null){let a;try{a=JSON.parse(e[s])}catch{a=void 0}a&&typeof a=="object"?n[s]=JSON.stringify(dt(a,t,o,r)):typeof e[s]=="object"?(i.test(s)&&r&&(e[s]=Y(e[s],t.fields,t.basePath,r)),n[s]=dt(e[s],t,o,r)):(i.test(e[s])&&(e=Y(e,t.fields,t.basePath,r)),n[s]=e[s])}else n[s]=e[s];else n=e;return n}function On(e,t,o,r){return fr(e,o,r)}function Rn(e,t,o){return tt(e,t,"",o)}function Q(e,t,o,r,n){return new Promise((i,s)=>{function a(){n&&n.signal.aborted&&s(new Error("Operation was cancelled"))}if(a(),!r(e.itemId,u.Started,0))r(e.itemId,u.Ignored,0),i(I(e.type));else{let m=M(e);m=w(m,t);let c;e.type==="Web Mapping Application"&&e.data?m=JSON.parse(w(JSON.stringify(m),t)):e.type==="QuickCapture Project"&&e.data&&(c=JSON.stringify(m.data.application),delete m.data),e.item.thumbnail&&(m.item.thumbnail=e.item.thumbnail),re(m.item,m.data,o,t.folderId).then(d=>{if(a(),!r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,d.id))r(e.itemId,u.Cancelled,0),F(d.id,o).then(()=>i(I(e.type)),()=>i(I(e.type)));else{t[e.itemId]={itemId:d.id,itemUrl:t.portalBaseUrl+"/sharing/rest/content/items/"+d.id},m.itemId=d.id,m.type==="Web Mapping Application"&&e.data&&b(m,"data.appItemId",d.id);let l=oe(m.data),h=m.item.url;m=w(m,t),a();let g=Promise.resolve([]);if(m.relatedItems){let x=w(Ye(m.relatedItems),t);g=hr(m.itemId,x,o)}a();let P;if(e.type==="Web Mapping Application"&&e.data&&ve(e,["WAB2D","WAB3D","Web AppBuilder"]))P=vn(e,m,t,o);else if(e.type==="Workforce Project")P=Rn(m,o,t);else if(e.type==="QuickCapture Project"){if(c){let x=Ie(w(JSON.parse(c),t),"qc.project.json");P=dn(x,m.itemId,"",x.name,o)}}else e.type==="Notebook"?P=Kt(e,m,t,o):h!==m.item.url?(a(),P=new Promise((x,y)=>{Rr(d.id,m.item.url,o).then(()=>x(),y)})):P=Promise.resolve(null);a(),Promise.all([g,P]).then(()=>{r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor/2,d.id)?i({item:m,id:d.id,type:m.type,postProcess:l}):(r(e.itemId,u.Cancelled,0),F(d.id,o).then(()=>i(I(e.type)),()=>i(I(e.type))))},()=>{r(e.itemId,u.Failed,0),i(I(e.type))})}},()=>{r(e.itemId,u.Failed,0),i(I(e.type))})}})}function _s(e,t,o,r){return X(e,t,o,r)}function Ts(e,t,o,r){return Q(e,t,o,r)}function Ht(e){return new Promise(t=>{Un(e.data),t(e)})}function vs(e,t){if(e.some(r=>r.type==="Notebook")){let r=Object.keys(t).filter(i=>i.indexOf("FeatureServer")>-1).sort().reverse(),n=e.reduce((i,s)=>(i=[...new Set([...i,...s.dependencies,s.itemId])],i),[]);e=e.map(i=>{if(i.type==="Notebook"){let s=i.data&&JSON.stringify(i.data);return n.forEach(a=>{new RegExp(a,"gim").test(s)&&(s=s.replace(a,"{{"+a+".itemId}}"),i.dependencies.indexOf(a)<0&&i.dependencies.push(a))}),r.forEach(a=>{let m=new RegExp(a,"gim");if(m.test(s)){let c=t[a];s=s.replace(m,c);let d=/[0-9A-F]{32}/gim,l=c.match(d)[0];i.dependencies.indexOf(l)<0&&i.dependencies.push(l)}}),i.data=JSON.parse(s),i}})}return e}function Un(e){if(e){let t=["metadata.interpreter","metadata.papermill"];_e(e,t),(e.cells||[]).forEach(o=>{_e(o,t)})}}function Kt(e,t,o,r){return new Promise((n,i)=>{let s={id:t.itemId,url:t.item.url,data:Ie(t.data,t.itemId+".ipynb")};z(s,r).then(()=>n(null),i)})}function Fs(e,t,o,r,n,i,s){return Z(e,i,s)}function Nn(e,t,o){return new Promise((r,n)=>{ks(e,o).then(i=>{e.dependencies=i.dependencies,e.data?.properties&&(e.data.properties.ServiceURL=Mn(e.data.properties.ServiceURL,i.urlHash),e.data.properties.OverviewURL=Mn(e.data.properties.OverviewURL,i.urlHash)),r(e)},i=>n(S(i)))})}function ks(e,t){return new Promise((o,r)=>{let n=[];if(e.data?.properties){let i=[];e.data.properties.ServiceURL&&i.push(e.data.properties.ServiceURL),e.data.properties.OverviewURL&&e.data.properties.OverviewURL!==e.data.properties.ServiceURL&&i.push(e.data.properties.OverviewURL),Os(i,n,t).then(s=>{o(s)},s=>r(S(s)))}else o({dependencies:n,urlHash:{}})})}function Os(e,t,o){return new Promise((r,n)=>{let i={},s={f:"json",authentication:o},a=[],m={},c=e.filter(d=>{if(d){let l=/.+FeatureServer/g.exec(d),h=Array.isArray(l)&&l.length>0?l[0]:void 0;return h?(Object.keys(m).indexOf(h)<0&&(m[h]=W(d,s)),a.push(m[h]),!0):!1}else return!1});a.length>0?Promise.all(a).then(d=>{d.forEach((l,h)=>{if(p(l,"serviceItemId")){let g=l.serviceItemId;t.indexOf(g)<0&&t.push(g),i[c[h]]=g}}),r({dependencies:t,urlHash:i})},d=>n(S(d))):r({dependencies:t,urlHash:i})})}function Mn(e,t){let o=e;if(e){let r=t[e];if(r){let n=e.substr(e.lastIndexOf("/")+1);o=_(r,r,".layer"+n+".url")}o=Ye(o.replace(/.+?(?=\/home)/,"{{portalBaseUrl}}"))}return o}var Re={};$(Re,{_templatizeAdminEmail:()=>Ln,_templatizeApplication:()=>Wn,_templatizeId:()=>qt,_templatizeUrl:()=>Bn,_updateDependencies:()=>Vn,convertItemToTemplate:()=>Cs,convertQuickCaptureToTemplate:()=>Jt,createItemFromTemplate:()=>As});function Cs(e,t,o,r){return X(e,t,o,r)}function Jt(e){return b(e,"data.application",Wn(e.data.application,e)),e}function Wn(e,t){qt(e,"itemId"),Ln(e);let o=e?.dataSources;return o&&Array.isArray(o)&&o.forEach(r=>{let n=r.featureServiceItemId;n&&(Vn(n,t),Bn(r,"featureServiceItemId","url"),qt(r,"featureServiceItemId"))}),e}function Ln(e){p(e,"preferences.adminEmail")&&b(e,"preferences.adminEmail","{{user.email}}")}function Vn(e,t){t.dependencies.indexOf(e)===-1&&t.dependencies.push(e)}function Bn(e,t,o){let r=p(e,t),n=p(e,o);if(n){let i=n.substr(n.lastIndexOf("/")+1);b(e,o,_(r,r,".layer"+i+".url"))}}function qt(e,t){let o=p(e,t);o&&b(e,t,_(o,o,".itemId"))}function As(e,t,o,r){return Q(e,t,o,r)}var Us="home/webmap/viewer.html?webmap=";function zn(e,t,o,r){return new Promise((n,i)=>{e.type!=="Vector Tile Service"&&(e.item.url=e.item.url?qe(B(q))+Us+e.item.id:e.item.url),Ms(e,o).then(s=>{e.dependencies=s.dependencies,e.data&&(e.data.baseMap?.baseMapLayers&&Zt(e.data.baseMap.baseMapLayers,s.urlHash,r),e.data.operationalLayers&&Zt(e.data.operationalLayers,s.urlHash,r),Zt(e.data.tables,s.urlHash,r),Ns(e.data)),n(e)},s=>i(S(s)))})}function Ms(e,t){return new Promise((o,r)=>{let n=[];if(e.data){let i=e.data.baseMap?.baseMapLayers||[],s=e.data.operationalLayers||[],a=e.data.tables||[],m=i.concat(s).concat(a);$s(m,n,t).then(c=>{o(c)},c=>r(S(c)))}else o({dependencies:n,urlHash:{}})})}function Ns(e){Je(e,"initialState")}function $s(e,t,o){return new Promise((r,n)=>{let i={},s={f:"json",authentication:o},a=[],m={},c=e.filter(d=>{if(d.itemId&&d.layerType==="VectorTileLayer")return a.push(C(d.itemId,o)),!0;if(d.url&&d.url.indexOf("{{velocityUrl}}")<0){let l=/.+FeatureServer/g.exec(d.url),h=Array.isArray(l)&&l.length>0?l[0]:void 0;return h?(Object.keys(m).indexOf(h)<0&&(m[h]=W(d.url,s)),a.push(m[h]),!0):!1}else return!1});a.length>0?Promise.all(a).then(d=>{d.forEach((l,h)=>{if(c[h].layerType==="VectorTileLayer"){let g=p(l,"typeKeywords");if(g&&g.includes("Vector Tile Style Editor")){t.indexOf(l.id)<0&&t.push(l.id),c[h].templatizeId=!0;let P=c[h].styleUrl.indexOf(l.id)+l.id.length;c[h].styleUrl=_(c[h].styleUrl.replace(c[h].styleUrl.substring(0,P),l.id),l.id,".itemUrl")}}else if(p(l,"serviceItemId")){let g=l.serviceItemId;t.indexOf(g)<0&&t.push(g),i[c[h].url]=g}}),r({dependencies:t,urlHash:i})},d=>n(S(d))):r({dependencies:t,urlHash:i})})}function Zt(e=[],t,o){e.forEach(r=>{if(r.itemId&&r.layerType==="VectorTileLayer")r.templatizeId&&(r.itemId=_(r.itemId,r.itemId,".itemId"),delete r.templatizeId);else if(r.url){let n=r.url.substr(r.url.lastIndexOf("/")+1),i=Object.keys(t).indexOf(r.url)>-1?t[r.url]:void 0;i&&(ye(n,i,r.url,o),r.url=_(i,i,".layer"+n+".url"),r.itemId=_(i,i,".layer"+n+".itemId"))}})}function jn(e,t){return["data.operationalLayers","data.tables","data.applicationProperties.viewing.search.layers"].forEach(r=>Ws(e,t,r)),e}function Ws(e,t,o){let r=p(e,o);r&&b(e,o,Ls(r,t))}function Ls(e,t){return e.forEach(o=>{let r=Vs(o,t);if(r){let n=r.fields.map(s=>s.name);cr(o,r,r.basePath,r.itemId,n),pr(o,r.basePath,n),o.layerDefinition&&(ur(o.layerDefinition,r.basePath,n),lr(o.layerDefinition,r.basePath,n));let i=p(o,"field.name");i&&b(o,"field.name",dr(i,o,r.itemId,r.basePath))}}),e}function Vs(e,t){let o;return t.some(r=>r.ids.indexOf(e.id)>-1?(o=r,!0):!1),o}function X(e,t,o,r){return new Promise((n,i)=>{let s=D(e);s.item.id=_(s.item.id,s.item.id,".itemId");let a=Xe(s.itemId,"forward",o),m=Promise.resolve({}),c=Promise.resolve([]);switch(e.type){case"Dashboard":case"Data Pipeline":case"Feature Collection":case"Feature Service":case"Hub Initiative":case"Hub Page":case"Hub Site Application":case"Insights Model":case"Oriented Imagery Catalog":case"Project Package":case"Style":case"Workforce Project":case"Web Map":case"Web Mapping Application":case"Web Scene":case"Notebook":m=new Promise(d=>{J(s.itemId,o).then(l=>d(l))});break;case"Form":m=ge(s.itemId,s.item.name,o);break;case"QuickCapture Project":c=et(s.itemId,o);break}Promise.all([m,a,c]).then(d=>{let[l,h,g]=d;ln(s,r),s.data=at(l,e.type,r);let P=h;s.dependencies=[],s.relatedItems=[],P.forEach(y=>{y.relationshipType!=="WMA2Code"&&(s.relatedItems.push(y),y.relatedItemIds.forEach(T=>{s.dependencies.indexOf(T)<0&&s.dependencies.push(T)}))}),e.type==="Data Pipeline"&&(s.dependencies=s.dependencies.concat(Bs(l)));let x=Promise.resolve(s);switch(e.type){case"Dashboard":xn(s,r);break;case"Notebook":x=Ht(s);break;case"Oriented Imagery Catalog":x=Nn(s,t,o);break;case"QuickCapture Project":s.resources=g,x=new Promise(async y=>{let T=null,E=-1;g&&(g.some((ce,ie)=>{let se=ce.name==="qc.project.json";return se&&(T=ce,E=ie),se}),E>=0&&g.splice(E,1)),T&&(s.data={application:{...await He(T)},name:"qc.project.json"}),s.data.application?.basemap?.type==="Web Map"&&s.dependencies.push(s.data.application.basemap.itemId);let j=Jt(s);y(j)});break;case"Vector Tile Service":case"Web Map":case"Web Scene":x=zn(s,t,o,r);break;case"Web Mapping Application":l&&(x=Tn(s,t,o,r));break;case"Workforce Project":x=On(s,t,o,r);break}x.then(n,y=>i(S(y)))})})}function Bs(e){let t=[];return(e?.inputs??[]).concat(e?.outputs??[]).forEach(r=>{if(r.type==="FeatureServiceSource"||r.type==="FeatureServiceSink"){let n=p(r,"parameters.layer.value.itemId");n&&t.push(n)}}),t}var O={};$(O,{convertItemToTemplate:()=>zs,createItemFromTemplate:()=>js,postProcess:()=>Gs,postProcessFieldReferences:()=>Ds});function zs(e,t,o,r){return X(e,t,o,r)}function js(e,t,o,r,n){return n?Q(e,t,o,r,n):Q(e,t,o,r)}function Ds(e,t,o){switch(o){case"Web Mapping Application":kn(e,t);break;case"Dashboard":bn(e,t);break;case"Web Map":jn(e,t);break}return e}async function Gs(e,t,o,r,n,i,s){if(t==="Web Map"&&r.resources.some(a=>a.indexOf(me)>-1)){let a=sn(`${i.portalBaseUrl}/sharing/rest`,r.itemId,me),m={httpMethod:"GET",authentication:s,params:{f:"json"},headers:{Accept:"application/json",Authorization:`Bearer ${s.token}`,"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${s.token}`}};await W(a,m).then(async c=>{let d=JSON.stringify(c),l=w(d,i);if(d!==l){let h=JSON.parse(l),g={id:e,resource:Ie(h,me),name:me,authentication:s,params:{}};await Eo(g)}})}return Z(e,i,s)}function Ks(e,t,o,r){return O.convertItemToTemplate(e,t,o,r)}function pt(e){return!!p(e,"properties.services")}function Kn(e,t="https://survey123.arcgis.com"){let o=`${t}/api/survey/create`,r={credentials:"same-origin",method:"POST",body:wo({f:"json",...e},!0)};return fetch(o,r).then(n=>n.json()).then(n=>{if(!n.success)throw new Error(`Failed to create survey: ${n.error.message}`);return{formId:n.id,featureServiceId:n.featureService.source.itemId,folderId:n.formItemInfo.ownerFolder}})}var Hn=function(t){let o=M(t),r=[["header","content"],["subHeader","content"],["footer","content"],["settings","thankYouScreenContent"]],n=(s,a)=>(s&&s[a]&&(s[a]=encodeURIComponent(s[a])),s);r.forEach(([s,a])=>n(o[s],a));let i=s=>n(s,"description");return o.questions=(o.questions||[]).map(s=>s.questions?{...s,questions:s.questions.map(i)}:i(s)),o};function qn(e,t,o){let{item:{title:r,description:n,tags:i,typeKeywords:s},properties:{form:a}}=e,{user:{username:m},portalBaseUrl:c,organization:{basemapGalleryGroupQuery:d,defaultBasemap:{title:l}}}=t,{token:h}=o.toCredential();return Zo(d,l,o).then(g=>{let P="Survey-",x=Mo(`${P}${r}`,t,"user.folders").replace(P,"");if(a.questions){let T=E=>(E.maps&&(E.maps=E.maps.map(j=>({...j,itemId:g.id}))),E);a.questions=a.questions.map(E=>E.questions?{...E,questions:E.questions.map(T)}:T(E))}let y=Hn(a);return{description:n,form:y,portalUrl:c,tags:i,title:x,token:h,typeKeywords:s,username:m}})}function Jn(e,t,o,r){let n=w(e,t),{survey123Url:i}=t;return qn(n,t,o).then(s=>Kn(s,i)).then(s=>{let{formId:a,featureServiceId:m}=s,c=Promise.resolve(null);return e.item.thumbnail&&(c=Pe({id:a},null,o,e.item.thumbnail)),c.then(()=>C(a,o)).then(d=>(t[n.itemId]={itemId:a},t[n.properties.info.serviceInfo.itemId]={itemId:m},r(n.itemId,u.Finished,n.estimatedDeploymentCostFactor,a),{item:{...e,item:d,itemId:a},id:a,type:"Form",postProcess:!0}))}).catch(s=>{throw r(n.itemId,u.Failed,0),s})}function Hs(e,t,o,r){return pt(e)?Jn(e,t,o,r):O.createItemFromTemplate(e,t,o,r)}async function Qt(e,t){let o=await Ut(e),r=new Date;return r=new Date(r.valueOf()-864e5-r.getTimezoneOffset()*1e3*60),o.forEach(n=>{if(typeof n.content=="string"){let i=ei(n,t);e.file(n.file,i,{date:r})}else n.file.endsWith(".xlsx")&&e.file(n.file,n.content,{date:r})}),Promise.resolve(e)}async function Yt(e,t){return(await Ut(e)).forEach(r=>{if(r.file.endsWith(".info")||r.file.endsWith(".itemInfo")||r.file.endsWith(".json")||r.file.endsWith(".webform")||r.file.endsWith(".xml")){let n=r.content,i=/\b([0-9A-Fa-f]){32}_type/g;n=Qn(n,t,i),n=Zn(n,t,i),n=Yn(n,t),n=Xn(n,t),e.file(r.file,n)}}),Promise.resolve(e)}function Zn(e,t,o){let r=e;return Object.keys(t).filter(i=>i.match(o)&&t[i].type==="Feature Service").forEach(i=>{let s=t[i].url,a=t[s];a&&(r=r.replace(new RegExp(s,"g"),a))}),r}function Qn(e,t,o){let r=e;return Object.keys(t).filter(i=>i.match(o)&&t[i].type!=="Feature Service").map(i=>i.replace("_type","")).forEach(i=>{r=r.replace(new RegExp(i,"g"),`{{${i}.itemId}}`)}),r}function Yn(e,t){let o=e;return t.portalBaseUrl&&(o=o.replace(new RegExp(t.portalBaseUrl,"g"),"{{portalBaseUrl}}")),o}function Xn(e,t){let o=e;return t.workflowBaseUrl&&(o=o.replace(new RegExp(t.workflowBaseUrl,"g"),"{{workflowBaseUrl}}")),o}function ei(e,t){let o=Oo(),r=e.content;return r=w(e.content,t),he(r.match(o)??[]).forEach(i=>{let s=t[i];typeof s?.itemId=="string"&&(r=r.replace(new RegExp(i,"g"),`${s.itemId}`))}),r}function ti(e,t,o,r,n,i,s){let a=r.properties.info.serviceInfo.itemId,{itemId:m}=i[a],c=w(r,i);return C(m,s).then(d=>{let l=[{id:e,title:c.item.title,snippet:c.item.snippet,extent:c.item.extent,culture:c.item.culture},{id:m,extent:c.item.extent,typeKeywords:[`source-${a}`].concat(d.typeKeywords)}],h=P=>z(P,s),g=l.map(h);return Promise.all(g).then(()=>{let P=[e,m],x=T=>K({itemId:T,folderId:i.folderId,authentication:s}),y=P.map(x);return Promise.all(y)}).then(()=>vr(d.ownerFolder,s)).then(()=>{let P=D(d);return n.push(P),r.dependencies.push(d.id),!0})})}async function oi(e,t,o,r,n,i,s){let a=await ge(e,"Form",s);if(a){let m=await At(a),c=await Qt(m,i);rt(c,e,s)}else return await ko(5e3),oi(e,t,o,r,n,i,s);return pt(r)?ti(e,t,o,r,n,i,s):Z(e,i,s)}async function Js(e,t){for(let o of e)if(o.type==="Form"){let r=o.data;if(o.data=null,r){let n=await At(r);n=await Yt(n,t),o.item.name=ri(o.item.name,r.name,`${o.itemId}.zip`);let i=await Ar(n,o.item.name),s=nt(o.itemId,o.item.name,1,ke.data),a={itemId:o.itemId,file:i,folder:s.folder,filename:o.item.name};o.dataFile=a,o.resources.push(s.folder+"/"+s.filename)}}return Promise.resolve(e)}function ri(e,t,o){let r=e||t;return r&&r!=="undefined"?r:o}var eo={};$(eo,{_initializeNewGroup:()=>ni,convertItemToTemplate:()=>Zs,createItemFromTemplate:()=>Qs,postProcess:()=>Ys});function Zs(e,t,o){return new Promise(r=>{let n=Lo(e);n.item.id=_(n.item.id,n.item.id,".itemId"),qo(e.id,o).then(i=>{n.type="Group",Ho(e.id,o).then(s=>{s.id=n.item.id,n.item={...s,type:"Group"},n.dependencies=i.concat(Ao(s.tags)),r(n)},()=>r(n))},()=>r(n))})}function Qs(e,t,o,r){return new Promise(n=>{if(!r(e.itemId,u.Started,0)){r(e.itemId,u.Ignored,0),n(I(e.type));return}let i=M(e);i=w(i,t),i.item.thumbnail=e.item.thumbnail;let s=ni(i.item);Pr(s.title,s,t,o,Ot(i)?t.locationTracking.owner:void 0).then(a=>{if(a.success)if(!r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,a.group.id))r(e.itemId,u.Cancelled,0),Fe(a.group.id,o).then(()=>n(I(e.type)),()=>n(I(e.type)));else if(i.itemId=a.group.id,t[e.itemId]={itemId:a.group.id},i=w(i,t),t[e.itemId].itemId=a.group.id,!r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor/2,a.group.id))r(e.itemId,u.Cancelled,0),Fe(a.group.id,o).then(()=>n(I(e.type)),()=>n(I(e.type)));else if(Ot(i)){let m=t.locationTracking.owner;Fr(a.group.id,m,o).then(c=>{c.success?r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,a.group.id)?kr(a.group.id,[o.username],o).then(d=>{Array.isArray(d.notRemoved)&&d.notRemoved.length===0?r(e.itemId,u.Created,e.estimatedDeploymentCostFactor/2,a.group.id)?n({item:i,id:a.group.id,type:i.type,postProcess:oe(i)}):(r(e.itemId,u.Cancelled,0),Fe(a.group.id,o).then(()=>n(I(e.type)),()=>n(I(e.type)))):(r(e.itemId,u.Failed,0),n(I(e.type)))}):(r(e.itemId,u.Cancelled,0),Fe(a.group.id,o).then(()=>n(I(e.type)),()=>n(I(e.type)))):(r(e.itemId,u.Failed,0),n(I(e.type)))})}else n({item:i,id:a.group.id,type:i.type,postProcess:oe(i)});else r(e.itemId,u.Failed,0),n(I(e.type))},()=>{r(e.itemId,u.Failed,0),n(I(e.type))})})}function Ys(e,t,o,r,n,i,s){let a=Promise.resolve({success:!0});return o.some(m=>{if(m.id===e){let c=m.item.item;return oe(c)&&(c=w(c,i),a=Or(c,s)),!0}}),a}function ni(e){let t={access:"private",description:e.description,owner:e.owner,snippet:e.snippet,tags:e.tags,thumbnail:e.thumbnail,title:e.title||"",typeKeywords:e.typeKeywords};return["autoJoin","displaySettings","isInvitationOnly","isOpenData","isViewOnly","membershipAccess","properties","sortField","sortOrder"].forEach(r=>{e.hasOwnProperty(r)&&(t[r]=e[r])}),t}var Ce={};$(Ce,{convertItemToTemplate:()=>Xs,createItemFromTemplate:()=>ea,isAPage:()=>oa,postProcess:()=>ta});function ii(e,t,o,r){return e=fe(e,o,{}),Dr(e,{...r,allowList:[]}).then(()=>!0)}function lt(e){let t=H(e);return(e.dependencies||[]).forEach(r=>{let n=new RegExp(r,"g"),i=`{{${r}.itemId}}`;t.item=le(t.item,n,i),t.data=le(t.data,n,i),e.properties&&(t.properties=le(t.properties,n,i))}),t}function ut(e,t,o){let r=L(K,{success:!0}),n=[r({itemId:e.item.id,folderId:t,authentication:o})];return V(e,"item.properties.parentInitiativeId")&&n.push(r({itemId:e.item.properties.parentInitiativeId,folderId:t,authentication:o})),Promise.all(n)}function Xs(e,t,o=null){let r=0,n=0;return Promise.all([Ee(e.id,{authentication:t}),ne(t)]).then(([i,s])=>(r=i.item.created,n=i.item.modified,Kr(i,s))).then(i=>(i.item.created=r,i.item.modified=n,i.item.typeKeywords=Ve(i.item.typeKeywords,"doNotDelete"),i.groups=[],i.estimatedDeploymentCostFactor=2,i.resources=[],V(i,"properties")||(i.properties={}),i=lt(i),i))}function ea(e,t,o,r){if(!r(e.itemId,u.Started,0))return Promise.resolve(I(e.type));if(e.assets&&e.resources&&delete e.assets,t.solutionItemExtent){let c=t.solutionItemExtent.split(",");t.organization.defaultExtentBBox=[[c[0],c[1]],[c[2],c[3]]]}let i={},s,a,m=e.item.thumbnail;return ne(o,t).then(c=>(a=c,Hr(e,t,i,a))).then(c=>{let d=c,l={assets:d.assets||[]};return Gr(d,l,a)}).then(c=>(s=c,ut(c,t.folderId,o))).then(()=>{let c={item:{id:s.item.id},params:{thumbnail:m},authentication:o};return ee(c)}).then(()=>{if(t[e.itemId]={itemId:s.item.id},r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor||2,s.item.id)){let d={item:{...e,...te(s)},id:s.item.id,type:e.type,postProcess:!0};return d.item.itemId=s.item.id,d}else return L(jr,{success:!0})(s,a).then(()=>Promise.resolve(I(e.type)))}).catch(c=>{throw r(e.itemId,u.Failed,0),c})}function ta(e,t,o,r,n,i,s){let a;return ne(s).then(m=>(a=m,Ee(e,{authentication:s}))).then(m=>ii(m,o,i,a))}function oa(e){let t=!1;return(e==="Hub Page"||e==="Site Page")&&(t=!0),t}var Ae={};$(Ae,{convertItemToTemplate:()=>ra,createItemFromTemplate:()=>na,isASite:()=>sa,postProcess:()=>ia});function si(e,t,o){let r=t.filter(n=>n.type.indexOf("Page")>-1).map(n=>n.id);return Promise.all(r.map(n=>Ee(n,o))).then(n=>tn(e,n,o))}function ai(e,t,o,r){let n=t.filter(m=>m.id!==e.item.id),i=n.map(m=>({item:{id:m.id,type:m.type}})),s=[];s=s.concat(en(e,i,r)),s=s.concat(si(e,n,r));let a=n.map(m=>m.id);return e.item.properties.children=a,e=Qr(e,o,{}),s.push(qr(e,{...r,allowList:void 0})),Promise.all(s).then(()=>!0)}function ra(e,t,o=null){let r=0,n=0,i,s,a;return ne(t).then(m=>(a=m,bt(e.id,a))).then(m=>(r=m.item.created,n=m.item.modified,i=m.item.title,s=m.data.values.title,Xr(m,a))).then(m=>(m.item.created=r,m.item.modified=n,m.item.title=i,m.item.typeKeywords=Ve(m.item.typeKeywords,"doNotDelete"),m.data.values.title=s,m.groups=[],m.estimatedDeploymentCostFactor=2,m.resources=[],p(m,"properties")||(m.properties={}),m.dependencies=he(m.dependencies),m=lt(m),m))}function na(e,t,o,r){if(!r(e.itemId,u.Started,0))return Promise.resolve(I(e.type));e.assets&&e.resources&&delete e.assets,t.solution||(t.solution={}),t.solution.title=t.title;let i={},s,a,m=e.item.thumbnail;return ne(o,t).then(c=>(a=c,Yr(e,t,i,a))).then(c=>{let d={assets:c.assets||[]};return Zr(c,d,a)}).then(c=>(s=c,ut(c,t.folderId,o))).then(()=>{let c={item:{id:s.item.id},params:{thumbnail:m},authentication:o};return ee(c)}).then(()=>{if(t[e.itemId]={itemId:s.item.id},r(e.itemId,u.Finished,e.estimatedDeploymentCostFactor||2,s.item.id)){let d={item:{...e,...te(s)},id:s.item.id,type:e.type,postProcess:!0};return d.item.itemId=s.item.id,d}else return L(Jr,{success:!0})(s,a).then(()=>Promise.resolve(I(e.type)))}).catch(c=>{throw r(e.itemId,u.Failed,0),c})}function ia(e,t,o,r,n,i,s){let a;return ne(s,i).then(m=>(a=m,bt(e,a))).then(m=>ai(m,o,i,a)).then(()=>Promise.resolve(!0))}function sa(e){let t=!1;return(e==="Hub Site Application"||e==="Site Application")&&(t=!0),t}var ht={};$(ht,{convertItemToTemplate:()=>ca,createItemFromTemplate:()=>da,isAStoryMap:()=>pa});function mi(e={}){let t=0;return Object.keys(e).reduce((o,r)=>(V(e,`${r}.type`)==="webmap"&&r!==`webmap${t}`&&(o.push({original:r,updated:`webmap${t}`}),t++),o),[])}function ci(e){let t=V(e,"data.resources")||{};return Object.keys(t).reduce((o,r)=>(V(t,`${r}.type`)==="webmap"&&o.push(V(t,`${r}.data.itemId`)),o),[])}function pi(e){let t=Qe(e.item.id,e.item.type);t.key=`${je(e.item.title)}_${Be("i")}`;let o=H(e);t.data=o.data;let r=o.item.created,n=o.item.modified;return t.item=Ge(o.item),t.item.created=r,t.item.modified=n,t.item.url="{{storyMapTemplateUrl}}",mi(t.data.resources).forEach(a=>{t.data.resources[a.updated]=H(t.data.resources[a.original]),delete t.data.resources[a.original],t.data.nodes=le(t.data.nodes,a.original,a.updated)}),t.item.typeKeywords.indexOf(di)!==-1&&(t.item.typeKeywords=[aa].concat(t.item.typeKeywords.filter(a=>a!==di))),t.properties={},t.properties.draftFileName="draft_{{timestamp}}.json",Object.assign(t.properties,ma),t.dependencies=ci(e),Promise.resolve(t)}var di="smstatusunpublishedchanges",aa="smstatuspublished",ma={oembed:{version:"1.0",type:"rich",title:"Example StoryMap",url:"{{storyMapTemplateUrl}}",provider_name:"ArcGIS StoryMaps",provider_url:"{{storyMapBaseUrl}}",width:800,height:600,thumbnail_url:"{{storyMapThumbnailUrl}}",thumbnail_height:"100.5",thumbnail_width:"400",html:'<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',cache_age:86400},oembedXML:`<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
|
3
3
|
<oembed>
|
|
4
4
|
<version>1.0</version>
|
|
5
5
|
<type>rich</type>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{a as _}from"./
|
|
2
|
+
import{a as _}from"./XF5N3NI5.js";import"./UBPOT5V3.js";import"./ISFTCFSJ.js";import{b as f}from"./2I5LGZNX.js";import{E as l,F as n,G as m,I as d,J as b,h as c,i as a,q as p}from"./FFF5HUPM.js";import"./QPIMTXPL.js";var u=c`:host{display:block;--solutions-theme-foreground-color: var(--calcite-color-surface-2);width:100%}.width-full{width:100%}.height-full{height:100%}.display-flex{display:flex}.border-bottom-1{border-bottom-width:1px!important;border-width:0px}.border-bottom-2{border-bottom-width:2px!important;border-width:0px}.border-solid{border-style:solid;border-color:var(--calcite-color-border-3)}.border-left-right{border-left:1px solid var(--calcite-color-border-3);border-right:1px solid var(--calcite-color-border-3)}.action-bar-size{height:51px;width:100%}.map-list{display:flex;flex-direction:column;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-color-surface-1);z-index:1000}.display-none{display:none}.adjusted-height{max-height:calc(100% - 68px);overflow-y:auto}.position-absolute{position:absolute}.position-relative{position:relative}.popover-map-list{overflow:auto;width:250px}.max-width-200{max-width:200px}.min-width-150{min-width:150px}calcite-action-bar{--calcite-internal-action-bar-gap: 0px;--calcite-internal-action-bar-padding: 0px}`,h=class extends m{constructor(){super(),this.mapInfos=[],this.isMapLayout=!1,this.showMapListInPopover=!1,this.referenceElement="",this.selectedWebMapId="",this._mapListExpanded=!1,this._isValidWebMap=!0,this._translations=_({name:"map-picker",blocking:!0}),this._list=l(),this._loadedId="",this._skipEditCheck=!1,this._popover=l(),this._mapPickerButton=l(),this.beforeMapInfoChange=p(),this.mapInfoChange=p(),this.listenOn(window,"mapChanged",this.mapChanged)}static{this.properties={mapInfos:0,isMapLayout:5,height:9,showMapListInPopover:5,referenceElement:1,selectedWebMapId:1,_mapListExpanded:16,_isValidWebMap:16,_translations:16}}static{this.styles=u}willUpdate(t){t.has("mapInfos")&&this.hasUpdated&&this.mapInfosWatchHandler(this.mapInfos,t.get("mapInfos")),t.has("selectedWebMapId")&&this.hasUpdated&&this.selectedWebMapIdWatchHandler(this.selectedWebMapId)}_webMapInfoWatchHandler(t,e){t&&JSON.stringify(t)!==JSON.stringify(e)&&(this._loadedId=t?.id,this.mapInfoChange.emit(t))}async mapInfosWatchHandler(t,e){if(t&&JSON.stringify(t)!==JSON.stringify(e)){let i=this._getWebMapInfo();this._webMapSelected(i)}}async selectedWebMapIdWatchHandler(t){this._loadedId=t}async setMapByID(t,e=!1){this._skipEditCheck=e;let i=this.mapInfos?.filter(s=>s.id===t);t&&i?.length>0&&this._webMapSelected(i[0]),this._skipEditCheck=!1}async close(){this._mapListExpanded&&(this._mapListExpanded=!1)}async toggle(t){this._mapListExpanded=t}async mapChanged(t){let e=t.detail.isValid;this._isValidWebMap=e}render(){return a`${!this.showMapListInPopover&&this._getToolbar()||""}${this.showMapListInPopover?this._getMapListPopover():this._getMapNameList(this._mapListExpanded)}`}loaded(){let t=this._getWebMapInfo();t&&this._webMapSelected(t)}_getMapPicker(){let t="map-picker-expand-toggle",e=this._mapListExpanded?"chevron-up":"chevron-down",i=this.isMapLayout?"":"position-absolute",s=this.isMapLayout?"max-width-200":"width-full",r=this._isValidWebMap?"map":"exclamation-mark-triangle";return a`<div class=${d(s)}><calcite-button alignment=icon-end-space-between appearance=transparent class=${`width-full height-full ${i}`} .iconEnd=${e} .iconStart=${r} id=${t} kind=neutral @click=${()=>this._chooseMap()} width=full ${n(this._mapPickerButton)}>${this._getWebMapInfo().name}</calcite-button><calcite-tooltip placement=bottom .referenceElement=${t}><span>${this._translations.switchMap}</span></calcite-tooltip></div>`}_getToolbar(){let t=this.isMapLayout?"border-bottom-1":"border-bottom-2",e=this.isMapLayout?"":"position-relative";return a`<div class=${`display-flex border-left-right ${e}`}><calcite-action-bar class=${`border-solid action-bar-size overflow-hidden ${t}`} expand-disabled layout=horizontal slot=header>${this._getMapPicker()}${this._updateMapPickerIconColor()}</calcite-action-bar></div>`}_updateMapPickerIconColor(){this._mapPickerButton.value?.componentOnReady().then(()=>{let t=this._mapPickerButton.value?.shadowRoot?.lastChild,e=null;if(t&&t instanceof HTMLElement){let i=t.getElementsByClassName("icon icon--start");i.length>0&&(e=i[0])}e&&(this._isValidWebMap?e.style.setProperty("color","var(--calcite-color-text-1)"):e.style.setProperty("color","var(--calcite-color-status-danger)"))})}_getMapNameList(t){let e=this.showMapListInPopover?"position-relative":"position-absolute",i=this.isMapLayout?"max-width-200 min-width-150":"width-full",s=this.isMapLayout?"border-bottom-1":"border-bottom-2",r=t?`map-list border-solid ${s} adjusted-height ${i} ${e}`:"display-none";return a`<div class=${d(r)}><calcite-list id=mapList .label=${this._translations.mapList} selection-appearance=border selection-mode=single-persist ${n(this._list)}>${this.mapInfos.map(o=>a`<calcite-list-item .label=${o.name} @click=${()=>this._webMapSelected(o)} .selected=${o.id===this._loadedId} .value=${o.id}></calcite-list-item>`)}</calcite-list></div>`}_getMapListPopover(){let t=this.height&&this.height>0&&this.showMapListInPopover?{"max-height":`${this.height.toString()}px`}:{};return a`<calcite-popover auto-close .label=${this._translations.mapList} placement=left .referenceElement=${this.referenceElement} ${n(this._popover)}><div style=${b(t)} class=popover-map-list>${this._getMapNameList(!0)}</div></calcite-popover>`}_getWebMapInfo(){let t=this.mapInfos.find(e=>this.selectedWebMapId===e.id);if(!t&&this.mapInfos.length>0&&(t=this.mapInfos[0]),!t)throw new Error("No valid web map info available");return t}_webMapSelected(t){let e=this._loadedId;this._loadedId=t.id;let i=!1;this._skipEditCheck?i=!0:this.beforeMapInfoChange.emit({currentId:e,mapInfo:t,ref:this.el}).defaultPrevented||(i=!0),i&&(this._webMapInfoWatchHandler(t,this._webMapInfo),this._webMapInfo=t),this._popover.value&&(this._popover.value.open=!1),this._mapListExpanded=!1}_chooseMap(){this._mapListExpanded=!this._mapListExpanded}};f("map-picker",h);export{h as MapPicker};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{b as o}from"./HVT2WBVC.js";import{E as r,F as l,G as i,h as s,i as e}from"./FFF5HUPM.js";import"./QPIMTXPL.js";var h=s`:host{display:block}calcite-input-message{margin-bottom:var(--calcite-space-lg)}`,a=class extends i{constructor(){super(...arguments),this.#e=r(),this.disabled=!1,this.showErrorMessage=!1}static{this.properties={selectedValue:3,disabled:7,labels:0,showErrorMessage:5}}static{this.styles=h}#e;get _radioButtonData(){return[{label:this.labels.selectFeature,value:"select-feature"},{label:this.labels.drawGraphic,value:"draw-graphic"},{label:this.labels.searchLocation,value:"search-location"}]}async setFocus(){await this.#e?.value?.setFocus({focusVisible:!0})}_renderErrorMessage(){return this.showErrorMessage?e`<calcite-input-message icon=exclamation-mark-triangle status=invalid><span>${this.labels.errorMessage}</span></calcite-input-message>`:null}render(){let c=this.labels.title,u=this.labels.groupName;return e`<calcite-label>${c}</calcite-label><calcite-radio-button-group .name=${u} .disabled=${this.disabled} layout=vertical ${l(this.#e)}>${this._radioButtonData.map(({label:n,value:t})=>e`<calcite-radio-button .value=${t} .labelText=${n} .checked=${this.selectedValue===t}></calcite-radio-button>`)}</calcite-radio-button-group>${this._renderErrorMessage()}`}};o("instant-apps-buffer-input-radiogroup",a);export{a as InstantAppsBufferInputRadiogroup};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{a as v}from"./CJ3EZE7U.js";import"./C5KDPY7R.js";import"./YM4U4HSN.js";import{a as h}from"./IADXB53D.js";import{a as g}from"./BM4VSEDV.js";import{b as p}from"./HVT2WBVC.js";import"./UBPOT5V3.js";import"./ISFTCFSJ.js";import{G as o,I as d,J as l,K as c,h as s,i as t,q as r}from"./FFF5HUPM.js";import"./QPIMTXPL.js";var _=s`:host{display:block;--instant-apps-interactive-legend-heading-font-size: 1rem;--instant-apps-interactive-legend-heading-font-weight: normal;--instant-apps-interactive-legend-secondary-color: var( --calcite-color-text-1 );--instant-apps-interactive-legend-ui-padding: 15px 10px}:host .esri-widget__heading{overflow:hidden}:host .esri-widget__heading{margin:0;overflow-x:hidden}:host .esri-widget__heading{display:inline-block;font-size:var(--instant-apps-interactive-legend-heading-font-size)}:host .esri-widget__heading{font-weight:var(--instant-apps-interactive-legend-heading-font-weight)}:host header{display:flex;text-align:left;padding:var(--instant-apps-interactive-legend-ui-padding);background-color:var(--instant-apps-interactive-legend-secondary-background-color);color:var(--instant-apps-interactive-legend-secondary-color)}:host header h3{margin-bottom:0;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;line-height:normal;color:var(--instant-apps-interactive-legend-secondary-color)}:host header .instant-apps-interactive-legend__heading-text--group-item{-webkit-line-clamp:2;line-clamp:2}:host header span{width:100%;font-size:var(--instant-apps-interactive-legend-total-feature-count-font-size);color:var(--instant-apps-interactive-legend-secondary-color)}:host header .instant-apps-interactive-legend__header-action-container{display:flex;align-items:center}:host .esri-widget__heading header{padding:var(--instant-apps-interactive-legend-ui-padding)}:host .esri-widget--panel{margin:0}:host(.calcite-mode-dark) .instant-apps-interactive-legend__header{background-color:#242424;color:var(--calcite-color-text-1)}:host(.calcite-mode-light) .instant-apps-interactive-legend__header{background-color:#fff;color:var(--calcite-color-text-1)}`,e={label:"esri-legend__service-label",header:"esri-widget__heading",interactiveLegendHeader:"instant-apps-interactive-legend__header",headerActionContainer:"instant-apps-interactive-legend__header-action-container"},a=class extends o{constructor(){super(...arguments),this._messages=g({name:"instant-apps-interactive-legend",blocking:!0}),this.isChild=!1,this.expanded=!0,this.groupLayerCaptionElementExpandUpdated=r()}static{this.properties={legendvm:0,featureCount:5,activeLayerInfo:0,isChild:5,expanded:5}}static{this.styles=_}toggleExpanded(){return()=>{this.expanded=!this.expanded,this.groupLayerCaptionElementExpandUpdated.emit(this.expanded)}}render(){let m=v(this.activeLayerInfo),{expanded:n}=this,i=n?this._messages.collapse:this._messages.expand,f=this.isChild?" instant-apps-interactive-legend__heading-text--group-item":"";return t`<header class=${`${e.interactiveLegendHeader} ${h(this.el)}`} style=${l({borderLeft:"1px solid var(--calcite-color-border-3)"})}><span><span class=${d(e.headerActionContainer)}><calcite-action @click=${this.toggleExpanded()} .icon=${n?"chevron-down":"chevron-up"} appearance=transparent .text=${i} .label=${i} scale=s></calcite-action><h3 class=${`${e.header} ${e.label}${f}`} title=${this.activeLayerInfo?.title??""??c}>${this.activeLayerInfo?.title}</h3></span>${this.featureCount&&m?t`<instant-apps-interactive-legend-count .activeLayerInfo=${this.activeLayerInfo} show-total .legendvm=${this.legendvm}></instant-apps-interactive-legend-count>`:null}</span></header>`}};p("instant-apps-interactive-legend-group-legend-element-caption",a);export{a as InstantAppsInteractiveLegendGroupLegendElementCaption};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import d from"./KGUELU4O.js";import{c as N}from"./TCUNTTNI.js";import c from"./7JC52SFZ.js";import a from"./4AFANEZZ.js";import{f as R}from"./YM4U4HSN.js";import{a as F}from"./ONARC6AZ.js";import{a as E}from"./BM4VSEDV.js";import{b as D}from"./HVT2WBVC.js";import"./UBPOT5V3.js";import"./ISFTCFSJ.js";import{F as b,G as $,I as H,h as w,i as y,t as I}from"./FFF5HUPM.js";import"./QPIMTXPL.js";export default $arcgis.t(([q,B,k,,{a:m},L])=>{var V=new Map([["HH",[1,0,3,2,null]],["LH",[3,2,1,0,4,null]],["LL",[2,3,0,1,null]]]),G=new Map([["HH",[2,1,0,5,4,3,8,7,6]],["LH",[8,7,6,5,4,3,2,1,0]],["LL",[6,7,8,3,void 0,void 0,0,1,2]]]),J=new Map([["HH",[3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12]],["LH",[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0]],["LL",[12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3]]]);function K(c,e){return e===null?V.get("HH")[c]:V.get(e)?.[c]??null}function Q(c,e){return e===null?c:G.get(e)?.[c]??c}function _(c,e){return e===null?_(c,"HH"):J.get(e)?.[c]??null}var U=w`@layer{instant-apps-interactive-legend-relationship{display:block}instant-apps-interactive-legend-relationship .instant-apps-interactive-legend-relationship__instructional-text{display:inline-block;width:100%;text-align:center;margin-bottom:10px;background-color:#d2e9f9}.calcite-mode-dark instant-apps-interactive-legend-relationship .instant-apps-interactive-legend-relationship__instructional-text{background-color:var(--calcite-color-brand);color:#151515}}`,M="svg g:first-of-type",W="svg g:last-of-type",h="esri-interactive-legend--selected-cell",S="esri-interactive-legend--instructional-text",j=2,O=3,X=4,Y=Object.freeze({0:"L",1:"H"}),Z=Object.freeze({0:"L",1:"M",2:"H"}),ee=Object.freeze({0:"L",1:"M1",2:"M2",3:"H"}),te={instructionalText:"instant-apps-interactive-legend-relationship__instructional-text"},x=class extends ${constructor(){super(),this._messages=E({name:"instant-apps-interactive-legend"}),this.cellNodeCounter=0,this.listenOn(window,"showAllSelected",this.showAllSelectedEmitted)}static{this.properties={filterMode:0,activeLayerInfo:0,legendElement:0}}static{this.styles=U}static{this.shadowRootOptions=I}get shouldApplyCustomFunctionality(){return!!(this.relationshipRamp&&this.activeLayerInfo&&this.legendElement&&m.data)}showAllSelectedEmitted(){let e=m.data[this.activeLayerInfo.layer.id].queryExpressions.length===0,t=this.relationshipRamp.querySelector(M);if(!t)return;let s=Array.from(t.children);e&&s?.forEach(i=>{i.removeAttribute("stroke"),i.removeAttribute("stroke-width"),i.removeAttribute("stroke-opacity"),i.setAttribute("aria-pressed","false"),i.classList.remove(h)})}applyRelationshipRampSvgAriaAttributes(){if(this.shouldApplyCustomFunctionality){let e=setInterval(()=>{let t=this.relationshipRamp.querySelector("svg");t&&(clearInterval(e),t.setAttribute("role","group"),t.setAttribute("aria-labelledby",S),t.removeAttribute("focusable"));let s=this.relationshipRamp.querySelector(W);s&&(clearInterval(e),s.setAttribute("aria-hidden","true"))},10)}}applyRelationshipRampInteractivity(){if(this.shouldApplyCustomFunctionality){let e=setInterval(()=>{let t=this.relationshipRamp.querySelector(M);if(t){clearInterval(e);let s=t.children;this.setupRelationshipDrawingStyle(s)}},10)}}setupRelationshipDrawingStyle(e){let t=Array.from(e);if(!t.length)return;let s=(this.activeLayerInfo?.layer?.renderer).uniqueValueInfos;if(Array.isArray(s))for(let a of s){let n=s.indexOf(a),l=t[n];this.setCellAttributes(l,n),l.classList.add("esri-interactive-legend__svg-rect-element")}let i=this.reorderCellNodes(t);this.attachFeatureIndexes(i),this.applyEventHandlers()}setCellAttributes(e,t){let s=this.activeLayerInfo.layer.renderer.uniqueValueInfos,i=this.generateIndexPattern(t);if(Array.isArray(s)&&s[i]){let a=e.classList.contains(h)?"true":"false",n=s[i]?.label||"",l=s[i]?.symbol?.color?.toHex?.()||"";e.setAttribute("data-color",l),e.setAttribute("data-cell-index",`${i}`),e.setAttribute("tabindex","0"),e.setAttribute("aria-pressed",a),e.setAttribute("aria-label",n),e.setAttribute("role","button")}}generateIndexPattern(e){let{focus:t,numClasses:s}=this.legendElement;return t==="HL"?e:s===2?K(e,t):s===3?Q(e,t):s===4?_(e,t):null}reorderCellNodes(e){let t=[];for(;this.cellNodeCounter<=e.length-1;)e.map(s=>{Number.parseInt(s.getAttribute("data-cell-index"))===this.cellNodeCounter&&t.push(s)}),this.cellNodeCounter++;return this.cellNodeCounter=0,t}attachFeatureIndexes(e){let{focus:t,numClasses:s}=this.legendElement;t==="HH"||t===null?this.relationshipFocusIsHighHigh(e,s):t==="LL"?this.relationshipFocusIsLowLow(e,s):t==="LH"?this.relationshipFocusIsLowHigh(e,s):t==="HL"&&this.relationshipFocusIsHighLow(e,s),this.cellNodeCounter=0}relationshipFocusIsHighHigh(e,t){for(let s=t-1;s>=0;s--)for(let i=t-1;i>=0;i--)this.setDataAttributes(e,s,i,t),this.cellNodeCounter++}relationshipFocusIsLowLow(e,t){for(let s=0;s<t;s++)for(let i=0;i<t;i++)this.setDataAttributes(e,s,i,t),this.cellNodeCounter++}relationshipFocusIsLowHigh(e,t){for(let s=0;s<t;s++)for(let i=t-1;i>=0;i--)this.setDataAttributes(e,s,i,t),this.cellNodeCounter++}relationshipFocusIsHighLow(e,t){for(let s=t-1;s>=0;s--)for(let i=0;i<t;i++)this.setDataAttributes(e,i,s,t),this.cellNodeCounter++}setDataAttributes(e,t,s,i){let a=e[this.cellNodeCounter];i===j?this.twoClassAttributes(a,t,s):i===O?this.threeClassAttributes(a,t,s):this.fourClassAttributes(a,t,s)}twoClassAttributes(e,t,s){let{legendElement:i}=this;this.cellNodeCounter===0||this.cellNodeCounter===3?i.focus==="HL"?this.swapDataFeatureIndexes(e,t,s):this.setDataFeatureIndexes(e,t,s):i.focus==="HL"?this.swapDataFeatureIndexes(e,t,s):this.setDataFeatureIndexes(e,t,s)}threeClassAttributes(e,t,s){let{legendElement:i}=this;this.cellNodeCounter===1||this.cellNodeCounter===3||this.cellNodeCounter===5||this.cellNodeCounter===7?i.focus==="HL"?this.swapDataFeatureIndexes(e,t,s):this.setDataFeatureIndexes(e,t,s):i.focus!=="HL"?this.setDataFeatureIndexes(e,t,s):this.swapDataFeatureIndexes(e,t,s)}fourClassAttributes(e,t,s){let{legendElement:i}=this,{focus:a}=i;this.cellNodeCounter>0&&this.cellNodeCounter<=14?a==="HL"?this.swapDataFeatureIndexes(e,t,s):this.setDataFeatureIndexes(e,t,s):a!=="HL"?this.setDataFeatureIndexes(e,t,s):this.swapDataFeatureIndexes(e,t,s)}setDataFeatureIndexes(e,t,s){e.setAttribute("data-feature-i",`${t}`),e.setAttribute("data-feature-j",`${s}`),this.setDataCellFocusValue(e,t,s)}swapDataFeatureIndexes(e,t,s){e.setAttribute("data-feature-i",`${s}`),e.setAttribute("data-feature-j",`${t}`),this.setDataCellFocusValue(e,s,t)}getDataCellValue(e,t,s){let i=s[e],a=s[t];return i&&a?`${i}${a}`:""}getDataCellMap(e){switch(e){case j:return Y;case O:return Z;case X:return ee;default:throw new Error("unrecognized numClasses")}}setDataCellFocusValue(e,t,s){let i=this.legendElement.numClasses,a=this.getDataCellMap(i),n=this.getDataCellValue(t,s,a);n?e.setAttribute("data-cell-focus",n):e.removeAttribute("data-cell-focus")}async onCellClick(e,t){let{i:s,j:i,focus:a}=t;await this.handleFilter(s,i,a),this.handleSelectedElement(e)}applyEventHandlers(){let e=this.relationshipRamp.querySelectorAll("svg rect");Array.from(e).forEach(t=>{let s=t.getAttribute("data-feature-i"),i=t.getAttribute("data-feature-j"),a=t.getAttribute("data-cell-focus");t.onclick=async()=>{await this.onCellClick(t,{i:s,j:i,focus:a})},t.onkeydown=async n=>{n.key==="Enter"&&await this.onCellClick(t,{i:s,j:i,focus:a})},t.onkeyup=async n=>{n.key===" "&&await this.onCellClick(t,{i:s,j:i,focus:a})}})}async handleFilter(e,t,s){let i=this.activeLayerInfo.layer?.renderer?.authoringInfo,a=i?.field1,n=i?.field2,{queryExpressions:l,fLayerView:o}=m.data[this.activeLayerInfo.layer.id];if(R(this.legendElement)&&i&&a&&n){let u=this.generateExpressionParams(a,n,i,e,t,s),r=this.generateExpressionForRelationship(u);l.length===0?l[0]=r:l.includes(r)?l.splice(l.indexOf(r),1):l.push(r);let d=l.join(" OR "),p=o?.filter?.timeExtent??null;if(N(this.filterMode?.type))o.filter=new k({where:d,timeExtent:o?.filter?.timeExtent??null});else if(this.filterMode?.effect){let{includedEffect:f,excludedEffect:A}=this.filterMode.effect,g=await L(A,o,"excludedEffect"),v=await L(f,o,"includedEffect");o.featureEffect=new B({filter:new k({where:d,timeExtent:p}),includedEffect:v,excludedEffect:g})}}}generateExpressionParams(e,t,s,i,a,n){let l=[],o=e.field,u=t.field,r=e.classBreakInfos,d=t.classBreakInfos,p=Object.hasOwn(s.field1,"normalizationField")?s?.field1?.normalizationField:null,f=Object.hasOwn(s.field2,"normalizationField")?s?.field2?.normalizationField:null;r.forEach((v,z)=>{let C=[];d.forEach((se,T)=>{let P=[r[z],d[T]];C.push(P)}),l.push(C)});let A=p?`(${o}/${p})`:o,g=f?`(${u}/${f})`:u;return{data:l,i,j:a,field1:A,field2:g,focus:n}}generateExpressionForRelationship(e){let{focus:t,field1:s,field2:i,data:a,i:n,j:l}=e,o=Number.parseInt(n),u=Number.parseInt(l),r=a[o][u];return t==="LL"?`${s} >= ${r[0].minValue} AND ${s} <= ${r[0].maxValue} AND ${i} >= ${r[1].minValue} AND ${i} <= ${r[1].maxValue}`:t==="LM"||t==="LM1"||t==="LM2"||t==="LH"?`${s} >= ${r[0].minValue} AND ${s} <= ${r[0].maxValue} AND ${i} > ${r[1].minValue} AND ${i} <= ${r[1].maxValue}`:t==="ML"||t==="M1L"||t==="M2L"||t==="HL"?`${s} > ${r[0].minValue} AND ${s} <= ${r[0].maxValue} AND ${i} >= ${r[1].minValue} AND ${i} <= ${r[1].maxValue}`:`${s} > ${r[0].minValue} AND ${s} <= ${r[0].maxValue} AND ${i} > ${r[1].minValue} AND ${i} <= ${r[1].maxValue}`}handleSelectedElement(e){e.classList.contains(h)?(e.removeAttribute("stroke"),e.removeAttribute("stroke-width"),e.removeAttribute("stroke-opacity"),e.setAttribute("aria-pressed","false"),e.classList.remove(h)):(e.classList.add(h),e.setAttribute("stroke","black"),e.setAttribute("stroke-width","3px"),e.setAttribute("stroke-opacity","1"),e.setAttribute("aria-pressed","true"))}addCSS(e){if(e&&!e?.querySelector("relationshipStyles")){let t=document.createElement("style");t.id="relationshipStyles",t.innerHTML=`
|
|
3
|
+
rect:hover {
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
opacity: 0.8;
|
|
6
|
+
}
|
|
7
|
+
`,e?.appendChild(t)}}setRelationshipRampRef(e){e&&(this.relationshipRamp=e,this.applyRelationshipRampInteractivity(),this.applyRelationshipRampSvgAriaAttributes())}render(){return y`<div ${b(this.addCSS)}><span id=${S} class=${H(te.instructionalText)}>${this._messages?.relationship?.instructionalText}</span>${this.renderRelationshipRamp()}</div>`}renderRelationshipRamp(){let e=(this.activeLayerInfo?.layer).renderer,t=q.renderRelationshipRampPreviewHTML(e)?.outerHTML;return F("relationship-ramp-diamond",y`<div .innerHTML=${t??""} ${b(this.setRelationshipRampRef)}></div>`)}};D("instant-apps-interactive-legend-relationship",x);return x},"symbols/support/symbolUtils","layers/support/FeatureEffect","layers/support/FeatureFilter",a,c,d)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import"./QPIMTXPL.js";var e='# Your Role\r\nYou are a solution designer for the ArcGIS Solutions assistant. Your job is to update an existing solution design based on the User Query by producing a minimal set of RFC 6902\u2013compliant JSON Patch operations.\r\n\r\nYou must follow all rules below at all times. If a request conflicts with these rules, prioritize the rules and adapt the design accordingly.\r\n\r\n# Your Task\r\n- Analyze the User Query, Current Solution Design, and chat history\r\n- Produce the fewest possible JSON Patch operations required to satisfy the request\r\n- Never modify, remove, or replace sections unrelated to the request\r\n- Use chat history to reconstruct prior changes when needed and as context for the current requested change\r\n\r\n# Response Guidelines\r\n- Populate `response` with a concise explanation of exactly what you changed\r\n- Refer to yourself as \u201CI\u201D or \u201Cwe\u201D.\r\n- If the request violates any rule below:\r\n - Politely decline in `response`\r\n - Return an empty `patches` array\r\n- Do not partially fulfill a request if any part of it violates the rules\r\n- The `response` must describe changes using UI-visible concepts only.\r\n- NEVER refer to internal JSON property names, schema terms, or implementation details in `response`.\r\n - This includes (but is not limited to): `choiceList`, `type`, `length`, `id`, `_idx`, `featureLayer`, `layers`, `customFields`.\r\n- When explaining changes:\r\n - Use UI terms such as \u201Cfield\u201D, \u201Coptions\u201D, \u201Callowed values\u201D, "domain", \u201Cchoice list\u201D, \u201Cname\u201D, or \u201Cdescription\u201D.\r\n- Always refer to custom fields as just fields. Do NOT include the word custom\r\n\r\n# Language and Localization Rules\r\n- Detect the primary language of the User Query\r\n- Use that language consistently for all user-facing strings unless explicitly prohibited\r\n\r\n# JSON Patch Rules\r\n\r\n## Array Indexing with `_idx`\r\n- Every array element includes a read-only `_idx`\r\n- Always use `_idx` values in patch paths\r\n- Never calculate array positions manually\r\n- Never include `_idx` itself in any patch path or value\r\n- When removing multiple elements from the same array, order those `remove` operations from highest `_idx` to lowest. This prevents index-shifting from making later removals target the wrong element.\r\n\r\n## Patch Minimization\r\n- Prefer updating the most specific path possible\r\n- Do not replace an entire object when a child property can be updated\r\n- Do not combine unrelated changes into a single operation\r\n\r\n## Encoding the `value` Field\r\n- The `value` field must always be a JSON-encoded string (as if passed to `JSON.stringify`).\r\n- `remove` operations must not include a `value`\r\n\r\nExamples:\r\n- Replace the alias of a custom field whose `_idx` is `2` in layer `_idx: 0` of the feature layer:\r\n `{{ "op": "replace", "path": "/featureLayer/layers/0/customFields/2/alias", "value": "\\"New Alias\\"" }}`\r\n- Append a new custom field to layer `_idx: 1` of the feature layer:\r\n `{{ "op": "add", "path": "/featureLayer/layers/1/customFields/-", "value": "{{\\"name\\":\\"my_field\\",\\"type\\":\\"string\\",\\"alias\\":\\"My Field\\",\\"description\\":\\"...\\",\\"choiceList\\":null,\\"length\\":255}}" }}`\r\n- Remove a custom field whose `_idx` is `3`:\r\n `{{ "op": "remove", "path": "/featureLayer/layers/0/customFields/3" }}`\r\n- Update the solution title:\r\n `{{ "op": "replace", "path": "/solution/title", "value": "\\"Updated Title\\"" }}`\r\n- Update tags:\r\n `{{ "op": "replace", "path": "/solution/tags", "value": "[\\"tag1\\",\\"tag2\\",\\"tag3\\"]" }}`\r\n- Update an item description (item `_idx: 1`):\r\n `{{ "op": "replace", "path": "/items/1/description", "value": "\\"New description.\\"" }}`\r\n\r\nDo NOT include `_idx` itself in any patch operation path or value\r\n\r\n# Design Rules\r\n\r\n## Solution\r\n- Only `title`, `description`, and `tags` may be updated\r\n- Only modify values. Do not add or remove properties\r\n\r\n## Strings\r\n- Only `value` may be updated\r\n- `key` and `description` are immutable\r\n- Always return the same number of strings\r\n\r\n## Items\r\n- Only `title` and `description` may be updated\r\n- `id` and `type` are immutable\r\n- Items cannot be added or removed\r\n\r\n## Feature Layers\r\n- Supported layer types: `Point`, `Polyline`, `Polygon`, `Table`\r\n\r\n### Layer Naming Rules\r\n- Layer `name` values should be written in Title Case unless specifically requested otherwise\r\n- Layer names should be localized to the detected User Query language unless specifically requested otherwise\r\n\r\n### Add Layers Rule\r\n- If `addLayers: false`:\r\n - Layers can NOT be added or removed\r\n - Layer `id` values are immutable\r\n- If `addLayers: true`:\r\n - Layers may be added or removed\r\n - Each new layer must receive a unique `id` starting at 0\r\n- Regardless of `addLayers`:\r\n - Fields within a layer or table may be modified according to the Required Fields and Custom Fields rules.\r\n - Custom fields may be added or removed when explicitly requested.\r\n\r\n### Layer Type Mutability Rule\r\n- Never edit the `typeMutable` property\r\n- If `typeMutable: true`:\r\n - The layer type must be chosen: `Point`, `Polyline`, `Polygon`, `Table`\r\n - The layer type may be changed without restriction\r\n- If `typeMutable: false`:\r\n - The layer type may never be changed\r\n - Requests to change the layer type should be rejected\r\n\r\n### Required Fields\r\n- Required fields are protected:\r\n - Cannot be removed\r\n - Cannot be moved\r\n - `name`, `type`, and `choiceList` are immutable\r\n- Only `alias` and `description` may be updated if explicitly requested\r\n\r\n### Custom Fields\r\n- Custom fields may be added, modified, or removed\r\n- Field names:\r\n - lowercase in the detected User Query language when that language has letter case\r\n - contain letters from any writing system (Unicode letters are allowed, e.g., `\xE4`, `\xF1`, `\u540D`, `\u3042`)\r\n - do not contain special characters other than underscores (`_`)\r\n - do not start with a number or underscore\r\n- Localize the field `name` to the detected User Query language\r\n- Valid types: `string`, `integer`, `double`, `date`\r\n- String fields:\r\n - Set `choiceList` to an array of allowed values if applicable, else `null`\r\n - All`choiceList` values should be written in the detected User Query language unless specifically requested otherwise\r\n - Set an appropriate `length`. When setting a default length use 256 instead of 255.\r\n- Non-string fields:\r\n - `choiceList: null`\r\n - `length: null`\r\n- Boolean values must be implemented as:\r\n - `string` with a two-value `choiceList`\r\n - The two values should be localized to the detected User Query language unless specifically requested otherwise\r\n - Preserve meaning equivalent to \u201CYes\u201D and \u201CNo\u201D (affirmative/negative)\r\n- No duplicate field names within the same layer\r\n\r\n# Current Solution Design\r\n{currentDesign}\r\n\r\n# User Query\r\n{query}';export{e as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import d from"./
|
|
2
|
+
import d from"./C76SZF3J.js";import c from"./IZ7DJL5P.js";import"./ONARC6AZ.js";import"./7VD3Y4IF.js";import b from"./FS5WR74E.js";import a from"./UBEU6ULP.js";import"./2B4SGB3I.js";import"./I2NTSKBD.js";import"./AE5HNAOV.js";import"./XF5N3NI5.js";import"./UBPOT5V3.js";import"./ISFTCFSJ.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import"./2I5LGZNX.js";import"./FFF5HUPM.js";import"./QPIMTXPL.js";export default $arcgis.t(([,,,a])=>{return a},a,b,c,d)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{b as r}from"./
|
|
2
|
+
import{b as r}from"./HVT2WBVC.js";import{G as i,h as a,i as p}from"./FFF5HUPM.js";import"./QPIMTXPL.js";export default $arcgis.t(([l])=>{var d=a`:host{display:block}`,m="floating",h="instant-apps-control-panel",x="border-bottom: 1px solid var(--calcite-color-border-3)",s=class extends i{constructor(){super(...arguments),this.components=[]}static{this.properties={components:0,view:0}}static{this.styles=d}async load(){await this._handleComponents()}async _handleComponents(){let t=this._getComponentsNode();t&&(this._resetUI(t),this._attachComponents(t))}_attachComponents(t){this.components.forEach(this._attachmentComponent(t))}_attachmentComponent(t){return(o,e)=>{let n=o.content;o.isExpand&&(n=this._getExpand(o),o.expandIcon&&(n.expandIcon=o.expandIcon),o.collapseTooltip&&(n.collapseTooltip=o.collapseTooltip),o.expandTooltip&&(n.expandTooltip=o.expandTooltip)),n.container||(n.container=document.createElement("div")),t?.appendChild(n.container),e!==this.components.length-1&&(n.container.style=x)}}_getExpand(t){let{view:o}=this,{content:e,focusTrapDisabled:n}=t,c=t?.expanded??!1;return new l({content:e,view:o,expanded:c,mode:m,group:h,focusTrapDisabled:!!n})}_getComponentsNode(){return this.el.querySelector('[slot="components"]')}_resetUI(t){if(t.children.length>0)for(;t.firstChild;)t.removeChild(t.firstChild)}render(){return p`<slot name=components></slot>`}};r("instant-apps-control-panel",s);return s},"widgets/Expand")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import i from"./QU25YPPX.js";import{a as L}from"./4MAZNAHZ.js";import h from"./LGZDNUGT.js";import e from"./UBEU6ULP.js";import d from"./2C4DK6YC.js";import a from"./WV7QX3ED.js";import{a as O}from"./MGEDATQ7.js";import{b as S}from"./2I5LGZNX.js";import{E as b,F as g,G as x,I as y,h as E,i as o,l as f,q as c,t as F}from"./FFF5HUPM.js";export default $arcgis.t(([M,p,R,v,{c:A},{c:H,d:w,j:I},{n:C},{i:m},{b:$}])=>{var V=E`@layer{:host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.display-none{display:none}.table-border{border:1px solid var(--calcite-color-border-2)}.border-end{border-inline-end:1px solid var(--calcite-color-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51-px{height:51px}.height-50-px{height:50px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir=rtl] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-color-surface-1)}.text-color{color:var(--calcite-color-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-color-status-danger)}.esri-feature-table vaadin-grid{border:none!important}vaadin-grid-cell-content{font-size:14px!important;color:var(--calcite-color-text-3)!important}.absolute-right{position:absolute;right:0;left:unset}html[dir=rtl] .absolute-right{left:0;right:unset}.disabled{cursor:default!important;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.actions-end{height:50px!important;display:inline-flex}.border-top{border-top:1px solid var(--calcite-color-border-2)}.modal{--calcite-dialog-content-space: 0}.esri-feature-table__table-container{height:100%}.search-container{background-color:var(--calcite-color-surface-2)!important}.search{--calcite-color-border-input: var(--calcite-color-border-3);width:60%;padding:10px}.delete-red{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-color-text-1: var(--calcite-color-status-danger);--calcite-color-text-3: var(--calcite-color-status-danger)}.label-override{white-space:nowrap}.padding-start-1-4{padding-inline-start:.5rem}.panel-header-override{--calcite-panel-header-content-space: 0px}.danger-label-color{color:var(--calcite-color-status-danger)}.danger-icon-color{--calcite-icon-color: var(--calcite-color-status-danger)}.width-51{width:51px}.height-51{height:51px}calcite-action-bar{--calcite-internal-action-bar-gap: 0px;--calcite-internal-action-bar-padding: 0px}}`,T=class extends x{constructor(){super(),this.defaultGlobalId=[],this.defaultLayerId="",this.defaultOid=[],this.enableAutoRefresh=!1,this.enableColumnReorder=!0,this.enableCSV=!1,this.enableInlineEdit=!1,this.enableShare=!1,this.enableTableAutosave=!0,this.featureSelectionMode="multiple",this.selectedRelatedIds=[],this.honorMapFieldSettings=!1,this.isMobile=!1,this.mapHidden=!1,this.showOnlyUpdatableLayers=!1,this.selectedIds=[],this.shareIncludeEmbed=!1,this.shareIncludeSocial=!1,this.showNewestFirst=!1,this.zoomAndScrollToSelected=!1,this.pasteEnabled=!1,this.showCopyPasteActions=!1,this.layerIds=[],this._allIds=[],this._configLayerOrderDefined=!1,this._csvExporting=!1,this._fetchingData=!1,this._hideTable=!1,this._filterActive=!1,this._selectAllActive=!1,this._showHideOpen=!1,this._showOnlySelected=!1,this._toolInfos=[],this._translations=O({name:"layer-table",blocking:!0}),this._fullTextSearchInfo=[],this._searchPlaceHolder="",this._size=0,this._queryingData=!1,this._editEnabled=!1,this._enabledLayerIds=[],this._defaultGlobalIdHonored=!1,this._defaultOidHonored=!1,this._deleteEnabled=!1,this._floorExpression="",this._floorField="",this._floorLevel="",this._loaded=!1,this._shareNode=b(),this._toolbar=b(),this._searchExpression="",this._skipEditCheck=!1,this._tempSelectedIds=[],this._outOFExtentOids=[],this._shouldUpdateTableOnExtentChange=!0,this._creatingFeature=!1,this._searchNode=b(),this._layerEditsHandles=[],this._pastedFeaturesIds=[],this._shouldSelectCreatedFeatures=!1,this.columnReorder=c(),this.featureSelectionChange=c(),this.toggleFilter=c(),this.showDelete=c(),this.relatedRecordToggled=c(),this.editMultipleFeatures=c(),this.copyFeatures=c(),this.pasteFeatures=c(),this.featuresAdded=c(),this.initCreateComponent=c(),this.requestLayerSelectionChange=c(),this.listenOn(window,"beforeMapInfoChange",this.beforeMapInfoChange,{capture:!0}),this.listenOn(window,"editorInitialized",this.editorInitialized),this.listenOn(window,"closeEdit",this.closeEdit),this.listenOn(window,"selectionChanged",this.selectionChanged),this.listenOn(window,"beforeLayerSelectionChange",this.beforeLayerSelectionChange),this.listenOn(window,"layerSelectionChange",this.layerSelectionChange),this.listenOn(window,"editsComplete",this.editsComplete),this.listenOn(window,"facilityChanged",this.facilityChanged),this.listenOn(window,"levelChanged",this.levelChanged),this.listenOn(window,"siteChanged",this.siteChanged),this.listenOn(window,"noLayersFound",this.noLayersFound),this.listenOn(window,"clearSelection",this.clearSelection),this.listenOn(window,"mapChanged",this.mapChanged),this.listenOn(window,"featuresSelected",this.featuresSelected),this.listenOn(window,"createWorkFlowStarted",this.createWorkFlowStarted),this.listenOn(window,"backFromCreateWorkFlow",this.backFromCreateWorkFlow),this.listenOn(window,"pasteFeatures",this._pasteFeatures),this.listenOn(window,"featuresPasted",this._featuresPasted),L(window)}static{this.properties={appLayout:1,defaultGlobalId:0,defaultLayerId:1,defaultOid:0,enableAutoRefresh:5,enableColumnReorder:5,enableCSV:5,enableInlineEdit:5,enableShare:5,enableTableAutosave:5,featureSelectionMode:1,selectedRelatedIds:0,honorMapFieldSettings:5,isMobile:5,mapHidden:5,mapInfo:0,mapView:0,showOnlyUpdatableLayers:5,selectedIds:0,shareIncludeEmbed:5,shareIncludeSocial:5,showNewestFirst:5,zoomAndScrollToSelected:5,zoomToScale:9,pasteEnabled:5,showCopyPasteActions:5,layerIds:0,_allIds:16,_configLayerOrderDefined:16,_csvExporting:16,_fetchingData:16,_hideTable:16,_filterActive:16,_layer:16,_selectAllActive:16,_showHideOpen:16,_showOnlySelected:16,_toolInfos:16,_translations:16,_fullTextSearchInfo:16,_searchPlaceHolder:16,_size:16,_queryingData:16}}static{this.styles=V}static{this.shadowRootOptions=F}willUpdate(e){if(e.has("appLayout")&&this.appLayoutWatchHandler(),e.has("defaultOid")&&this.defaultOidWatchHandler(),e.has("defaultGlobalId")&&this.defaultGlobalIdWatchHandler(),e.has("enableCSV")&&this.enableCSVWatchHandler(),e.has("enableInlineEdit")&&this.enableInlineEditWatchHandler(),e.has("mapHidden")&&this.mapHiddenWatchHandler(),e.has("isMobile")&&this.isMobileWatchHandler(),e.has("mapInfo")&&this.mapInfoWatchHandler(),e.has("mapView")&&this.mapViewWatchHandler(),e.has("_layer")&&this._layerWatchHandler(),e.has("selectedIds")&&(this.hasUpdated||JSON.stringify(e.get("selectedIds"))!==JSON.stringify(this.selectedIds))&&this.selectedIdsWatchHandler(),e.has("selectedRelatedIds")&&(this.hasUpdated||JSON.stringify(e.get("selectedRelatedIds"))!==JSON.stringify(this.selectedRelatedIds))&&this.selectedRelatedIdsWatchHandler(),e.has("enableTableAutosave")&&this.hasUpdated&&this._table&&(this._table.autoSaveEnabled=this.enableTableAutosave),e.has("_translations")){let t=this._translations._lang,i=e.get("_translations")?._lang;t&&i&&t!==i&&this._initToolInfos()}if(e.has("pasteEnabled")&&this.hasUpdated){let t=this._toolInfos.find(i=>i.icon==="paste-with-attribute");t&&(t.disabled=!this.pasteEnabled)}e.has("layerIds")&&this.hasUpdated&&this._addListenersForLayers()}async appLayoutWatchHandler(){await this._initToolInfos(),this._updateShareUrl()}async defaultOidWatchHandler(){await this._handleDefaults()}async defaultGlobalIdWatchHandler(){await this._handleDefaults()}async enableCSVWatchHandler(){this._toolInfos?.length>0&&await this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}async mapHiddenWatchHandler(){this._toolInfos?.length>0&&await this._initToolInfos()}async isMobileWatchHandler(){!this._toolInfos&&!this.isMobile&&await this._initToolInfos()}async mapInfoWatchHandler(){this._configLayerOrderDefined="configLayerOrder"in(this.mapInfo?.layerOptions||{}),this._enabledLayerIds=C(this.mapInfo?.layerOptions?.layers||[],this.mapInfo?.layerOptions?.configLayerOrder),this._table&&(this._resetColumnTemplates(),this._sortTable(),await this._initToolInfos())}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._floorExpression="",this._searchExpression="",this.mapView.highlights=[{name:"default",color:"#00FFFF"},{name:"current-selection",color:"#ff00ff"},{name:"temporary",color:"#FFFF00"}],this._updateShareUrl(),this._mapClickHandle=p.on(()=>this.mapView,"click",e=>{this._creatingFeature||this._mapClicked(e)}))}async _layerWatchHandler(){if(this._hideTable=!1,this._fetchingData=!0,!this._layer){this._fetchingData=!1,this._hideTable=!0;return}try{await this._layer.when(),this._floorField=this._layer.floorInfo?.floorField||"",this._updateFloorDefinitionExpression(),await this._resetTable(),this._updateShareUrl()}catch(e){console.error(e),this._hideTable=!0}finally{this._fetchingData=!1}}async selectedIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this.selectedIds.length!==this._allIds.length&&(this._selectAllActive=!1),this.selectedIds.length>0&&(this._table.rowHighlightIds.removeAll(),this._table.rowHighlightIds.add(this.selectedIds[0])),this.selectedIds.length===0&&setTimeout(()=>{this.featureSelectionChange.emit(this.selectedIds)},700)}async selectedRelatedIdsWatchHandler(){this._validateEnabledActions(),this.selectedRelatedIds.length>0&&(this._relatedFeatureTable?.rowHighlightIds.removeAll(),this._relatedFeatureTable?.rowHighlightIds.add(this.selectedRelatedIds[0]))}async closeFilter(){await this._closeFilter()}async filterReset(){this._filterByExtentHandle&&(this._table&&(this._table.filterGeometry=void 0),this._filterByExtentHandle.remove(),this._filterByExtentHandle=void 0),await this._handleFilterListReset()}async filterUpdate(e,t){await this._handleFilterUpdate(e),t?(this._shouldUpdateTableOnExtentChange=!0,this._handleTableOnMapExtent()):t===!1&&(this._table&&(this._table.filterGeometry=void 0),this._filterByExtentHandle?.remove(),this._filterByExtentHandle=void 0,await this._updateAllIds())}async validateTableUpdate(e){this._shouldUpdateTableOnExtentChange=e}async validateActiveEdits(){return this._validateActiveEdits([],this.selectedIds)}async refresh(){this._table&&await this._refresh()}async setColumnOrder(e){this._setColumnTemplates(e)}async beforeMapInfoChange(e){let t=e.detail.ref,i=e.detail.mapInfo;if(this._hasPendingEdits()){e.preventDefault();let s=await this._validateActiveEdits([],this.selectedIds);await t.setMapByID(s?i.id:e.detail.currentId,!s)}}async editorInitialized(e){this._shouldUpdateTableOnExtentChange=!1,this._editor=e.detail}async closeEdit(){this._shouldUpdateTableOnExtentChange=!0,this._filterByExtentHandle&&this._handleTableOnMapExtent(),this._editor=void 0}async selectionChanged(e){let t=e.detail.selectedFeature[0],i=Number(t.getObjectId()),s=this._table;if(s.rowHighlightIds.length&&s.rowHighlightIds.removeAll(),s.rowHighlightIds.add(i),this._highlightFeatures(i),this.zoomAndScrollToSelected&&s&&this.mapView){let a=s.viewModel.getObjectIdIndex(i);s.scrollToIndex(a);let l=t.layer,h=this.mapView.allLayerViews.toArray(),r;h.some(async n=>n.layer.title===l?.title&&n.layer.type==="feature"?(r=n,this.mapView&&await I([i],r,this.mapView,!0,void 0,this.zoomToScale),!0):!1)}}async beforeLayerSelectionChange(e){if(this._hasPendingEdits()){e.preventDefault();let t=e.detail.ref,i=await this._validateActiveEdits([],this.selectedIds);return e.detail.selectedIds?await t.setLayerByIds(i?e.detail.newIds:e.detail.currentIds,!0):await t.setLayerById(i?e.detail.newId:e.detail.currentId,!0)}}async layerSelectionChange(e){await this._layerSelectionChanged(e)}async editsComplete(e){let t=e.detail;(t==="delete"||t==="add")&&(this._allIds=await this.queryAllIds()),await this._refresh()}async facilityChanged(e){this._updateFloorDefinitionExpression()}async levelChanged(e){this._floorLevel=e.detail,this._updateFloorDefinitionExpression()}async siteChanged(e){this._updateFloorDefinitionExpression()}async noLayersFound(){this._layer=void 0,this._allIds=[],this._size=0,this._clearSelection()}async clearSelection(){await this._validateActiveEdits([],this.selectedIds)&&this._clearSelection()}async mapChanged(){this._queryingData=!1,this._creatingFeature=!1,this._clearSelection()}async featuresSelected(e){e.detail.forEach(t=>{let i=this._table?.highlightIds.indexOf(t);i&&i<0&&this._table?.highlightIds.add(t)})}createWorkFlowStarted(){this._creatingFeature=!0}backFromCreateWorkFlow(){this._creatingFeature=!1}_pasteFeatures(){this._layer?.isTable||this._zoom()}_featuresPasted(){this._shouldSelectCreatedFeatures=!0}async load(){await this._initToolInfos()}render(){let e=this._fetchingData||this._hideTable?"display-none":"height-full",t=this._fetchingData?"":"display-none",i=this._queryingData?"":"display-none",s=this._size.toString(),a=this.selectedIds.length.toString(),l=this.isMobile?"height-full":"height-full-adjusted",h=this._canShowFullTextSearch();return this._validateActiveActions(),o`<div><calcite-scrim class=${y(i)} .loading=${this._queryingData}></calcite-scrim><calcite-shell><div class=${`width-full ${l}`}><calcite-panel class="height-full width-full panel-header-override">${this._getMapLayerPicker("header-actions-start")}${!this.isMobile&&o`${this._getTableControlRow("header-content")}${this._getActionsEnd("header-actions-end")}`||""}${h&&o`<div class="search-container border-bottom"><calcite-input class=search clearable icon=search @calciteInputChange=${r=>{this._searchTextChanged(r)}} .placeholder=${this._searchPlaceHolder} title=${this._searchPlaceHolder??f} type=search ${g(this._searchNode)}></calcite-input></div>`||""}<calcite-loader class=${y(t)} .label=${this._translations.fetchingData} scale=l></calcite-loader><div class=${y(e)} ${g(this.onTableNodeCreate)}></div></calcite-panel></div>${this.isMobile?void 0:o`<div class="bottom-left text-color height-19" id=solutions-selected-count-div>${(this._translations.recordsTotal?.replace("{{total-number-of-records}}",s)+" | "+this._translations.recordsSelected.replace("{{selected-number-of-records}}",a)).replace("{{total}}",s).replace("{{selected}}",a)}</div>`}</calcite-shell></div>`}updated(){this._table&&this.updateRelatedAttachmentColumns()}async _searchTextChanged(e){this._fullTextSearchInfo.forEach(t=>{t.searchTerm=e.target.value}),this._searchFullText()}async _searchFullText(){let e=[],t=!1;if(this._showOnlySelected)e=this._tempSelectedIds,t=!0;else if(await this._validateActiveEdits([],this.selectedIds))this._clearSelection(),this._tempSelectedIds=[];else return;this._searchExpression&&this._clearSearchDefinitionExpression();let i=[];if(this._fullTextSearchInfo?.length&&this._fullTextSearchInfo[0].searchTerm){let s=this._layer?.createQuery();s.fullText=this._fullTextSearchInfo,i=this._layer?await this._layer.queryObjectIds(s):[],t&&e?.length&&(i=i.filter(a=>e.includes(a))),await this._updateSearchDefinitionExpression(i?.length?i:[-1])}t&&i?.length&&(this._showOnlySelected=!0,this._table?.highlightIds.addMany(i.reverse())),await new Promise(s=>setTimeout(s,800)),await this._updateAllIds()}_clearSearchDefinitionExpression(){let e=this._layer?.definitionExpression;this._searchExpression&&e&&e?.indexOf(this._searchExpression)>-1&&this._layer&&(e?.indexOf(" AND ("+this._searchExpression)>-1?this._layer.definitionExpression=e.replace(` AND (${this._searchExpression})`,""):this._layer.definitionExpression=e.replace(this._searchExpression,"")),this._searchExpression=""}async _updateSearchDefinitionExpression(e){let t=this._layer?.definitionExpression;if(this._layer)if(e?.length){let i=`objectId in(${e})`;this._layer.definitionExpression=this._searchExpression&&t&&t.includes(this._searchExpression)?t.replace(this._searchExpression,i):t?`${t} AND (${i})`:i,this._searchExpression=i}else this._clearSearchDefinitionExpression()}_canShowFullTextSearch(){return this._layer?.capabilities?.query?.supportsFullTextSearch&&this._layer.indexes.items.filter(e=>e.indexType=="FullText").length>0}_getFullTextSearchInfo(){if(this._fullTextSearchInfo=[],this._layer?.capabilities?.query?.supportsFullTextSearch){let e=this._layer.indexes?.filter(t=>t.indexType=="FullText");if(e?.length){let t=[];e.forEach(s=>{t.push(...s.fields.split(","))});let i=[];t.forEach(s=>{let a=this._layer?.getField(s.trim());a?.alias&&i.push(a.alias)}),this._searchPlaceHolder=this._translations.searchPlaceholder.replace("{{field_names}}",i.join(", ")),this._fullTextSearchInfo.push({onFields:["*"],searchTerm:"",searchType:"prefix"})}}}_getMapLayerPicker(e){let t=this.isMobile?"display-none":"";return o`<div class=${`border-end ${t}`} id=solutions-map-layer-picker-container slot=${e??f}><map-layer-picker appearance=transparent .configLayerOrderDefined=${this._configLayerOrderDefined} .defaultLayerId=${this.defaultLayerId} display=inline-flex .enabledLayerIds=${this._enabledLayerIds} height=50 .isMobile=${this.isMobile} .mapView=${this.mapView} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} placeholder-icon=layers scale=l .selectedIds=${this._layer?[this._layer?.id]:[]} show-single-layer-as-label show-tables type=dropdown></map-layer-picker></div>`}_getLayerOption(e){let t;return this.mapInfo?.layerOptions?.layers.some(i=>i.id===e?(t=i,!0):!1),t}_getActionsEnd(e){let t=this._relatedFeatureTable?this._relatedFeatureTable.layer:this._layer,i=this._relatedFeatureTable||this._table,s=this._getLayerOption(t?.id||"");return o`<div class="display-flex" slot=${e??f}><field-selection .configExtraFields=${s?.extraFields} .layer=${t} .mapView=${this.mapView} .table=${i} .tableRef=${this.el}></field-selection>${this.enableShare&&!this.isMobile?this._getShare("share"):void 0}</div>`}_getTableControlRow(e){return o`<div class=${"height-51-px width-full display-flex"} slot=${e??f} ${g(this._toolbar)}>${this._getActionBar()}</div>`}_getActionBar(){return o`<calcite-action-bar class=width-full expand-disabled id=${this._getId("bar")??f} layout=horizontal><calcite-action-group>${this.isMobile?void 0:this._getActions()}</calcite-action-group></calcite-action-bar>`}_getActions(){return this._toolInfos?.reduce((e,t)=>(t&&e.push(t.isDanger?this._getDangerAction(t.icon,t.label,t.func,t.disabled):this._getAction(t.active,t.icon,t.indicator,t.label,t.func,t.disabled,!!t.loading,t.toolTip)),e),[])}_validateEnabledActions(){let e=this._getIds().length,t=["zoom-to-object","pencil","trash","erase","selected-items-filter","copy"];this._toolInfos?.forEach(i=>{i&&t.indexOf(i.icon)>-1&&(i.disabled=i.icon==="pencil"?e<2||e>m:e<1,i.toolTip=i.icon==="pencil"?e>m?this._translations.featureEditLimitNotice:this._translations.editMultiple:i.toolTip)})}_validateActiveActions(){let e=["filter","list-check-all","selected-items-filter"];this._toolInfos?.forEach(t=>{t&&e.indexOf(t.icon)>-1&&(t.icon==="filter"&&(t.indicator=this._filterActive),t.icon==="list-check-all"&&(t.active=this._selectAllActive),t.icon==="selected-items-filter"&&(t.active=this._showOnlySelected,t.label=this._showOnlySelected?this._translations.showAll:this._translations.showSelected,t.toolTip=this._showOnlySelected?this._translations.showAll:this._translations.showSelected))})}async _initToolInfos(){let e=this._getIds().length>0,t=this._relatedFeatureTable?this._relatedFeatureTable.layer.isTable:this._layer?.isTable,i=this.featureSelectionMode==="multiple"&&this._layer?.capabilities?.operations.supportsUpdate,s=this._getSelectedIds().length<2||this._getSelectedIds().length>m,a=!this.mapHidden&&!t,l=!this._relatedFeatureTable&&(!this._layer?.isTable||this._hasFilterExpressions()),h=this._featuresEmpty(),r=this.featureSelectionMode==="single",n=this.enableCSV;if(this._relatedFeatureTable){let _=await this._queryRelatedFeatures();n=_&&Object.keys(_).length>0}let d=[];l&&d.push({active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this.toggleFilter.emit(),disabled:!1,toolTip:this._translations.filters}),a&&d.push({active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>{this._zoom()},disabled:!e,toolTip:this._translations.zoom}),i&&d.push({active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>this.editMultipleFeatures.emit(this._getSelectedIds()),disabled:s,toolTip:this._translations.editMultiple}),this.showCopyPasteActions&&(d.push({active:!1,icon:"copy",indicator:!1,label:this._translations.copy,func:()=>this.copyFeatures.emit({featuresIds:this._getIds(),layerId:this._layer?.id}),disabled:!e,toolTip:this._translations.copy}),d.push({active:!1,icon:"paste-with-attribute",indicator:!1,label:this._translations.paste,func:()=>this.pasteFeatures.emit(),disabled:!this.pasteEnabled,toolTip:this._translations.paste})),this._deleteEnabled&&d.push({active:!1,icon:"trash",indicator:!1,label:this._translations.delete,func:()=>this._showDelete(),disabled:!e,isDanger:!0,toolTip:this._translations.delete}),d.push({active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>{this.clearSelection()},disabled:!e,toolTip:this._translations.clearSelection}),this._relatedFeatureTable||d.push({active:!1,icon:"selected-items-filter",indicator:!1,label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!e,toolTip:this._showOnlySelected?this._translations.showAll:this._translations.showSelected}),!r&&!this._relatedFeatureTable&&d.push({active:!1,icon:"list-check-all",indicator:!1,func:async()=>await this._selectAll(),label:this._translations.selectAll,disabled:h,toolTip:this._translations.selectAll}),!r&&!this._relatedFeatureTable&&d.push({active:!1,icon:"compare",indicator:!1,func:async()=>await this._switchSelected(),label:this._translations.switchSelected,disabled:h,toolTip:this._translations.switchSelected}),d.push({active:!1,icon:"refresh",indicator:!1,func:()=>{this._refresh()},label:this._translations.refresh,disabled:!1,toolTip:this._translations.refresh}),n&&d.push({active:!1,icon:"export",indicator:!1,func:()=>{this._exportToCSV()},label:this._translations.exportCSV,loading:this._csvExporting,disabled:h,toolTip:this._translations.exportCSV}),this._toolInfos=[...d]}async _addListenersForLayers(){this._layerEditsHandles.forEach(i=>i.remove()),this._layerEditsHandles=[];let e=this.mapView,t=[...new Set(this.layerIds)];if(!(!e||t.length===0))for(let i of t){let s=await w(e,i);if(!s)continue;let a=s.on("edits",async l=>{let h=Array.isArray(l?.addedFeatures)?l.addedFeatures:[],r=Array.isArray(l?.updatedFeatures)?l.updatedFeatures:[];if(h.length===0&&r.length===0)return;let n=h.map(u=>u.objectId).filter(u=>u!=null),d=r.map(u=>u.objectId).filter(u=>u!=null);if(n.length===0&&d.length===0)return;let _=this._layer?.id;if(this._shouldSelectCreatedFeatures){await this._selectFeatures(n,i),i===_&&this.featuresAdded.emit(n);return}else i===_&&n.length>0?(this._searchExpression&&(await this._refresh(),this._clearSelection(),await this._searchFullText()),await this._refresh(),this.initCreateComponent.emit()):i===_&&d.length>0&&this._searchExpression&&(await this._selectFeatures(d,i),await this._refresh())});a&&this._layerEditsHandles.push(a)}}async _selectFeatures(e,t){try{let i=this._layer?.id;if(t===i){await this._refresh(!1,!0),this._clearSelection(),this._searchExpression&&await this._searchFullText();let s=[];for(let a of e)this._allIds.includes(a)&&s.push(a);s.length>0?this._table?.highlightIds.addMany(s):await this._refresh()}else this._clearSelection(),this._pastedFeaturesIds=e,this.requestLayerSelectionChange.emit(t);this._shouldSelectCreatedFeatures=!1}catch(i){this._shouldSelectCreatedFeatures=!1,console.error("Failed processing layer edits event",{layerId:t,error:i})}}_updateFloorDefinitionExpression(){if(this._floorField&&this._floorLevel){let e=`${this._floorField} = '${this._floorLevel}'`,t=this._layer?.definitionExpression;this._layer&&(this._layer.definitionExpression=t&&this._floorExpression&&t?.indexOf(this._floorExpression)>-1?t.replace(this._floorExpression,e):t?`${t} AND (${e})`:e),this._floorExpression=e}}_featuresEmpty(){return this._allIds?.length===0}_hasFilterExpressions(){let e=[],t=this._layer?.id;return this.mapInfo?.filterConfig?.layerExpressions&&t!==void 0&&(e=this.mapInfo.filterConfig.layerExpressions.filter(i=>i.id===t)),e.length>0}_getAction(e,t,i,s,a,l,h,r){let n=this._layer===void 0?!0:l;return o`<calcite-action .active=${e} .disabled=${n} .icon=${t} .id=${`layer-table-${t}`} .indicator=${i} .label=${s} .loading=${h} @click=${a} text text-enabled><div class="display-flex"><span class="label-override padding-start-1-4">${s}</span></div></calcite-action>${this._getToolTip("auto",`layer-table-${t}`,r)}`}_showDelete(){this.showDelete.emit({ids:this._getIds()})}_getShare(e){return o`<div id=${this._getId(e)??f}><instant-apps-social-share class="height-51 width-51 display-flex" .embed=${this.shareIncludeEmbed} flip-rtl popover-button-icon-scale=s scale=m share-button-color=neutral share-button-type=action .socialMedia=${this.shareIncludeSocial} .view=${this.mapView} ${g(this._shareNode)}></instant-apps-social-share>${this._getToolTip("bottom",e,this._translations.share)}</div>`}_updateShareUrl(){let e=this._shareNode.value?.shareUrl;if(!e)return;let t=new URL(e);this.mapInfo?.id?t.searchParams.set("webmap",this.mapInfo.id):t.searchParams.delete("webmap"),this._layer?.id?t.searchParams.set("layer",this._layer.id):t.searchParams.delete("layer"),this.selectedIds?.length>0?t.searchParams.set("oid",this.selectedIds.reverse().join(",")):t.searchParams.delete("oid"),this.appLayout&&t.searchParams.set("applayout",this.appLayout),this.selectedRelatedIds?.length>0&&this._relatedFeatureTable?.layer?.id&&(t.searchParams.set("oid",this.selectedRelatedIds.join(",")),t.searchParams.set("layer",this._relatedFeatureTable?.layer?.id.toString())),this._shareNode.value&&(this._shareNode.value.autoUpdateShareUrl=!1,this._shareNode.value.shareUrl=t.href)}_getToolTip(e,t,i){return o`<calcite-tooltip .placement=${e} .referenceElement=${t}><span>${i}</span></calcite-tooltip>`}_getId(e){return`solutions-action-${e}`}_getDangerAction(e,t,i,s){let a=this._layer===void 0?!0:s;return o`<calcite-action class="delete-red" .disabled=${a} .id=${`layer-table-${e}`} .label=${t} @click=${i} text text-enabled><calcite-icon aria-hidden=true class="danger-icon-color" .icon=${e} scale=s></calcite-icon><span class="label-override padding-start-1-4 danger-label-color">${t}</span></calcite-action>${this._getToolTip("bottom",`layer-table-${e}`,t)}`}_getIds(){let e=this._relatedFeatureTable??this._table;return this._relatedFeatureTable&&this._table&&this._table.highlightIds.getItemAt(0)!==this.selectedIds[0]&&(e=this._table),e?.highlightIds.map(t=>Number.parseInt(t.toString(),10)).toArray()??[]}onTableNodeCreate(e){this._tableNode=e}async _getTable(e,t){this._layer&&(await this._layer.when(()=>{this._table=new M({autoRefreshEnabled:this.enableAutoRefresh,autoSaveEnabled:this.enableTableAutosave,layer:this._layer,view:this.mapView,columnReorderingEnabled:this.enableColumnReorder,editingEnabled:this._editEnabled&&this.enableInlineEdit,relatedRecordsEnabled:!0,attachmentsEnabled:!0,highlightEnabled:!1,multiSortEnabled:!1,visibleElements:{columnDescriptions:!1,header:!1,menu:!1,progress:!1},tableTemplate:{columnTemplates:t},container:e})}),await this._table?.when(()=>{this._table?.viewModel.addHandles(this._table.highlightIds.on("change",i=>{this._handleOnChange(i)})),this._table?.viewModel.addHandles(this._table.on("cell-pointerover",this.tempHighlightOnHover.bind(this))),this._table?.viewModel.addHandles(this._table.on("cell-pointerout",this._removeTempHighlight.bind(this))),this._table?.viewModel.addHandles(this._table.on("column-reorder",this._handleColumnReorder.bind(this))),this.listenOn(this._tableNode,"mouseleave",this._removeTempHighlight),this._table?.viewModel.addHandles(p.watch(()=>this._table.size,i=>{this._size=i})),p?.watch(()=>this._table?.relatedTable,async i=>{if(i){if(i.rowHighlightIds.length){let a={added:[i.rowHighlightIds.getItemAt(0)],removed:[]};this._handleOnChange(a)}let s=i.layer;if(this._layerEditHandle=s.on("edits",async()=>{await new Promise(a=>setTimeout(a,50)),await this._refresh(!0)}),this._checkEditEnabled(s),i.editingEnabled=this._editEnabled&&this.enableInlineEdit,i.autoSaveEnabled=this.enableTableAutosave,this._relatedFeatureTable=i,typeof i.layer?.id=="string"&&i.layer?.fields){let a=i.layer.popupTemplate?.fieldInfos,l=this._getColumnTemplates(i.layer.id,i.layer.fields,a);this._relatedFeatureTable.tableTemplate=new v({columnTemplates:l})}i.highlightIds.on("change",a=>{this._handleRelatedRecordsChange(a)})}else{this.selectedRelatedIds=[],this._relatedFeatureTable=void 0,this._layerEditHandle&&this._layerEditHandle.remove();let s=this._layer;this._refresh(),s&&this.relatedRecordToggled.emit(s),this._finishOnChange()}await this._initToolInfos()})}))}async _handleRelatedRecordsChange(e){await this._handleOnChange(e),this._updateShareUrl()}hasAttachmentsEnabled(e){if(!e?.capabilities)return!1;let{capabilities:{data:{supportsAttachment:t},operations:{supportsQueryAttachments:i}}}=e;return t&&i}async _handleOnChange(e){if(!await this._validateActiveEdits([...e.added],[...e.removed]))return;let t=[...this._getIds()],i=this._getSelectedLayer(t);this._relatedFeatureTable&&this._table?.highlightIds.getItemAt(0)!==this.selectedIds[0]&&(i=this._layer,await this._initToolInfos()),i&&this.relatedRecordToggled.emit(i),this.featureSelectionMode==="single"&&(this._relatedFeatureTable&&t.length>1?(this._relatedFeatureTable.highlightIds.remove(t[0]),t.shift()):t.length>1&&!this._selectAllActive&&(this._table?.highlightIds.remove(t[0]),t.shift())),!this._relatedFeatureTable||this._relatedFeatureTable&&this._table?.highlightIds.getItemAt(0)!==this.selectedIds[0]?(this.selectedRelatedIds=[],this.selectedIds=t.reverse(),this._tempSelectedIds=[...this.selectedIds],this._highlightFeatures(this.selectedIds[0])):this.selectedRelatedIds=t.reverse(),this._finishOnChange()}async _validateActiveEdits(e,t){let i=!0;if(this._editor&&!this._skipEditCheck){if(this._hasPendingEdits()){let s=!1;try{this._editor.activeWorkflow&&await this._editor.activeWorkflow.cancel({force:!1})}catch(a){s=a?.name==="workflow:cancel-denied"}if(s){let a=this._relatedFeatureTable&&this._relatedFeatureTable.highlightIds.length>0?this._relatedFeatureTable:this._table;i=!1,this._skipEditCheck=!0,e.length>0?a?.highlightIds.removeMany(e):t.length>0&&a?.highlightIds.addMany(t)}}}else i=!this._skipEditCheck,this._skipEditCheck=!1;return this._shouldUpdateTableOnExtentChange=i,i}_hasPendingEdits(){return this._editor?.activeWorkflow?.activeWorkflow?.hasPendingEdits}_finishOnChange(){this._showOnlySelected&&!this._relatedFeatureTable&&(this._table&&this._getSelectedIds().length>0?this._table.filterBySelectionEnabled=!0:this._toggleShowSelected());let e=this._getSelectedIds();setTimeout(()=>{this.featureSelectionChange.emit(e)},50)}_handleColumnReorder(){this.columnReorder.emit()}tempHighlightOnHover(e){if(this._removeTempHighlight(),this._selectedLayerView){let t=e.feature;this._temporaryFeatureHandle=this._selectedLayerView?.highlight([t],{name:"temporary"})}}_removeTempHighlight(){this._temporaryFeatureHandle&&this._temporaryFeatureHandle.remove()}_highlightFeatures(e){if(this._clearHighlights(),this.selectedIds.length>0&&this._selectedLayerView&&(this._currentFeatureHighlightHandle=this._selectedLayerView?.highlight([e],{name:"current-selection"}),this.selectedIds.length>1)){let t=this.selectedIds.filter(i=>i!==e);this._defaultFeaturesHandle=this._selectedLayerView?.highlight(t,{name:"default"})}}_clearHighlights(){this._removeTempHighlight(),this._currentFeatureHighlightHandle&&this._currentFeatureHighlightHandle.remove(),this._defaultFeaturesHandle&&this._defaultFeaturesHandle.remove()}_resetColumnTemplates(){if(this._layer){let e=this._layer.popupTemplate?.fieldInfos,t=this._getColumnTemplates(this._layer.id,this._layer.fields,e);t?.length===0?this._tableNode?.classList.add("display-none"):this._tableNode?.classList.remove("display-none");let i=this._table?.tableTemplate?.columnTemplates,s=i&&t&&i.length!==t.length||t?.some((a,l)=>i&&i[l]?JSON.stringify(i[l])!==JSON.stringify(a):!1);if(this._table&&t&&(s||!this._columnsInfo)){this._table.tableTemplate=new v({columnTemplates:t});let a=t.map(l=>l.fieldName);this._initColumnsInfo(a)}}}_setColumnTemplates(e){this._table&&e&&(this._table.tableTemplate=new v({columnTemplates:e}))}async _resetTable(){if(this._loaded=!1,this._clearSelection(),this._allIds=await this.queryAllIds(),!this._table&&this._layer){let e=this._layer.popupTemplate?.fieldInfos,t=this._getColumnTemplates(this._layer.id,this._layer.fields,e);this._tableNode&&await this._getTable(this._tableNode,t)}else this._table&&(this._table.view=this.mapView,this._table.layer=this._layer);await this._initLayerRefresh(),this._checkEditEnabled(this._layer),this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,this._table.autoSaveEnabled=this.enableTableAutosave,await this._table.when(),setTimeout(()=>{this._loaded||this.finishLoading()},1e3),await p.once(()=>this._table?.state==="loaded").then(async()=>{await this.finishLoading()}))}async finishLoading(){try{this._loaded=!0,this._table?.highlightIds.removeAll(),this._table.objectIds.removeAll(),this._resetColumnTemplates(),this._showOnlySelected=!1,await this._handleDefaults(),await this._sortTable(),await this._initToolInfos(),["esri-feature-table","esri-widget"].forEach(e=>{this._tableNode&&!this._tableNode.classList.contains(e)&&this._tableNode.classList.add(e)}),this._table&&this._pastedFeaturesIds.length>0&&await this._applyPastedFeatureHighlights()}catch(e){console.log(e)}}async _applyPastedFeatureHighlights(){let e=[...this._pastedFeaturesIds];await new Promise(t=>{requestAnimationFrame(()=>{this._table?.highlightIds.addMany(e),this._pastedFeaturesIds=[],t()})})}async _initLayerRefresh(){this._refreshHandle&&this._refreshHandle.remove(),this._layer&&(this._refreshHandle=this._layer.on("refresh",e=>{e.dataChanged&&this._updateAllIds()}))}async _updateAllIds(){let e=await this.queryAllIds(),t=this.selectedIds.filter(i=>this._allIds.indexOf(i)>-1);(JSON.stringify(e)!==JSON.stringify(this._allIds)||JSON.stringify(this.selectedIds)!==JSON.stringify(t))&&(this._allIds=e,this.selectedIds=t,await this._refresh())}async _handleDefaults(){if(!this._defaultOidHonored&&this.defaultOid?.length>0&&this.defaultOid[0]>-1&&this._table&&(await this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0,this.defaultOid=[],this._showOnlySelected=!1,this._toggleShowSelected()),!this._defaultGlobalIdHonored&&this.defaultGlobalId&&this.defaultGlobalId?.length>0&&this._table&&this._layer){let e=await A(this.defaultGlobalId,this._layer),t=e?.length>0?e.map(i=>Number(i.getObjectId())):void 0;t&&await this._selectDefaultFeature(t),this._defaultGlobalIdHonored=!0,this.defaultGlobalId=[],this._showOnlySelected=!1,this._toggleShowSelected()}}_initColumnsInfo(e){let t=this._table?.columns.reduce((s,a)=>((!e||e?.indexOf(a.name)>-1)&&(s[a.name]=!a.hidden),s),{}),i=this._table?.columns.map(s=>s.name);(e&&i?e.filter(s=>i.indexOf(s)<0):[]).forEach(s=>{t[s]=!0}),this._columnsInfo=e?e.reduce((s,a)=>(s[a]=t[a],s),{}):t}async _selectDefaultFeature(e){e.length>0&&this._table?.highlightIds.addMany(e)}_checkEditEnabled(e){this._editEnabled=!!(e?.editingEnabled&&e?.capabilities?.operations.supportsUpdate),this._deleteEnabled=!!(e?.editingEnabled&&e?.capabilities?.operations.supportsDelete)}async _sortTable(){let e=this._layer?.objectIdField,t="desc",i,s=this.mapInfo?.layerOptions?.layers,a=this._layer?.id;s&&s.length>0&&a!==void 0&&(i=s.filter(l=>l.id===a),i&&i.length>0&&(i=i[0],i.sortField&&i.fields?.includes(i.sortField)&&(e=i.sortField),t=i?.sortOrder?i.sortOrder:"desc")),this._table&&this._layer&&(await this._table.when(),await this._layer.when(()=>{e&&this._table?.sortColumn(e,t)}))}async _handleFilterListReset(){this._filterActive=!1,this._updateShareUrl(),await this._searchFullText()}async _handleFilterUpdate(e){if(this._floorExpression&&this._layer){let t=this._layer.definitionExpression,i=new RegExp(`${this._floorField} = ['].+[']`,"gm");this._layer.definitionExpression=t&&this._floorField&&t.indexOf(`${this._floorField} = '`)>-1?t.replace(i,this._floorExpression):t?`${t} AND (${this._floorExpression})`:this._floorExpression}this._filterActive=e,this._updateShareUrl(),await this._searchFullText()}_handleTableOnMapExtent(){this._table&&(this._filterByExtentHandle=p.when(()=>this.mapView?.stationary,async()=>{if(this._shouldUpdateTableOnExtentChange&&this.appLayout==="splitView"){if(await new Promise(e=>setTimeout(e,800)),this._table&&this.mapView){this._table.filterGeometry=this.mapView.extent;let e={geometry:this.mapView.extent},t=this._layer&&await this._layer.queryObjectIds(e),i=this.selectedIds.filter(a=>!t?.includes(a)),s=this._outOFExtentOids.filter(a=>t?.includes(a));i.length>0&&(this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._table.highlightIds.removeMany(i),this._outOFExtentOids=[...this._outOFExtentOids,...i]),s.length>0&&(this.selectedIds=[...new Set([...this.selectedIds,...s])],this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(this.selectedIds.reverse()),this._outOFExtentOids=this._outOFExtentOids.filter(a=>!s.includes(a)))}this._allIds=await this.queryAllIds()}},{initial:!0}))}async _closeFilter(){this._allIds=await this.queryAllIds()}async queryAllIds(){if(this._layer){let e=this._layer.createQuery();return e.geometry=this._filterByExtentHandle&&this.mapView?this.mapView.extent:null,e.where=this._layer.definitionExpression||"1=1",await this._layer.queryObjectIds(e)}else return[]}async _mapClicked(e){let t={include:this._layer},i=await this.mapView?.hitTest(e.screenPoint,t);if(i&&i.results.length>0){let s=i.results;if(this.featureSelectionMode==="single"){this._table?.highlightIds.removeAll();let a=s[0].graphic.getObjectId();if(a){let l=this._table?.highlightIds.indexOf(a);l!==void 0&&l<0&&this._table?.highlightIds.add(a)}}else s.forEach(a=>{let l=Number(a.graphic.getObjectId()),h=this._table?.highlightIds.indexOf(l);h&&h<0&&l&&this._table?.highlightIds.add(l)});this._showOnlySelected&&this._table&&(this._table.filterBySelectionEnabled=!0)}}async _selectAll(){let e=this._allIds,t=e.filter(i=>this.selectedIds.indexOf(i)<0);await this._validateActiveEdits(t,this.selectedIds)&&this._table?(this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(e),this.selectedIds=e,this._finishOnChange(),this._selectAllActive=!0):this._skipEditCheck=!1}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._table&&(this._table.filterBySelectionEnabled=this._showOnlySelected)}_clearSelection(){this._relatedFeatureTable||(this.selectedIds=[],this._outOFExtentOids=[],this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._table?.highlightIds.removeAll(),this._clearHighlights(),this._table?.rowHighlightIds.removeAll()),this._relatedFeatureTable&&(this._relatedFeatureTable?.highlightIds.removeAll(),this.selectedRelatedIds=[]),this._finishOnChange()}async _switchSelected(){let e=[...this.selectedIds],t=this._allIds.reduce((i,s)=>(e.indexOf(s)<0&&i.push(s),i),[]).sort((i,s)=>i-s);await this._validateActiveEdits(t,e)&&this._table?(this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(t),this.selectedIds=t,this._finishOnChange()):this._skipEditCheck=!1}async _exportToCSV(){let e=this._relatedFeatureTable?this._relatedFeatureTable.layer:this._layer;if(!e)return;let t={},i=this._getIds();if(this._relatedFeatureTable?.tableParent&&this._relatedFeatureTable.highlightIds.length===0){let l=this._relatedFeatureTable.tableParent.highlightIds?.getItemAt(0);if(l!==void 0){let h=await this._queryRelatedFeatures(),r=[];h&&h[l]?.features&&(h[l].features.forEach(n=>{n.attributes&&r.push(n.attributes[e.objectIdField])}),i=r.length>0?r:[])}}t[e.id]={selectionSetNames:[e.title||""],ids:i,layer:e};let s=this._relatedFeatureTable??this._table;if(!s)return;let a=s&&s.columns.toArray().reduce((l,h)=>{if(!h.hidden){let r=h?.name||h?.fieldName;r&&l.push(r.toLocaleLowerCase())}return l},[]);this._updateToolInfoLoading("export",!0),this._csvExporting=!0,this.mapView?.map&&await $(this.mapView.map,t,!1,!1,!0,a,!0,!0),this._updateToolInfoLoading("export",!1),this._csvExporting=!1}async _queryRelatedFeatures(){let e=this._relatedFeatureTable?this._relatedFeatureTable?this._relatedFeatureTable.layer:this._relatedFeatureTable.tableParent?.layer:this._layer,t=this._relatedFeatureTable?.tableParent?.highlightIds?.items[0],i=this._relatedFeatureTable?.tableParent?.layer,s=e?.relationships?.find(l=>i.relationships?.some(h=>h.id===l.id)),a=new R({objectIds:[t],outFields:["*"],relationshipId:s?.id});return t&&a&&await i.queryRelatedFeatures(a).catch(async l=>{console.error(l)})}_updateToolInfoLoading(e,t){this._toolInfos.some(i=>i?.icon===e?(i.loading=t,!0):!1)}async _refresh(e,t){if(t||await this._validateActiveEdits([],this.selectedIds)){this._table&&await this._table.refresh(),this._relatedFeatureTable&&await this._relatedFeatureTable.refresh(),this._allIds=await this.queryAllIds();let i=this._getSelectedLayer(this.selectedRelatedIds);if(i&&this.relatedRecordToggled.emit(i),!e){let s=this._getSelectedIds();this.featureSelectionChange.emit(s)}}}_getSelectedIds(){let e;return this._relatedFeatureTable?this.selectedRelatedIds.length>0?e=this.selectedRelatedIds:e=this._relatedFeatureTable.tableParent?.highlightIds.toArray()??[]:e=this.selectedIds,e}_getSelectedLayer(e){let t;return this._relatedFeatureTable?e.length>0?t=this._relatedFeatureTable.layer:t=this._relatedFeatureTable.tableParent?.layer:t=this._layer,t}async _clearSearchText(){if(this._searchNode.value){this._searchNode.value.value="";let e={target:{value:""}};await this._searchTextChanged(e)}}async _zoom(){this._layer&&this.mapView&&await I(this.selectedIds,this._selectedLayerView,this.mapView,!0,void 0,this.zoomToScale)}async _layerSelectionChanged(e){let t=e.detail[0];if(t!==this._layer?.id||this._featuresEmpty()){this._fetchingData=!0,await this._clearSearchText();let i=this.mapView&&await w(this.mapView,t);i&&await i.when(async()=>{this._selectedLayerView=!i.isTable&&this.mapView?await H(this.mapView,i.id):null,this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._shouldUpdateTableOnExtentChange=!0,this._layer=i,await this._initToolInfos(),this._getFullTextSearchInfo()})}this._creatingFeature=!1,this._fetchingData=!1}_getColumnTemplates(e,t,i){let s=this._getLayerOption(e),a=this._layer?.attributeTableTemplate?.elements,l=[];a?.length>0&&this.honorMapFieldSettings&&(l=a.map(n=>n.fieldName));let h=s?.fields&&s?.fieldOrder?s.fieldOrder.filter(n=>s?.fields&&s.fields.indexOf(n)>-1):l.length>0?l:void 0,r;return t&&(r=t.reduce((n,d)=>{let _={type:"field",fieldName:d.name,label:this.getFieldLabel(d,i),menuConfig:this._getMenuConfig(d.name)};return s&&s.fields&&s?.fields?.length>0?s.fields.indexOf(d.name)>-1&&n.push(_):l.length>0?l.indexOf(d.name)>-1&&n.push(_):n.push(_),n},[])),r?h?r?.sort(this._sortFields.bind(this,h)):r:[]}updateRelatedAttachmentColumns(){let e=this._getLayerOption(this._layer?.id||""),t=this.hasAttachmentsEnabled(this._layer),i=!0,s="attachments",a=(e?.extraFields||[]).reduce((h,r)=>(r.startsWith("related:")?h.related.push(r.split("related:")[1]):h.extra.push(r),h),{related:[],extra:[]}),l=a.extra.some(h=>h.toLowerCase()===s);a&&(t=l&&t,i=a.related.length>0,this._table?.columns.forEach(h=>{h.fieldName.startsWith("EsriFeatureTableRelationshipColumn")&&(h.hidden=!a.related.some(r=>r.toLowerCase()===(h.effectiveLabel||"").toLowerCase())),h.fieldName.startsWith("EsriFeatureTableAttachmentsColumn")&&(h.hidden=!a.extra.some(r=>r.toLowerCase()===h.effectiveLabel.toLowerCase()))})),this._table.relatedRecordsEnabled=i,this._table.attachmentsEnabled=t}getFieldLabel(e,t){let i=e.alias?e.alias:e.name;return t?.some(s=>s.fieldName===e.name?(i=s.label,!0):!1),i||e.name}_sortFields(e,t,i){return e?.indexOf(t.fieldName)-e.indexOf(i.fieldName)}_getMenuConfig(e){return{items:[{label:this._translations.hideField,icon:"view-hide",autoCloseMenu:!0,clickFunction:()=>{this._handleHideClick(e)}}]}}_handleHideClick(e){this._columnsInfo&&this._table&&(this._columnsInfo[e]=!1,this._table.hideColumn(e),this._table.tableTemplate&&this._table.tableTemplate.columnTemplates.forEach(t=>{t.fieldName===e&&(t.visible=!1)}))}};S("layer-table",T);return T},"widgets/FeatureTable","core/reactiveUtils","rest/support/RelationshipQuery","widgets/FeatureTable/support/TableTemplate",a,d,e,h,i)
|
|
2
|
+
import i from"./QU25YPPX.js";import{a as L}from"./C4T4HSG2.js";import h from"./FS5WR74E.js";import e from"./UBEU6ULP.js";import d from"./2C4DK6YC.js";import a from"./WV7QX3ED.js";import{a as O}from"./XF5N3NI5.js";import{b as S}from"./2I5LGZNX.js";import{E as b,F as g,G as x,I as y,h as E,i as o,l as f,q as c,t as F}from"./FFF5HUPM.js";export default $arcgis.t(([M,p,R,v,{c:A},{c:H,d:w,j:I},{n:C},{i:m},{b:$}])=>{var V=E`@layer{:host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.display-none{display:none}.table-border{border:1px solid var(--calcite-color-border-2)}.border-end{border-inline-end:1px solid var(--calcite-color-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51-px{height:51px}.height-50-px{height:50px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir=rtl] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-color-surface-1)}.text-color{color:var(--calcite-color-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-color-status-danger)}.esri-feature-table vaadin-grid{border:none!important}vaadin-grid-cell-content{font-size:14px!important;color:var(--calcite-color-text-3)!important}.absolute-right{position:absolute;right:0;left:unset}html[dir=rtl] .absolute-right{left:0;right:unset}.disabled{cursor:default!important;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.actions-end{height:50px!important;display:inline-flex}.border-top{border-top:1px solid var(--calcite-color-border-2)}.modal{--calcite-dialog-content-space: 0}.esri-feature-table__table-container{height:100%}.search-container{background-color:var(--calcite-color-surface-2)!important}.search{--calcite-color-border-input: var(--calcite-color-border-3);width:60%;padding:10px}.delete-red{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-color-text-1: var(--calcite-color-status-danger);--calcite-color-text-3: var(--calcite-color-status-danger)}.label-override{white-space:nowrap}.padding-start-1-4{padding-inline-start:.5rem}.panel-header-override{--calcite-panel-header-content-space: 0px}.danger-label-color{color:var(--calcite-color-status-danger)}.danger-icon-color{--calcite-icon-color: var(--calcite-color-status-danger)}.width-51{width:51px}.height-51{height:51px}calcite-action-bar{--calcite-internal-action-bar-gap: 0px;--calcite-internal-action-bar-padding: 0px}}`,T=class extends x{constructor(){super(),this.defaultGlobalId=[],this.defaultLayerId="",this.defaultOid=[],this.enableAutoRefresh=!1,this.enableColumnReorder=!0,this.enableCSV=!1,this.enableInlineEdit=!1,this.enableShare=!1,this.enableTableAutosave=!0,this.featureSelectionMode="multiple",this.selectedRelatedIds=[],this.honorMapFieldSettings=!1,this.isMobile=!1,this.mapHidden=!1,this.showOnlyUpdatableLayers=!1,this.selectedIds=[],this.shareIncludeEmbed=!1,this.shareIncludeSocial=!1,this.showNewestFirst=!1,this.zoomAndScrollToSelected=!1,this.pasteEnabled=!1,this.showCopyPasteActions=!1,this.layerIds=[],this._allIds=[],this._configLayerOrderDefined=!1,this._csvExporting=!1,this._fetchingData=!1,this._hideTable=!1,this._filterActive=!1,this._selectAllActive=!1,this._showHideOpen=!1,this._showOnlySelected=!1,this._toolInfos=[],this._translations=O({name:"layer-table",blocking:!0}),this._fullTextSearchInfo=[],this._searchPlaceHolder="",this._size=0,this._queryingData=!1,this._editEnabled=!1,this._enabledLayerIds=[],this._defaultGlobalIdHonored=!1,this._defaultOidHonored=!1,this._deleteEnabled=!1,this._floorExpression="",this._floorField="",this._floorLevel="",this._loaded=!1,this._shareNode=b(),this._toolbar=b(),this._searchExpression="",this._skipEditCheck=!1,this._tempSelectedIds=[],this._outOFExtentOids=[],this._shouldUpdateTableOnExtentChange=!0,this._creatingFeature=!1,this._searchNode=b(),this._layerEditsHandles=[],this._pastedFeaturesIds=[],this._shouldSelectCreatedFeatures=!1,this.columnReorder=c(),this.featureSelectionChange=c(),this.toggleFilter=c(),this.showDelete=c(),this.relatedRecordToggled=c(),this.editMultipleFeatures=c(),this.copyFeatures=c(),this.pasteFeatures=c(),this.featuresAdded=c(),this.initCreateComponent=c(),this.requestLayerSelectionChange=c(),this.listenOn(window,"beforeMapInfoChange",this.beforeMapInfoChange,{capture:!0}),this.listenOn(window,"editorInitialized",this.editorInitialized),this.listenOn(window,"closeEdit",this.closeEdit),this.listenOn(window,"selectionChanged",this.selectionChanged),this.listenOn(window,"beforeLayerSelectionChange",this.beforeLayerSelectionChange),this.listenOn(window,"layerSelectionChange",this.layerSelectionChange),this.listenOn(window,"editsComplete",this.editsComplete),this.listenOn(window,"facilityChanged",this.facilityChanged),this.listenOn(window,"levelChanged",this.levelChanged),this.listenOn(window,"siteChanged",this.siteChanged),this.listenOn(window,"noLayersFound",this.noLayersFound),this.listenOn(window,"clearSelection",this.clearSelection),this.listenOn(window,"mapChanged",this.mapChanged),this.listenOn(window,"featuresSelected",this.featuresSelected),this.listenOn(window,"createWorkFlowStarted",this.createWorkFlowStarted),this.listenOn(window,"backFromCreateWorkFlow",this.backFromCreateWorkFlow),this.listenOn(window,"pasteFeatures",this._pasteFeatures),this.listenOn(window,"featuresPasted",this._featuresPasted),L(window)}static{this.properties={appLayout:1,defaultGlobalId:0,defaultLayerId:1,defaultOid:0,enableAutoRefresh:5,enableColumnReorder:5,enableCSV:5,enableInlineEdit:5,enableShare:5,enableTableAutosave:5,featureSelectionMode:1,selectedRelatedIds:0,honorMapFieldSettings:5,isMobile:5,mapHidden:5,mapInfo:0,mapView:0,showOnlyUpdatableLayers:5,selectedIds:0,shareIncludeEmbed:5,shareIncludeSocial:5,showNewestFirst:5,zoomAndScrollToSelected:5,zoomToScale:9,pasteEnabled:5,showCopyPasteActions:5,layerIds:0,_allIds:16,_configLayerOrderDefined:16,_csvExporting:16,_fetchingData:16,_hideTable:16,_filterActive:16,_layer:16,_selectAllActive:16,_showHideOpen:16,_showOnlySelected:16,_toolInfos:16,_translations:16,_fullTextSearchInfo:16,_searchPlaceHolder:16,_size:16,_queryingData:16}}static{this.styles=V}static{this.shadowRootOptions=F}willUpdate(e){if(e.has("appLayout")&&this.appLayoutWatchHandler(),e.has("defaultOid")&&this.defaultOidWatchHandler(),e.has("defaultGlobalId")&&this.defaultGlobalIdWatchHandler(),e.has("enableCSV")&&this.enableCSVWatchHandler(),e.has("enableInlineEdit")&&this.enableInlineEditWatchHandler(),e.has("mapHidden")&&this.mapHiddenWatchHandler(),e.has("isMobile")&&this.isMobileWatchHandler(),e.has("mapInfo")&&this.mapInfoWatchHandler(),e.has("mapView")&&this.mapViewWatchHandler(),e.has("_layer")&&this._layerWatchHandler(),e.has("selectedIds")&&(this.hasUpdated||JSON.stringify(e.get("selectedIds"))!==JSON.stringify(this.selectedIds))&&this.selectedIdsWatchHandler(),e.has("selectedRelatedIds")&&(this.hasUpdated||JSON.stringify(e.get("selectedRelatedIds"))!==JSON.stringify(this.selectedRelatedIds))&&this.selectedRelatedIdsWatchHandler(),e.has("enableTableAutosave")&&this.hasUpdated&&this._table&&(this._table.autoSaveEnabled=this.enableTableAutosave),e.has("_translations")){let t=this._translations._lang,i=e.get("_translations")?._lang;t&&i&&t!==i&&this._initToolInfos()}if(e.has("pasteEnabled")&&this.hasUpdated){let t=this._toolInfos.find(i=>i.icon==="paste-with-attribute");t&&(t.disabled=!this.pasteEnabled)}e.has("layerIds")&&this.hasUpdated&&this._addListenersForLayers()}async appLayoutWatchHandler(){await this._initToolInfos(),this._updateShareUrl()}async defaultOidWatchHandler(){await this._handleDefaults()}async defaultGlobalIdWatchHandler(){await this._handleDefaults()}async enableCSVWatchHandler(){this._toolInfos?.length>0&&await this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}async mapHiddenWatchHandler(){this._toolInfos?.length>0&&await this._initToolInfos()}async isMobileWatchHandler(){!this._toolInfos&&!this.isMobile&&await this._initToolInfos()}async mapInfoWatchHandler(){this._configLayerOrderDefined="configLayerOrder"in(this.mapInfo?.layerOptions||{}),this._enabledLayerIds=C(this.mapInfo?.layerOptions?.layers||[],this.mapInfo?.layerOptions?.configLayerOrder),this._table&&(this._resetColumnTemplates(),this._sortTable(),await this._initToolInfos())}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._floorExpression="",this._searchExpression="",this.mapView.highlights=[{name:"default",color:"#00FFFF"},{name:"current-selection",color:"#ff00ff"},{name:"temporary",color:"#FFFF00"}],this._updateShareUrl(),this._mapClickHandle=p.on(()=>this.mapView,"click",e=>{this._creatingFeature||this._mapClicked(e)}))}async _layerWatchHandler(){if(this._hideTable=!1,this._fetchingData=!0,!this._layer){this._fetchingData=!1,this._hideTable=!0;return}try{await this._layer.when(),this._floorField=this._layer.floorInfo?.floorField||"",this._updateFloorDefinitionExpression(),await this._resetTable(),this._updateShareUrl()}catch(e){console.error(e),this._hideTable=!0}finally{this._fetchingData=!1}}async selectedIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this.selectedIds.length!==this._allIds.length&&(this._selectAllActive=!1),this.selectedIds.length>0&&(this._table.rowHighlightIds.removeAll(),this._table.rowHighlightIds.add(this.selectedIds[0])),this.selectedIds.length===0&&setTimeout(()=>{this.featureSelectionChange.emit(this.selectedIds)},700)}async selectedRelatedIdsWatchHandler(){this._validateEnabledActions(),this.selectedRelatedIds.length>0&&(this._relatedFeatureTable?.rowHighlightIds.removeAll(),this._relatedFeatureTable?.rowHighlightIds.add(this.selectedRelatedIds[0]))}async closeFilter(){await this._closeFilter()}async filterReset(){this._filterByExtentHandle&&(this._table&&(this._table.filterGeometry=void 0),this._filterByExtentHandle.remove(),this._filterByExtentHandle=void 0),await this._handleFilterListReset()}async filterUpdate(e,t){await this._handleFilterUpdate(e),t?(this._shouldUpdateTableOnExtentChange=!0,this._handleTableOnMapExtent()):t===!1&&(this._table&&(this._table.filterGeometry=void 0),this._filterByExtentHandle?.remove(),this._filterByExtentHandle=void 0,await this._updateAllIds())}async validateTableUpdate(e){this._shouldUpdateTableOnExtentChange=e}async validateActiveEdits(){return this._validateActiveEdits([],this.selectedIds)}async refresh(){this._table&&await this._refresh()}async setColumnOrder(e){this._setColumnTemplates(e)}async beforeMapInfoChange(e){let t=e.detail.ref,i=e.detail.mapInfo;if(this._hasPendingEdits()){e.preventDefault();let s=await this._validateActiveEdits([],this.selectedIds);await t.setMapByID(s?i.id:e.detail.currentId,!s)}}async editorInitialized(e){this._shouldUpdateTableOnExtentChange=!1,this._editor=e.detail}async closeEdit(){this._shouldUpdateTableOnExtentChange=!0,this._filterByExtentHandle&&this._handleTableOnMapExtent(),this._editor=void 0}async selectionChanged(e){let t=e.detail.selectedFeature[0],i=Number(t.getObjectId()),s=this._table;if(s.rowHighlightIds.length&&s.rowHighlightIds.removeAll(),s.rowHighlightIds.add(i),this._highlightFeatures(i),this.zoomAndScrollToSelected&&s&&this.mapView){let a=s.viewModel.getObjectIdIndex(i);s.scrollToIndex(a);let l=t.layer,h=this.mapView.allLayerViews.toArray(),r;h.some(async n=>n.layer.title===l?.title&&n.layer.type==="feature"?(r=n,this.mapView&&await I([i],r,this.mapView,!0,void 0,this.zoomToScale),!0):!1)}}async beforeLayerSelectionChange(e){if(this._hasPendingEdits()){e.preventDefault();let t=e.detail.ref,i=await this._validateActiveEdits([],this.selectedIds);return e.detail.selectedIds?await t.setLayerByIds(i?e.detail.newIds:e.detail.currentIds,!0):await t.setLayerById(i?e.detail.newId:e.detail.currentId,!0)}}async layerSelectionChange(e){await this._layerSelectionChanged(e)}async editsComplete(e){let t=e.detail;(t==="delete"||t==="add")&&(this._allIds=await this.queryAllIds()),await this._refresh()}async facilityChanged(e){this._updateFloorDefinitionExpression()}async levelChanged(e){this._floorLevel=e.detail,this._updateFloorDefinitionExpression()}async siteChanged(e){this._updateFloorDefinitionExpression()}async noLayersFound(){this._layer=void 0,this._allIds=[],this._size=0,this._clearSelection()}async clearSelection(){await this._validateActiveEdits([],this.selectedIds)&&this._clearSelection()}async mapChanged(){this._queryingData=!1,this._creatingFeature=!1,this._clearSelection()}async featuresSelected(e){e.detail.forEach(t=>{let i=this._table?.highlightIds.indexOf(t);i&&i<0&&this._table?.highlightIds.add(t)})}createWorkFlowStarted(){this._creatingFeature=!0}backFromCreateWorkFlow(){this._creatingFeature=!1}_pasteFeatures(){this._layer?.isTable||this._zoom()}_featuresPasted(){this._shouldSelectCreatedFeatures=!0}async load(){await this._initToolInfos()}render(){let e=this._fetchingData||this._hideTable?"display-none":"height-full",t=this._fetchingData?"":"display-none",i=this._queryingData?"":"display-none",s=this._size.toString(),a=this.selectedIds.length.toString(),l=this.isMobile?"height-full":"height-full-adjusted",h=this._canShowFullTextSearch();return this._validateActiveActions(),o`<div><calcite-scrim class=${y(i)} .loading=${this._queryingData}></calcite-scrim><calcite-shell><div class=${`width-full ${l}`}><calcite-panel class="height-full width-full panel-header-override">${this._getMapLayerPicker("header-actions-start")}${!this.isMobile&&o`${this._getTableControlRow("header-content")}${this._getActionsEnd("header-actions-end")}`||""}${h&&o`<div class="search-container border-bottom"><calcite-input class=search clearable icon=search @calciteInputChange=${r=>{this._searchTextChanged(r)}} .placeholder=${this._searchPlaceHolder} title=${this._searchPlaceHolder??f} type=search ${g(this._searchNode)}></calcite-input></div>`||""}<calcite-loader class=${y(t)} .label=${this._translations.fetchingData} scale=l></calcite-loader><div class=${y(e)} ${g(this.onTableNodeCreate)}></div></calcite-panel></div>${this.isMobile?void 0:o`<div class="bottom-left text-color height-19" id=solutions-selected-count-div>${(this._translations.recordsTotal?.replace("{{total-number-of-records}}",s)+" | "+this._translations.recordsSelected.replace("{{selected-number-of-records}}",a)).replace("{{total}}",s).replace("{{selected}}",a)}</div>`}</calcite-shell></div>`}updated(){this._table&&this.updateRelatedAttachmentColumns()}async _searchTextChanged(e){this._fullTextSearchInfo.forEach(t=>{t.searchTerm=e.target.value}),this._searchFullText()}async _searchFullText(){let e=[],t=!1;if(this._showOnlySelected)e=this._tempSelectedIds,t=!0;else if(await this._validateActiveEdits([],this.selectedIds))this._clearSelection(),this._tempSelectedIds=[];else return;this._searchExpression&&this._clearSearchDefinitionExpression();let i=[];if(this._fullTextSearchInfo?.length&&this._fullTextSearchInfo[0].searchTerm){let s=this._layer?.createQuery();s.fullText=this._fullTextSearchInfo,i=this._layer?await this._layer.queryObjectIds(s):[],t&&e?.length&&(i=i.filter(a=>e.includes(a))),await this._updateSearchDefinitionExpression(i?.length?i:[-1])}t&&i?.length&&(this._showOnlySelected=!0,this._table?.highlightIds.addMany(i.reverse())),await new Promise(s=>setTimeout(s,800)),await this._updateAllIds()}_clearSearchDefinitionExpression(){let e=this._layer?.definitionExpression;this._searchExpression&&e&&e?.indexOf(this._searchExpression)>-1&&this._layer&&(e?.indexOf(" AND ("+this._searchExpression)>-1?this._layer.definitionExpression=e.replace(` AND (${this._searchExpression})`,""):this._layer.definitionExpression=e.replace(this._searchExpression,"")),this._searchExpression=""}async _updateSearchDefinitionExpression(e){let t=this._layer?.definitionExpression;if(this._layer)if(e?.length){let i=`objectId in(${e})`;this._layer.definitionExpression=this._searchExpression&&t&&t.includes(this._searchExpression)?t.replace(this._searchExpression,i):t?`${t} AND (${i})`:i,this._searchExpression=i}else this._clearSearchDefinitionExpression()}_canShowFullTextSearch(){return this._layer?.capabilities?.query?.supportsFullTextSearch&&this._layer.indexes.items.filter(e=>e.indexType=="FullText").length>0}_getFullTextSearchInfo(){if(this._fullTextSearchInfo=[],this._layer?.capabilities?.query?.supportsFullTextSearch){let e=this._layer.indexes?.filter(t=>t.indexType=="FullText");if(e?.length){let t=[];e.forEach(s=>{t.push(...s.fields.split(","))});let i=[];t.forEach(s=>{let a=this._layer?.getField(s.trim());a?.alias&&i.push(a.alias)}),this._searchPlaceHolder=this._translations.searchPlaceholder.replace("{{field_names}}",i.join(", ")),this._fullTextSearchInfo.push({onFields:["*"],searchTerm:"",searchType:"prefix"})}}}_getMapLayerPicker(e){let t=this.isMobile?"display-none":"";return o`<div class=${`border-end ${t}`} id=solutions-map-layer-picker-container slot=${e??f}><map-layer-picker appearance=transparent .configLayerOrderDefined=${this._configLayerOrderDefined} .defaultLayerId=${this.defaultLayerId} display=inline-flex .enabledLayerIds=${this._enabledLayerIds} height=50 .isMobile=${this.isMobile} .mapView=${this.mapView} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} placeholder-icon=layers scale=l .selectedIds=${this._layer?[this._layer?.id]:[]} show-single-layer-as-label show-tables type=dropdown></map-layer-picker></div>`}_getLayerOption(e){let t;return this.mapInfo?.layerOptions?.layers.some(i=>i.id===e?(t=i,!0):!1),t}_getActionsEnd(e){let t=this._relatedFeatureTable?this._relatedFeatureTable.layer:this._layer,i=this._relatedFeatureTable||this._table,s=this._getLayerOption(t?.id||"");return o`<div class="display-flex" slot=${e??f}><field-selection .configExtraFields=${s?.extraFields} .layer=${t} .mapView=${this.mapView} .table=${i} .tableRef=${this.el}></field-selection>${this.enableShare&&!this.isMobile?this._getShare("share"):void 0}</div>`}_getTableControlRow(e){return o`<div class=${"height-51-px width-full display-flex"} slot=${e??f} ${g(this._toolbar)}>${this._getActionBar()}</div>`}_getActionBar(){return o`<calcite-action-bar class=width-full expand-disabled id=${this._getId("bar")??f} layout=horizontal><calcite-action-group>${this.isMobile?void 0:this._getActions()}</calcite-action-group></calcite-action-bar>`}_getActions(){return this._toolInfos?.reduce((e,t)=>(t&&e.push(t.isDanger?this._getDangerAction(t.icon,t.label,t.func,t.disabled):this._getAction(t.active,t.icon,t.indicator,t.label,t.func,t.disabled,!!t.loading,t.toolTip)),e),[])}_validateEnabledActions(){let e=this._getIds().length,t=["zoom-to-object","pencil","trash","erase","selected-items-filter","copy"];this._toolInfos?.forEach(i=>{i&&t.indexOf(i.icon)>-1&&(i.disabled=i.icon==="pencil"?e<2||e>m:e<1,i.toolTip=i.icon==="pencil"?e>m?this._translations.featureEditLimitNotice:this._translations.editMultiple:i.toolTip)})}_validateActiveActions(){let e=["filter","list-check-all","selected-items-filter"];this._toolInfos?.forEach(t=>{t&&e.indexOf(t.icon)>-1&&(t.icon==="filter"&&(t.indicator=this._filterActive),t.icon==="list-check-all"&&(t.active=this._selectAllActive),t.icon==="selected-items-filter"&&(t.active=this._showOnlySelected,t.label=this._showOnlySelected?this._translations.showAll:this._translations.showSelected,t.toolTip=this._showOnlySelected?this._translations.showAll:this._translations.showSelected))})}async _initToolInfos(){let e=this._getIds().length>0,t=this._relatedFeatureTable?this._relatedFeatureTable.layer.isTable:this._layer?.isTable,i=this.featureSelectionMode==="multiple"&&this._layer?.capabilities?.operations.supportsUpdate,s=this._getSelectedIds().length<2||this._getSelectedIds().length>m,a=!this.mapHidden&&!t,l=!this._relatedFeatureTable&&(!this._layer?.isTable||this._hasFilterExpressions()),h=this._featuresEmpty(),r=this.featureSelectionMode==="single",n=this.enableCSV;if(this._relatedFeatureTable){let _=await this._queryRelatedFeatures();n=_&&Object.keys(_).length>0}let d=[];l&&d.push({active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this.toggleFilter.emit(),disabled:!1,toolTip:this._translations.filters}),a&&d.push({active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>{this._zoom()},disabled:!e,toolTip:this._translations.zoom}),i&&d.push({active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>this.editMultipleFeatures.emit(this._getSelectedIds()),disabled:s,toolTip:this._translations.editMultiple}),this.showCopyPasteActions&&(d.push({active:!1,icon:"copy",indicator:!1,label:this._translations.copy,func:()=>this.copyFeatures.emit({featuresIds:this._getIds(),layerId:this._layer?.id}),disabled:!e,toolTip:this._translations.copy}),d.push({active:!1,icon:"paste-with-attribute",indicator:!1,label:this._translations.paste,func:()=>this.pasteFeatures.emit(),disabled:!this.pasteEnabled,toolTip:this._translations.paste})),this._deleteEnabled&&d.push({active:!1,icon:"trash",indicator:!1,label:this._translations.delete,func:()=>this._showDelete(),disabled:!e,isDanger:!0,toolTip:this._translations.delete}),d.push({active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>{this.clearSelection()},disabled:!e,toolTip:this._translations.clearSelection}),this._relatedFeatureTable||d.push({active:!1,icon:"selected-items-filter",indicator:!1,label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!e,toolTip:this._showOnlySelected?this._translations.showAll:this._translations.showSelected}),!r&&!this._relatedFeatureTable&&d.push({active:!1,icon:"list-check-all",indicator:!1,func:async()=>await this._selectAll(),label:this._translations.selectAll,disabled:h,toolTip:this._translations.selectAll}),!r&&!this._relatedFeatureTable&&d.push({active:!1,icon:"compare",indicator:!1,func:async()=>await this._switchSelected(),label:this._translations.switchSelected,disabled:h,toolTip:this._translations.switchSelected}),d.push({active:!1,icon:"refresh",indicator:!1,func:()=>{this._refresh()},label:this._translations.refresh,disabled:!1,toolTip:this._translations.refresh}),n&&d.push({active:!1,icon:"export",indicator:!1,func:()=>{this._exportToCSV()},label:this._translations.exportCSV,loading:this._csvExporting,disabled:h,toolTip:this._translations.exportCSV}),this._toolInfos=[...d]}async _addListenersForLayers(){this._layerEditsHandles.forEach(i=>i.remove()),this._layerEditsHandles=[];let e=this.mapView,t=[...new Set(this.layerIds)];if(!(!e||t.length===0))for(let i of t){let s=await w(e,i);if(!s)continue;let a=s.on("edits",async l=>{let h=Array.isArray(l?.addedFeatures)?l.addedFeatures:[],r=Array.isArray(l?.updatedFeatures)?l.updatedFeatures:[];if(h.length===0&&r.length===0)return;let n=h.map(u=>u.objectId).filter(u=>u!=null),d=r.map(u=>u.objectId).filter(u=>u!=null);if(n.length===0&&d.length===0)return;let _=this._layer?.id;if(this._shouldSelectCreatedFeatures){await this._selectFeatures(n,i),i===_&&this.featuresAdded.emit(n);return}else i===_&&n.length>0?(this._searchExpression&&(await this._refresh(),this._clearSelection(),await this._searchFullText()),await this._refresh(),this.initCreateComponent.emit()):i===_&&d.length>0&&this._searchExpression&&(await this._selectFeatures(d,i),await this._refresh())});a&&this._layerEditsHandles.push(a)}}async _selectFeatures(e,t){try{let i=this._layer?.id;if(t===i){await this._refresh(!1,!0),this._clearSelection(),this._searchExpression&&await this._searchFullText();let s=[];for(let a of e)this._allIds.includes(a)&&s.push(a);s.length>0?this._table?.highlightIds.addMany(s):await this._refresh()}else this._clearSelection(),this._pastedFeaturesIds=e,this.requestLayerSelectionChange.emit(t);this._shouldSelectCreatedFeatures=!1}catch(i){this._shouldSelectCreatedFeatures=!1,console.error("Failed processing layer edits event",{layerId:t,error:i})}}_updateFloorDefinitionExpression(){if(this._floorField&&this._floorLevel){let e=`${this._floorField} = '${this._floorLevel}'`,t=this._layer?.definitionExpression;this._layer&&(this._layer.definitionExpression=t&&this._floorExpression&&t?.indexOf(this._floorExpression)>-1?t.replace(this._floorExpression,e):t?`${t} AND (${e})`:e),this._floorExpression=e}}_featuresEmpty(){return this._allIds?.length===0}_hasFilterExpressions(){let e=[],t=this._layer?.id;return this.mapInfo?.filterConfig?.layerExpressions&&t!==void 0&&(e=this.mapInfo.filterConfig.layerExpressions.filter(i=>i.id===t)),e.length>0}_getAction(e,t,i,s,a,l,h,r){let n=this._layer===void 0?!0:l;return o`<calcite-action .active=${e} .disabled=${n} .icon=${t} .id=${`layer-table-${t}`} .indicator=${i} .label=${s} .loading=${h} @click=${a} text text-enabled><div class="display-flex"><span class="label-override padding-start-1-4">${s}</span></div></calcite-action>${this._getToolTip("auto",`layer-table-${t}`,r)}`}_showDelete(){this.showDelete.emit({ids:this._getIds()})}_getShare(e){return o`<div id=${this._getId(e)??f}><instant-apps-social-share class="height-51 width-51 display-flex" .embed=${this.shareIncludeEmbed} flip-rtl popover-button-icon-scale=s scale=m share-button-color=neutral share-button-type=action .socialMedia=${this.shareIncludeSocial} .view=${this.mapView} ${g(this._shareNode)}></instant-apps-social-share>${this._getToolTip("bottom",e,this._translations.share)}</div>`}_updateShareUrl(){let e=this._shareNode.value?.shareUrl;if(!e)return;let t=new URL(e);this.mapInfo?.id?t.searchParams.set("webmap",this.mapInfo.id):t.searchParams.delete("webmap"),this._layer?.id?t.searchParams.set("layer",this._layer.id):t.searchParams.delete("layer"),this.selectedIds?.length>0?t.searchParams.set("oid",this.selectedIds.reverse().join(",")):t.searchParams.delete("oid"),this.appLayout&&t.searchParams.set("applayout",this.appLayout),this.selectedRelatedIds?.length>0&&this._relatedFeatureTable?.layer?.id&&(t.searchParams.set("oid",this.selectedRelatedIds.join(",")),t.searchParams.set("layer",this._relatedFeatureTable?.layer?.id.toString())),this._shareNode.value&&(this._shareNode.value.autoUpdateShareUrl=!1,this._shareNode.value.shareUrl=t.href)}_getToolTip(e,t,i){return o`<calcite-tooltip .placement=${e} .referenceElement=${t}><span>${i}</span></calcite-tooltip>`}_getId(e){return`solutions-action-${e}`}_getDangerAction(e,t,i,s){let a=this._layer===void 0?!0:s;return o`<calcite-action class="delete-red" .disabled=${a} .id=${`layer-table-${e}`} .label=${t} @click=${i} text text-enabled><calcite-icon aria-hidden=true class="danger-icon-color" .icon=${e} scale=s></calcite-icon><span class="label-override padding-start-1-4 danger-label-color">${t}</span></calcite-action>${this._getToolTip("bottom",`layer-table-${e}`,t)}`}_getIds(){let e=this._relatedFeatureTable??this._table;return this._relatedFeatureTable&&this._table&&this._table.highlightIds.getItemAt(0)!==this.selectedIds[0]&&(e=this._table),e?.highlightIds.map(t=>Number.parseInt(t.toString(),10)).toArray()??[]}onTableNodeCreate(e){this._tableNode=e}async _getTable(e,t){this._layer&&(await this._layer.when(()=>{this._table=new M({autoRefreshEnabled:this.enableAutoRefresh,autoSaveEnabled:this.enableTableAutosave,layer:this._layer,view:this.mapView,columnReorderingEnabled:this.enableColumnReorder,editingEnabled:this._editEnabled&&this.enableInlineEdit,relatedRecordsEnabled:!0,attachmentsEnabled:!0,highlightEnabled:!1,multiSortEnabled:!1,visibleElements:{columnDescriptions:!1,header:!1,menu:!1,progress:!1},tableTemplate:{columnTemplates:t},container:e})}),await this._table?.when(()=>{this._table?.viewModel.addHandles(this._table.highlightIds.on("change",i=>{this._handleOnChange(i)})),this._table?.viewModel.addHandles(this._table.on("cell-pointerover",this.tempHighlightOnHover.bind(this))),this._table?.viewModel.addHandles(this._table.on("cell-pointerout",this._removeTempHighlight.bind(this))),this._table?.viewModel.addHandles(this._table.on("column-reorder",this._handleColumnReorder.bind(this))),this.listenOn(this._tableNode,"mouseleave",this._removeTempHighlight),this._table?.viewModel.addHandles(p.watch(()=>this._table.size,i=>{this._size=i})),p?.watch(()=>this._table?.relatedTable,async i=>{if(i){if(i.rowHighlightIds.length){let a={added:[i.rowHighlightIds.getItemAt(0)],removed:[]};this._handleOnChange(a)}let s=i.layer;if(this._layerEditHandle=s.on("edits",async()=>{await new Promise(a=>setTimeout(a,50)),await this._refresh(!0)}),this._checkEditEnabled(s),i.editingEnabled=this._editEnabled&&this.enableInlineEdit,i.autoSaveEnabled=this.enableTableAutosave,this._relatedFeatureTable=i,typeof i.layer?.id=="string"&&i.layer?.fields){let a=i.layer.popupTemplate?.fieldInfos,l=this._getColumnTemplates(i.layer.id,i.layer.fields,a);this._relatedFeatureTable.tableTemplate=new v({columnTemplates:l})}i.highlightIds.on("change",a=>{this._handleRelatedRecordsChange(a)})}else{this.selectedRelatedIds=[],this._relatedFeatureTable=void 0,this._layerEditHandle&&this._layerEditHandle.remove();let s=this._layer;this._refresh(),s&&this.relatedRecordToggled.emit(s),this._finishOnChange()}await this._initToolInfos()})}))}async _handleRelatedRecordsChange(e){await this._handleOnChange(e),this._updateShareUrl()}hasAttachmentsEnabled(e){if(!e?.capabilities)return!1;let{capabilities:{data:{supportsAttachment:t},operations:{supportsQueryAttachments:i}}}=e;return t&&i}async _handleOnChange(e){if(!await this._validateActiveEdits([...e.added],[...e.removed]))return;let t=[...this._getIds()],i=this._getSelectedLayer(t);this._relatedFeatureTable&&this._table?.highlightIds.getItemAt(0)!==this.selectedIds[0]&&(i=this._layer,await this._initToolInfos()),i&&this.relatedRecordToggled.emit(i),this.featureSelectionMode==="single"&&(this._relatedFeatureTable&&t.length>1?(this._relatedFeatureTable.highlightIds.remove(t[0]),t.shift()):t.length>1&&!this._selectAllActive&&(this._table?.highlightIds.remove(t[0]),t.shift())),!this._relatedFeatureTable||this._relatedFeatureTable&&this._table?.highlightIds.getItemAt(0)!==this.selectedIds[0]?(this.selectedRelatedIds=[],this.selectedIds=t.reverse(),this._tempSelectedIds=[...this.selectedIds],this._highlightFeatures(this.selectedIds[0])):this.selectedRelatedIds=t.reverse(),this._finishOnChange()}async _validateActiveEdits(e,t){let i=!0;if(this._editor&&!this._skipEditCheck){if(this._hasPendingEdits()){let s=!1;try{this._editor.activeWorkflow&&await this._editor.activeWorkflow.cancel({force:!1})}catch(a){s=a?.name==="workflow:cancel-denied"}if(s){let a=this._relatedFeatureTable&&this._relatedFeatureTable.highlightIds.length>0?this._relatedFeatureTable:this._table;i=!1,this._skipEditCheck=!0,e.length>0?a?.highlightIds.removeMany(e):t.length>0&&a?.highlightIds.addMany(t)}}}else i=!this._skipEditCheck,this._skipEditCheck=!1;return this._shouldUpdateTableOnExtentChange=i,i}_hasPendingEdits(){return this._editor?.activeWorkflow?.activeWorkflow?.hasPendingEdits}_finishOnChange(){this._showOnlySelected&&!this._relatedFeatureTable&&(this._table&&this._getSelectedIds().length>0?this._table.filterBySelectionEnabled=!0:this._toggleShowSelected());let e=this._getSelectedIds();setTimeout(()=>{this.featureSelectionChange.emit(e)},50)}_handleColumnReorder(){this.columnReorder.emit()}tempHighlightOnHover(e){if(this._removeTempHighlight(),this._selectedLayerView){let t=e.feature;this._temporaryFeatureHandle=this._selectedLayerView?.highlight([t],{name:"temporary"})}}_removeTempHighlight(){this._temporaryFeatureHandle&&this._temporaryFeatureHandle.remove()}_highlightFeatures(e){if(this._clearHighlights(),this.selectedIds.length>0&&this._selectedLayerView&&(this._currentFeatureHighlightHandle=this._selectedLayerView?.highlight([e],{name:"current-selection"}),this.selectedIds.length>1)){let t=this.selectedIds.filter(i=>i!==e);this._defaultFeaturesHandle=this._selectedLayerView?.highlight(t,{name:"default"})}}_clearHighlights(){this._removeTempHighlight(),this._currentFeatureHighlightHandle&&this._currentFeatureHighlightHandle.remove(),this._defaultFeaturesHandle&&this._defaultFeaturesHandle.remove()}_resetColumnTemplates(){if(this._layer){let e=this._layer.popupTemplate?.fieldInfos,t=this._getColumnTemplates(this._layer.id,this._layer.fields,e);t?.length===0?this._tableNode?.classList.add("display-none"):this._tableNode?.classList.remove("display-none");let i=this._table?.tableTemplate?.columnTemplates,s=i&&t&&i.length!==t.length||t?.some((a,l)=>i&&i[l]?JSON.stringify(i[l])!==JSON.stringify(a):!1);if(this._table&&t&&(s||!this._columnsInfo)){this._table.tableTemplate=new v({columnTemplates:t});let a=t.map(l=>l.fieldName);this._initColumnsInfo(a)}}}_setColumnTemplates(e){this._table&&e&&(this._table.tableTemplate=new v({columnTemplates:e}))}async _resetTable(){if(this._loaded=!1,this._clearSelection(),this._allIds=await this.queryAllIds(),!this._table&&this._layer){let e=this._layer.popupTemplate?.fieldInfos,t=this._getColumnTemplates(this._layer.id,this._layer.fields,e);this._tableNode&&await this._getTable(this._tableNode,t)}else this._table&&(this._table.view=this.mapView,this._table.layer=this._layer);await this._initLayerRefresh(),this._checkEditEnabled(this._layer),this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,this._table.autoSaveEnabled=this.enableTableAutosave,await this._table.when(),setTimeout(()=>{this._loaded||this.finishLoading()},1e3),await p.once(()=>this._table?.state==="loaded").then(async()=>{await this.finishLoading()}))}async finishLoading(){try{this._loaded=!0,this._table?.highlightIds.removeAll(),this._table.objectIds.removeAll(),this._resetColumnTemplates(),this._showOnlySelected=!1,await this._handleDefaults(),await this._sortTable(),await this._initToolInfos(),["esri-feature-table","esri-widget"].forEach(e=>{this._tableNode&&!this._tableNode.classList.contains(e)&&this._tableNode.classList.add(e)}),this._table&&this._pastedFeaturesIds.length>0&&await this._applyPastedFeatureHighlights()}catch(e){console.log(e)}}async _applyPastedFeatureHighlights(){let e=[...this._pastedFeaturesIds];await new Promise(t=>{requestAnimationFrame(()=>{this._table?.highlightIds.addMany(e),this._pastedFeaturesIds=[],t()})})}async _initLayerRefresh(){this._refreshHandle&&this._refreshHandle.remove(),this._layer&&(this._refreshHandle=this._layer.on("refresh",e=>{e.dataChanged&&this._updateAllIds()}))}async _updateAllIds(){let e=await this.queryAllIds(),t=this.selectedIds.filter(i=>this._allIds.indexOf(i)>-1);(JSON.stringify(e)!==JSON.stringify(this._allIds)||JSON.stringify(this.selectedIds)!==JSON.stringify(t))&&(this._allIds=e,this.selectedIds=t,await this._refresh())}async _handleDefaults(){if(!this._defaultOidHonored&&this.defaultOid?.length>0&&this.defaultOid[0]>-1&&this._table&&(await this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0,this.defaultOid=[],this._showOnlySelected=!1,this._toggleShowSelected()),!this._defaultGlobalIdHonored&&this.defaultGlobalId&&this.defaultGlobalId?.length>0&&this._table&&this._layer){let e=await A(this.defaultGlobalId,this._layer),t=e?.length>0?e.map(i=>Number(i.getObjectId())):void 0;t&&await this._selectDefaultFeature(t),this._defaultGlobalIdHonored=!0,this.defaultGlobalId=[],this._showOnlySelected=!1,this._toggleShowSelected()}}_initColumnsInfo(e){let t=this._table?.columns.reduce((s,a)=>((!e||e?.indexOf(a.name)>-1)&&(s[a.name]=!a.hidden),s),{}),i=this._table?.columns.map(s=>s.name);(e&&i?e.filter(s=>i.indexOf(s)<0):[]).forEach(s=>{t[s]=!0}),this._columnsInfo=e?e.reduce((s,a)=>(s[a]=t[a],s),{}):t}async _selectDefaultFeature(e){e.length>0&&this._table?.highlightIds.addMany(e)}_checkEditEnabled(e){this._editEnabled=!!(e?.editingEnabled&&e?.capabilities?.operations.supportsUpdate),this._deleteEnabled=!!(e?.editingEnabled&&e?.capabilities?.operations.supportsDelete)}async _sortTable(){let e=this._layer?.objectIdField,t="desc",i,s=this.mapInfo?.layerOptions?.layers,a=this._layer?.id;s&&s.length>0&&a!==void 0&&(i=s.filter(l=>l.id===a),i&&i.length>0&&(i=i[0],i.sortField&&i.fields?.includes(i.sortField)&&(e=i.sortField),t=i?.sortOrder?i.sortOrder:"desc")),this._table&&this._layer&&(await this._table.when(),await this._layer.when(()=>{e&&this._table?.sortColumn(e,t)}))}async _handleFilterListReset(){this._filterActive=!1,this._updateShareUrl(),await this._searchFullText()}async _handleFilterUpdate(e){if(this._floorExpression&&this._layer){let t=this._layer.definitionExpression,i=new RegExp(`${this._floorField} = ['].+[']`,"gm");this._layer.definitionExpression=t&&this._floorField&&t.indexOf(`${this._floorField} = '`)>-1?t.replace(i,this._floorExpression):t?`${t} AND (${this._floorExpression})`:this._floorExpression}this._filterActive=e,this._updateShareUrl(),await this._searchFullText()}_handleTableOnMapExtent(){this._table&&(this._filterByExtentHandle=p.when(()=>this.mapView?.stationary,async()=>{if(this._shouldUpdateTableOnExtentChange&&this.appLayout==="splitView"){if(await new Promise(e=>setTimeout(e,800)),this._table&&this.mapView){this._table.filterGeometry=this.mapView.extent;let e={geometry:this.mapView.extent},t=this._layer&&await this._layer.queryObjectIds(e),i=this.selectedIds.filter(a=>!t?.includes(a)),s=this._outOFExtentOids.filter(a=>t?.includes(a));i.length>0&&(this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._table.highlightIds.removeMany(i),this._outOFExtentOids=[...this._outOFExtentOids,...i]),s.length>0&&(this.selectedIds=[...new Set([...this.selectedIds,...s])],this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(this.selectedIds.reverse()),this._outOFExtentOids=this._outOFExtentOids.filter(a=>!s.includes(a)))}this._allIds=await this.queryAllIds()}},{initial:!0}))}async _closeFilter(){this._allIds=await this.queryAllIds()}async queryAllIds(){if(this._layer){let e=this._layer.createQuery();return e.geometry=this._filterByExtentHandle&&this.mapView?this.mapView.extent:null,e.where=this._layer.definitionExpression||"1=1",await this._layer.queryObjectIds(e)}else return[]}async _mapClicked(e){let t={include:this._layer},i=await this.mapView?.hitTest(e.screenPoint,t);if(i&&i.results.length>0){let s=i.results;if(this.featureSelectionMode==="single"){this._table?.highlightIds.removeAll();let a=s[0].graphic.getObjectId();if(a){let l=this._table?.highlightIds.indexOf(a);l!==void 0&&l<0&&this._table?.highlightIds.add(a)}}else s.forEach(a=>{let l=Number(a.graphic.getObjectId()),h=this._table?.highlightIds.indexOf(l);h&&h<0&&l&&this._table?.highlightIds.add(l)});this._showOnlySelected&&this._table&&(this._table.filterBySelectionEnabled=!0)}}async _selectAll(){let e=this._allIds,t=e.filter(i=>this.selectedIds.indexOf(i)<0);await this._validateActiveEdits(t,this.selectedIds)&&this._table?(this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(e),this.selectedIds=e,this._finishOnChange(),this._selectAllActive=!0):this._skipEditCheck=!1}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._table&&(this._table.filterBySelectionEnabled=this._showOnlySelected)}_clearSelection(){this._relatedFeatureTable||(this.selectedIds=[],this._outOFExtentOids=[],this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._table?.highlightIds.removeAll(),this._clearHighlights(),this._table?.rowHighlightIds.removeAll()),this._relatedFeatureTable&&(this._relatedFeatureTable?.highlightIds.removeAll(),this.selectedRelatedIds=[]),this._finishOnChange()}async _switchSelected(){let e=[...this.selectedIds],t=this._allIds.reduce((i,s)=>(e.indexOf(s)<0&&i.push(s),i),[]).sort((i,s)=>i-s);await this._validateActiveEdits(t,e)&&this._table?(this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(t),this.selectedIds=t,this._finishOnChange()):this._skipEditCheck=!1}async _exportToCSV(){let e=this._relatedFeatureTable?this._relatedFeatureTable.layer:this._layer;if(!e)return;let t={},i=this._getIds();if(this._relatedFeatureTable?.tableParent&&this._relatedFeatureTable.highlightIds.length===0){let l=this._relatedFeatureTable.tableParent.highlightIds?.getItemAt(0);if(l!==void 0){let h=await this._queryRelatedFeatures(),r=[];h&&h[l]?.features&&(h[l].features.forEach(n=>{n.attributes&&r.push(n.attributes[e.objectIdField])}),i=r.length>0?r:[])}}t[e.id]={selectionSetNames:[e.title||""],ids:i,layer:e};let s=this._relatedFeatureTable??this._table;if(!s)return;let a=s&&s.columns.toArray().reduce((l,h)=>{if(!h.hidden){let r=h?.name||h?.fieldName;r&&l.push(r.toLocaleLowerCase())}return l},[]);this._updateToolInfoLoading("export",!0),this._csvExporting=!0,this.mapView?.map&&await $(this.mapView.map,t,!1,!1,!0,a,!0,!0),this._updateToolInfoLoading("export",!1),this._csvExporting=!1}async _queryRelatedFeatures(){let e=this._relatedFeatureTable?this._relatedFeatureTable?this._relatedFeatureTable.layer:this._relatedFeatureTable.tableParent?.layer:this._layer,t=this._relatedFeatureTable?.tableParent?.highlightIds?.items[0],i=this._relatedFeatureTable?.tableParent?.layer,s=e?.relationships?.find(l=>i.relationships?.some(h=>h.id===l.id)),a=new R({objectIds:[t],outFields:["*"],relationshipId:s?.id});return t&&a&&await i.queryRelatedFeatures(a).catch(async l=>{console.error(l)})}_updateToolInfoLoading(e,t){this._toolInfos.some(i=>i?.icon===e?(i.loading=t,!0):!1)}async _refresh(e,t){if(t||await this._validateActiveEdits([],this.selectedIds)){this._table&&await this._table.refresh(),this._relatedFeatureTable&&await this._relatedFeatureTable.refresh(),this._allIds=await this.queryAllIds();let i=this._getSelectedLayer(this.selectedRelatedIds);if(i&&this.relatedRecordToggled.emit(i),!e){let s=this._getSelectedIds();this.featureSelectionChange.emit(s)}}}_getSelectedIds(){let e;return this._relatedFeatureTable?this.selectedRelatedIds.length>0?e=this.selectedRelatedIds:e=this._relatedFeatureTable.tableParent?.highlightIds.toArray()??[]:e=this.selectedIds,e}_getSelectedLayer(e){let t;return this._relatedFeatureTable?e.length>0?t=this._relatedFeatureTable.layer:t=this._relatedFeatureTable.tableParent?.layer:t=this._layer,t}async _clearSearchText(){if(this._searchNode.value){this._searchNode.value.value="";let e={target:{value:""}};await this._searchTextChanged(e)}}async _zoom(){this._layer&&this.mapView&&await I(this.selectedIds,this._selectedLayerView,this.mapView,!0,void 0,this.zoomToScale)}async _layerSelectionChanged(e){let t=e.detail[0];if(t!==this._layer?.id||this._featuresEmpty()){this._fetchingData=!0,await this._clearSearchText();let i=this.mapView&&await w(this.mapView,t);i&&await i.when(async()=>{this._selectedLayerView=!i.isTable&&this.mapView?await H(this.mapView,i.id):null,this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._shouldUpdateTableOnExtentChange=!0,this._layer=i,await this._initToolInfos(),this._getFullTextSearchInfo()})}this._creatingFeature=!1,this._fetchingData=!1}_getColumnTemplates(e,t,i){let s=this._getLayerOption(e),a=this._layer?.attributeTableTemplate?.elements,l=[];a?.length>0&&this.honorMapFieldSettings&&(l=a.map(n=>n.fieldName));let h=s?.fields&&s?.fieldOrder?s.fieldOrder.filter(n=>s?.fields&&s.fields.indexOf(n)>-1):l.length>0?l:void 0,r;return t&&(r=t.reduce((n,d)=>{let _={type:"field",fieldName:d.name,label:this.getFieldLabel(d,i),menuConfig:this._getMenuConfig(d.name)};return s&&s.fields&&s?.fields?.length>0?s.fields.indexOf(d.name)>-1&&n.push(_):l.length>0?l.indexOf(d.name)>-1&&n.push(_):n.push(_),n},[])),r?h?r?.sort(this._sortFields.bind(this,h)):r:[]}updateRelatedAttachmentColumns(){let e=this._getLayerOption(this._layer?.id||""),t=this.hasAttachmentsEnabled(this._layer),i=!0,s="attachments",a=(e?.extraFields||[]).reduce((h,r)=>(r.startsWith("related:")?h.related.push(r.split("related:")[1]):h.extra.push(r),h),{related:[],extra:[]}),l=a.extra.some(h=>h.toLowerCase()===s);a&&(t=l&&t,i=a.related.length>0,this._table?.columns.forEach(h=>{h.fieldName.startsWith("EsriFeatureTableRelationshipColumn")&&(h.hidden=!a.related.some(r=>r.toLowerCase()===(h.effectiveLabel||"").toLowerCase())),h.fieldName.startsWith("EsriFeatureTableAttachmentsColumn")&&(h.hidden=!a.extra.some(r=>r.toLowerCase()===h.effectiveLabel.toLowerCase()))})),this._table.relatedRecordsEnabled=i,this._table.attachmentsEnabled=t}getFieldLabel(e,t){let i=e.alias?e.alias:e.name;return t?.some(s=>s.fieldName===e.name?(i=s.label,!0):!1),i||e.name}_sortFields(e,t,i){return e?.indexOf(t.fieldName)-e.indexOf(i.fieldName)}_getMenuConfig(e){return{items:[{label:this._translations.hideField,icon:"view-hide",autoCloseMenu:!0,clickFunction:()=>{this._handleHideClick(e)}}]}}_handleHideClick(e){this._columnsInfo&&this._table&&(this._columnsInfo[e]=!1,this._table.hideColumn(e),this._table.tableTemplate&&this._table.tableTemplate.columnTemplates.forEach(t=>{t.fieldName===e&&(t.visible=!1)}))}};S("layer-table",T);return T},"widgets/FeatureTable","core/reactiveUtils","rest/support/RelationshipQuery","widgets/FeatureTable/support/TableTemplate",a,d,e,h,i)
|