@esri/solutions-components 5.0.2 → 5.0.3
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/{PNBTKFO6.js → 254AARKL.js} +1 -1
- package/dist/cdn/{VYTGCKEU.js → 2OL2CMZE.js} +1 -1
- package/dist/cdn/{5UEEUPL5.js → 3H5S6KGV.js} +1 -1
- package/dist/cdn/{XFEOA56B.js → 3NTCGBPK.js} +1 -1
- package/dist/cdn/{ASSNR5JI.js → 3QMNW3AL.js} +1 -1
- package/dist/cdn/{4CMHNL7Z.js → 3X5E5PEB.js} +1 -1
- package/dist/cdn/{TUGGGATS.js → 46N6WE5W.js} +1 -1
- package/dist/cdn/{W53A2CNH.js → 47EMI5L2.js} +1 -1
- package/dist/cdn/{RDWJHF5P.js → 4H3LGV2O.js} +1 -1
- package/dist/cdn/{2642PFUF.js → 4TZGWL7D.js} +1 -1
- package/dist/cdn/{FL74XITX.js → 5H3T3ZTG.js} +1 -1
- package/dist/cdn/{MMZXFDQZ.js → 632Z67I5.js} +1 -1
- package/dist/cdn/{BGO3JXY3.js → 65I7NFWN.js} +1 -1
- package/dist/cdn/{WZZG5H7Q.js → 6GMSPYN2.js} +1 -1
- package/dist/cdn/{LFIJXE3U.js → 6LLQFZGG.js} +1 -1
- package/dist/cdn/{Y4YYE2LG.js → 7G7GTCD2.js} +1 -1
- package/dist/cdn/{HAAFUV3J.js → 7QOFBIFO.js} +1 -1
- package/dist/cdn/{54WM76XB.js → A25PBMLE.js} +1 -1
- package/dist/cdn/{FUUWSZIZ.js → B5ARN6DC.js} +1 -1
- package/dist/cdn/{ZQJ2QLO5.js → B7LNGJY2.js} +1 -1
- package/dist/cdn/{CK7LURBK.js → BAVJY3AH.js} +1 -1
- package/dist/cdn/{YQECYE4M.js → BVBWBQGA.js} +1 -1
- package/dist/cdn/{FZ4NFB5R.js → DIG42YV7.js} +1 -1
- package/dist/cdn/{D2QNPQWY.js → E5GLDSJZ.js} +1 -1
- package/dist/cdn/{E4L5GTBZ.js → EG4OLFS7.js} +1 -1
- package/dist/cdn/F7CBQCHQ.js +2 -0
- package/dist/cdn/{LGUC7DRT.js → F7KPKXY6.js} +1 -1
- package/dist/cdn/{GJJOB4RR.js → FRM6WUOB.js} +1 -1
- package/dist/cdn/{USIESVTZ.js → GHL7S2IO.js} +1 -1
- package/dist/cdn/{M7OEPT52.js → GVHIJ3IB.js} +1 -1
- package/dist/cdn/{QXLM22NS.js → H2ZDTZJM.js} +1 -1
- package/dist/cdn/{HNRZHAOD.js → HLTPPQD5.js} +1 -1
- package/dist/cdn/{3M6AYSM7.js → IJBEMLYV.js} +1 -1
- package/dist/cdn/{VCH6XDEH.js → IKK4EKF4.js} +1 -1
- package/dist/cdn/{U75PDOJF.js → JMOT5FWT.js} +1 -1
- package/dist/cdn/{JHOXJY5O.js → JO4WX767.js} +1 -1
- package/dist/cdn/{C43NWBRR.js → KB2TRJ24.js} +1 -1
- package/dist/cdn/LI7AOAAS.js +2 -0
- package/dist/cdn/{4OZQG5MW.js → LT26PSOA.js} +1 -1
- package/dist/cdn/{OLDYKR5E.js → LYVD54Z4.js} +1 -1
- package/dist/cdn/{WDFQGUHD.js → MJM54ITG.js} +1 -1
- package/dist/cdn/{2J6ZHQEF.js → MKJGHHQA.js} +1 -1
- package/dist/cdn/{BHHQFUCH.js → MOQP5E5H.js} +1 -1
- package/dist/cdn/{N5YBX6NM.js → MQ3VVC37.js} +1 -1
- package/dist/cdn/{BFHVGXZN.js → O5B2N6WR.js} +1 -1
- package/dist/cdn/{DZUVI4S3.js → OELPVFFA.js} +1 -1
- package/dist/cdn/OWIJJGEY.js +2 -0
- package/dist/cdn/{B5SYTUTT.js → PHNGM56J.js} +1 -1
- package/dist/cdn/{ZYTKA3NP.js → PTCD4PWF.js} +1 -1
- package/dist/cdn/{5VP4DXWE.js → PUFV6POH.js} +1 -1
- package/dist/cdn/{KVR3XE7B.js → PXZF4QLN.js} +1 -1
- package/dist/cdn/{LQ3CLDU5.js → Q364IAYO.js} +1 -1
- package/dist/cdn/{ZRCMN3AQ.js → Q5CDQ25L.js} +1 -1
- package/dist/cdn/{UDTF5SYU.js → QDQVOSEM.js} +1 -1
- package/dist/cdn/{VDDTJAF2.js → QFQS5CRA.js} +1 -1
- package/dist/cdn/{N7RLYKQG.js → QKSDEEHH.js} +1 -1
- package/dist/cdn/{UR6OMPID.js → QO5AMX4U.js} +1 -1
- package/dist/cdn/{RTSKNY33.js → QRPBAR4V.js} +1 -1
- package/dist/cdn/{LTBO6VJF.js → RNEXKDUX.js} +1 -1
- package/dist/cdn/{BVWFZPY7.js → S23N6TCC.js} +1 -1
- package/dist/cdn/{6E6CKB2R.js → SHZO2XLE.js} +1 -1
- package/dist/cdn/{TAXUQXTN.js → SJEXGZK4.js} +1 -1
- package/dist/cdn/{5Z32YRHM.js → SVAPYMHV.js} +1 -1
- package/dist/cdn/{HLPUNGB5.js → TH6ZKLKN.js} +1 -1
- package/dist/cdn/{KKI72ISR.js → TZR3I4ZP.js} +1 -1
- package/dist/cdn/{AJRYDDC7.js → U2XTDZYY.js} +1 -1
- package/dist/cdn/{XUFPQNGT.js → UDOITPWM.js} +1 -1
- package/dist/cdn/{QKGOQ7EC.js → URNDQQPI.js} +1 -1
- package/dist/cdn/{UDPPJCXC.js → UW42HUTN.js} +1 -1
- package/dist/cdn/{JN4HYWSX.js → VNMG3E5D.js} +1 -1
- package/dist/cdn/{QJ4MQK3Y.js → VPNO4RA7.js} +1 -1
- package/dist/cdn/{Y3FTYVXY.js → WEWRDXGB.js} +1 -1
- package/dist/cdn/{NQF577F4.js → WUNWHJR5.js} +1 -1
- package/dist/cdn/{6EFUV7CH.js → WZGZCVBE.js} +1 -1
- package/dist/cdn/{6LPOLFT7.js → XWZ2LVEA.js} +1 -1
- package/dist/cdn/{V65IKENN.js → Y3CSVJBO.js} +1 -1
- package/dist/cdn/{KSKNVJAL.js → Y7H6OFT6.js} +1 -1
- package/dist/cdn/{55CA3AGN.js → YCKE3G3V.js} +1 -1
- package/dist/cdn/Z6D47FMI.js +2 -0
- package/dist/cdn/{NQXUGAR7.js → ZEFTAU6G.js} +1 -1
- package/dist/cdn/{BNQ63VOG.js → ZTRDNR6L.js} +1 -1
- package/dist/cdn/{JIPE2UQ3.js → ZV6LDJIX.js} +1 -1
- package/dist/cdn/{TBJLV2A3.js → ZWFXFJN5.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/runtime.js +2 -2
- package/dist/components/solution-details-panel/customElement.js +15 -14
- 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 +1 -1
- package/dist/cdn/C2MDLUTX.js +0 -2
- package/dist/cdn/NXG2TZQJ.js +0 -2
- package/dist/cdn/NZYAEBC7.js +0 -2
- package/dist/cdn/VU3OQQKP.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import c from"./KDIUYXBA.js";import a from"./UUYUTETH.js";import{a as nt}from"./LFIJXE3U.js";import"./36I27Q5R.js";import"./GDPFKW75.js";import{b as at}from"./VU3OQQKP.js";import{F as W,G as $,H as st,J as oe,h as tt,i as b,l as _e,r as L,u as it}from"./46DQNAMV.js";import{a as Te}from"./OR4HXHSY.js";export default $arcgis.t(([Jt,Qt,Zt,ei,ti,ii,si,ai,ni,Z,ri,oi,li,{g:rt},{d:Le,e:ot}])=>{var Pe=typeof self<"u"?self:global,ne=typeof navigator<"u",Lt=ne&&typeof HTMLImageElement>"u",ce=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),ke=Pe.Buffer,le=Pe.BigInt,ve=!!ke,Dt=a=>a;function de(a,e=Dt){if(ce)try{return typeof Te=="function"?Promise.resolve(e(Te(a))):import(a).then(e)}catch{console.warn(`Couldn't load ${a}`)}}var $e=Pe.fetch,Ot=a=>$e=a;if(!Pe.fetch){let a=de("http",(i=>i)),e=de("https",(i=>i)),t=(i,{headers:s}={})=>new Promise((async(n,r)=>{let{port:o,hostname:l,pathname:h,protocol:d,search:u}=new URL(i),y={method:"GET",hostname:l,path:encodeURI(h)+u,headers:s};o!==""&&(y.port=Number(o));let M=(d==="https:"?await e:await a).request(y,(x=>{if(x.statusCode===301||x.statusCode===302){let xe=new URL(x.headers.location,i).toString();return t(xe,{headers:s}).then(n).catch(r)}n({status:x.statusCode,arrayBuffer:()=>new Promise((xe=>{let et=[];x.on("data",(_t=>et.push(_t))),x.on("end",(()=>xe(Buffer.concat(et))))}))})}));M.on("error",r),M.end()}));Ot(t)}function c(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}var ue=a=>Ct(a)?void 0:a,Ft=a=>a!==void 0;function Ct(a){return a===void 0||(a instanceof Map?a.size===0:Object.values(a).filter(Ft).length===0)}function m(a){let e=new Error(a);throw delete e.stack,e}function V(a){return(a=(function(e){for(;e.endsWith("\0");)e=e.slice(0,-1);return e})(a).trim())===""?void 0:a}function Re(a){let e=(function(t){let i=0;return t.ifd0.enabled&&(i+=1024),t.exif.enabled&&(i+=2048),t.makerNote&&(i+=2048),t.userComment&&(i+=1024),t.gps.enabled&&(i+=512),t.interop.enabled&&(i+=100),t.ifd1.enabled&&(i+=1024),i+2048})(a);return a.jfif.enabled&&(e+=50),a.xmp.enabled&&(e+=2e4),a.iptc.enabled&&(e+=14e3),a.icc.enabled&&(e+=6e3),e}var Ue=a=>String.fromCharCode.apply(null,a),lt=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0;function It(a){return lt?lt.decode(a):ve?Buffer.from(a).toString("utf8"):decodeURIComponent(escape(Ue(a)))}var P=class a{static from(e,t){return e instanceof this&&e.le===t?e:new a(e,void 0,void 0,t)}constructor(e,t=0,i,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){i===void 0&&(i=e.byteLength-t);let n=new DataView(e,t,i);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof a){i===void 0&&(i=e.byteLength-t),(t+=e.byteOffset)+i>e.byteOffset+e.byteLength&&m("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,i);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else m("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,i=a){return e instanceof DataView||e instanceof a?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||m("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new i(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new a(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return It(this.getUint8Array(e,t))}getLatin1String(e=0,t=this.byteLength){let i=this.getUint8Array(e,t);return Ue(i)}getUnicodeString(e=0,t=this.byteLength){let i=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)i.push(this.getUint16(e+s));return Ue(i)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,i){switch(t){case 1:return this.getUint8(e,i);case 2:return this.getUint16(e,i);case 4:return this.getUint32(e,i);case 8:return this.getUint64&&this.getUint64(e,i)}}getUint(e,t,i){switch(t){case 8:return this.getUint8(e,i);case 16:return this.getUint16(e,i);case 32:return this.getUint32(e,i);case 64:return this.getUint64&&this.getUint64(e,i)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function Ee(a,e){m(`${a} '${e}' was not loaded, try using full build of exifr.`)}var re=class extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||Ee(this.kind,e),t&&(e in t||(function(i,s){m(`Unknown ${i} '${s}'.`)})(this.kind,e),t[e].enabled||Ee(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},k=new re("file parser"),g=new re("segment parser"),A=new re("file reader");function Rt(a,e){return typeof a=="string"?ht(a,e):ne&&!Lt&&a instanceof HTMLImageElement?ht(a.src,e):a instanceof Uint8Array||a instanceof ArrayBuffer||a instanceof DataView?new P(a):ne&&a instanceof Blob?Ve(a,e,"blob",z):void m("Invalid input argument")}function ht(a,e){return(t=a).startsWith("data:")||t.length>1e4?Be(a,e,"base64"):ce&&a.includes("://")?Ve(a,e,"url",G):ce?Be(a,e,"fs"):ne?Ve(a,e,"url",G):void m("Invalid input argument");var t}async function Ve(a,e,t,i){return A.has(t)?Be(a,e,t):i?(async function(s,n){let r=await n(s);return new P(r)})(a,i):void m(`Parser ${t} is not loaded`)}async function Be(a,e,t){let i=new(A.get(t))(a,e);return await i.read(),i}var G=a=>$e(a).then((e=>e.arrayBuffer())),z=a=>new Promise(((e,t)=>{let i=new FileReader;i.onloadend=()=>e(i.result||new ArrayBuffer),i.onerror=t,i.readAsArrayBuffer(a)})),Ne=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function p(a,e,t){let i=new Ne;for(let[s,n]of t)i.set(s,n);if(Array.isArray(e))for(let s of e)a.set(s,i);else a.set(e,i);return i}function H(a,e,t){let i,s=a.get(e);for(i of t)s.set(i[0],i[1])}var w=new Map,I=new Map,U=new Map,D=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],J=["jfif","xmp","icc","iptc","ihdr"],j=["tiff",...J],f=["ifd0","ifd1","exif","gps","interop"],O=[...j,...f],F=["makerNote","userComment"],Q=["translateKeys","translateValues","reviveValues","multiSegment"],R=[...Q,"sanitize","mergeOutput","silentErrors"],fe=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},E=class extends fe{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,i,s){if(super(),c(this,"enabled",!1),c(this,"skip",new Set),c(this,"pick",new Set),c(this,"deps",new Set),c(this,"translateKeys",!1),c(this,"translateValues",!1),c(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=f.includes(e),this.canBeFiltered&&(this.dict=w.get(e)),i!==void 0)if(Array.isArray(i))this.parse=this.enabled=!0,this.canBeFiltered&&i.length>0&&this.translateTagSet(i,this.pick);else if(typeof i=="object"){if(this.enabled=!0,this.parse=i.parse!==!1,this.canBeFiltered){let{pick:n,skip:r}=i;n&&n.length>0&&this.translateTagSet(n,this.pick),r&&r.length>0&&this.translateTagSet(r,this.skip)}this.applyInheritables(i)}else i===!0||i===!1?this.parse=this.enabled=i:m(`Invalid options argument: ${i}`)}applyInheritables(e){let t,i;for(t of Q)i=e[t],i!==void 0&&(this[t]=i)}translateTagSet(e,t){if(this.dict){let i,s,{tagKeys:n,tagValues:r}=this.dict;for(i of e)typeof i=="string"?(s=r.indexOf(i),s===-1&&(s=n.indexOf(Number(i))),s!==-1&&t.add(Number(n[s]))):t.add(i)}else for(let i of e)t.add(i)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,pe(this.pick,this.deps)):this.enabled&&this.pick.size>0&&pe(this.pick,this.deps)}},S={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},ct=new Map,_=class extends fe{static useCached(e){let t=ct.get(e);return t!==void 0||(t=new this(e),ct.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):m(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=ne?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of D)this[e]=S[e];for(e of R)this[e]=S[e];for(e of F)this[e]=S[e];for(e of O)this[e]=new E(e,S[e],void 0,this)}setupFromTrue(){let e;for(e of D)this[e]=S[e];for(e of R)this[e]=S[e];for(e of F)this[e]=!0;for(e of O)this[e]=new E(e,!0,void 0,this)}setupFromArray(e){let t;for(t of D)this[t]=S[t];for(t of R)this[t]=S[t];for(t of F)this[t]=S[t];for(t of O)this[t]=new E(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,f)}setupFromObject(e){let t;for(t of(f.ifd0=f.ifd0||f.image,f.ifd1=f.ifd1||f.thumbnail,Object.assign(this,e),D))this[t]=De(e[t],S[t]);for(t of R)this[t]=De(e[t],S[t]);for(t of F)this[t]=De(e[t],S[t]);for(t of j)this[t]=new E(t,S[t],e[t],this);for(t of f)this[t]=new E(t,S[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,f,O),e.tiff===!0?this.batchEnableWithBool(f,!0):e.tiff===!1?this.batchEnableWithUserValue(f,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,f):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,f)}batchEnableWithBool(e,t){for(let i of e)this[i].enabled=t}batchEnableWithUserValue(e,t){for(let i of e){let s=t[i];this[i].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,i,s=i){if(e&&e.length){for(let r of s)this[r].enabled=!1;let n=dt(e,i);for(let[r,o]of n)pe(this[r].pick,o),this[r].enabled=!0}else if(t&&t.length){let n=dt(t,i);for(let[r,o]of n)pe(this[r].skip,o)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:i,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),i.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:i,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),i.needed&&e.deps.add(34853),this.tiff.enabled=f.some((n=>this[n].enabled===!0))||this.makerNote||this.userComment;for(let n of f)this[n].finalizeFilters()}get onlyTiff(){return!J.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of j)this[e].enabled&&!g.has(e)&&Ee("segment parser",e)}};function dt(a,e){let t,i,s,n,r=[];for(s of e){for(n of(t=w.get(s),i=[],t))(a.includes(n[0])||a.includes(n[1]))&&i.push(n[0]);i.length&&r.push([s,i])}return r}function De(a,e){return a!==void 0?a:e!==void 0?e:void 0}function pe(a,e){for(let t of e)a.add(t)}c(_,"default",S);var v=class{constructor(e){c(this,"parsers",{}),c(this,"output",{}),c(this,"errors",[]),c(this,"pushToErrors",(t=>this.errors.push(t))),this.options=_.useCached(e)}async read(e){this.file=await Rt(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[i,s]of k)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[i]=!0;this.file.close&&this.file.close(),m("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),ue(e)}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map((async i=>{let s=await i.parse();i.assignToOutput(e,s)}));this.options.silentErrors&&(t=t.map((i=>i.catch(this.pushToErrors)))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,i=g.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),r=this.parsers.tiff=new i(n,e,t),o=await r.extractThumbnail();return t.close&&t.close(),o}};async function Ae(a,e){let t=new v(e);return await t.read(a),t.parse()}var Ut=Object.freeze({__proto__:null,parse:Ae,Exifr:v,fileParsers:k,segmentParsers:g,fileReaders:A,tagKeys:w,tagValues:I,tagRevivers:U,createDictionary:p,extendDictionary:H,fetchUrlAsArrayBuffer:G,readBlobAsArrayBuffer:z,chunkedProps:D,otherSegments:J,segments:j,tiffBlocks:f,segmentsAndBlocks:O,tiffExtractables:F,inheritables:Q,allFormatters:R,Options:_}),q=class{constructor(e,t,i){c(this,"errors",[]),c(this,"ensureSegmentChunk",(async s=>{let n=s.start,r=s.size||65536;if(this.file.chunked)if(this.file.available(n,r))s.chunk=this.file.subarray(n,r);else try{s.chunk=await this.file.readChunk(n,r)}catch(o){m(`Couldn't read segment: ${JSON.stringify(s)}. ${o.message}`)}else this.file.byteLength>n+r?s.chunk=this.file.subarray(n,r):s.size===void 0?s.chunk=this.file.subarray(n):m("Segment unreachable: "+JSON.stringify(s));return s.chunk})),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=i}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let i=new(g.get(e))(t,this.options,this.file);return this.parsers[e]=i}createParsers(e){for(let t of e){let{type:i,chunk:s}=t,n=this.options[i];if(n&&n.enabled){let r=this.parsers[i];r&&r.append||r||this.createParser(i,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}},C=class{static findPosition(e,t){let i=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,i):this.headerLength,n=t+s,r=i-s;return{offset:t,length:i,headerLength:s,start:n,size:r,end:n+r}}static parse(e,t={}){return new this(e,new _({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof P?e:new P(e)}constructor(e,t={},i){c(this,"errors",[]),c(this,"raw",new Map),c(this,"handleError",(s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)})),this.chunk=this.normalizeInput(e),this.file=i,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let i=U.get(t),s=I.get(t),n=w.get(t),r=this.options[t],o=r.reviveValues&&!!i,l=r.translateValues&&!!s,h=r.translateKeys&&!!n,d={};for(let[u,y]of e)o&&i.has(u)?y=i.get(u)(y):l&&s.has(u)&&(y=this.translateValue(y,s.get(u))),h&&n.has(u)&&(u=n.get(u)||u),d[u]=y;return d}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,i){if(this.globalOptions.mergeOutput)return Object.assign(e,i);e[t]?Object.assign(e[t],i):e[t]=i}};c(C,"headerLength",4),c(C,"type",void 0),c(C,"multiSegment",!1),c(C,"canHandle",(()=>!1));function Et(a){return a===192||a===194||a===196||a===219||a===221||a===218||a===254}function Vt(a){return a>=224&&a<=239}function Bt(a,e,t){for(let[i,s]of g)if(s.canHandle(a,e,t))return i}var ge=class extends q{constructor(...e){super(...e),c(this,"appSegments",[]),c(this,"jpegSegments",[]),c(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(g.keyList())):(e=e===void 0?g.keyList().filter((t=>this.options[t].enabled)):e.filter((t=>this.options[t].enabled&&g.has(t))),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:i,findAll:s,wanted:n,remaining:r}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some((o=>{let l=g.get(o),h=this.options[o];return l.multiSegment&&h.multiSegment})),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,i.byteLength),!this.options.onlyTiff&&i.chunked){let o=!1;for(;r.size>0&&!o&&(i.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=i,h=this.appSegments.some((d=>!this.file.available(d.offset||d.start,d.length||d.size)));if(o=e>l&&!h?!await i.readNextChunk(e):!await i.readNextChunk(l),(e=this.findAppSegmentsInRange(e,i.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let i,s,n,r,o,l,{file:h,findAll:d,wanted:u,remaining:y,options:M}=this;for(;e<t;e++)if(h.getUint8(e)===255){if(i=h.getUint8(e+1),Vt(i)){if(s=h.getUint16(e+2),n=Bt(h,e,s),n&&u.has(n)&&(r=g.get(n),o=r.findPosition(h,e),l=M[n],o.type=n,this.appSegments.push(o),!d&&(r.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=o.chunkNumber<o.chunkCount,this.unfinishedMultiSegment||y.delete(n)):y.delete(n),y.size===0)))break;M.recordUnknownSegments&&(o=C.findPosition(h,e),o.marker=i,this.unknownSegments.push(o)),e+=s+1}else if(Et(i)){if(s=h.getUint16(e+2),i===218&&M.stopAfterSos!==!1)return;M.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:i}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some((t=>t.multiSegment)))return;let e=(function(t,i){let s,n,r,o=new Map;for(let l=0;l<t.length;l++)s=t[l],n=s[i],o.has(n)?r=o.get(n):o.set(n,r=[]),r.push(s);return Array.from(o)})(this.appSegments,"type");this.mergedAppSegments=e.map((([t,i])=>{let s=g.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(i)}:i[0]}))}getSegment(e){return this.appSegments.find((t=>t.type===e))}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};c(ge,"type","jpeg"),k.set("jpeg",ge);var Nt=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],Ge=class extends C{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,i=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let r=s.size>0,o=n.size===0,l=this.chunk.getUint16(e);e+=2;for(let h=0;h<l;h++){let d=this.chunk.getUint16(e);if(r){if(s.has(d)&&(i.set(d,this.parseTag(e,d,t)),s.delete(d),s.size===0))break}else!o&&n.has(d)||i.set(d,this.parseTag(e,d,t));e+=12}return i}parseTag(e,t,i){let{chunk:s}=this,n=s.getUint16(e+2),r=s.getUint32(e+4),o=Nt[n];if(o*r<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&m(`Invalid TIFF value type. block: ${i.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&m(`Invalid TIFF value offset. block: ${i.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,r);if(n===2)return V(s.getString(e,r));if(n===7)return s.getUint8Array(e,r);if(r===1)return this.parseTagValue(n,e);{let l=new((function(d){switch(d){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}})(n))(r),h=o;for(let d=0;d<r;d++)l[d]=this.parseTagValue(n,e),e+=h;return l}}parseTagValue(e,t){let{chunk:i}=this;switch(e){case 1:return i.getUint8(t);case 3:return i.getUint16(t);case 4:return i.getUint32(t);case 5:return i.getUint32(t)/i.getUint32(t+4);case 6:return i.getInt8(t);case 8:return i.getInt16(t);case 9:return i.getInt32(t);case 10:return i.getInt32(t)/i.getInt32(t+4);case 11:return i.getFloat(t);case 12:return i.getDouble(t);case 13:return i.getUint32(t);default:m(`Invalid tiff type ${e}`)}}},te=class extends Ge{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let i=new Map;return this[t]=i,this.parseTags(e,t,i),i}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&m("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&m(`IFD0 offset points to outside of file.
|
|
2
|
+
import c from"./KDIUYXBA.js";import a from"./UUYUTETH.js";import{a as nt}from"./6LLQFZGG.js";import"./36I27Q5R.js";import"./GDPFKW75.js";import{b as at}from"./LI7AOAAS.js";import{F as W,G as $,H as st,J as oe,h as tt,i as b,l as _e,r as L,u as it}from"./46DQNAMV.js";import{a as Te}from"./OR4HXHSY.js";export default $arcgis.t(([Jt,Qt,Zt,ei,ti,ii,si,ai,ni,Z,ri,oi,li,{g:rt},{d:Le,e:ot}])=>{var Pe=typeof self<"u"?self:global,ne=typeof navigator<"u",Lt=ne&&typeof HTMLImageElement>"u",ce=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),ke=Pe.Buffer,le=Pe.BigInt,ve=!!ke,Dt=a=>a;function de(a,e=Dt){if(ce)try{return typeof Te=="function"?Promise.resolve(e(Te(a))):import(a).then(e)}catch{console.warn(`Couldn't load ${a}`)}}var $e=Pe.fetch,Ot=a=>$e=a;if(!Pe.fetch){let a=de("http",(i=>i)),e=de("https",(i=>i)),t=(i,{headers:s}={})=>new Promise((async(n,r)=>{let{port:o,hostname:l,pathname:h,protocol:d,search:u}=new URL(i),y={method:"GET",hostname:l,path:encodeURI(h)+u,headers:s};o!==""&&(y.port=Number(o));let M=(d==="https:"?await e:await a).request(y,(x=>{if(x.statusCode===301||x.statusCode===302){let xe=new URL(x.headers.location,i).toString();return t(xe,{headers:s}).then(n).catch(r)}n({status:x.statusCode,arrayBuffer:()=>new Promise((xe=>{let et=[];x.on("data",(_t=>et.push(_t))),x.on("end",(()=>xe(Buffer.concat(et))))}))})}));M.on("error",r),M.end()}));Ot(t)}function c(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}var ue=a=>Ct(a)?void 0:a,Ft=a=>a!==void 0;function Ct(a){return a===void 0||(a instanceof Map?a.size===0:Object.values(a).filter(Ft).length===0)}function m(a){let e=new Error(a);throw delete e.stack,e}function V(a){return(a=(function(e){for(;e.endsWith("\0");)e=e.slice(0,-1);return e})(a).trim())===""?void 0:a}function Re(a){let e=(function(t){let i=0;return t.ifd0.enabled&&(i+=1024),t.exif.enabled&&(i+=2048),t.makerNote&&(i+=2048),t.userComment&&(i+=1024),t.gps.enabled&&(i+=512),t.interop.enabled&&(i+=100),t.ifd1.enabled&&(i+=1024),i+2048})(a);return a.jfif.enabled&&(e+=50),a.xmp.enabled&&(e+=2e4),a.iptc.enabled&&(e+=14e3),a.icc.enabled&&(e+=6e3),e}var Ue=a=>String.fromCharCode.apply(null,a),lt=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0;function It(a){return lt?lt.decode(a):ve?Buffer.from(a).toString("utf8"):decodeURIComponent(escape(Ue(a)))}var P=class a{static from(e,t){return e instanceof this&&e.le===t?e:new a(e,void 0,void 0,t)}constructor(e,t=0,i,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){i===void 0&&(i=e.byteLength-t);let n=new DataView(e,t,i);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof a){i===void 0&&(i=e.byteLength-t),(t+=e.byteOffset)+i>e.byteOffset+e.byteLength&&m("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,i);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else m("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,i=a){return e instanceof DataView||e instanceof a?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||m("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new i(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new a(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return It(this.getUint8Array(e,t))}getLatin1String(e=0,t=this.byteLength){let i=this.getUint8Array(e,t);return Ue(i)}getUnicodeString(e=0,t=this.byteLength){let i=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)i.push(this.getUint16(e+s));return Ue(i)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,i){switch(t){case 1:return this.getUint8(e,i);case 2:return this.getUint16(e,i);case 4:return this.getUint32(e,i);case 8:return this.getUint64&&this.getUint64(e,i)}}getUint(e,t,i){switch(t){case 8:return this.getUint8(e,i);case 16:return this.getUint16(e,i);case 32:return this.getUint32(e,i);case 64:return this.getUint64&&this.getUint64(e,i)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function Ee(a,e){m(`${a} '${e}' was not loaded, try using full build of exifr.`)}var re=class extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||Ee(this.kind,e),t&&(e in t||(function(i,s){m(`Unknown ${i} '${s}'.`)})(this.kind,e),t[e].enabled||Ee(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},k=new re("file parser"),g=new re("segment parser"),A=new re("file reader");function Rt(a,e){return typeof a=="string"?ht(a,e):ne&&!Lt&&a instanceof HTMLImageElement?ht(a.src,e):a instanceof Uint8Array||a instanceof ArrayBuffer||a instanceof DataView?new P(a):ne&&a instanceof Blob?Ve(a,e,"blob",z):void m("Invalid input argument")}function ht(a,e){return(t=a).startsWith("data:")||t.length>1e4?Be(a,e,"base64"):ce&&a.includes("://")?Ve(a,e,"url",G):ce?Be(a,e,"fs"):ne?Ve(a,e,"url",G):void m("Invalid input argument");var t}async function Ve(a,e,t,i){return A.has(t)?Be(a,e,t):i?(async function(s,n){let r=await n(s);return new P(r)})(a,i):void m(`Parser ${t} is not loaded`)}async function Be(a,e,t){let i=new(A.get(t))(a,e);return await i.read(),i}var G=a=>$e(a).then((e=>e.arrayBuffer())),z=a=>new Promise(((e,t)=>{let i=new FileReader;i.onloadend=()=>e(i.result||new ArrayBuffer),i.onerror=t,i.readAsArrayBuffer(a)})),Ne=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function p(a,e,t){let i=new Ne;for(let[s,n]of t)i.set(s,n);if(Array.isArray(e))for(let s of e)a.set(s,i);else a.set(e,i);return i}function H(a,e,t){let i,s=a.get(e);for(i of t)s.set(i[0],i[1])}var w=new Map,I=new Map,U=new Map,D=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],J=["jfif","xmp","icc","iptc","ihdr"],j=["tiff",...J],f=["ifd0","ifd1","exif","gps","interop"],O=[...j,...f],F=["makerNote","userComment"],Q=["translateKeys","translateValues","reviveValues","multiSegment"],R=[...Q,"sanitize","mergeOutput","silentErrors"],fe=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},E=class extends fe{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,i,s){if(super(),c(this,"enabled",!1),c(this,"skip",new Set),c(this,"pick",new Set),c(this,"deps",new Set),c(this,"translateKeys",!1),c(this,"translateValues",!1),c(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=f.includes(e),this.canBeFiltered&&(this.dict=w.get(e)),i!==void 0)if(Array.isArray(i))this.parse=this.enabled=!0,this.canBeFiltered&&i.length>0&&this.translateTagSet(i,this.pick);else if(typeof i=="object"){if(this.enabled=!0,this.parse=i.parse!==!1,this.canBeFiltered){let{pick:n,skip:r}=i;n&&n.length>0&&this.translateTagSet(n,this.pick),r&&r.length>0&&this.translateTagSet(r,this.skip)}this.applyInheritables(i)}else i===!0||i===!1?this.parse=this.enabled=i:m(`Invalid options argument: ${i}`)}applyInheritables(e){let t,i;for(t of Q)i=e[t],i!==void 0&&(this[t]=i)}translateTagSet(e,t){if(this.dict){let i,s,{tagKeys:n,tagValues:r}=this.dict;for(i of e)typeof i=="string"?(s=r.indexOf(i),s===-1&&(s=n.indexOf(Number(i))),s!==-1&&t.add(Number(n[s]))):t.add(i)}else for(let i of e)t.add(i)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,pe(this.pick,this.deps)):this.enabled&&this.pick.size>0&&pe(this.pick,this.deps)}},S={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},ct=new Map,_=class extends fe{static useCached(e){let t=ct.get(e);return t!==void 0||(t=new this(e),ct.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):m(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=ne?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of D)this[e]=S[e];for(e of R)this[e]=S[e];for(e of F)this[e]=S[e];for(e of O)this[e]=new E(e,S[e],void 0,this)}setupFromTrue(){let e;for(e of D)this[e]=S[e];for(e of R)this[e]=S[e];for(e of F)this[e]=!0;for(e of O)this[e]=new E(e,!0,void 0,this)}setupFromArray(e){let t;for(t of D)this[t]=S[t];for(t of R)this[t]=S[t];for(t of F)this[t]=S[t];for(t of O)this[t]=new E(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,f)}setupFromObject(e){let t;for(t of(f.ifd0=f.ifd0||f.image,f.ifd1=f.ifd1||f.thumbnail,Object.assign(this,e),D))this[t]=De(e[t],S[t]);for(t of R)this[t]=De(e[t],S[t]);for(t of F)this[t]=De(e[t],S[t]);for(t of j)this[t]=new E(t,S[t],e[t],this);for(t of f)this[t]=new E(t,S[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,f,O),e.tiff===!0?this.batchEnableWithBool(f,!0):e.tiff===!1?this.batchEnableWithUserValue(f,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,f):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,f)}batchEnableWithBool(e,t){for(let i of e)this[i].enabled=t}batchEnableWithUserValue(e,t){for(let i of e){let s=t[i];this[i].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,i,s=i){if(e&&e.length){for(let r of s)this[r].enabled=!1;let n=dt(e,i);for(let[r,o]of n)pe(this[r].pick,o),this[r].enabled=!0}else if(t&&t.length){let n=dt(t,i);for(let[r,o]of n)pe(this[r].skip,o)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:i,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),i.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:i,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),i.needed&&e.deps.add(34853),this.tiff.enabled=f.some((n=>this[n].enabled===!0))||this.makerNote||this.userComment;for(let n of f)this[n].finalizeFilters()}get onlyTiff(){return!J.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of j)this[e].enabled&&!g.has(e)&&Ee("segment parser",e)}};function dt(a,e){let t,i,s,n,r=[];for(s of e){for(n of(t=w.get(s),i=[],t))(a.includes(n[0])||a.includes(n[1]))&&i.push(n[0]);i.length&&r.push([s,i])}return r}function De(a,e){return a!==void 0?a:e!==void 0?e:void 0}function pe(a,e){for(let t of e)a.add(t)}c(_,"default",S);var v=class{constructor(e){c(this,"parsers",{}),c(this,"output",{}),c(this,"errors",[]),c(this,"pushToErrors",(t=>this.errors.push(t))),this.options=_.useCached(e)}async read(e){this.file=await Rt(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[i,s]of k)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[i]=!0;this.file.close&&this.file.close(),m("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),ue(e)}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map((async i=>{let s=await i.parse();i.assignToOutput(e,s)}));this.options.silentErrors&&(t=t.map((i=>i.catch(this.pushToErrors)))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,i=g.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),r=this.parsers.tiff=new i(n,e,t),o=await r.extractThumbnail();return t.close&&t.close(),o}};async function Ae(a,e){let t=new v(e);return await t.read(a),t.parse()}var Ut=Object.freeze({__proto__:null,parse:Ae,Exifr:v,fileParsers:k,segmentParsers:g,fileReaders:A,tagKeys:w,tagValues:I,tagRevivers:U,createDictionary:p,extendDictionary:H,fetchUrlAsArrayBuffer:G,readBlobAsArrayBuffer:z,chunkedProps:D,otherSegments:J,segments:j,tiffBlocks:f,segmentsAndBlocks:O,tiffExtractables:F,inheritables:Q,allFormatters:R,Options:_}),q=class{constructor(e,t,i){c(this,"errors",[]),c(this,"ensureSegmentChunk",(async s=>{let n=s.start,r=s.size||65536;if(this.file.chunked)if(this.file.available(n,r))s.chunk=this.file.subarray(n,r);else try{s.chunk=await this.file.readChunk(n,r)}catch(o){m(`Couldn't read segment: ${JSON.stringify(s)}. ${o.message}`)}else this.file.byteLength>n+r?s.chunk=this.file.subarray(n,r):s.size===void 0?s.chunk=this.file.subarray(n):m("Segment unreachable: "+JSON.stringify(s));return s.chunk})),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=i}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let i=new(g.get(e))(t,this.options,this.file);return this.parsers[e]=i}createParsers(e){for(let t of e){let{type:i,chunk:s}=t,n=this.options[i];if(n&&n.enabled){let r=this.parsers[i];r&&r.append||r||this.createParser(i,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}},C=class{static findPosition(e,t){let i=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,i):this.headerLength,n=t+s,r=i-s;return{offset:t,length:i,headerLength:s,start:n,size:r,end:n+r}}static parse(e,t={}){return new this(e,new _({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof P?e:new P(e)}constructor(e,t={},i){c(this,"errors",[]),c(this,"raw",new Map),c(this,"handleError",(s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)})),this.chunk=this.normalizeInput(e),this.file=i,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let i=U.get(t),s=I.get(t),n=w.get(t),r=this.options[t],o=r.reviveValues&&!!i,l=r.translateValues&&!!s,h=r.translateKeys&&!!n,d={};for(let[u,y]of e)o&&i.has(u)?y=i.get(u)(y):l&&s.has(u)&&(y=this.translateValue(y,s.get(u))),h&&n.has(u)&&(u=n.get(u)||u),d[u]=y;return d}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,i){if(this.globalOptions.mergeOutput)return Object.assign(e,i);e[t]?Object.assign(e[t],i):e[t]=i}};c(C,"headerLength",4),c(C,"type",void 0),c(C,"multiSegment",!1),c(C,"canHandle",(()=>!1));function Et(a){return a===192||a===194||a===196||a===219||a===221||a===218||a===254}function Vt(a){return a>=224&&a<=239}function Bt(a,e,t){for(let[i,s]of g)if(s.canHandle(a,e,t))return i}var ge=class extends q{constructor(...e){super(...e),c(this,"appSegments",[]),c(this,"jpegSegments",[]),c(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(g.keyList())):(e=e===void 0?g.keyList().filter((t=>this.options[t].enabled)):e.filter((t=>this.options[t].enabled&&g.has(t))),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:i,findAll:s,wanted:n,remaining:r}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some((o=>{let l=g.get(o),h=this.options[o];return l.multiSegment&&h.multiSegment})),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,i.byteLength),!this.options.onlyTiff&&i.chunked){let o=!1;for(;r.size>0&&!o&&(i.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=i,h=this.appSegments.some((d=>!this.file.available(d.offset||d.start,d.length||d.size)));if(o=e>l&&!h?!await i.readNextChunk(e):!await i.readNextChunk(l),(e=this.findAppSegmentsInRange(e,i.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let i,s,n,r,o,l,{file:h,findAll:d,wanted:u,remaining:y,options:M}=this;for(;e<t;e++)if(h.getUint8(e)===255){if(i=h.getUint8(e+1),Vt(i)){if(s=h.getUint16(e+2),n=Bt(h,e,s),n&&u.has(n)&&(r=g.get(n),o=r.findPosition(h,e),l=M[n],o.type=n,this.appSegments.push(o),!d&&(r.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=o.chunkNumber<o.chunkCount,this.unfinishedMultiSegment||y.delete(n)):y.delete(n),y.size===0)))break;M.recordUnknownSegments&&(o=C.findPosition(h,e),o.marker=i,this.unknownSegments.push(o)),e+=s+1}else if(Et(i)){if(s=h.getUint16(e+2),i===218&&M.stopAfterSos!==!1)return;M.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:i}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some((t=>t.multiSegment)))return;let e=(function(t,i){let s,n,r,o=new Map;for(let l=0;l<t.length;l++)s=t[l],n=s[i],o.has(n)?r=o.get(n):o.set(n,r=[]),r.push(s);return Array.from(o)})(this.appSegments,"type");this.mergedAppSegments=e.map((([t,i])=>{let s=g.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(i)}:i[0]}))}getSegment(e){return this.appSegments.find((t=>t.type===e))}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};c(ge,"type","jpeg"),k.set("jpeg",ge);var Nt=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],Ge=class extends C{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,i=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let r=s.size>0,o=n.size===0,l=this.chunk.getUint16(e);e+=2;for(let h=0;h<l;h++){let d=this.chunk.getUint16(e);if(r){if(s.has(d)&&(i.set(d,this.parseTag(e,d,t)),s.delete(d),s.size===0))break}else!o&&n.has(d)||i.set(d,this.parseTag(e,d,t));e+=12}return i}parseTag(e,t,i){let{chunk:s}=this,n=s.getUint16(e+2),r=s.getUint32(e+4),o=Nt[n];if(o*r<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&m(`Invalid TIFF value type. block: ${i.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&m(`Invalid TIFF value offset. block: ${i.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,r);if(n===2)return V(s.getString(e,r));if(n===7)return s.getUint8Array(e,r);if(r===1)return this.parseTagValue(n,e);{let l=new((function(d){switch(d){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}})(n))(r),h=o;for(let d=0;d<r;d++)l[d]=this.parseTagValue(n,e),e+=h;return l}}parseTagValue(e,t){let{chunk:i}=this;switch(e){case 1:return i.getUint8(t);case 3:return i.getUint16(t);case 4:return i.getUint32(t);case 5:return i.getUint32(t)/i.getUint32(t+4);case 6:return i.getInt8(t);case 8:return i.getInt16(t);case 9:return i.getInt32(t);case 10:return i.getInt32(t)/i.getInt32(t+4);case 11:return i.getFloat(t);case 12:return i.getDouble(t);case 13:return i.getUint32(t);default:m(`Invalid tiff type ${e}`)}}},te=class extends Ge{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let i=new Map;return this[t]=i,this.parseTags(e,t,i),i}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&m("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&m(`IFD0 offset points to outside of file.
|
|
3
3
|
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,Re(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,Re(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let i=e.get(t);i&&i.length===1&&e.set(t,i[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",ut(...e.get(2),e.get(1))),e.set("longitude",ut(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,i,s={};for(t of f)if(e=this[t],!Ct(e))if(i=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,i)}else s[t]=i;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[i,s]of Object.entries(t))this.assignObjectToOutput(e,i,s)}};function ut(a,e,t,i){var s=a+e/60+t/3600;return i!=="S"&&i!=="W"||(s*=-1),s}c(te,"type","tiff"),c(te,"headerLength",10),g.set("tiff",te);var Gt=Object.freeze({__proto__:null,default:Ut,Exifr:v,fileParsers:k,segmentParsers:g,fileReaders:A,tagKeys:w,tagValues:I,tagRevivers:U,createDictionary:p,extendDictionary:H,fetchUrlAsArrayBuffer:G,readBlobAsArrayBuffer:z,chunkedProps:D,otherSegments:J,segments:j,tiffBlocks:f,segmentsAndBlocks:O,tiffExtractables:F,inheritables:Q,allFormatters:R,Options:_,parse:Ae}),Ke={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},Xe=Object.assign({},Ke,{firstChunkSize:4e4,gps:[1,2,3,4]});async function Me(a){let e=new v(Xe);await e.read(a);let t=await e.parse();if(t&&t.gps){let{latitude:i,longitude:s}=t.gps;return{latitude:i,longitude:s}}}var qe=Object.assign({},Ke,{tiff:!1,ifd1:!0,mergeOutput:!1});async function Pt(a){let e=new v(qe);await e.read(a);let t=await e.extractThumbnail();return t&&ve?ke.from(t):t}async function kt(a){let e=await this.thumbnail(a);if(e!==void 0){let t=new Blob([e]);return URL.createObjectURL(t)}}var Ye=Object.assign({},Ke,{firstChunkSize:4e4,ifd0:[274]});async function Je(a){let e=new v(Ye);await e.read(a);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}var Qe=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),B=!0,N=!0;if(typeof navigator=="object"){let a=navigator.userAgent;if(a.includes("iPad")||a.includes("iPhone")){let e=a.match(/OS (\d+)_(\d+)/);if(e){let[,t,i]=e;B=Number(t)+.1*Number(i)<13.4,N=!1}}else if(a.includes("OS X 10")){let[,e]=a.match(/OS X 10[_.](\d+)/);B=N=Number(e)<15}if(a.includes("Chrome/")){let[,e]=a.match(/Chrome\/(\d+)/);B=N=Number(e)<81}else if(a.includes("Firefox/")){let[,e]=a.match(/Firefox\/(\d+)/);B=N=Number(e)<77}}async function vt(a){let e=await Je(a);return Object.assign({canvas:B,css:N},Qe[e])}var ze=class extends P{constructor(...e){super(...e),c(this,"ranges",new He),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,i){if(e===0&&this.byteLength===0&&i){let s=new DataView(i.buffer||i,i.byteOffset,i.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=ve?ke.allocUnsafe(e):new Uint8Array(e);let i=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:i}}subarray(e,t,i=!1){return t=t||this._lengthToEnd(e),i&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,i=!1){i&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},He=class{constructor(){c(this,"list",[])}get length(){return this.list.length}add(e,t,i=0){let s=e+t,n=this.list.filter((r=>ft(e,r.offset,s)||ft(e,r.end,s)));if(n.length>0){e=Math.min(e,...n.map((o=>o.offset))),s=Math.max(s,...n.map((o=>o.end))),t=s-e;let r=n.shift();r.offset=e,r.length=t,r.end=s,this.list=this.list.filter((o=>!n.includes(o)))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let i=e+t;return this.list.some((s=>s.offset<=e&&i<=s.end))}};function ft(a,e,t){return a<=e&&e<=t}var Y=class extends ze{constructor(e,t){super(0),c(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,i=await this.readChunk(e,t);return!!i&&i.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};A.set("blob",class extends Y{async readWhole(){this.chunked=!1;let a=await z(this.input);this._swapArrayBuffer(a)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(a,e){let t=e?a+e:void 0,i=this.input.slice(a,t),s=await z(i);return this.set(s,a,!0)}});var zt=Object.freeze({__proto__:null,default:Gt,Exifr:v,fileParsers:k,segmentParsers:g,fileReaders:A,tagKeys:w,tagValues:I,tagRevivers:U,createDictionary:p,extendDictionary:H,fetchUrlAsArrayBuffer:G,readBlobAsArrayBuffer:z,chunkedProps:D,otherSegments:J,segments:j,tiffBlocks:f,segmentsAndBlocks:O,tiffExtractables:F,inheritables:Q,allFormatters:R,Options:_,parse:Ae,gpsOnlyOptions:Xe,gps:Me,thumbnailOnlyOptions:qe,thumbnail:Pt,thumbnailUrl:kt,orientationOnlyOptions:Ye,orientation:Je,rotations:Qe,get rotateCanvas(){return B},get rotateCss(){return N},rotation:vt});A.set("url",class extends Y{async readWhole(){this.chunked=!1;let a=await G(this.input);a instanceof ArrayBuffer?this._swapArrayBuffer(a):a instanceof Uint8Array&&this._swapBuffer(a)}async _readChunk(a,e){let t=e?a+e-1:void 0,i=this.options.httpHeaders||{};(a||t)&&(i.range=`bytes=${[a,t].join("-")}`);let s=await $e(this.input,{headers:i}),n=await s.arrayBuffer(),r=n.byteLength;if(s.status!==416)return r!==e&&(this.size=a+r),this.set(n,a,!0)}});P.prototype.getUint64=function(a){let e=this.getUint32(a),t=this.getUint32(a+4);return e<1048575?e<<32|t:typeof le!==void 0?(console.warn("Using BigInt because of type 64uint but JS can only handle 53b numbers."),le(e)<<le(32)|le(t)):void m("Trying to read 64b value but JS can only handle 53b numbers.")};var je=class extends q{parseBoxes(e=0){let t=[];for(;e<this.file.byteLength-4;){let i=this.parseBoxHead(e);if(t.push(i),i.length===0)break;e+=i.length}return t}parseSubBoxes(e){e.boxes=this.parseBoxes(e.start)}findBox(e,t){return e.boxes===void 0&&this.parseSubBoxes(e),e.boxes.find((i=>i.kind===t))}parseBoxHead(e){let t=this.file.getUint32(e),i=this.file.getString(e+4,4),s=e+8;return t===1&&(t=this.file.getUint64(e+8),s+=8),{offset:e,length:t,kind:i,start:s}}parseBoxFullHead(e){if(e.version!==void 0)return;let t=this.file.getUint32(e.start);e.version=t>>24,e.start+=4}},me=class extends je{static canHandle(e,t){if(t!==0)return!1;let i=e.getUint16(2);if(i>50)return!1;let s=16,n=[];for(;s<i;)n.push(e.getString(s,4)),s+=4;return n.includes(this.type)}async parse(){let e=this.file.getUint32(0),t=this.parseBoxHead(e);for(;t.kind!=="meta";)e+=t.length,await this.file.ensureChunk(e,16),t=this.parseBoxHead(e);await this.file.ensureChunk(t.offset,t.length),this.parseBoxFullHead(t),this.parseSubBoxes(t),this.options.icc.enabled&&await this.findIcc(t),this.options.tiff.enabled&&await this.findExif(t)}async registerSegment(e,t,i){await this.file.ensureChunk(t,i);let s=this.file.subarray(t,i);this.createParser(e,s)}async findIcc(e){let t=this.findBox(e,"iprp");if(t===void 0)return;let i=this.findBox(t,"ipco");if(i===void 0)return;let s=this.findBox(i,"colr");s!==void 0&&await this.registerSegment("icc",s.offset+12,s.length)}async findExif(e){let t=this.findBox(e,"iinf");if(t===void 0)return;let i=this.findBox(e,"iloc");if(i===void 0)return;let s=this.findExifLocIdInIinf(t),n=this.findExtentInIloc(i,s);if(n===void 0)return;let[r,o]=n;await this.file.ensureChunk(r,o);let l=4+this.file.getUint32(r);r+=l,o-=l,await this.registerSegment("tiff",r,o)}findExifLocIdInIinf(e){this.parseBoxFullHead(e);let t,i,s,n,r=e.start,o=this.file.getUint16(r);for(r+=2;o--;){if(t=this.parseBoxHead(r),this.parseBoxFullHead(t),i=t.start,t.version>=2&&(s=t.version===3?4:2,n=this.file.getString(i+s+2,4),n==="Exif"))return this.file.getUintBytes(i,s);r+=t.length}}get8bits(e){let t=this.file.getUint8(e);return[t>>4,15&t]}findExtentInIloc(e,t){this.parseBoxFullHead(e);let i=e.start,[s,n]=this.get8bits(i++),[r,o]=this.get8bits(i++),l=e.version===2?4:2,h=e.version===1||e.version===2?2:0,d=o+s+n,u=e.version===2?4:2,y=this.file.getUintBytes(i,u);for(i+=u;y--;){let M=this.file.getUintBytes(i,l);i+=l+h+2+r;let x=this.file.getUint16(i);if(i+=2,M===t)return x>1&&console.warn(`ILOC box has more than one extent but we're only processing one
|
|
4
4
|
Please create an issue at https://github.com/MikeKovarik/exifr with this file`),[this.file.getUintBytes(i+o,s),this.file.getUintBytes(i+o+s,n)];i+=x*d}}},ye=class extends me{};c(ye,"type","heic");var we=class extends me{};c(we,"type","avif"),k.set("heic",ye),k.set("avif",we),p(w,["ifd0","ifd1"],[[256,"ImageWidth"],[257,"ImageHeight"],[258,"BitsPerSample"],[259,"Compression"],[262,"PhotometricInterpretation"],[270,"ImageDescription"],[271,"Make"],[272,"Model"],[273,"StripOffsets"],[274,"Orientation"],[277,"SamplesPerPixel"],[278,"RowsPerStrip"],[279,"StripByteCounts"],[282,"XResolution"],[283,"YResolution"],[284,"PlanarConfiguration"],[296,"ResolutionUnit"],[301,"TransferFunction"],[305,"Software"],[306,"ModifyDate"],[315,"Artist"],[316,"HostComputer"],[317,"Predictor"],[318,"WhitePoint"],[319,"PrimaryChromaticities"],[513,"ThumbnailOffset"],[514,"ThumbnailLength"],[529,"YCbCrCoefficients"],[530,"YCbCrSubSampling"],[531,"YCbCrPositioning"],[532,"ReferenceBlackWhite"],[700,"ApplicationNotes"],[33432,"Copyright"],[33723,"IPTC"],[34665,"ExifIFD"],[34675,"ICC"],[34853,"GpsIFD"],[330,"SubIFD"],[40965,"InteropIFD"],[40091,"XPTitle"],[40092,"XPComment"],[40093,"XPAuthor"],[40094,"XPKeywords"],[40095,"XPSubject"]]),p(w,"exif",[[33434,"ExposureTime"],[33437,"FNumber"],[34850,"ExposureProgram"],[34852,"SpectralSensitivity"],[34855,"ISO"],[34858,"TimeZoneOffset"],[34859,"SelfTimerMode"],[34864,"SensitivityType"],[34865,"StandardOutputSensitivity"],[34866,"RecommendedExposureIndex"],[34867,"ISOSpeed"],[34868,"ISOSpeedLatitudeyyy"],[34869,"ISOSpeedLatitudezzz"],[36864,"ExifVersion"],[36867,"DateTimeOriginal"],[36868,"CreateDate"],[36873,"GooglePlusUploadCode"],[36880,"OffsetTime"],[36881,"OffsetTimeOriginal"],[36882,"OffsetTimeDigitized"],[37121,"ComponentsConfiguration"],[37122,"CompressedBitsPerPixel"],[37377,"ShutterSpeedValue"],[37378,"ApertureValue"],[37379,"BrightnessValue"],[37380,"ExposureCompensation"],[37381,"MaxApertureValue"],[37382,"SubjectDistance"],[37383,"MeteringMode"],[37384,"LightSource"],[37385,"Flash"],[37386,"FocalLength"],[37393,"ImageNumber"],[37394,"SecurityClassification"],[37395,"ImageHistory"],[37396,"SubjectArea"],[37500,"MakerNote"],[37510,"UserComment"],[37520,"SubSecTime"],[37521,"SubSecTimeOriginal"],[37522,"SubSecTimeDigitized"],[37888,"AmbientTemperature"],[37889,"Humidity"],[37890,"Pressure"],[37891,"WaterDepth"],[37892,"Acceleration"],[37893,"CameraElevationAngle"],[40960,"FlashpixVersion"],[40961,"ColorSpace"],[40962,"ExifImageWidth"],[40963,"ExifImageHeight"],[40964,"RelatedSoundFile"],[41483,"FlashEnergy"],[41486,"FocalPlaneXResolution"],[41487,"FocalPlaneYResolution"],[41488,"FocalPlaneResolutionUnit"],[41492,"SubjectLocation"],[41493,"ExposureIndex"],[41495,"SensingMethod"],[41728,"FileSource"],[41729,"SceneType"],[41730,"CFAPattern"],[41985,"CustomRendered"],[41986,"ExposureMode"],[41987,"WhiteBalance"],[41988,"DigitalZoomRatio"],[41989,"FocalLengthIn35mmFormat"],[41990,"SceneCaptureType"],[41991,"GainControl"],[41992,"Contrast"],[41993,"Saturation"],[41994,"Sharpness"],[41996,"SubjectDistanceRange"],[42016,"ImageUniqueID"],[42032,"OwnerName"],[42033,"SerialNumber"],[42034,"LensInfo"],[42035,"LensMake"],[42036,"LensModel"],[42037,"LensSerialNumber"],[42080,"CompositeImage"],[42081,"CompositeImageCount"],[42082,"CompositeImageExposureTimes"],[42240,"Gamma"],[59932,"Padding"],[59933,"OffsetSchema"],[65e3,"OwnerName"],[65001,"SerialNumber"],[65002,"Lens"],[65100,"RawFile"],[65101,"Converter"],[65102,"WhiteBalance"],[65105,"Exposure"],[65106,"Shadows"],[65107,"Brightness"],[65108,"Contrast"],[65109,"Saturation"],[65110,"Sharpness"],[65111,"Smoothness"],[65112,"MoireFilter"],[40965,"InteropIFD"]]),p(w,"gps",[[0,"GPSVersionID"],[1,"GPSLatitudeRef"],[2,"GPSLatitude"],[3,"GPSLongitudeRef"],[4,"GPSLongitude"],[5,"GPSAltitudeRef"],[6,"GPSAltitude"],[7,"GPSTimeStamp"],[8,"GPSSatellites"],[9,"GPSStatus"],[10,"GPSMeasureMode"],[11,"GPSDOP"],[12,"GPSSpeedRef"],[13,"GPSSpeed"],[14,"GPSTrackRef"],[15,"GPSTrack"],[16,"GPSImgDirectionRef"],[17,"GPSImgDirection"],[18,"GPSMapDatum"],[19,"GPSDestLatitudeRef"],[20,"GPSDestLatitude"],[21,"GPSDestLongitudeRef"],[22,"GPSDestLongitude"],[23,"GPSDestBearingRef"],[24,"GPSDestBearing"],[25,"GPSDestDistanceRef"],[26,"GPSDestDistance"],[27,"GPSProcessingMethod"],[28,"GPSAreaInformation"],[29,"GPSDateStamp"],[30,"GPSDifferential"],[31,"GPSHPositioningError"]]),p(I,["ifd0","ifd1"],[[274,{1:"Horizontal (normal)",2:"Mirror horizontal",3:"Rotate 180",4:"Mirror vertical",5:"Mirror horizontal and rotate 270 CW",6:"Rotate 90 CW",7:"Mirror horizontal and rotate 90 CW",8:"Rotate 270 CW"}],[296,{1:"None",2:"inches",3:"cm"}]]);var ie=p(I,"exif",[[34850,{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"}],[37121,{0:"-",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}],[37383,{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"}],[37384,{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"}],[37385,{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"}],[41495,{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"}],[41728,{1:"Film Scanner",2:"Reflection Print Scanner",3:"Digital Camera"}],[41729,{1:"Directly photographed"}],[41985,{0:"Normal",1:"Custom",2:"HDR (no original saved)",3:"HDR (original saved)",4:"Original (for HDR)",6:"Panorama",7:"Portrait HDR",8:"Portrait"}],[41986,{0:"Auto",1:"Manual",2:"Auto bracket"}],[41987,{0:"Auto",1:"Manual"}],[41990,{0:"Standard",1:"Landscape",2:"Portrait",3:"Night",4:"Other"}],[41991,{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"}],[41996,{0:"Unknown",1:"Macro",2:"Close",3:"Distant"}],[42080,{0:"Unknown",1:"Not a Composite Image",2:"General Composite Image",3:"Composite Image Captured While Shooting"}]]),pt={1:"No absolute unit of measurement",2:"Inch",3:"Centimeter"};ie.set(37392,pt),ie.set(41488,pt);var Oe={0:"Normal",1:"Low",2:"High"};function gt(a){return typeof a=="object"&&a.length!==void 0?a[0]:a}function mt(a){let e=Array.from(a).slice(1);return e[1]>15&&(e=e.map((t=>String.fromCharCode(t)))),e[2]!=="0"&&e[2]!==0||e.pop(),e.join(".")}function Fe(a){if(typeof a=="string"){var[e,t,i,s,n,r]=a.trim().split(/[-: ]/g).map(Number),o=new Date(e,t-1,i);return Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(r)||(o.setHours(s),o.setMinutes(n),o.setSeconds(r)),Number.isNaN(+o)?a:o}}function ee(a){if(typeof a=="string")return a;let e=[];if(a[1]===0&&a[a.length-1]===0)for(let t=0;t<a.length;t+=2)e.push(yt(a[t+1],a[t]));else for(let t=0;t<a.length;t+=2)e.push(yt(a[t],a[t+1]));return V(String.fromCodePoint(...e))}function yt(a,e){return a<<8|e}ie.set(41992,Oe),ie.set(41993,Oe),ie.set(41994,Oe),p(U,["ifd0","ifd1"],[[50827,function(a){return typeof a!="string"?It(a):a}],[306,Fe],[40091,ee],[40092,ee],[40093,ee],[40094,ee],[40095,ee]]),p(U,"exif",[[40960,mt],[36864,mt],[36867,Fe],[36868,Fe],[40962,gt],[40963,gt]]),p(U,"gps",[[0,a=>Array.from(a).join(".")],[7,a=>Array.from(a).join(":")]]);var se=class extends C{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1752462448&&e.getString(t+4,20)==="http://ns.adobe.com/"}static headerLength(e,t){return e.getString(t+4,34)==="http://ns.adobe.com/xmp/extension/"?79:33}static findPosition(e,t){let i=super.findPosition(e,t);return i.multiSegment=i.extended=i.headerLength===79,i.multiSegment?(i.chunkCount=e.getUint8(t+72),i.chunkNumber=e.getUint8(t+76),e.getUint8(t+77)!==0&&i.chunkNumber++):(i.chunkCount=1/0,i.chunkNumber=-1),i}static handleMultiSegments(e){return e.map((t=>t.chunk.getString())).join("")}normalizeInput(e){return typeof e=="string"?e:P.from(e).getString()}parse(e=this.chunk){if(!this.localOptions.parse)return e;e=(function(n){let r={},o={};for(let l of Tt)r[l]=[],o[l]=0;return n.replace($t,((l,h,d)=>{if(h==="<"){let u=++o[d];return r[d].push(u),`${l}#${u}`}return`${l}#${r[d].pop()}`}))})(e);let t=Se.findAll(e,"rdf","Description");t.length===0&&t.push(new Se("rdf","Description",void 0,e));let i,s={};for(let n of t)for(let r of n.properties)i=Wt(r.ns,s),At(r,i);return(function(n){let r;for(let o in n)r=n[o]=ue(n[o]),r===void 0&&delete n[o];return ue(n)})(s)}assignToOutput(e,t){if(this.localOptions.parse)for(let[i,s]of Object.entries(t))switch(i){case"tiff":this.assignObjectToOutput(e,"ifd0",s);break;case"exif":this.assignObjectToOutput(e,"exif",s);break;case"xmlns":break;default:this.assignObjectToOutput(e,i,s)}else e.xmp=t}};c(se,"type","xmp"),c(se,"multiSegment",!0),g.set("xmp",se);var We=class a{static findAll(e){return Mt(e,/([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(a.unpackMatch)}static unpackMatch(e){let t=e[1],i=e[2],s=e[3].slice(1,-1);return s=xt(s),new a(t,i,s)}constructor(e,t,i){this.ns=e,this.name=t,this.value=i}serialize(){return this.value}},Se=class a{static findAll(e,t,i){if(t!==void 0||i!==void 0){t=t||"[\\w\\d-]+",i=i||"[\\w\\d-]+";var s=new RegExp(`<(${t}):(${i})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`,"gm")}else s=/<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;return Mt(e,s).map(a.unpackMatch)}static unpackMatch(e){let t=e[1],i=e[2],s=e[4],n=e[8];return new a(t,i,s,n)}constructor(e,t,i,s){this.ns=e,this.name=t,this.attrString=i,this.innerXml=s,this.attrs=We.findAll(i),this.children=a.findAll(s),this.value=this.children.length===0?xt(s):void 0,this.properties=[...this.attrs,...this.children]}get isPrimitive(){return this.value!==void 0&&this.attrs.length===0&&this.children.length===0}get isListContainer(){return this.children.length===1&&this.children[0].isList}get isList(){let{ns:e,name:t}=this;return e==="rdf"&&(t==="Seq"||t==="Bag"||t==="Alt")}get isListItem(){return this.ns==="rdf"&&this.name==="li"}serialize(){if(this.properties.length===0&&this.value===void 0)return;if(this.isPrimitive)return this.value;if(this.isListContainer)return this.children[0].serialize();if(this.isList)return jt(this.children.map(Ht));if(this.isListItem&&this.children.length===1&&this.attrs.length===0)return this.children[0].serialize();let e={};for(let t of this.properties)At(t,e);return this.value!==void 0&&(e.value=this.value),ue(e)}};function At(a,e){let t=a.serialize();t!==void 0&&(e[a.name]=t)}var Ht=a=>a.serialize(),jt=a=>a.length===1?a[0]:a,Wt=(a,e)=>e[a]?e[a]:e[a]={};function Mt(a,e){let t,i=[];if(!a)return i;for(;(t=e.exec(a))!==null;)i.push(t);return i}function xt(a){if((function(i){return i==null||i==="null"||i==="undefined"||i===""||i.trim()===""})(a))return;let e=Number(a);if(!Number.isNaN(e))return e;let t=a.toLowerCase();return t==="true"||t!=="false"&&a.trim()}var Tt=["rdf:li","rdf:Seq","rdf:Bag","rdf:Alt","rdf:Description"],$t=new RegExp(`(<|\\/)(${Tt.join("|")})`,"g"),ci=Object.freeze({__proto__:null,default:zt,Exifr:v,fileParsers:k,segmentParsers:g,fileReaders:A,tagKeys:w,tagValues:I,tagRevivers:U,createDictionary:p,extendDictionary:H,fetchUrlAsArrayBuffer:G,readBlobAsArrayBuffer:z,chunkedProps:D,otherSegments:J,segments:j,tiffBlocks:f,segmentsAndBlocks:O,tiffExtractables:F,inheritables:Q,allFormatters:R,Options:_,parse:Ae,gpsOnlyOptions:Xe,gps:Me,thumbnailOnlyOptions:qe,thumbnail:Pt,thumbnailUrl:kt,orientationOnlyOptions:Ye,orientation:Je,rotations:Qe,get rotateCanvas(){return B},get rotateCss(){return N},rotation:vt});var wt=de("fs",(a=>a.promises));A.set("fs",class extends Y{async readWhole(){this.chunked=!1,this.fs=await wt;let a=await this.fs.readFile(this.input);this._swapBuffer(a)}async readChunked(){this.chunked=!0,this.fs=await wt,await this.open(),await this.readChunk(0,this.options.firstChunkSize)}async open(){this.fh===void 0&&(this.fh=await this.fs.open(this.input,"r"),this.size=(await this.fh.stat(this.input)).size)}async _readChunk(a,e){this.fh===void 0&&await this.open(),a+e>this.size&&(e=this.size-a);var t=this.subarray(a,e,!0);return await this.fh.read(t.dataView,0,e,a),t}async close(){if(this.fh){let a=this.fh;this.fh=void 0,await a.close()}}});A.set("base64",class extends Y{constructor(...a){super(...a),this.input=this.input.replace(/^data:([^;]+);base64,/gim,""),this.size=this.input.length/4*3,this.input.endsWith("==")?this.size-=2:this.input.endsWith("=")&&(this.size-=1)}async _readChunk(a,e){let t,i,s=this.input;a===void 0?(a=0,t=0,i=0):(t=4*Math.floor(a/3),i=a-t/4*3),e===void 0&&(e=this.size);let n=a+e,r=t+4*Math.ceil(n/3);s=s.slice(t,r);let o=Math.min(e,this.size-a);if(ve){let l=ke.from(s,"base64").slice(i,i+o);return this.set(l,a,!0)}{let l=this.subarray(a,o,!0),h=atob(s),d=l.toUint8();for(let u=0;u<o;u++)d[u]=h.charCodeAt(i+u);return l}}});var be=class extends q{static canHandle(e,t){return t===18761||t===19789}extendOptions(e){let{ifd0:t,xmp:i,iptc:s,icc:n}=e;i.enabled&&t.deps.add(700),s.enabled&&t.deps.add(33723),n.enabled&&t.deps.add(34675),t.finalizeFilters()}async parse(){let{tiff:e,xmp:t,iptc:i,icc:s}=this.options;if(e.enabled||t.enabled||i.enabled||s.enabled){let n=Math.max(Re(this.options),this.options.chunkSize);await this.file.ensureChunk(0,n),this.createParser("tiff",this.file),this.parsers.tiff.parseHeader(),await this.parsers.tiff.parseIfd0Block(),this.adaptTiffPropAsSegment("xmp"),this.adaptTiffPropAsSegment("iptc"),this.adaptTiffPropAsSegment("icc")}}adaptTiffPropAsSegment(e){if(this.parsers.tiff[e]){let t=this.parsers.tiff[e];this.injectSegment(e,t)}}};c(be,"type","tiff"),k.set("tiff",be);var Kt=de("zlib"),Xt=["ihdr","iccp","text","itxt","exif"],Ce=class extends q{constructor(...e){super(...e),c(this,"catchError",(t=>this.errors.push(t))),c(this,"metaChunks",[]),c(this,"unknownChunks",[])}static canHandle(e,t){return t===35152&&e.getUint32(0)===2303741511&&e.getUint32(4)===218765834}async parse(){let{file:e}=this;await this.findPngChunksInRange(8,e.byteLength),await this.readSegments(this.metaChunks),this.findIhdr(),this.parseTextChunks(),await this.findExif().catch(this.catchError),await this.findXmp().catch(this.catchError),await this.findIcc().catch(this.catchError)}async findPngChunksInRange(e,t){let{file:i}=this;for(;e<t;){let s=i.getUint32(e),n=i.getUint32(e+4),r=i.getString(e+4,4).toLowerCase(),o=s+4+4+4,l={type:r,offset:e,length:o,start:e+4+4,size:s,marker:n};Xt.includes(r)?this.metaChunks.push(l):this.unknownChunks.push(l),e+=o}}parseTextChunks(){let e=this.metaChunks.filter((t=>t.type==="text"));for(let t of e){let[i,s]=this.file.getString(t.start,t.size).split("\0");this.injectKeyValToIhdr(i,s)}}injectKeyValToIhdr(e,t){let i=this.parsers.ihdr;i&&i.raw.set(e,t)}findIhdr(){let e=this.metaChunks.find((t=>t.type==="ihdr"));e&&this.options.ihdr.enabled!==!1&&this.createParser("ihdr",e.chunk)}async findExif(){let e=this.metaChunks.find((t=>t.type==="exif"));e&&this.injectSegment("tiff",e.chunk)}async findXmp(){let e=this.metaChunks.filter((t=>t.type==="itxt"));for(let t of e)t.chunk.getString(0,17)==="XML:com.adobe.xmp"&&this.injectSegment("xmp",t.chunk)}async findIcc(){let e=this.metaChunks.find((o=>o.type==="iccp"));if(!e)return;let{chunk:t}=e,i=t.getUint8Array(0,81),s=0;for(;s<80&&i[s]!==0;)s++;let n=s+2,r=t.getString(0,s);if(this.injectKeyValToIhdr("ProfileName",r),ce){let o=await Kt,l=t.getUint8Array(n);l=o.inflateSync(l),this.injectSegment("icc",l)}}};c(Ce,"type","png"),k.set("png",Ce),p(w,"interop",[[1,"InteropIndex"],[2,"InteropVersion"],[4096,"RelatedImageFileFormat"],[4097,"RelatedImageWidth"],[4098,"RelatedImageHeight"]]),H(w,"ifd0",[[11,"ProcessingSoftware"],[254,"SubfileType"],[255,"OldSubfileType"],[263,"Thresholding"],[264,"CellWidth"],[265,"CellLength"],[266,"FillOrder"],[269,"DocumentName"],[280,"MinSampleValue"],[281,"MaxSampleValue"],[285,"PageName"],[286,"XPosition"],[287,"YPosition"],[290,"GrayResponseUnit"],[297,"PageNumber"],[321,"HalftoneHints"],[322,"TileWidth"],[323,"TileLength"],[332,"InkSet"],[337,"TargetPrinter"],[18246,"Rating"],[18249,"RatingPercent"],[33550,"PixelScale"],[34264,"ModelTransform"],[34377,"PhotoshopSettings"],[50706,"DNGVersion"],[50707,"DNGBackwardVersion"],[50708,"UniqueCameraModel"],[50709,"LocalizedCameraModel"],[50736,"DNGLensInfo"],[50739,"ShadowScale"],[50740,"DNGPrivateData"],[33920,"IntergraphMatrix"],[33922,"ModelTiePoint"],[34118,"SEMInfo"],[34735,"GeoTiffDirectory"],[34736,"GeoTiffDoubleParams"],[34737,"GeoTiffAsciiParams"],[50341,"PrintIM"],[50721,"ColorMatrix1"],[50722,"ColorMatrix2"],[50723,"CameraCalibration1"],[50724,"CameraCalibration2"],[50725,"ReductionMatrix1"],[50726,"ReductionMatrix2"],[50727,"AnalogBalance"],[50728,"AsShotNeutral"],[50729,"AsShotWhiteXY"],[50730,"BaselineExposure"],[50731,"BaselineNoise"],[50732,"BaselineSharpness"],[50734,"LinearResponseLimit"],[50735,"CameraSerialNumber"],[50741,"MakerNoteSafety"],[50778,"CalibrationIlluminant1"],[50779,"CalibrationIlluminant2"],[50781,"RawDataUniqueID"],[50827,"OriginalRawFileName"],[50828,"OriginalRawFileData"],[50831,"AsShotICCProfile"],[50832,"AsShotPreProfileMatrix"],[50833,"CurrentICCProfile"],[50834,"CurrentPreProfileMatrix"],[50879,"ColorimetricReference"],[50885,"SRawType"],[50898,"PanasonicTitle"],[50899,"PanasonicTitle2"],[50931,"CameraCalibrationSig"],[50932,"ProfileCalibrationSig"],[50933,"ProfileIFD"],[50934,"AsShotProfileName"],[50936,"ProfileName"],[50937,"ProfileHueSatMapDims"],[50938,"ProfileHueSatMapData1"],[50939,"ProfileHueSatMapData2"],[50940,"ProfileToneCurve"],[50941,"ProfileEmbedPolicy"],[50942,"ProfileCopyright"],[50964,"ForwardMatrix1"],[50965,"ForwardMatrix2"],[50966,"PreviewApplicationName"],[50967,"PreviewApplicationVersion"],[50968,"PreviewSettingsName"],[50969,"PreviewSettingsDigest"],[50970,"PreviewColorSpace"],[50971,"PreviewDateTime"],[50972,"RawImageDigest"],[50973,"OriginalRawFileDigest"],[50981,"ProfileLookTableDims"],[50982,"ProfileLookTableData"],[51043,"TimeCodes"],[51044,"FrameRate"],[51058,"TStop"],[51081,"ReelName"],[51089,"OriginalDefaultFinalSize"],[51090,"OriginalBestQualitySize"],[51091,"OriginalDefaultCropSize"],[51105,"CameraLabel"],[51107,"ProfileHueSatMapEncoding"],[51108,"ProfileLookTableEncoding"],[51109,"BaselineExposureOffset"],[51110,"DefaultBlackRender"],[51111,"NewRawImageDigest"],[51112,"RawToPreviewGain"]]);var St=[[273,"StripOffsets"],[279,"StripByteCounts"],[288,"FreeOffsets"],[289,"FreeByteCounts"],[291,"GrayResponseCurve"],[292,"T4Options"],[293,"T6Options"],[300,"ColorResponseUnit"],[320,"ColorMap"],[324,"TileOffsets"],[325,"TileByteCounts"],[326,"BadFaxLines"],[327,"CleanFaxData"],[328,"ConsecutiveBadFaxLines"],[330,"SubIFD"],[333,"InkNames"],[334,"NumberofInks"],[336,"DotRange"],[338,"ExtraSamples"],[339,"SampleFormat"],[340,"SMinSampleValue"],[341,"SMaxSampleValue"],[342,"TransferRange"],[343,"ClipPath"],[344,"XClipPathUnits"],[345,"YClipPathUnits"],[346,"Indexed"],[347,"JPEGTables"],[351,"OPIProxy"],[400,"GlobalParametersIFD"],[401,"ProfileType"],[402,"FaxProfile"],[403,"CodingMethods"],[404,"VersionYear"],[405,"ModeNumber"],[433,"Decode"],[434,"DefaultImageColor"],[435,"T82Options"],[437,"JPEGTables"],[512,"JPEGProc"],[515,"JPEGRestartInterval"],[517,"JPEGLosslessPredictors"],[518,"JPEGPointTransforms"],[519,"JPEGQTables"],[520,"JPEGDCTables"],[521,"JPEGACTables"],[559,"StripRowCounts"],[999,"USPTOMiscellaneous"],[18247,"XP_DIP_XML"],[18248,"StitchInfo"],[28672,"SonyRawFileType"],[28688,"SonyToneCurve"],[28721,"VignettingCorrection"],[28722,"VignettingCorrParams"],[28724,"ChromaticAberrationCorrection"],[28725,"ChromaticAberrationCorrParams"],[28726,"DistortionCorrection"],[28727,"DistortionCorrParams"],[29895,"SonyCropTopLeft"],[29896,"SonyCropSize"],[32781,"ImageID"],[32931,"WangTag1"],[32932,"WangAnnotation"],[32933,"WangTag3"],[32934,"WangTag4"],[32953,"ImageReferencePoints"],[32954,"RegionXformTackPoint"],[32955,"WarpQuadrilateral"],[32956,"AffineTransformMat"],[32995,"Matteing"],[32996,"DataType"],[32997,"ImageDepth"],[32998,"TileDepth"],[33300,"ImageFullWidth"],[33301,"ImageFullHeight"],[33302,"TextureFormat"],[33303,"WrapModes"],[33304,"FovCot"],[33305,"MatrixWorldToScreen"],[33306,"MatrixWorldToCamera"],[33405,"Model2"],[33421,"CFARepeatPatternDim"],[33422,"CFAPattern2"],[33423,"BatteryLevel"],[33424,"KodakIFD"],[33445,"MDFileTag"],[33446,"MDScalePixel"],[33447,"MDColorTable"],[33448,"MDLabName"],[33449,"MDSampleInfo"],[33450,"MDPrepDate"],[33451,"MDPrepTime"],[33452,"MDFileUnits"],[33589,"AdventScale"],[33590,"AdventRevision"],[33628,"UIC1Tag"],[33629,"UIC2Tag"],[33630,"UIC3Tag"],[33631,"UIC4Tag"],[33918,"IntergraphPacketData"],[33919,"IntergraphFlagRegisters"],[33921,"INGRReserved"],[34016,"Site"],[34017,"ColorSequence"],[34018,"IT8Header"],[34019,"RasterPadding"],[34020,"BitsPerRunLength"],[34021,"BitsPerExtendedRunLength"],[34022,"ColorTable"],[34023,"ImageColorIndicator"],[34024,"BackgroundColorIndicator"],[34025,"ImageColorValue"],[34026,"BackgroundColorValue"],[34027,"PixelIntensityRange"],[34028,"TransparencyIndicator"],[34029,"ColorCharacterization"],[34030,"HCUsage"],[34031,"TrapIndicator"],[34032,"CMYKEquivalent"],[34152,"AFCP_IPTC"],[34232,"PixelMagicJBIGOptions"],[34263,"JPLCartoIFD"],[34306,"WB_GRGBLevels"],[34310,"LeafData"],[34687,"TIFF_FXExtensions"],[34688,"MultiProfiles"],[34689,"SharedData"],[34690,"T88Options"],[34732,"ImageLayer"],[34750,"JBIGOptions"],[34856,"Opto-ElectricConvFactor"],[34857,"Interlace"],[34908,"FaxRecvParams"],[34909,"FaxSubAddress"],[34910,"FaxRecvTime"],[34929,"FedexEDR"],[34954,"LeafSubIFD"],[37387,"FlashEnergy"],[37388,"SpatialFrequencyResponse"],[37389,"Noise"],[37390,"FocalPlaneXResolution"],[37391,"FocalPlaneYResolution"],[37392,"FocalPlaneResolutionUnit"],[37397,"ExposureIndex"],[37398,"TIFF-EPStandardID"],[37399,"SensingMethod"],[37434,"CIP3DataFile"],[37435,"CIP3Sheet"],[37436,"CIP3Side"],[37439,"StoNits"],[37679,"MSDocumentText"],[37680,"MSPropertySetStorage"],[37681,"MSDocumentTextPosition"],[37724,"ImageSourceData"],[40965,"InteropIFD"],[40976,"SamsungRawPointersOffset"],[40977,"SamsungRawPointersLength"],[41217,"SamsungRawByteOrder"],[41218,"SamsungRawUnknown"],[41484,"SpatialFrequencyResponse"],[41485,"Noise"],[41489,"ImageNumber"],[41490,"SecurityClassification"],[41491,"ImageHistory"],[41494,"TIFF-EPStandardID"],[41995,"DeviceSettingDescription"],[42112,"GDALMetadata"],[42113,"GDALNoData"],[44992,"ExpandSoftware"],[44993,"ExpandLens"],[44994,"ExpandFilm"],[44995,"ExpandFilterLens"],[44996,"ExpandScanner"],[44997,"ExpandFlashLamp"],[46275,"HasselbladRawImage"],[48129,"PixelFormat"],[48130,"Transformation"],[48131,"Uncompressed"],[48132,"ImageType"],[48256,"ImageWidth"],[48257,"ImageHeight"],[48258,"WidthResolution"],[48259,"HeightResolution"],[48320,"ImageOffset"],[48321,"ImageByteCount"],[48322,"AlphaOffset"],[48323,"AlphaByteCount"],[48324,"ImageDataDiscard"],[48325,"AlphaDataDiscard"],[50215,"OceScanjobDesc"],[50216,"OceApplicationSelector"],[50217,"OceIDNumber"],[50218,"OceImageLogic"],[50255,"Annotations"],[50459,"HasselbladExif"],[50547,"OriginalFileName"],[50560,"USPTOOriginalContentType"],[50656,"CR2CFAPattern"],[50710,"CFAPlaneColor"],[50711,"CFALayout"],[50712,"LinearizationTable"],[50713,"BlackLevelRepeatDim"],[50714,"BlackLevel"],[50715,"BlackLevelDeltaH"],[50716,"BlackLevelDeltaV"],[50717,"WhiteLevel"],[50718,"DefaultScale"],[50719,"DefaultCropOrigin"],[50720,"DefaultCropSize"],[50733,"BayerGreenSplit"],[50737,"ChromaBlurRadius"],[50738,"AntiAliasStrength"],[50752,"RawImageSegmentation"],[50780,"BestQualityScale"],[50784,"AliasLayerMetadata"],[50829,"ActiveArea"],[50830,"MaskedAreas"],[50935,"NoiseReductionApplied"],[50974,"SubTileBlockSize"],[50975,"RowInterleaveFactor"],[51008,"OpcodeList1"],[51009,"OpcodeList2"],[51022,"OpcodeList3"],[51041,"NoiseProfile"],[51114,"CacheVersion"],[51125,"DefaultUserCrop"],[51157,"NikonNEFInfo"],[65024,"KdcIFD"]];H(w,"ifd0",St),H(w,"exif",St),p(I,"gps",[[23,{M:"Magnetic North",T:"True North"}],[25,{K:"Kilometers",M:"Miles",N:"Nautical Miles"}]]);var ae=class extends C{static canHandle(e,t){return e.getUint8(t+1)===224&&e.getUint32(t+4)===1246120262&&e.getUint8(t+8)===0}parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint16(0)],[2,this.chunk.getUint8(2)],[3,this.chunk.getUint16(3)],[5,this.chunk.getUint16(5)],[7,this.chunk.getUint8(7)],[8,this.chunk.getUint8(8)]])}};c(ae,"type","jfif"),c(ae,"headerLength",9),g.set("jfif",ae),p(w,"jfif",[[0,"JFIFVersion"],[2,"ResolutionUnit"],[3,"XResolution"],[5,"YResolution"],[7,"ThumbnailWidth"],[8,"ThumbnailHeight"]]);var Ie=class extends C{parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint32(0)],[4,this.chunk.getUint32(4)],[8,this.chunk.getUint8(8)],[9,this.chunk.getUint8(9)],[10,this.chunk.getUint8(10)],[11,this.chunk.getUint8(11)],[12,this.chunk.getUint8(12)],...Array.from(this.raw)])}};c(Ie,"type","ihdr"),g.set("ihdr",Ie),p(w,"ihdr",[[0,"ImageWidth"],[4,"ImageHeight"],[8,"BitDepth"],[9,"ColorType"],[10,"Compression"],[11,"Filter"],[12,"Interlace"]]),p(I,"ihdr",[[9,{0:"Grayscale",2:"RGB",3:"Palette",4:"Grayscale with Alpha",6:"RGB with Alpha",DEFAULT:"Unknown"}],[10,{0:"Deflate/Inflate",DEFAULT:"Unknown"}],[11,{0:"Adaptive",DEFAULT:"Unknown"}],[12,{0:"Noninterlaced",1:"Adam7 Interlace",DEFAULT:"Unknown"}]]);var X=class extends C{static canHandle(e,t){return e.getUint8(t+1)===226&&e.getUint32(t+4)===1229144927}static findPosition(e,t){let i=super.findPosition(e,t);return i.chunkNumber=e.getUint8(t+16),i.chunkCount=e.getUint8(t+17),i.multiSegment=i.chunkCount>1,i}static handleMultiSegments(e){return(function(t){let i=(function(s){let n=s[0].constructor,r=0;for(let h of s)r+=h.length;let o=new n(r),l=0;for(let h of s)o.set(h,l),l+=h.length;return o})(t.map((s=>s.chunk.toUint8())));return new P(i)})(e)}parse(){return this.raw=new Map,this.parseHeader(),this.parseTags(),this.translate(),this.output}parseHeader(){let{raw:e}=this;this.chunk.byteLength<84&&m("ICC header is too short");for(let[t,i]of Object.entries(qt)){t=parseInt(t,10);let s=i(this.chunk,t);s!=="\0\0\0\0"&&e.set(t,s)}}parseTags(){let e,t,i,s,n,{raw:r}=this,o=this.chunk.getUint32(128),l=132,h=this.chunk.byteLength;for(;o--;){if(e=this.chunk.getString(l,4),t=this.chunk.getUint32(l+4),i=this.chunk.getUint32(l+8),s=this.chunk.getString(t,4),t+i>h)return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");n=this.parseTag(s,t,i),n!==void 0&&n!=="\0\0\0\0"&&r.set(e,n),l+=12}}parseTag(e,t,i){switch(e){case"desc":return this.parseDesc(t);case"mluc":return this.parseMluc(t);case"text":return this.parseText(t,i);case"sig ":return this.parseSig(t)}if(!(t+i>this.chunk.byteLength))return this.chunk.getUint8Array(t,i)}parseDesc(e){let t=this.chunk.getUint32(e+8)-1;return V(this.chunk.getString(e+12,t))}parseText(e,t){return V(this.chunk.getString(e+8,t-8))}parseSig(e){return V(this.chunk.getString(e+8,4))}parseMluc(e){let{chunk:t}=this,i=t.getUint32(e+8),s=t.getUint32(e+12),n=e+16,r=[];for(let o=0;o<i;o++){let l=t.getString(n+0,2),h=t.getString(n+2,2),d=t.getUint32(n+4),u=t.getUint32(n+8)+e,y=V(t.getUnicodeString(u,d));r.push({lang:l,country:h,text:y}),n+=s}return i===1?r[0].text:r}translateValue(e,t){return typeof e=="string"?t[e]||t[e.toLowerCase()]||e:t[e]||e}};c(X,"type","icc"),c(X,"multiSegment",!0),c(X,"headerLength",18);var qt={4:T,8:function(a,e){return[a.getUint8(e),a.getUint8(e+1)>>4,a.getUint8(e+1)%16].map((t=>t.toString(10))).join(".")},12:T,16:T,20:T,24:function(a,e){let t=a.getUint16(e),i=a.getUint16(e+2)-1,s=a.getUint16(e+4),n=a.getUint16(e+6),r=a.getUint16(e+8),o=a.getUint16(e+10);return new Date(Date.UTC(t,i,s,n,r,o))},36:T,40:T,48:T,52:T,64:(a,e)=>a.getUint32(e),80:T};function T(a,e){return V(a.getString(e,4))}g.set("icc",X),p(w,"icc",[[4,"ProfileCMMType"],[8,"ProfileVersion"],[12,"ProfileClass"],[16,"ColorSpaceData"],[20,"ProfileConnectionSpace"],[24,"ProfileDateTime"],[36,"ProfileFileSignature"],[40,"PrimaryPlatform"],[44,"CMMFlags"],[48,"DeviceManufacturer"],[52,"DeviceModel"],[56,"DeviceAttributes"],[64,"RenderingIntent"],[68,"ConnectionSpaceIlluminant"],[80,"ProfileCreator"],[84,"ProfileID"],["Header","ProfileHeader"],["MS00","WCSProfiles"],["bTRC","BlueTRC"],["bXYZ","BlueMatrixColumn"],["bfd","UCRBG"],["bkpt","MediaBlackPoint"],["calt","CalibrationDateTime"],["chad","ChromaticAdaptation"],["chrm","Chromaticity"],["ciis","ColorimetricIntentImageState"],["clot","ColorantTableOut"],["clro","ColorantOrder"],["clrt","ColorantTable"],["cprt","ProfileCopyright"],["crdi","CRDInfo"],["desc","ProfileDescription"],["devs","DeviceSettings"],["dmdd","DeviceModelDesc"],["dmnd","DeviceMfgDesc"],["dscm","ProfileDescriptionML"],["fpce","FocalPlaneColorimetryEstimates"],["gTRC","GreenTRC"],["gXYZ","GreenMatrixColumn"],["gamt","Gamut"],["kTRC","GrayTRC"],["lumi","Luminance"],["meas","Measurement"],["meta","Metadata"],["mmod","MakeAndModel"],["ncl2","NamedColor2"],["ncol","NamedColor"],["ndin","NativeDisplayInfo"],["pre0","Preview0"],["pre1","Preview1"],["pre2","Preview2"],["ps2i","PS2RenderingIntent"],["ps2s","PostScript2CSA"],["psd0","PostScript2CRD0"],["psd1","PostScript2CRD1"],["psd2","PostScript2CRD2"],["psd3","PostScript2CRD3"],["pseq","ProfileSequenceDesc"],["psid","ProfileSequenceIdentifier"],["psvm","PS2CRDVMSize"],["rTRC","RedTRC"],["rXYZ","RedMatrixColumn"],["resp","OutputResponse"],["rhoc","ReflectionHardcopyOrigColorimetry"],["rig0","PerceptualRenderingIntentGamut"],["rig2","SaturationRenderingIntentGamut"],["rpoc","ReflectionPrintOutputColorimetry"],["sape","SceneAppearanceEstimates"],["scoe","SceneColorimetryEstimates"],["scrd","ScreeningDesc"],["scrn","Screening"],["targ","CharTarget"],["tech","Technology"],["vcgt","VideoCardGamma"],["view","ViewingConditions"],["vued","ViewingCondDesc"],["wtpt","MediaWhitePoint"]]);var he={"4d2p":"Erdt Systems",AAMA:"Aamazing Technologies",ACER:"Acer",ACLT:"Acolyte Color Research",ACTI:"Actix Sytems",ADAR:"Adara Technology",ADBE:"Adobe",ADI:"ADI Systems",AGFA:"Agfa Graphics",ALMD:"Alps Electric",ALPS:"Alps Electric",ALWN:"Alwan Color Expertise",AMTI:"Amiable Technologies",AOC:"AOC International",APAG:"Apago",APPL:"Apple Computer",AST:"AST","AT&T":"AT&T",BAEL:"BARBIERI electronic",BRCO:"Barco NV",BRKP:"Breakpoint",BROT:"Brother",BULL:"Bull",BUS:"Bus Computer Systems","C-IT":"C-Itoh",CAMR:"Intel",CANO:"Canon",CARR:"Carroll Touch",CASI:"Casio",CBUS:"Colorbus PL",CEL:"Crossfield",CELx:"Crossfield",CGS:"CGS Publishing Technologies International",CHM:"Rochester Robotics",CIGL:"Colour Imaging Group, London",CITI:"Citizen",CL00:"Candela",CLIQ:"Color IQ",CMCO:"Chromaco",CMiX:"CHROMiX",COLO:"Colorgraphic Communications",COMP:"Compaq",COMp:"Compeq/Focus Technology",CONR:"Conrac Display Products",CORD:"Cordata Technologies",CPQ:"Compaq",CPRO:"ColorPro",CRN:"Cornerstone",CTX:"CTX International",CVIS:"ColorVision",CWC:"Fujitsu Laboratories",DARI:"Darius Technology",DATA:"Dataproducts",DCP:"Dry Creek Photo",DCRC:"Digital Contents Resource Center, Chung-Ang University",DELL:"Dell Computer",DIC:"Dainippon Ink and Chemicals",DICO:"Diconix",DIGI:"Digital","DL&C":"Digital Light & Color",DPLG:"Doppelganger",DS:"Dainippon Screen",DSOL:"DOOSOL",DUPN:"DuPont",EPSO:"Epson",ESKO:"Esko-Graphics",ETRI:"Electronics and Telecommunications Research Institute",EVER:"Everex Systems",EXAC:"ExactCODE",Eizo:"Eizo",FALC:"Falco Data Products",FF:"Fuji Photo Film",FFEI:"FujiFilm Electronic Imaging",FNRD:"Fnord Software",FORA:"Fora",FORE:"Forefront Technology",FP:"Fujitsu",FPA:"WayTech Development",FUJI:"Fujitsu",FX:"Fuji Xerox",GCC:"GCC Technologies",GGSL:"Global Graphics Software",GMB:"Gretagmacbeth",GMG:"GMG",GOLD:"GoldStar Technology",GOOG:"Google",GPRT:"Giantprint",GTMB:"Gretagmacbeth",GVC:"WayTech Development",GW2K:"Sony",HCI:"HCI",HDM:"Heidelberger Druckmaschinen",HERM:"Hermes",HITA:"Hitachi America",HP:"Hewlett-Packard",HTC:"Hitachi",HiTi:"HiTi Digital",IBM:"IBM",IDNT:"Scitex",IEC:"Hewlett-Packard",IIYA:"Iiyama North America",IKEG:"Ikegami Electronics",IMAG:"Image Systems",IMI:"Ingram Micro",INTC:"Intel",INTL:"N/A (INTL)",INTR:"Intra Electronics",IOCO:"Iocomm International Technology",IPS:"InfoPrint Solutions Company",IRIS:"Scitex",ISL:"Ichikawa Soft Laboratory",ITNL:"N/A (ITNL)",IVM:"IVM",IWAT:"Iwatsu Electric",Idnt:"Scitex",Inca:"Inca Digital Printers",Iris:"Scitex",JPEG:"Joint Photographic Experts Group",JSFT:"Jetsoft Development",JVC:"JVC Information Products",KART:"Scitex",KFC:"KFC Computek Components",KLH:"KLH Computers",KMHD:"Konica Minolta",KNCA:"Konica",KODA:"Kodak",KYOC:"Kyocera",Kart:"Scitex",LCAG:"Leica",LCCD:"Leeds Colour",LDAK:"Left Dakota",LEAD:"Leading Technology",LEXM:"Lexmark International",LINK:"Link Computer",LINO:"Linotronic",LITE:"Lite-On",Leaf:"Leaf",Lino:"Linotronic",MAGC:"Mag Computronic",MAGI:"MAG Innovision",MANN:"Mannesmann",MICN:"Micron Technology",MICR:"Microtek",MICV:"Microvitec",MINO:"Minolta",MITS:"Mitsubishi Electronics America",MITs:"Mitsuba",MNLT:"Minolta",MODG:"Modgraph",MONI:"Monitronix",MONS:"Monaco Systems",MORS:"Morse Technology",MOTI:"Motive Systems",MSFT:"Microsoft",MUTO:"MUTOH INDUSTRIES",Mits:"Mitsubishi Electric",NANA:"NANAO",NEC:"NEC",NEXP:"NexPress Solutions",NISS:"Nissei Sangyo America",NKON:"Nikon",NONE:"none",OCE:"Oce Technologies",OCEC:"OceColor",OKI:"Oki",OKID:"Okidata",OKIP:"Okidata",OLIV:"Olivetti",OLYM:"Olympus",ONYX:"Onyx Graphics",OPTI:"Optiquest",PACK:"Packard Bell",PANA:"Matsushita Electric Industrial",PANT:"Pantone",PBN:"Packard Bell",PFU:"PFU",PHIL:"Philips Consumer Electronics",PNTX:"HOYA",POne:"Phase One A/S",PREM:"Premier Computer Innovations",PRIN:"Princeton Graphic Systems",PRIP:"Princeton Publishing Labs",QLUX:"Hong Kong",QMS:"QMS",QPCD:"QPcard AB",QUAD:"QuadLaser",QUME:"Qume",RADI:"Radius",RDDx:"Integrated Color Solutions",RDG:"Roland DG",REDM:"REDMS Group",RELI:"Relisys",RGMS:"Rolf Gierling Multitools",RICO:"Ricoh",RNLD:"Edmund Ronald",ROYA:"Royal",RPC:"Ricoh Printing Systems",RTL:"Royal Information Electronics",SAMP:"Sampo",SAMS:"Samsung",SANT:"Jaime Santana Pomares",SCIT:"Scitex",SCRN:"Dainippon Screen",SDP:"Scitex",SEC:"Samsung",SEIK:"Seiko Instruments",SEIk:"Seikosha",SGUY:"ScanGuy.com",SHAR:"Sharp Laboratories",SICC:"International Color Consortium",SONY:"Sony",SPCL:"SpectraCal",STAR:"Star",STC:"Sampo Technology",Scit:"Scitex",Sdp:"Scitex",Sony:"Sony",TALO:"Talon Technology",TAND:"Tandy",TATU:"Tatung",TAXA:"TAXAN America",TDS:"Tokyo Denshi Sekei",TECO:"TECO Information Systems",TEGR:"Tegra",TEKT:"Tektronix",TI:"Texas Instruments",TMKR:"TypeMaker",TOSB:"Toshiba",TOSH:"Toshiba",TOTK:"TOTOKU ELECTRIC",TRIU:"Triumph",TSBT:"Toshiba",TTX:"TTX Computer Products",TVM:"TVM Professional Monitor",TW:"TW Casper",ULSX:"Ulead Systems",UNIS:"Unisys",UTZF:"Utz Fehlau & Sohn",VARI:"Varityper",VIEW:"Viewsonic",VISL:"Visual communication",VIVO:"Vivo Mobile Communication",WANG:"Wang",WLBR:"Wilbur Imaging",WTG2:"Ware To Go",WYSE:"WYSE Technology",XERX:"Xerox",XRIT:"X-Rite",ZRAN:"Zoran",Zebr:"Zebra Technologies",appl:"Apple Computer",bICC:"basICColor",berg:"bergdesign",ceyd:"Integrated Color Solutions",clsp:"MacDermid ColorSpan",ds:"Dainippon Screen",dupn:"DuPont",ffei:"FujiFilm Electronic Imaging",flux:"FluxData",iris:"Scitex",kart:"Scitex",lcms:"Little CMS",lino:"Linotronic",none:"none",ob4d:"Erdt Systems",obic:"Medigraph",quby:"Qubyx Sarl",scit:"Scitex",scrn:"Dainippon Screen",sdp:"Scitex",siwi:"SIWI GRAFIKA",yxym:"YxyMaster"},bt={scnr:"Scanner",mntr:"Monitor",prtr:"Printer",link:"Device Link",abst:"Abstract",spac:"Color Space Conversion Profile",nmcl:"Named Color",cenc:"ColorEncodingSpace profile",mid:"MultiplexIdentification profile",mlnk:"MultiplexLink profile",mvis:"MultiplexVisualization profile",nkpf:"Nikon Input Device Profile (NON-STANDARD!)"};p(I,"icc",[[4,he],[12,bt],[40,Object.assign({},he,bt)],[48,he],[80,he],[64,{0:"Perceptual",1:"Relative Colorimetric",2:"Saturation",3:"Absolute Colorimetric"}],["tech",{amd:"Active Matrix Display",crt:"Cathode Ray Tube Display",kpcd:"Photo CD",pmd:"Passive Matrix Display",dcam:"Digital Camera",dcpj:"Digital Cinema Projector",dmpc:"Digital Motion Picture Camera",dsub:"Dye Sublimation Printer",epho:"Electrophotographic Printer",esta:"Electrostatic Printer",flex:"Flexography",fprn:"Film Writer",fscn:"Film Scanner",grav:"Gravure",ijet:"Ink Jet Printer",imgs:"Photo Image Setter",mpfr:"Motion Picture Film Recorder",mpfs:"Motion Picture Film Scanner",offs:"Offset Lithography",pjtv:"Projection Television",rpho:"Photographic Paper Printer",rscn:"Reflective Scanner",silk:"Silkscreen",twax:"Thermal Wax Printer",vidc:"Video Camera",vidm:"Video Monitor"}]]);var K=class extends C{static canHandle(e,t,i){return e.getUint8(t+1)===237&&e.getString(t+4,9)==="Photoshop"&&this.containsIptc8bim(e,t,i)!==void 0}static headerLength(e,t,i){let s,n=this.containsIptc8bim(e,t,i);if(n!==void 0)return s=e.getUint8(t+n+7),s%2!=0&&(s+=1),s===0&&(s=4),n+8+s}static containsIptc8bim(e,t,i){for(let s=0;s<i;s++)if(this.isIptcSegmentHead(e,t+s))return s}static isIptcSegmentHead(e,t){return e.getUint8(t)===56&&e.getUint32(t)===943868237&&e.getUint16(t+4)===1028}parse(){let{raw:e}=this,t=this.chunk.byteLength-1,i=!1;for(let s=0;s<t;s++)if(this.chunk.getUint8(s)===28&&this.chunk.getUint8(s+1)===2){i=!0;let n=this.chunk.getUint16(s+3),r=this.chunk.getUint8(s+2),o=this.chunk.getLatin1String(s+5,n);e.set(r,this.pluralizeValue(e.get(r),o)),s+=4+n}else if(i)break;return this.translate(),this.output}pluralizeValue(e,t){return e!==void 0?e instanceof Array?(e.push(t),e):[e,t]:t}};c(K,"type","iptc"),c(K,"translateValues",!1),c(K,"reviveValues",!1),g.set("iptc",K),p(w,"iptc",[[0,"ApplicationRecordVersion"],[3,"ObjectTypeReference"],[4,"ObjectAttributeReference"],[5,"ObjectName"],[7,"EditStatus"],[8,"EditorialUpdate"],[10,"Urgency"],[12,"SubjectReference"],[15,"Category"],[20,"SupplementalCategories"],[22,"FixtureIdentifier"],[25,"Keywords"],[26,"ContentLocationCode"],[27,"ContentLocationName"],[30,"ReleaseDate"],[35,"ReleaseTime"],[37,"ExpirationDate"],[38,"ExpirationTime"],[40,"SpecialInstructions"],[42,"ActionAdvised"],[45,"ReferenceService"],[47,"ReferenceDate"],[50,"ReferenceNumber"],[55,"DateCreated"],[60,"TimeCreated"],[62,"DigitalCreationDate"],[63,"DigitalCreationTime"],[65,"OriginatingProgram"],[70,"ProgramVersion"],[75,"ObjectCycle"],[80,"Byline"],[85,"BylineTitle"],[90,"City"],[92,"Sublocation"],[95,"State"],[100,"CountryCode"],[101,"Country"],[103,"OriginalTransmissionReference"],[105,"Headline"],[110,"Credit"],[115,"Source"],[116,"CopyrightNotice"],[118,"Contact"],[120,"Caption"],[121,"LocalCaption"],[122,"Writer"],[125,"RasterizedCaption"],[130,"ImageType"],[131,"ImageOrientation"],[135,"LanguageIdentifier"],[150,"AudioType"],[151,"AudioSamplingRate"],[152,"AudioSamplingResolution"],[153,"AudioDuration"],[154,"AudioOutcue"],[184,"JobID"],[185,"MasterDocumentID"],[186,"ShortDocumentID"],[187,"UniqueDocumentID"],[188,"OwnerID"],[200,"ObjectPreviewFileFormat"],[201,"ObjectPreviewFileVersion"],[202,"ObjectPreviewData"],[221,"Prefs"],[225,"ClassifyState"],[228,"SimilarityIndex"],[230,"DocumentNotes"],[231,"DocumentHistory"],[232,"ExifCameraInfo"],[255,"CatalogSets"]]),p(I,"iptc",[[10,{0:"0 (reserved)",1:"1 (most urgent)",2:"2",3:"3",4:"4",5:"5 (normal urgency)",6:"6",7:"7",8:"8 (least urgent)",9:"9 (user-defined priority)"}],[75,{a:"Morning",b:"Both Morning and Evening",p:"Evening"}],[131,{L:"Landscape",P:"Portrait",S:"Square"}]]);var hi=tt`@layer{:host{display:block}.hide-editor-toolbar .esri-editor__panel-toolbar{display:none!important}.esri-editor__panel-content{padding-block:0px!important}.esri-editor .esri-item-list__group__header,.esri-editor__panel-content__section .esri-widget__heading{display:none!important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px!important;padding-inline:10px!important}.search-widget{width:92%!important;margin:5px 14px 20px}.display-none{display:none!important}.hide-map{height:1%;visibility:hidden}.show-map{padding:10px!important;position:absolute!important;bottom:0;height:auto!important;width:calc(100% - 22px)}.notice-msg{padding:10px;width:calc(100% - 20px)}.edit-location-btn{margin:5px;display:flex}.esri-editor__panel-content{padding-block:10px!important}.image-preview-container{padding:10px}.esri-editor{height:auto!important}.content-container{padding:1.5rem}.instruction-text{margin-bottom:1.5rem;font-size:1rem}.selected-card{border:2px solid var(--calcite-ui-brand)}.upload-img-footer-container{width:100%;gap:5px;display:grid}.info-container{display:flex;align-items:center;gap:6px;margin-bottom:10px}.info-container calcite-icon{--calcite-icon-color: var(--calcite-color-brand)}.info-container span{font-size:12px;color:var(--calcite-ui-text-3)}.padding-10{padding:10px}.report-selection-container{display:flex;flex-direction:column;gap:12px;padding:10px;--calcite-card-border-color: var(--calcite-color-border-1)}.cursor-pointer{cursor:pointer}.card-body-content{display:flex;flex-direction:row;align-items:center;padding:10px 5px;gap:15px}.text-stack{display:flex;flex-direction:column;gap:2px}.option-title{font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-1);font-size:var(--calcite-font-size--1)}.option-description{color:var(--calcite-ui-text-3);font-size:var(--calcite-font-size--1)}.action-footer{display:flex;justify-content:center;margin-top:16px}.analysis-wrapper{display:flex;flex-direction:column;align-items:center;gap:5px;text-align:center;margin:auto}.analyzing-icon{--calcite-icon-color: var(--calcite-color-brand);animation:sparkle 2s infinite ease-in-out}@keyframes sparkle{0%,to{transform:scale(1)}50%{transform:scale(1.5)}}@media only screen and (max-width:600px){.esri-editor__panel-content{padding-block:0!important;min-height:0!important}}}`,Ze=class extends st{constructor(){super(...arguments),this.customizeSubmit=!1,this.enableSearch=!1,this.enableSnapping=!1,this.floorLevel="",this.isMobile=!1,this.selectedLayerId="",this.showGuidingMsg=!0,this.submitNewReportsMessage="",this.updateMapPosition=!1,this.reportingArea=!1,this.reportingAreaLayer="",this.reportingAreaMessage="",this.showSketchWidgets=!1,this.allowMultipleCreation=!1,this.popupEnabled=!1,this.showLayerVisibilityMsg=!1,this.enablePhotoLocation=!1,this._currentPage="templatePicker",this._editorLoading=!1,this._inValidGeomtryDrawn=!1,this._selectedImageBase64="",this._imageAnalysisFailed=!1,this._translations=nt({name:"create-feature",blocking:!0}),this._addingAttachment=!1,this._uploadedImage=null,this._calciteNotice=W(),this._isSubmitBtnClicked=!1,this._mapViewContainer=W(),this._searchDiv=W(),this._inputImageForAI=W(),this._guidingMessageRefNode=W(),this._abortController=new AbortController,this.success=L(),this.fail=L(),this.drawComplete=L(),this.editingLocation=L(),this.editingAttachment=L(),this.progressStatus=L(),this.modeChanged=L()}static{this.properties={appName:1,customizeSubmit:5,enableSearch:5,enableSnapping:5,floorLevel:1,formElements:1,isMobile:5,mapView:0,searchConfiguration:0,selectedLayerId:1,showGuidingMsg:5,submitNewReportsMessage:1,updateMapPosition:5,reportingArea:5,reportingAreaLayer:1,reportingAreaMessage:1,showSketchWidgets:5,allowMultipleCreation:5,popupEnabled:5,showLayerVisibilityMsg:5,enablePhotoLocation:5,aiImageExtraction:0,_currentPage:16,_editorLoading:16,_inValidGeomtryDrawn:16,_selectedImageBase64:16,_imageAnalysisFailed:16,_translations:16}}static{this.styles=hi}static{this.shadowRootOptions=it}willUpdate(e){e.has("mapView")&&this.hasUpdated&&this.mapViewWatchHandler(),e.has("isMobile")&&this.hasUpdated&&this.isMobileHandler(),e.has("_editorLoading")&&(this.hasUpdated||this._editorLoading!==!1)&&this._editorLoadingWatchHandler(this._editorLoading)}async mapViewWatchHandler(){this.mapView&&await this.mapView.when(async()=>{this._imageAnalysisInfo&&!this._imageAnalysisInfo.canUseAI&&await this.init()})}async isMobileHandler(){this.modeChanged.emit()}async _editorLoadingWatchHandler(e){if(e){if(this._container?.classList.add("display-none"),this._selectedLayer?.isTable){if(this._selectedLayer.templates&&this._editor){let t=this._selectedLayer.templates[0],i={layer:this._selectedLayer,template:t};await this._editor.startCreateFeaturesWorkflowAtFeatureCreation(i),await this.hideEditorsElements()}}else await this.startCreate();this._container?.classList.remove("display-none"),this._editorLoading=!1}}async submit(){this._editor?.viewModel?.featureFormViewModel&&(this._isSubmitBtnClicked=!0,this._editor.viewModel.featureFormViewModel.submit())}async refresh(e){this._editor&&(e?await this._setFloorLevel(e):this.reportingArea&&this.reportingAreaLayer&&this._currentPage!=="drawing"?await this.queryIntersectingFeatures():this._currentPage!=="drawing"&&(this._inValidGeomtryDrawn=!1,this.drawComplete.emit(this._inValidGeomtryDrawn)))}async showForm(){this.progressStatus.emit(100),this._container?.classList.remove("display-none"),this._mapViewContainer.value?.classList?.replace("show-map","hide-map"),this._currentPage="featureForm"}async load(){this._imageAnalysisInfo=await this._getImageAnalysisInfo(),this._currentPage=this._imageAnalysisInfo.canUseAI?"chooseReportType":"templatePicker"}async loaded(){this._imageAnalysisInfo&&!this._imageAnalysisInfo.canUseAI&&await this.init()}async updated(){if(this.isMobile&&this.updateMapPosition){let e=this._currentPage==="drawing"?80:30,t=this.enableSearch?this._searchDiv.value?.offsetHeight:0;await this._calciteNotice.value?.componentOnReady();let i=(this._calciteNotice.value?.offsetHeight||0)+t+e;this._mapViewContainer.value&&(this._mapViewContainer.value.style.top=`${i}px`)}this.reportingAreaMessage&&this._guidingMessageRefNode.value?.children[0]&&(this._guidingMessageRefNode.value.children[0].style.margin="0px")}disconnectedCallback(){super.disconnectedCallback(),this._editor&&(this._editor.viewModel.sketchViewModel&&this._editor.viewModel.sketchViewModel?.destroy(),this._editor.destroy(),this.enableSnapping&&this.mapView?.ui.view&&((this.mapView?.ui.view).grid=null))}render(){let e=this._currentPage==="drawing"||this._currentPage==="editing"?"":"display-none",t=this._editorLoading||this._currentPage==="loading"?"":"display-none",i=this._editorLoading?"display-none":"",s=this.isMobile&&this.updateMapPosition?"show-map":"display-none",n=this._inValidGeomtryDrawn?"danger":"success",r=this._inValidGeomtryDrawn?"exclamation-mark-triangle":"lightbulb",o=this.showLayerVisibilityMsg&&this._currentPage==="templatePicker",l=(this.showGuidingMsg||o)&&this._currentPage!=="loading",h=this._translations.chooseCategoryMsg,d=this._imageAnalysisInfo?.canUseAI&&["chooseReportType","analyzingImage","imageUpload"].includes(this._currentPage);return this._inValidGeomtryDrawn?h=this.reportingAreaMessage||this._translations.reportOutsideAreaMessage:this._currentPage==="drawing"||this._currentPage==="editing"?h=this._translations.provideLocationMsg:this._currentPage==="featureForm"?h=this._imageAnalysisInfo?.results?.filter(u=>u.success).length?this._translations.formReviewMsg:this._translations.provideDetailsMsg:o&&(h=this._translations.enableFeatureTemplatesMessage),b`${this._imageAnalysisFailed&&b`<calcite-alert auto-close icon=x-octagon kind=danger label @calciteAlertClose=${()=>{this._imageAnalysisFailed=!1}} open placement=top><div slot=title>${this._translations.error}</div><div slot=message>${this._translations.imageExtractionError}</div></calcite-alert>`||""}${d&&b`<calcite-panel>${this._currentPage==="chooseReportType"&&this._getReportTypePage()||""}${this._currentPage==="imageUpload"&&this._aiImageExtractionPage()||""}${this._currentPage==="analyzingImage"&&this._getAnalyzingImagePage()||""}</calcite-panel>`||""}${!d&&b`${l&&b`<calcite-notice class="notice-msg" .icon=${r} .kind=${n} open ${$(this._calciteNotice)}><div slot=message .innerHTML=${h??""} ${$(this._guidingMessageRefNode)}></div></calcite-notice>`||""}${this._selectedImageBase64&&this._currentPage==="featureForm"&&b`<div class="image-preview-container"><calcite-label>${this._translations.photo}</calcite-label><img class="width-full" src=${this._selectedImageBase64??_e}></div>`||""}<calcite-loader class=${oe(t)} label scale=s></calcite-loader>${this._currentPage==="featureForm"&&this.isMobile&&b`<calcite-button appearance=transparent class="edit-location-btn" icon-start=pin @click=${this.editLocation}>${this._translations.editLocationLabel}</calcite-button>`||""}<div class=${oe(i)} id=feature-form></div>${this.enableSearch&&b`<div class=${`search-widget ${e} ${i}`} id=search-widget-ref ${$(this._searchDiv)}></div>`||""}`||""}<div class=${oe(s)} ${$(this._mapViewContainer)}></div>`}async init(){this.mapView&&this.selectedLayerId&&(this._updatedMapView=this.mapView,await(this.isMobile&&this.updateMapPosition?this.createMobileMapView():this._loadWidgets()))}async createMobileMapView(){this._mapViewContainer.value&&this.mapView&&(this._mapViewContainer.value.classList.add("hide-map"),await new ii({map:this.mapView.map,container:this._mapViewContainer.value,zoom:this.mapView.zoom,center:this.mapView.center,popupEnabled:this.popupEnabled}).when(e=>{this._updatedMapView=e;let t=new si({view:this._updatedMapView});t&&this._updatedMapView.ui.add(t,"top-left"),this._loadWidgets()},e=>{console.log(e)}))}async _loadWidgets(){await this.createEditorWidget(),this.enableSearch&&await this.createSearchWidget()}_getReportTypePage(){return b`<div class="report-selection-container"><calcite-label>${this._translations.createReportHeading}</calcite-label><calcite-card class="cursor-pointer" @click=${()=>{this.progressStatus.emit(35),this._currentPage="imageUpload"}}><div slot=description class="card-body-content"><calcite-icon icon=effects scale=m style="color: var(--calcite-ui-text-2)"></calcite-icon><div class="text-stack"><span class="option-title">${this._translations.aiImgExtractionLabel}</span><span class="option-description">${this._translations.aiAssistantDescription}</span></div></div></calcite-card><calcite-card class="cursor-pointer" @click=${()=>{this._currentPage="templatePicker",this.init()}}><div slot=description class="card-body-content"><calcite-icon icon=pencil scale=m></calcite-icon><div class="text-stack"><span class="option-title">${this._translations.fillOutManually}</span><span class="option-description">${this._translations.startBlank}</span></div></div></calcite-card></div>`}_aiImageExtractionPage(){let e=this._selectedImageBase64!=="",t=e?this._translations.replaceImage:this._translations.imageUploadLimitHint;return b`<calcite-notice class="notice-msg" icon=effects kind=brand open><div slot=message>${this._translations.aiAssistantProcessingHint}</div></calcite-notice><div class="padding-10"><calcite-label><div>${this._translations.photo}<span style="color: var(--calcite-color-status-danger)">*</span></div><calcite-input type=file accept="image/*;capture=camera" @calciteInputInput=${this._onImageUpload} ${$(this._inputImageForAI)}></calcite-input></calcite-label><div class="info-container"><calcite-icon icon=information scale=s></calcite-icon><span>${t}</span></div>${e&&b`<img class="width-full" src=${this._selectedImageBase64??_e}>`||""}</div><div slot=footer class="upload-img-footer-container"><calcite-button width=full .disabled=${!e} id=next-btn @click=${this._analyzeImage}>${this._translations.next}</calcite-button><calcite-button width=full appearance=outline kind=brand @click=${()=>this.modeChanged.emit()}>${this._translations.cancel}</calcite-button></div>`}_getAnalyzingImagePage(){return b`<div class="analysis-wrapper"><calcite-label layout=inline><calcite-icon class="analyzing-icon" icon=effects scale=s></calcite-icon><span>${this._translations.analyzingImage}</span></calcite-label><calcite-button class="skip-btn" appearance=transparent @click=${()=>{this._abortController.abort(),this._currentPage="templatePicker"}}>${this._translations.skip}</calcite-button></div>`}_onImageUpload(e){let t=e.target;if(t){let i=t.files[0],s=new FileReader;s.onload=n=>{this._selectedImageBase64=n.target?.result},i?(s.readAsDataURL(i),this._uploadedImage=i):(this._selectedImageBase64="",this._uploadedImage=null)}}async _analyzeImage(){this._abortController=new AbortController;let e=this._abortController.signal,t=await this._getImageAnalysisInfo();if(!t.canUseAI||!t.url||!this._inputImageForAI.value?.files?.length){this._imageAnalysisFailed=!0,console.error(this._translations.error),this._resetImageAnalysisInfo(),await this.init();return}try{this._currentPage="analyzingImage",this.progressStatus.emit(45);let i=this._inputImageForAI.value.files[0],s=await new Promise((r,o)=>{let l=new FileReader;l.onloadend=()=>r(l.result),l.onerror=o,this._inputImageForAI.value&&l.readAsDataURL(i)});if(this.enablePhotoLocation){let r=await Me(i);if(r?.longitude&&r.latitude&&this.mapView?.spatialReference){let o=new oi({longitude:r.longitude,latitude:r.latitude,spatialReference:new li({wkid:4326})}),l=await rt(o,this.mapView.spatialReference);this._imageAnalysisInfo&&(this._imageAnalysisInfo.imageLocation=l)}}let n=[];if(this.aiImageExtraction?.forEach(r=>{r?.field&&r.prompt&&r.id===this.selectedLayerId&&n.push({key:r.field,context:r.prompt})}),n.length){let r={input:s,data:n},o=await ri(t.url,{method:"post",headers:{"Content-Type":"application/json","x-esri-authorization":`Bearer ${t.token}`,"x-esri-request-source":`instantapps/${this.appName}`},body:JSON.stringify(r),responseType:"json",signal:e});this._imageAnalysisInfo&&(this._imageAnalysisInfo.results=o.data.results)}this._currentPage="loading",await this.init()}catch(i){i.name==="AbortError"?console.error("Aborted",i):(this._imageAnalysisFailed=!0,console.error("Analyzing failed",i)),this._resetImageAnalysisInfo(),this.init()}}_resetImageAnalysisInfo(){let e={url:"",token:"",canUseAI:!1,imageLocation:void 0,results:[]};this._selectedImageBase64="",this._imageAnalysisInfo=e}async _getImageAnalysisInfo(){let e={url:"",token:"",canUseAI:!1};if(this.aiImageExtraction?.some(t=>t?.field&&t.prompt&&t.id===this.selectedLayerId)){let t=(this.mapView?.map).portalItem.portal;if(t){let i=await t.fetchSettings(),s=t?.helperServices.aiUtilityServices;s?.url&&s?.api?.image_analyze&&(e.url=s.url+s.api.image_analyze),t.credential&&(e.token=t.credential.token),i?.aiAssistantsEnabled&&!i.blockBetaApps&&t?.user?.privileges?.includes("portal:user:useAIAssistants")&&(e.canUseAI=!0)}}return e}async createEditorWidget(){this._editor&&this._editor.destroy();let e=[];this._container=document.createElement("div"),this._container?.classList.add("display-none"),this.enableSnapping||this._container.classList.add("hide-editor-toolbar");let t=this._updatedMapView&&await ot(this._updatedMapView),i=this.mapView&&await Le(this.mapView,this.selectedLayerId);if(i&&(this._selectedLayer=i,!this._selectedLayer?.isTable&&t&&t.forEach(s=>{e.push({layer:s,enabled:s?.type==="feature"&&s?.id===this.selectedLayerId,addEnabled:!0,updateEnabled:!1,deleteEnabled:!1})})),this._editor=new Jt({view:this._updatedMapView,layerInfos:e,visibleElements:{settingsMenu:this.enableSnapping,snappingControls:this.enableSnapping,createFeaturesSection:!0,editFeaturesSection:!1,flow:!0,sketch:this.showSketchWidgets&&this._selectedLayer?.geometryType!=="point"},container:this._container}),this._mapViewContainer.value?this.el.insertBefore(this._container,this._mapViewContainer.value):this.el.appendChild(this._container),this._selectedLayer?.isTable&&(this._editorLoading=!0),this._editor){let s=Z.watch(()=>this._editor?.viewModel.state,h=>{h==="adding-attachment"||h==="editing-attachment"?(this._addingAttachment=!0,this.editingAttachment.emit(!0)):this._addingAttachment&&(this.editingAttachment.emit(!1),this._addingAttachment=!1)});s&&this._editor.viewModel.addHandles(s);let n=Z?.watch(()=>this._editor?.viewModel.featureTemplatesViewModel.state,h=>{h==="ready"&&this._editor?.viewModel?.activeWorkflow?.type!=="create-features"&&(this.progressStatus.emit(50),this._editorLoading=!0)});n&&this._editor.viewModel.addHandles(n);let r=Z?.watch(()=>this._editor?.viewModel.featureFormViewModel?.state,h=>{h==="ready"&&this._editor?.viewModel.featureFormViewModel&&this._currentPage!=="editing"&&(this._mapViewContainer.value?.classList?.replace("show-map","hide-map"),this._editor.viewModel.featureFormViewModel.addHandles(this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this))),setTimeout(()=>{this._setFloorLevel(this.floorLevel),this._imageAnalysisInfo?.results&&this._setAttributeValuesFromImageAnalysis()},200),!this.allowMultipleCreation&&this._editor.activeWorkflow&&(this._editor.activeWorkflow.data.creationInfo.maxFeatures=1),this._currentPage="featureForm",this.progressStatus.emit(100),this.drawComplete.emit(!1))});r&&this._editor.viewModel.addHandles(r);let o=Z.watch(()=>this._editor?.viewModel.state,h=>{h==="creating-features"&&this._editor?.viewModel.featureFormViewModel&&this._editor.viewModel.featureFormViewModel.state==="disabled"&&(this._mapViewContainer.value?.classList.replace("hide-map","show-map"),this._selectedLayer&&!this._selectedLayer.isTable&&(this._currentPage="drawing",this._editor.viewModel.sketchViewModel?.createGraphic&&this._imageAnalysisInfo?.imageLocation&&(this._updatedMapView?.goTo({center:this._imageAnalysisInfo.imageLocation}),this._selectedLayer.geometryType==="point"&&this._initializeSketchPoint(this._imageAnalysisInfo.imageLocation.clone()))))});o&&this._editor.viewModel.addHandles(o),this._editor.on("sketch-create",async h=>{h.detail.state==="complete"&&(this._drawnGeometry=h.detail.graphic?.geometry,this.reportingArea&&this.reportingAreaLayer&&await this.queryIntersectingFeatures())});let l;this._editor.on("sketch-update",h=>{clearTimeout(l),l=window.setTimeout(async()=>{this._drawnGeometry=h.detail.graphics[0].geometry,this.reportingArea&&this.reportingAreaLayer&&await this.queryIntersectingFeatures()},50)})}}async queryIntersectingFeatures(){let e=this.mapView&&await Le(this.mapView,this.reportingAreaLayer);if(e){let t=e.createQuery();t.geometry=this._drawnGeometry,t.spatialRelationship="intersects";let i=await e.queryFeatureCount(t)===0;this._inValidGeomtryDrawn=i,this.drawComplete.emit(this._inValidGeomtryDrawn)}}editLocation(){this.progressStatus.emit(75),this.editingLocation.emit(),this._container?.classList.add("display-none"),this._mapViewContainer.value?.classList.replace("hide-map","show-map"),this._currentPage="editing"}async startCreate(){return await this.hideEditorsElements(),new Promise((e,t)=>{if(this._editor?.viewModel.featureTemplatesViewModel.items?.length){let i=this._editor.viewModel.featureTemplatesViewModel.items[0].items;this._editor.viewModel.featureTemplatesViewModel.addHandles(this._editor.viewModel.featureTemplatesViewModel.on("select",()=>{this.progressStatus.emit(75),setTimeout(()=>{this.hideEditorsElements().then(()=>{e({})},n=>t(n))},700)})),i.length===1&&this._editor.viewModel.featureTemplatesViewModel.select(i[0]);let s=i.length>1;this.hideEditorsElements().then(()=>{s&&(this._currentPage="templatePicker",e({}))},n=>s&&t(n))}})}async createSearchWidget(){if(this._updatedMapView){let e={view:this._updatedMapView};if(this.searchConfiguration&&(e={...this._getSearchConfig(this.searchConfiguration,this._updatedMapView)}),this._search=new ai(e),!this._search)return;this._search.container="search-widget-ref",this._search.popupEnabled=!1,this._search.resultGraphicEnabled=!1;let t;this._search.viewModel.addHandles(this._search.on("search-complete",s=>{s.results[0].results&&s.results[0].results[0]&&(s.results[0].results[0].extent&&this._updatedMapView?.goTo(s.results[0].results[0].extent),this._selectedLayer?.geometryType==="point"&&(t=s.results[0].results[0]?.feature.geometry))}));let i=Z.watch(()=>this._search?.viewModel.state,s=>{s==="ready"&&setTimeout(()=>{if(this._editor?.viewModel.sketchViewModel?.createGraphic&&t)this._initializeSketchPoint(t);else if(this._editor?.viewModel.sketchViewModel&&this._editor.viewModel.sketchViewModel.updateGraphics.length>0&&t){let n=this._editor?.viewModel.sketchViewModel?.updateGraphics.getItemAt(0);n&&(n.set("geometry",t),this._editor?.viewModel.sketchViewModel?.update(n),this.hideEditorsElements())}},100)});i&&this._search.viewModel.addHandles(i)}}async _initializeSketchPoint(e){if(this._editor?.viewModel.sketchViewModel?.createGraphic){let t=this._editor.viewModel.sketchViewModel.createGraphic.set("geometry",e).clone();this._editor.viewModel.sketchViewModel.addGraphic(t),this._editor.viewModel.sketchViewModel.emit("create",{graphic:t,state:"complete",toolEventInfo:null,type:"create"}),await this._editor.viewModel.sketchViewModel.update(t),this.hideEditorsElements()}}_getSearchConfig(e,t){let i="includeDefaultSources",s=e.sources;return s&&s?.length>0?(e[i]=!1,s.forEach(n=>{if(n.hasOwnProperty("layer")){let r=n,o=r.layer?.id,l=o?t.map?.findLayerById(o):"",h=r?.layer?.url;l?r.layer=l:h&&(r.layer=new Zt(h))}}),s?.forEach(n=>{if(n.hasOwnProperty("locator")){let r=n;if(r?.name==="ArcGIS World Geocoding Service"){let o=r.outFields||["Addr_type","Match_addr","StAddr","City"];r.outFields=o,r.singleLineFieldName="SingleLine"}r.url=r.url,delete r.url}})):e={...e,includeDefaultSources:!0},e}async _setFloorLevel(e){if(!e)return;let t=this._selectedLayer,i=t?.floorInfo?.floorField;if(i){let s=t.fields.find(n=>n.name===i);if(s&&!t?.formTemplate)this._editor?.viewModel.featureFormViewModel&&(this._editor.viewModel.featureFormViewModel.setValue(s.name,e),s.editable=!1);else if(t.formTemplate&&this.formElements){let n=new Qt({expression:`'${e}'`,name:"floor-info-test",title:"Floor Info",returnType:"string"}),r=new ei({label:i,editableExpression:"false",fieldName:i,input:{type:"text-box",maxLength:50,minLength:0},valueExpression:n.name});this._updatedMapView?.map.editableLayers.forEach(o=>{let l=this.formElements.orgElements,h=this.formElements.orgExpressionInfos,d=[...l];if(d.push(r),o.type==="feature"){let u=o,y=new ti({title:u?.formTemplate?.title,description:u?.formTemplate?.description,elements:d,expressionInfos:[n].concat(h)});o.formTemplate=y}})}}}_setAttributeValuesFromImageAnalysis(){this._imageAnalysisInfo?.results&&this._imageAnalysisInfo.results.forEach(e=>{this._editor?.viewModel.featureFormViewModel&&e.key&&e.success&&this._editor.viewModel.featureFormViewModel.setValue(e.key,e.value)})}async hideEditorsElements(){this.customizeSubmit&&(await this.timeout(700),this.el.querySelector(".esri-editor")?.querySelectorAll("calcite-flow-item")?.forEach(e=>{let t=e.shadowRoot?.querySelector("calcite-panel")?.shadowRoot?.querySelector("article");t?.querySelector("header")?.setAttribute("style","display: none"),t?.querySelector("footer")?.setAttribute("style","display: none")}))}async submitted(e){let t=!1;if(e.invalid.length){this._isSubmitBtnClicked=!1;return}if(this._isSubmitBtnClicked){this._isSubmitBtnClicked=!1;try{if(this._editor?.activeWorkflow){if(this._selectedLayer&&this._selectedLayer.capabilities.data.supportsAttachment&&this._selectedImageBase64&&(t=!0),t){let i=this._selectedLayer?.on("edits",async s=>{if(s.addedFeatures.length>0){let n=s.addedFeatures[0].objectId;try{if(this._uploadedImage&&this._selectedLayer){let r=this._uploadedImage,o=new FormData;o.set("keywords","ai-image"),o.set("attachment",r),o.append("f","json");let l=new ni({attributes:{[this._selectedLayer.objectIdField]:n}});await this._selectedLayer.addAttachment(l,o)}}catch(r){console.error("Attachment upload failed",r)}i?.remove(),this.success.emit()}})}await this._editor.activeWorkflow.commit(),this._editor.viewModel.failures?.length&&this._editor.viewModel.failures.some(i=>{if(i.error)throw i.error})}}catch(i){this.fail.emit(i);return}t||this.success.emit()}}async timeout(e){return new Promise(t=>setTimeout(t,e))}};at("create-feature",Ze);return Ze},"widgets/Editor","form/ExpressionInfo","layers/FeatureLayer","form/elements/FieldElement","form/FormTemplate","views/MapView","widgets/Home","widgets/Search","Graphic","core/reactiveUtils","request","geometry/Point","geometry/SpatialReference",a,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import c from"./KDIUYXBA.js";import b from"./UUYUTETH.js";import{a as L}from"./
|
|
2
|
+
import c from"./KDIUYXBA.js";import b from"./UUYUTETH.js";import{a as L}from"./6LLQFZGG.js";import"./36I27Q5R.js";import"./GDPFKW75.js";import{b as m}from"./LI7AOAAS.js";import{H as p,h as y,i as a,r as l,u as d}from"./46DQNAMV.js";import"./OR4HXHSY.js";export default $arcgis.t(([n,_,,{a:w,c:u,e:f}])=>{async function I(h,t){let{style:i="decimal",places:e=2}=t||{},s=n.convertNumberFormatToIntlOptions({places:e,digitSeparator:!0});return s.style=i,n.formatNumber(h,s)}var x=y`@layer{:host{display:block}.notice-msg{width:calc(100% - 20px);padding:10px}.layer-name{font-weight:500;word-break:break-word}.feature-count{padding:0 10px}}`,o=class extends p{constructor(){super(),this.layers=[],this.showFeatureCount=!0,this.showNextIcon=!1,this.applyLayerViewFilter=!1,this.filterByMapExtent=!1,this._noLayersToDisplay=!1,this._mapLayerIds=[],this._isLoading=!1,this._translations=L({name:"layer-list",blocking:!0}),this.layerSelect=l(),this.layersListLoaded=l(),this.listenOn(window,"selectedLanguageUpdated",this.selectedLanguageUpdated)}static{this.properties={mapView:0,layers:0,showFeatureCount:5,showNextIcon:5,applyLayerViewFilter:5,filterByMapExtent:5,_noLayersToDisplay:16,_mapLayerIds:16,_isLoading:16,_translations:16}}static{this.styles=x}static{this.shadowRootOptions=d}willUpdate(t){t.has("filterByMapExtent")&&this.hasUpdated&&this.filterByMapExtentWatchHandler(this.filterByMapExtent)}filterByMapExtentWatchHandler(t){t?this.initializeMapExtentFilter():this._filterByMapExtentHandle&&this._filterByMapExtentHandle.remove()}async refresh(){await this.setLayers()}async selectedLanguageUpdated(t){await this.setLayers()}async load(){this.filterByMapExtent&&this.initializeMapExtentFilter()}async loaded(){await this.setLayers()}render(){return a`${this._isLoading&&a`<calcite-loader label scale=m></calcite-loader>`||""}${!this._isLoading&&this.mapView&&this._noLayersToDisplay&&a`<calcite-notice class="notice-msg" icon=layers-reference kind=danger open><div slot=title>${this._translations.error}</div><div slot=message>${this._translations.noLayerToDisplayErrorMsg}</div></calcite-notice>`||""}${!this._isLoading&&this.mapView&&a`<calcite-list label selection-appearance=border selection-mode=none>${this.filterByMapExtent&&this._mapLayerIds.length>0&&this.getExtentNotice()||""}${this.renderLayerList()}</calcite-list>`||""}`}initializeMapExtentFilter(){this._filterByMapExtentHandle=_.when(()=>this.mapView?.stationary,()=>{this.setLayers()},{initial:!0})}async setLayers(){this.mapView&&(this._isLoading=!0,await this.initLayerHash(),this._isLoading=!1)}async initLayerHash(){let t=[];if(this.mapView){this._layerItemsHash=await w(this.mapView,!0);let i=await f(this.mapView);for(let e of i)if(e?.type==="feature"&&this.showFeatureCount){let s=e.createQuery();if(e?.definitionExpression&&(s.where=s.where+" AND "+e.definitionExpression),this.applyLayerViewFilter){let r=await u(this.mapView,e.id);r?.filter?.where&&(s.where=s.where?s.where+" AND "+r.filter.where:r.filter.where)}s.geometry=this.filterByMapExtent?this.mapView.extent:null;let c=e.queryFeatureCount(s);t.push(c),c.then(async r=>{let g=Number.isNaN(r)?"":await I(r,{places:0,style:"decimal"});this._layerItemsHash?.[e.id]&&(this._layerItemsHash[e.id].formattedFeatureCount=g)})}await Promise.all(t).then(()=>{let e=this._layerItemsHash&&this.getLayersToBeShownInList(this._layerItemsHash);this._mapLayerIds=e?.reverse()||[],this.handleNoLayersToDisplay()},()=>{this._mapLayerIds=[],this.handleNoLayersToDisplay()})}}handleNoLayersToDisplay(){this._noLayersToDisplay=!(this._mapLayerIds.length>0),this.layersListLoaded.emit(this._mapLayerIds)}getLayersToBeShownInList(t){let i=this.layers?.length>0?this.layers:[];return Object.keys(t).reduce((e,s)=>(i.indexOf(s)>-1&&e.push(s),e),[])}renderLayerList(){return this._mapLayerIds.length>0?this._mapLayerIds.reduce((t,i)=>{if(this._layerItemsHash&&this._layerItemsHash[i]){let e=this.getLayerListItem(i);e&&t.push(e)}return t},[]):void 0}getLayerListItem(t){let i=this._layerItemsHash&&this._layerItemsHash[t].name,e=this._layerItemsHash&&this._layerItemsHash[t].formattedFeatureCount;return a`<calcite-list-item @calciteListItemSelect=${()=>{this.onLayerItemSelected(t)}}><div class="layer-name" slot=content-start>${i}</div>${this.showFeatureCount&&e!==void 0&&e!==""&&a`<div class="feature-count" slot=content-end>${`(${e})`}</div>`||""}${this.showNextIcon&&a`<calcite-icon flip-rtl icon=chevron-right scale=s slot=content-end></calcite-icon>`||""}</calcite-list-item>`}getExtentNotice(){return a`<calcite-notice class="notice-msg" icon=extent-filter kind=brand open scale=s><div slot=message>${this._translations.extentFilterMsg}</div></calcite-notice>`}onLayerItemSelected(t){this._layerItemsHash&&this.layerSelect.emit({layerId:t,layerName:this._layerItemsHash[t]?.name})}};m("layer-list",o);return o},"intl","core/reactiveUtils",b,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{b as n}from"./
|
|
2
|
+
import{b as n}from"./LI7AOAAS.js";import{F as m,G as r,H as o,h as t,i as p}from"./46DQNAMV.js";import"./OR4HXHSY.js";export default $arcgis.t(([l,h])=>{var d=t`.display-block{display:block}`,s=class extends o{constructor(){super(...arguments),this._basemapElement=m()}static{this.properties={mapView:0,basemapConfig:0,basemapWidget:0}}static{this.styles=d}willUpdate(a){a.has("basemapConfig")&&this.basemapConfigWatchHandler(),a.has("mapView")&&this.mapViewWatchHandler()}async basemapConfigWatchHandler(){if(this.basemapWidget?.source){let a=this.basemapWidget?.source;a.query=this.basemapConfig?.basemapGroupId?`id:${this.basemapConfig.basemapGroupId}`:null,await a.refresh()}}async mapViewWatchHandler(){this.mapView!==void 0&&await this.mapView.when(()=>{this._initBaseMapGallery(this.mapView)})}render(){return p`<div class="display-block" ${r(this._basemapElement)}></div>`}loaded(){this.mapView&&this.mapViewWatchHandler()}async _initBaseMapGallery(a){if(a){let e=new h({query:this.basemapConfig?.basemapGroupId?`id:${this.basemapConfig.basemapGroupId}`:null,filterFunction:this.basemapConfig?i=>i?.portalItem?.id&&this.basemapConfig?!this.basemapConfig.basemapIdsToFilter.includes(i?.portalItem?.id):!0:()=>!0});await e.refresh(),this.basemapWidget?(this.basemapWidget.view=a,this.basemapWidget.source=e):this.basemapWidget=new l({container:this._basemapElement.value,view:a,source:e})}}};n("map-basemap-gallery",s);return s},"widgets/BasemapGallery","widgets/BasemapGallery/support/PortalBasemapsSource")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./254AARKL.js";import a from"./QRPBAR4V.js";import{K as J,nb as B,ob as S,qa as M,r as N}from"./JE7L7M3J.js";import{g as O}from"./CGLFPVBM.js";export default $arcgis.t(([{H:T,g:D,h:k,i:z,j:K,m:U,n:w},{a:v,b:h,c:j,e:p}])=>{var V=class{constructor(e,r,s){this.cMissingImageDataURI="https://static.arcgis.com/images/solution.png",this.cardCache=[],this.cardCacheParams={q:"",categoriesAsStr:"[]",sortField:"title",sortOrder:"asc"},this.locale=e,this.orgUrl=r,this.portalUrl=s,this.anonAgolSession=new O({}),this.agolPortalUrl=K(s)}addToCache(e){this.cardCache.push(e)}getCache(){return this.cardCache}removeFromCache(e){this.cardCache=this.cardCache.filter(r=>r.id!==e)}requestAvailableSolutionCards(e,r,s,t,o,n,a,i){let m=a?.start?a.start:1,g=a?.num?a.num:24,P=this.portalUrl+"/sharing/rest",f=this.agolPortalUrl+"/sharing/rest",C=this.anonAgolSession,q=JSON.stringify(e.categories);if(this.cardCacheParams.q!==e.q||this.cardCacheParams.categoriesAsStr!==q||e.sortField==="relevance"?(this.cardCache=[],this.cardCacheParams={q:e.q,categoriesAsStr:q,sortField:e.sortField,sortOrder:e.sortOrder}):(this.cardCacheParams.sortField!==e.sortField||this.cardCacheParams.sortOrder!==e.sortOrder)&&(this.cardCacheParams.sortField=e.sortField,this.cardCacheParams.sortOrder=e.sortOrder,this.cardCache=p(this.cardCache,this.cardCacheParams.sortField,this.cardCacheParams.sortOrder)),this.cardCache.length>0){let c;if(i&&i.size>0){let d=v(this.cardCache,i);c=h(d,m,g)}else c=h(this.cardCache,m,g);return Promise.resolve(c)}let A={filter:e.filter,sortField:e.sortField,sortOrder:e.sortOrder,categories:e?.categories?this.convertSearchCategories(e.categories):"",signal:n},y=[];if(r&&!o){let c=t||new O({});y.push(S(r,e.q,c,A,P))}return s&&o&&y.push(S(s,e.q,C,A,f)),Promise.allSettled(y).then(c=>{let d=[];c.forEach(u=>{if(u.status==="fulfilled"){let I=u.value,b="",R=!1;b=this.agolPortalUrl,R=!0,I.results.forEach(E=>{E.sourcePortalUrl=b,E.knownToBePublicSource=R}),d.push(I)}else if(u.status==="rejected")throw new Error(u.reason.message?u.reason.message:"cannotAccessAGO")}),d.length===0?this.cardCache=[]:d.length===1?this.cardCache=this.getCardsFromResponse(d[0]):this.cardCache=p(this.getCardsFromResponse(this.mergeResponses(d)),this.cardCacheParams.sortField,this.cardCacheParams.sortOrder);let F;if(i&&i.size>0){let u=v(this.cardCache,i);F=h(u,m,g)}else F=h(this.cardCache,m,g);return Promise.resolve(F)}).catch(c=>Promise.reject(new Error(c.message)))}requestDeployedSolutionCards(e,r,s="",t){let o=this.portalUrl+"/sharing/rest";if(t.aborted)return Promise.resolve([]);if(this.cardCacheParams.q!==e.q||this.cardCacheParams.categoriesAsStr!==JSON.stringify(e.q)||e.sortField==="relevance"?(this.cardCache=[],this.cardCacheParams={q:e.q,categoriesAsStr:"[]",sortField:e.sortField,sortOrder:e.sortOrder}):(this.cardCacheParams.sortField!==e.sortField||this.cardCacheParams.sortOrder!==e.sortOrder)&&(this.cardCacheParams.sortField=e.sortField,this.cardCacheParams.sortOrder=e.sortOrder,this.cardCache=p(this.cardCache,this.cardCacheParams.sortField,this.cardCacheParams.sortOrder)),t.aborted)return Promise.resolve([]);if(this.cardCache.length>0){let a=h(this.cardCache,1,this.cardCache.length);return Promise.resolve(a)}let n={q:e.q,filter:e.filter,sortField:e.sortField,sortOrder:e.sortOrder,authentication:r,portal:o,categories:e?.categories?JSON.stringify(e.categories):"",num:e.num,signal:t};return s?M(s,r).then(a=>{if(t.aborted)return Promise.resolve([]);this.cardCache=this.getCardsFromResponse({results:[a]});let i=h(this.cardCache,1,this.cardCache.length);return Promise.resolve(i)}).catch(a=>Promise.reject(new Error(a))):B(n).then(a=>{this.cardCache=this.getCardsFromResponse(a);let i=h(this.cardCache,1,this.cardCache.length);return Promise.resolve(i)}).catch(a=>Promise.reject(new Error(a)))}convertSearchCategories(e){return e&&(Array.isArray(e)?e=e.map(r=>JSON.stringify(Array.isArray(r)?r:[r])):e=JSON.stringify([e])),e}getCardsFromResponse(e){return e.results.length>0?N(e.results).map(r=>{let s=r.sourcePortalUrl?r.sourcePortalUrl:this.portalUrl,t=r.sourcePortalUrl?r.sourcePortalUrl:this.orgUrl,o={id:r.id,title:r.title,snippet:r.snippet||"",description:r.description||"",url:r.url||"",itemUrl:`${t}/home/item.html`+k([{k:"id",v:r.id}])||"",thumbnailFilename:r.thumbnail,thumbnailUrl:z(r.id,r.thumbnail,this.cMissingImageDataURI,s),tryitUrl:r.url||"",typeKeywords:r.typeKeywords,learnMoreUrl:r.properties?.learnMoreUrl||"",createdMs:r.created,created:U(r.created,this.locale),modified:U(r.modified,this.locale),numViews:r.numViews,tags:r.tags,categories:r.groupCategories&&r.groupCategories.length>0?r.groupCategories:r.categories||[],licenseInfo:D(r.licenseInfo),deployCommonId:w(r.typeKeywords||[],"solutionid-"),deployVersion:w(r.typeKeywords||[],"solutionversion-"),canDelete:r.created>16183314e5,preview:this.preparePreviewImageUrls(r.id,r.properties?.preview,s),sourcePortalUrl:r.sourcePortalUrl||"",knownToBePublicSource:r.knownToBePublicSource||!1,waitId:"",relatedSolutions:J(r,"properties.relatedSolutions")||[],owner:r.owner};return o.deployCommonId!==""&&o.deployVersion!==""?o:null}).filter(r=>r!=null):[]}mergeResponses(e){let r=0;e.forEach(t=>r+=t.total);let s=[];return e.forEach(t=>s=s.concat(t.results)),{query:e[0].query,start:1,num:r,nextStart:-1,total:r,results:s}}preparePreviewImageUrls(e,r,s){return r?r.map(t=>(t.format==="image"&&(t.name=s+"/sharing/rest/content/items/"+e+"/resources/"+t.name),t)):[]}};async function L(l,e,r,s,t=T,o="created",n="desc",a=!1,i=[],m=[],g,P,f){if(!l?.IsSignedIn)return;let C={q:t,filter:"type:Solution",sortField:o,sortOrder:n,delay:a,categories:i,num:100};return C.q+=G(l,P),await x(e,C,s,m,f,g)}function G(l,e){let r="",s=l.PortalUserOrg,t=l.PortalUserName;return s&&(r+=" orgid:"+s),e!=="My organization's solutions"&&t&&(r+=" owner:"+t),r}async function x(l,e,r,s,t="",o){let n=await r.requestDeployedSolutionCards(e,l,t,o),a=j(n.cards,s);return{cards:n.cards,relatedSolutions:a}}return{a:V,b:L}},a,b)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import m from"./6EFUV7CH.js";import l from"./CK7LURBK.js";import k from"./USIESVTZ.js";import j from"./4CMHNL7Z.js";import i from"./U75PDOJF.js";import h from"./UDTF5SYU.js";import f from"./PNBTKFO6.js";import e from"./C2MDLUTX.js";import"./NQXUGAR7.js";import d from"./FL74XITX.js";import c from"./KKI72ISR.js";import b from"./5Z32YRHM.js";import"./4T7P5RXF.js";import"./6MZ227J7.js";import a from"./RTSKNY33.js";import{a as u}from"./PZ4L77M5.js";import"./JE7L7M3J.js";import{a as S}from"./LFIJXE3U.js";import"./36I27Q5R.js";import"./GDPFKW75.js";import"./AOBFPJ2R.js";import"./JK6XUSIM.js";import"./UPHYUDLT.js";import"./QJJXVRMV.js";import"./7FMLZNDR.js";import"./LL5C4DHP.js";import"./WPAMUSBR.js";import"./XJPOVJV7.js";import"./LDNQ56OK.js";import"./3HUY3T5F.js";import"./Z6G5PBUQ.js";import"./J3QMHA2M.js";import"./TKZAMPEI.js";import"./2IHQU2FX.js";import"./CGLFPVBM.js";import"./OEJAW72H.js";import"./5JJMGPOW.js";import"./TYX345MZ.js";import"./5UWT66A7.js";import{b as C}from"./VU3OQQKP.js";import{F as o,G as s,H as v,J as _,h as g,i as p,r as n}from"./46DQNAMV.js";import"./OR4HXHSY.js";export default $arcgis.t(([,,,{D:x,H:D,I:I,K:c,a:f,b:w,w:F},,{b:O},,,{g:k,h:A},,,,,{a:y,b:M},{a:T}])=>{var $=g`.back-color-override{background-color:var(--calcite-color-foreground-2);--calcite-tab-border-color: var(--calcite-color-foreground-3)}.display-none{display:none!important}.height-100{height:100%}calcite-tab-nav{padding-bottom:6px;padding-top:6px}calcite-tab{--calcite-color-focus: transparent}calcite-tab>*{--calcite-color-focus: initial}calcite-tabs{--calcite-tab-border-color: var(--calcite-color-border-3);height:100%}.tab-space-0{--calcite-tab-content-space-y: var(--calcite-spacing-none)}.tab-space-md{--calcite-tab-content-space-y: var(--calcite-spacing-md)}solutions-searchsort-toolbar,solutions-deploy-app-nav,solution-details-panel,solutions-resources-shell,solutions-deployed-shell,solutions-all-shell,calcite-tab-nav,solution-deployed-card-panel{width:1440px;display:block;max-width:96vw;padding-right:var(--calcite-spacing-none);padding-left:var(--calcite-spacing-none);margin-left:auto;margin-right:auto;box-sizing:border-box}.border{height:var(--calcite-spacing-px);border-bottom-color:var(--calcite-color-border-3);border-bottom-style:solid;border-bottom-width:var(--calcite-border-width-sm);box-sizing:border-box}.overflow-auto{overflow:auto}solution-details-panel{scroll-margin-top:3rem}`,m=class extends v{constructor(){super(),this.initTitleOrId="",this.sortType="relevance",this.useLocalAppConfig=!1,this.authentication=void 0,this._isLoaded=!1,this.isMobile=!1,this._activeTab="all-solutions",this._showDeployedCardFetchFailed=!1,this._translations=S({name:"solutions-deploy-app",blocking:!0}),this._agoTerms=`${I}`,this._allCards=[],this._allShell=o(),this._allTab=o(),this._allTabTitle=o(),this._resourcesTab=o(),this._resourcesTabTitle=o(),this._categories=[],this._configContextProvider=u({context:w}),this._delay=!1,this._deployAppNav=o(),this._deployedCardPanel=o(),this._deployCardFetchFailedMessage="",this._deployedCardTab=o(),this._deployedCardTabTitle=o(),this._detailsShell=o(),this._detailsTab=o(),this._detailsTabTitle=o(),this._forceInit=!1,this._getSuggested=!1,this._tabpanelsFixed=!1,this._isMobileContextProvider=u({context:f}),this._mySolutionsShell=o(),this._mySolutionsTab=o(),this._mySolutionsTabTitle=o(),this._sortField="relevance",this._sortOrder="desc",this._telemetryManager=new T,this.deployAppTabSelected=n(),this.deployedCardFetchFailed=n(),this.detailsCardSelected=n(),this.deployedCardSelected=n(),this.metaTagStringsReady=n(),this.sessionRefreshed=n(),this.tabChanged=n(),this.listenOn(window,"detailsCardSelected",this._detailsCardSelected),this.listenOn(window,"deployedCardSelected",this._deployedCardSelected),this.listenOn(window,"displayDeployedCard",this._handleDeployedCardDisplay),this.listenOn(window,"navTabSelected",this._setActiveTab),this.listenOn(window,"forceSelectTab",t=>this.selectTab(t.detail,{})),this._mediaQueryChange=this._mediaQueryChange.bind(this)}static{this.properties={appConfig:1,initTab:1,initTitleOrId:1,sortType:1,useLocalAppConfig:5,authentication:16,_isLoaded:16,isMobile:16,_activeTab:16,_showDeployedCardFetchFailed:16,_translations:16}}static{this.styles=$}get _telemetry(){return this._configContextProvider.value?.telemetrySession}get _isDisconnectedEnvironment(){return this._configContextProvider.value?.isEnterprise===!0&&this._configContextProvider.value?.authentication?.CanSearchArcGISOnline===!1}async selectTab(t,e){if(this._isLoaded||this._forceInit){let i=this._getDefaultSearchOptions(e);switch(this._searchSortToolbar&&(this._searchSortToolbar.scope=t.tabType),t.tabType){case"all-solutions":this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0,i&&await this._allShell.value?.searchSolutions(i);break;case"resources":this._resourcesTab.value.selected=!0,this._resourcesTabTitle.value.selected=!0;break;case"deployed-card":if(this.authentication?.IsSignedIn){if(this._forceInit=!0,this._isLoaded=!1,this._cardFetcherDeployed&&await this._getDeployedSolution(t.tabTitleOrId),this._deployedSolutions?.cards?.length>0){let a;this._deployedSolutions.cards.some(l=>l.id===t.tabTitleOrId?(a=l,this.deployedCardSelected.emit({card:a}),!0):!1),this._isLoaded=!0,this._forceInit=!1}else return this._isLoaded=!0,this._forceInit=!1,this.selectTab({tabTitleOrId:"",tabType:"deployments"},e);break}else await this.authentication?.signIn();case"details":if(this._allCards){let a=k(this._allCards,t.tabTitleOrId);a=a||A(this._allCards,t.tabTitleOrId),a?(this._detailsTab.value.selected=!0,this._detailsTabTitle.value.selected=!0,this.detailsCardSelected.emit(a)):(t.tabType="all-solutions",this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0)}break;case"deployments":this._mySolutionsTab.value.selected=!0,this._mySolutionsTabTitle.value.selected=!0,this._searchSortToolbar&&i?.filter&&this._searchSortToolbar.changeOwnerFilter(i.filter!=="Organization"),i&&await this._mySolutionsShell.value?.searchSolutions(i);break}return this._setActiveTab(new CustomEvent("setActiveTab",{detail:t})),this._blurTabs(),this._showDeployedCardFetchFailed&&(this.deployedCardFetchFailed.emit({message:this._deployCardFetchFailedMessage,title:this._translations.failedToOpen}),this._showDeployedCardFetchFailed=!1),!0}else return this._initTab=t,this._initFilters=e,!1}async connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia("(max-width: 800px)"),this._mediaQuery.addEventListener("change",this._mediaQueryChange),this._mediaQueryChange(this._mediaQuery)}updated(){this._fixTabpanelFocus()}_fixTabpanelFocus(){if(!this._tabpanelsFixed&&this._allTab.value){let t=[this._allTab,this._mySolutionsTab,this._resourcesTab,this._detailsTab,this._deployedCardTab];Promise.all(t.map(async e=>{let i=e.value;if(i&&(await i.componentOnReady?.(),i.shadowRoot)){let a=i.shadowRoot.querySelector('[role="tabpanel"]');a&&(a.tabIndex=-1)}})).then(()=>{this._tabpanelsFixed=!0,this._setupTabpanelObserver()}).catch(()=>{this._tabpanelsFixed=!0})}}_setupTabpanelObserver(){this._tabpanelObserver||(this._tabpanelObserver=new MutationObserver(t=>{t.forEach(e=>{if(e.type==="attributes"&&e.attributeName==="tabindex"){let i=e.target;i.getAttribute("role")==="tabpanel"&&i.tabIndex===0&&(i.tabIndex=-1)}})}),[this._allTab,this._mySolutionsTab,this._resourcesTab,this._detailsTab,this._deployedCardTab].forEach(t=>{let e=t.value;if(e?.shadowRoot){let i=e.shadowRoot.querySelector('[role="tabpanel"]');i&&this._tabpanelObserver.observe(i,{attributes:!0,attributeFilter:["tabindex"]})}}))}async load(){this.useLocalAppConfig&&(this.appConfig=O)}render(){let t=this._isLoaded?"display-none":"",e=this._isLoaded?"":"display-none";return p`<calcite-shell><solutions-deploy-app-nav .appConfig=${this.appConfig} .initTab=${this.initTab} @authInit=${this._handleAuthInit} slot=header ${s(this._deployAppNav)}></solutions-deploy-app-nav>${this._isSearchToolbarShowing()&&p`<div class="border" slot=header></div>`||""}<solutions-searchsort-toolbar slot=header ${s(async i=>{i&&(await this._deployAppNav.value?.componentOnReady(),this._searchSortToolbar=i)})}></solutions-searchsort-toolbar><calcite-loader class=${_(t)} id=solutions-loader .label=${this._translations.fetchingAllSolutions}></calcite-loader><calcite-tabs class=${_(e)} scale=l><calcite-tab-nav class="display-none" @calciteTabChange=${this._handleCalciteTabChanged} slot=title-group><calcite-tab-title ${s(this._allTabTitle)}>${this._translations.allSolutions}</calcite-tab-title><calcite-tab-title ${s(this._mySolutionsTabTitle)}>${this._translations.mySolutions}</calcite-tab-title><calcite-tab-title ${s(this._resourcesTabTitle)}>${this._translations.solutionResources}</calcite-tab-title><calcite-tab-title class="display-none" ${s(this._detailsTabTitle)}></calcite-tab-title><calcite-tab-title class="display-none" ${s(this._deployedCardTabTitle)}></calcite-tab-title></calcite-tab-nav><calcite-tab class="back-color-override tab-space-0" selected ${s(this._allTab)}><solutions-all-shell class="height-100" ${s(this._allShell)}></solutions-all-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${s(this._mySolutionsTab)}><solutions-deployed-shell class="height-100" ${s(this._mySolutionsShell)}></solutions-deployed-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${s(this._resourcesTab)}><solutions-resources-shell class="height-100"></solutions-resources-shell></calcite-tab><calcite-tab class="back-color-override" ${s(this._detailsTab)}><solution-details-panel class="height-100" ${s(this._detailsShell)}></solution-details-panel></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${s(this._deployedCardTab)}><solution-deployed-card-panel class="shell-container height-100" ${s(this._deployedCardPanel)}></solution-deployed-card-panel></calcite-tab></calcite-tabs></calcite-shell>`}loaded(){this._setScrollbarGutters()}disconnectedCallback(){super.disconnectedCallback(),this._mediaQuery?.removeEventListener("change",this._mediaQueryChange),this._tabpanelObserver?.disconnect()}async _handleAuthInit(t){let e=t.detail;e.telemetrySession||(e.telemetrySession=T.getDisabledSession()),this._configContextProvider.setValue(e),e.authentication&&(this.authentication=e.authentication),this._cardFetcherDeployed=new y(e.locale,e.orgUrl,e.portalURL),this._cardsFetcher=new y(e.locale,e.orgUrl,e.portalURL),this._isDisconnectedEnvironment||await this._getSolutions(e.primarySolutionsGroupId,e.agoBasedEnterpriseSolutionsGroupId),this._configContextProvider.value.allCards=this._allCards,this._configContextProvider.value.anonAgolSession=this._cardsFetcher.anonAgolSession,this._configContextProvider.value.agolPortalUrl=this._cardsFetcher.agolPortalUrl,await this._initializeTelemetry(),this._isLoaded=!0,this._setRefreshInterval(),this._initTab?(this.selectTab(this._initTab,this._initFilters),this._logTabViewTelemetry(this._initTab.tabType),this._initTab=void 0,this._initFilters=void 0):this.authentication?.IsSignedIn&&(this.initTab==="details"||this.initTab==="deployed-card"||(this._logTabViewTelemetry(this._activeTab),this._emitMetaTagStrings(this._activeTab)))}_mediaQueryChange(t){this.isMobile=t.matches,this._isMobileContextProvider.setValue(this.isMobile)}_setActiveTab(t){let e=t.detail.tabType,i=this._activeTab!==e;switch(this._activeTab=e,i&&this._logTabViewTelemetry(e),e){case"all-solutions":this._allTabTitle.value?.click();break;case"deployments":this._mySolutionsTabTitle.value?.click();break;case"resources":this._resourcesTabTitle.value?.click();break;case"deployed-card":this._deployedCardTabTitle.value?.click();break;case"details":this._detailsTabTitle.value?.click();break}e!=="details"&&e!=="deployed-card"&&(this._deployAppNav.value.activateMenuItem(e),this.deployAppTabSelected.emit(e),this._emitMetaTagStrings(e))}_logTabViewTelemetry(t,e){let i;switch(t){case"all-solutions":i=c.ALL_SOLUTIONS;break;case"deployments":i=c.DEPLOYMENTS;break;case"resources":i=c.RESOURCES;break;case"details":i=c.SOLUTION_DETAILS;break;case"deployed-card":i=c.DEPLOYMENTS;break}if(!((t==="details"||t==="deployed-card")&&!e)&&i){let a=[];if((t==="details"||t==="deployed-card")&&e){let r=e;a.push(r.title||""),a.push(r.deployCommonId||""),a.push(r.deployVersion||"")}let l=t==="deployed-card"?"Open":"View";this._telemetry?.logEvent({category:i,action:l,dimensions:a.length>0?a:void 0})}}_emitMetaTagStrings(t,e){let i="",a="";switch(t){case"all-solutions":i=this._translations.metaAllSolutionsTitle,a=this._translations.metaAllSolutionsDescription;break;case"deployments":case"deployed-card":i=this._translations.metaDeploymentsTitle,a=this._translations.metaDeploymentsDescription;break;case"resources":i=this._translations.metaResourcesTitle,a=this._translations.metaResourcesDescription;break;case"details":e&&(i=this._translations.metaDetailsTitle.replace("{title}",e.title),a=e.snippet);break}this.metaTagStringsReady.emit({pageType:t,title:i,description:a,detailTemplate:e})}_handleCalciteTabChanged(){this.tabChanged.emit(this._activeTab)}_detailsCardSelected(t){this._activeTab="details",this._detailsTabTitle.value.selected=!0,this._detailsTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail&&(this._selectedDetailsCard=t.detail),this._logTabViewTelemetry("details",this._selectedDetailsCard),this._emitMetaTagStrings("details",this._selectedDetailsCard)}_deployedCardSelected(t){this._activeTab="deployed-card",this._deployedCardTabTitle.value.selected=!0,this._deployedCardTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail?.card&&(this._selectedDeployedCard=t.detail.card),this._logTabViewTelemetry("deployed-card",this._selectedDeployedCard),this._emitMetaTagStrings("deployed-card")}_handleDeployedCardDisplay(t){let{card:e,cardRef:i}=t.detail;this.deployedCardSelected.emit({card:e,cardRef:i})}async _initializeTelemetry(){let t=this._configContextProvider.value;if(!this.authentication||!t)return;let e=await this._telemetryManager.initializeTelemetry(this.authentication,t);this._configContextProvider.value.telemetrySession=e}async _getSolutions(t,e){if(this._isDisconnectedEnvironment)return[];this._abortController?(this._abortController.abort(),this._abortController=new AbortController):this._abortController=new AbortController;let i=await this._cardsFetcher?.requestAvailableSolutionCards({q:this._agoTerms,filter:"type:Solution",sortField:this._sortField,sortOrder:this._sortOrder,nextStart:-1,categories:this._categories,delay:this._delay,getSuggested:this._getSuggested,num:100},t,e,this._configContextProvider.value.userSession,this._configContextProvider.value.isEnterprise,this._abortController.signal,{num:1e3});return this._abortController=void 0,this._allCards.length===0&&i?.cards&&(this._allCards=i?.cards),this._allCards}async _getDeployedSolution(t){let e=this._configContextProvider.value.authentication,i=this._configContextProvider.value.userSession;if(e&&i&&e.IsSignedIn){this._abortControllerDeployed?(this._abortControllerDeployed.abort(),this._abortControllerDeployed=new AbortController):this._abortControllerDeployed=new AbortController;let a=F(e);try{let l=await M(e,i,this._cardsFetcher,this._cardFetcherDeployed,D,"created","desc",!1,[],[],this._abortControllerDeployed.signal,a?"My organization's solutions":"My solutions",t);l.cards.length===0||l.cards[0].typeKeywords.indexOf("Deployed")<0?(this._deployCardFetchFailedMessage=this._translations.failedToFetchNotSolution.replace("{{ITEMID}}",t),this._showDeployedCardFetchFailed=!0):this._deployedSolutions=l}catch(l){let r=l.message;r.indexOf("CONT_0001")>-1||r.indexOf("Item does not exist or is inaccessible.")>-1?(this._deployCardFetchFailedMessage=this._translations.failedToFetchWrongId.replace("{{ITEMID}}",t),this._showDeployedCardFetchFailed=!0):r.indexOf("GWM_0003")>-1||r.indexOf("You do not have permissions to access this resource or perform this operation.")>-1?(this._deployCardFetchFailedMessage=this._translations.failedToFetchWrongPermissions.replace("{{ITEMID}}",t),this._showDeployedCardFetchFailed=!0):(this._showDeployedCardFetchFailed=!0,this._deployCardFetchFailedMessage=""),console.warn(l)}}}_blurTabs(){this._allTabTitle.value?.blur(),this._resourcesTabTitle.value?.blur(),this._detailsTabTitle.value?.blur(),this._mySolutionsTabTitle.value?.blur()}_isSearchToolbarShowing(){return this._activeTab==="all-solutions"||this._activeTab==="deployments"&&this.authentication?.IsSignedIn===!0}_getDefaultSearchOptions(t){let e;if(t){let i=t.domain,a=t.industry==="AEC"?x.AEC:t.industry,l=t.offerType,r=t.searchTerm,E="",d=t.sortField,h=t.owner,b=t.filter;e=i||a?{type:i?"domain":a?"industry":""}:void 0,i&&(e=e?{...e,domain:i}:{domain:i}),a&&(e=e?{...e,industry:a}:{industry:a}),r&&(e=e?{...e,searchTerm:r}:{searchTerm:r}),e&&(e={...e,displayValue:E}),d&&(e=e?{...e,sortType:d}:{sortType:d}),l&&(d=l.toLowerCase(),e=e?{...e,sortType:d}:{sortType:d}),h&&(e=e?{...e,owner:h}:{owner:h}),b&&(e=e?{...e,filter:b}:{filter:b})}return e}_setScrollbarGutters(){let t=this._detailsTab.value?.shadowRoot?.firstElementChild;t?.style&&(t.style.scrollbarGutter="stable both-edges");let e=this._deployedCardTab.value?.shadowRoot?.firstElementChild;e?.style&&(e.style.scrollbarGutter="stable both-edges")}_setRefreshInterval(){let{userSession:t,authentication:e}=this._configContextProvider.value;if(t&&t.tokenDuration&&e?.IsSignedIn){let i=Date.now(),a=(e.Credential?.expires-i)*.95;setInterval(async()=>{if(e.Credential&&e.Credential.expires){await e.Credential?.refreshToken();let l=new Date(e.Credential.expires);t.updateToken(e.Credential.token,l),this.sessionRefreshed.emit(t.token)}},a)}}};C("solutions-deploy-app",m);return m},"identity/IdentityManager","identity/OAuthInfo","portal/Portal",a,b,c,d,e,f,h,i,j,k,l,m)
|
|
2
|
+
import m from"./WZGZCVBE.js";import l from"./BAVJY3AH.js";import k from"./GHL7S2IO.js";import j from"./3X5E5PEB.js";import i from"./JMOT5FWT.js";import h from"./QDQVOSEM.js";import f from"./254AARKL.js";import e from"./Z6D47FMI.js";import"./ZEFTAU6G.js";import d from"./5H3T3ZTG.js";import c from"./TZR3I4ZP.js";import b from"./SVAPYMHV.js";import"./4T7P5RXF.js";import"./6MZ227J7.js";import a from"./QRPBAR4V.js";import{a as u}from"./PZ4L77M5.js";import"./JE7L7M3J.js";import{a as S}from"./6LLQFZGG.js";import"./36I27Q5R.js";import"./GDPFKW75.js";import"./AOBFPJ2R.js";import"./JK6XUSIM.js";import"./UPHYUDLT.js";import"./QJJXVRMV.js";import"./7FMLZNDR.js";import"./LL5C4DHP.js";import"./WPAMUSBR.js";import"./XJPOVJV7.js";import"./LDNQ56OK.js";import"./3HUY3T5F.js";import"./Z6G5PBUQ.js";import"./J3QMHA2M.js";import"./TKZAMPEI.js";import"./2IHQU2FX.js";import"./CGLFPVBM.js";import"./OEJAW72H.js";import"./5JJMGPOW.js";import"./TYX345MZ.js";import"./5UWT66A7.js";import{b as C}from"./LI7AOAAS.js";import{F as o,G as s,H as v,J as _,h as g,i as p,r as n}from"./46DQNAMV.js";import"./OR4HXHSY.js";export default $arcgis.t(([,,,{D:x,H:D,I:I,K:c,a:f,b:w,w:F},,{b:O},,,{g:k,h:A},,,,,{a:y,b:M},{a:T}])=>{var $=g`.back-color-override{background-color:var(--calcite-color-foreground-2);--calcite-tab-border-color: var(--calcite-color-foreground-3)}.display-none{display:none!important}.height-100{height:100%}calcite-tab-nav{padding-bottom:6px;padding-top:6px}calcite-tab{--calcite-color-focus: transparent}calcite-tab>*{--calcite-color-focus: initial}calcite-tabs{--calcite-tab-border-color: var(--calcite-color-border-3);height:100%}.tab-space-0{--calcite-tab-content-space-y: var(--calcite-spacing-none)}.tab-space-md{--calcite-tab-content-space-y: var(--calcite-spacing-md)}solutions-searchsort-toolbar,solutions-deploy-app-nav,solution-details-panel,solutions-resources-shell,solutions-deployed-shell,solutions-all-shell,calcite-tab-nav,solution-deployed-card-panel{width:1440px;display:block;max-width:96vw;padding-right:var(--calcite-spacing-none);padding-left:var(--calcite-spacing-none);margin-left:auto;margin-right:auto;box-sizing:border-box}.border{height:var(--calcite-spacing-px);border-bottom-color:var(--calcite-color-border-3);border-bottom-style:solid;border-bottom-width:var(--calcite-border-width-sm);box-sizing:border-box}.overflow-auto{overflow:auto}solution-details-panel{scroll-margin-top:3rem}`,m=class extends v{constructor(){super(),this.initTitleOrId="",this.sortType="relevance",this.useLocalAppConfig=!1,this.authentication=void 0,this._isLoaded=!1,this.isMobile=!1,this._activeTab="all-solutions",this._showDeployedCardFetchFailed=!1,this._translations=S({name:"solutions-deploy-app",blocking:!0}),this._agoTerms=`${I}`,this._allCards=[],this._allShell=o(),this._allTab=o(),this._allTabTitle=o(),this._resourcesTab=o(),this._resourcesTabTitle=o(),this._categories=[],this._configContextProvider=u({context:w}),this._delay=!1,this._deployAppNav=o(),this._deployedCardPanel=o(),this._deployCardFetchFailedMessage="",this._deployedCardTab=o(),this._deployedCardTabTitle=o(),this._detailsShell=o(),this._detailsTab=o(),this._detailsTabTitle=o(),this._forceInit=!1,this._getSuggested=!1,this._tabpanelsFixed=!1,this._isMobileContextProvider=u({context:f}),this._mySolutionsShell=o(),this._mySolutionsTab=o(),this._mySolutionsTabTitle=o(),this._sortField="relevance",this._sortOrder="desc",this._telemetryManager=new T,this.deployAppTabSelected=n(),this.deployedCardFetchFailed=n(),this.detailsCardSelected=n(),this.deployedCardSelected=n(),this.metaTagStringsReady=n(),this.sessionRefreshed=n(),this.tabChanged=n(),this.listenOn(window,"detailsCardSelected",this._detailsCardSelected),this.listenOn(window,"deployedCardSelected",this._deployedCardSelected),this.listenOn(window,"displayDeployedCard",this._handleDeployedCardDisplay),this.listenOn(window,"navTabSelected",this._setActiveTab),this.listenOn(window,"forceSelectTab",t=>this.selectTab(t.detail,{})),this._mediaQueryChange=this._mediaQueryChange.bind(this)}static{this.properties={appConfig:1,initTab:1,initTitleOrId:1,sortType:1,useLocalAppConfig:5,authentication:16,_isLoaded:16,isMobile:16,_activeTab:16,_showDeployedCardFetchFailed:16,_translations:16}}static{this.styles=$}get _telemetry(){return this._configContextProvider.value?.telemetrySession}get _isDisconnectedEnvironment(){return this._configContextProvider.value?.isEnterprise===!0&&this._configContextProvider.value?.authentication?.CanSearchArcGISOnline===!1}async selectTab(t,e){if(this._isLoaded||this._forceInit){let i=this._getDefaultSearchOptions(e);switch(this._searchSortToolbar&&(this._searchSortToolbar.scope=t.tabType),t.tabType){case"all-solutions":this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0,i&&await this._allShell.value?.searchSolutions(i);break;case"resources":this._resourcesTab.value.selected=!0,this._resourcesTabTitle.value.selected=!0;break;case"deployed-card":if(this.authentication?.IsSignedIn){if(this._forceInit=!0,this._isLoaded=!1,this._cardFetcherDeployed&&await this._getDeployedSolution(t.tabTitleOrId),this._deployedSolutions?.cards?.length>0){let a;this._deployedSolutions.cards.some(l=>l.id===t.tabTitleOrId?(a=l,this.deployedCardSelected.emit({card:a}),!0):!1),this._isLoaded=!0,this._forceInit=!1}else return this._isLoaded=!0,this._forceInit=!1,this.selectTab({tabTitleOrId:"",tabType:"deployments"},e);break}else await this.authentication?.signIn();case"details":if(this._allCards){let a=k(this._allCards,t.tabTitleOrId);a=a||A(this._allCards,t.tabTitleOrId),a?(this._detailsTab.value.selected=!0,this._detailsTabTitle.value.selected=!0,this.detailsCardSelected.emit(a)):(t.tabType="all-solutions",this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0)}break;case"deployments":this._mySolutionsTab.value.selected=!0,this._mySolutionsTabTitle.value.selected=!0,this._searchSortToolbar&&i?.filter&&this._searchSortToolbar.changeOwnerFilter(i.filter!=="Organization"),i&&await this._mySolutionsShell.value?.searchSolutions(i);break}return this._setActiveTab(new CustomEvent("setActiveTab",{detail:t})),this._blurTabs(),this._showDeployedCardFetchFailed&&(this.deployedCardFetchFailed.emit({message:this._deployCardFetchFailedMessage,title:this._translations.failedToOpen}),this._showDeployedCardFetchFailed=!1),!0}else return this._initTab=t,this._initFilters=e,!1}async connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia("(max-width: 800px)"),this._mediaQuery.addEventListener("change",this._mediaQueryChange),this._mediaQueryChange(this._mediaQuery)}updated(){this._fixTabpanelFocus()}_fixTabpanelFocus(){if(!this._tabpanelsFixed&&this._allTab.value){let t=[this._allTab,this._mySolutionsTab,this._resourcesTab,this._detailsTab,this._deployedCardTab];Promise.all(t.map(async e=>{let i=e.value;if(i&&(await i.componentOnReady?.(),i.shadowRoot)){let a=i.shadowRoot.querySelector('[role="tabpanel"]');a&&(a.tabIndex=-1)}})).then(()=>{this._tabpanelsFixed=!0,this._setupTabpanelObserver()}).catch(()=>{this._tabpanelsFixed=!0})}}_setupTabpanelObserver(){this._tabpanelObserver||(this._tabpanelObserver=new MutationObserver(t=>{t.forEach(e=>{if(e.type==="attributes"&&e.attributeName==="tabindex"){let i=e.target;i.getAttribute("role")==="tabpanel"&&i.tabIndex===0&&(i.tabIndex=-1)}})}),[this._allTab,this._mySolutionsTab,this._resourcesTab,this._detailsTab,this._deployedCardTab].forEach(t=>{let e=t.value;if(e?.shadowRoot){let i=e.shadowRoot.querySelector('[role="tabpanel"]');i&&this._tabpanelObserver.observe(i,{attributes:!0,attributeFilter:["tabindex"]})}}))}async load(){this.useLocalAppConfig&&(this.appConfig=O)}render(){let t=this._isLoaded?"display-none":"",e=this._isLoaded?"":"display-none";return p`<calcite-shell><solutions-deploy-app-nav .appConfig=${this.appConfig} .initTab=${this.initTab} @authInit=${this._handleAuthInit} slot=header ${s(this._deployAppNav)}></solutions-deploy-app-nav>${this._isSearchToolbarShowing()&&p`<div class="border" slot=header></div>`||""}<solutions-searchsort-toolbar slot=header ${s(async i=>{i&&(await this._deployAppNav.value?.componentOnReady(),this._searchSortToolbar=i)})}></solutions-searchsort-toolbar><calcite-loader class=${_(t)} id=solutions-loader .label=${this._translations.fetchingAllSolutions}></calcite-loader><calcite-tabs class=${_(e)} scale=l><calcite-tab-nav class="display-none" @calciteTabChange=${this._handleCalciteTabChanged} slot=title-group><calcite-tab-title ${s(this._allTabTitle)}>${this._translations.allSolutions}</calcite-tab-title><calcite-tab-title ${s(this._mySolutionsTabTitle)}>${this._translations.mySolutions}</calcite-tab-title><calcite-tab-title ${s(this._resourcesTabTitle)}>${this._translations.solutionResources}</calcite-tab-title><calcite-tab-title class="display-none" ${s(this._detailsTabTitle)}></calcite-tab-title><calcite-tab-title class="display-none" ${s(this._deployedCardTabTitle)}></calcite-tab-title></calcite-tab-nav><calcite-tab class="back-color-override tab-space-0" selected ${s(this._allTab)}><solutions-all-shell class="height-100" ${s(this._allShell)}></solutions-all-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${s(this._mySolutionsTab)}><solutions-deployed-shell class="height-100" ${s(this._mySolutionsShell)}></solutions-deployed-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${s(this._resourcesTab)}><solutions-resources-shell class="height-100"></solutions-resources-shell></calcite-tab><calcite-tab class="back-color-override" ${s(this._detailsTab)}><solution-details-panel class="height-100" ${s(this._detailsShell)}></solution-details-panel></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${s(this._deployedCardTab)}><solution-deployed-card-panel class="shell-container height-100" ${s(this._deployedCardPanel)}></solution-deployed-card-panel></calcite-tab></calcite-tabs></calcite-shell>`}loaded(){this._setScrollbarGutters()}disconnectedCallback(){super.disconnectedCallback(),this._mediaQuery?.removeEventListener("change",this._mediaQueryChange),this._tabpanelObserver?.disconnect()}async _handleAuthInit(t){let e=t.detail;e.telemetrySession||(e.telemetrySession=T.getDisabledSession()),this._configContextProvider.setValue(e),e.authentication&&(this.authentication=e.authentication),this._cardFetcherDeployed=new y(e.locale,e.orgUrl,e.portalURL),this._cardsFetcher=new y(e.locale,e.orgUrl,e.portalURL),this._isDisconnectedEnvironment||await this._getSolutions(e.primarySolutionsGroupId,e.agoBasedEnterpriseSolutionsGroupId),this._configContextProvider.value.allCards=this._allCards,this._configContextProvider.value.anonAgolSession=this._cardsFetcher.anonAgolSession,this._configContextProvider.value.agolPortalUrl=this._cardsFetcher.agolPortalUrl,await this._initializeTelemetry(),this._isLoaded=!0,this._setRefreshInterval(),this._initTab?(this.selectTab(this._initTab,this._initFilters),this._logTabViewTelemetry(this._initTab.tabType),this._initTab=void 0,this._initFilters=void 0):this.authentication?.IsSignedIn&&(this.initTab==="details"||this.initTab==="deployed-card"||(this._logTabViewTelemetry(this._activeTab),this._emitMetaTagStrings(this._activeTab)))}_mediaQueryChange(t){this.isMobile=t.matches,this._isMobileContextProvider.setValue(this.isMobile)}_setActiveTab(t){let e=t.detail.tabType,i=this._activeTab!==e;switch(this._activeTab=e,i&&this._logTabViewTelemetry(e),e){case"all-solutions":this._allTabTitle.value?.click();break;case"deployments":this._mySolutionsTabTitle.value?.click();break;case"resources":this._resourcesTabTitle.value?.click();break;case"deployed-card":this._deployedCardTabTitle.value?.click();break;case"details":this._detailsTabTitle.value?.click();break}e!=="details"&&e!=="deployed-card"&&(this._deployAppNav.value.activateMenuItem(e),this.deployAppTabSelected.emit(e),this._emitMetaTagStrings(e))}_logTabViewTelemetry(t,e){let i;switch(t){case"all-solutions":i=c.ALL_SOLUTIONS;break;case"deployments":i=c.DEPLOYMENTS;break;case"resources":i=c.RESOURCES;break;case"details":i=c.SOLUTION_DETAILS;break;case"deployed-card":i=c.DEPLOYMENTS;break}if(!((t==="details"||t==="deployed-card")&&!e)&&i){let a=[];if((t==="details"||t==="deployed-card")&&e){let r=e;a.push(r.title||""),a.push(r.deployCommonId||""),a.push(r.deployVersion||"")}let l=t==="deployed-card"?"Open":"View";this._telemetry?.logEvent({category:i,action:l,dimensions:a.length>0?a:void 0})}}_emitMetaTagStrings(t,e){let i="",a="";switch(t){case"all-solutions":i=this._translations.metaAllSolutionsTitle,a=this._translations.metaAllSolutionsDescription;break;case"deployments":case"deployed-card":i=this._translations.metaDeploymentsTitle,a=this._translations.metaDeploymentsDescription;break;case"resources":i=this._translations.metaResourcesTitle,a=this._translations.metaResourcesDescription;break;case"details":e&&(i=this._translations.metaDetailsTitle.replace("{title}",e.title),a=e.snippet);break}this.metaTagStringsReady.emit({pageType:t,title:i,description:a,detailTemplate:e})}_handleCalciteTabChanged(){this.tabChanged.emit(this._activeTab)}_detailsCardSelected(t){this._activeTab="details",this._detailsTabTitle.value.selected=!0,this._detailsTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail&&(this._selectedDetailsCard=t.detail),this._logTabViewTelemetry("details",this._selectedDetailsCard),this._emitMetaTagStrings("details",this._selectedDetailsCard)}_deployedCardSelected(t){this._activeTab="deployed-card",this._deployedCardTabTitle.value.selected=!0,this._deployedCardTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail?.card&&(this._selectedDeployedCard=t.detail.card),this._logTabViewTelemetry("deployed-card",this._selectedDeployedCard),this._emitMetaTagStrings("deployed-card")}_handleDeployedCardDisplay(t){let{card:e,cardRef:i}=t.detail;this.deployedCardSelected.emit({card:e,cardRef:i})}async _initializeTelemetry(){let t=this._configContextProvider.value;if(!this.authentication||!t)return;let e=await this._telemetryManager.initializeTelemetry(this.authentication,t);this._configContextProvider.value.telemetrySession=e}async _getSolutions(t,e){if(this._isDisconnectedEnvironment)return[];this._abortController?(this._abortController.abort(),this._abortController=new AbortController):this._abortController=new AbortController;let i=await this._cardsFetcher?.requestAvailableSolutionCards({q:this._agoTerms,filter:"type:Solution",sortField:this._sortField,sortOrder:this._sortOrder,nextStart:-1,categories:this._categories,delay:this._delay,getSuggested:this._getSuggested,num:100},t,e,this._configContextProvider.value.userSession,this._configContextProvider.value.isEnterprise,this._abortController.signal,{num:1e3});return this._abortController=void 0,this._allCards.length===0&&i?.cards&&(this._allCards=i?.cards),this._allCards}async _getDeployedSolution(t){let e=this._configContextProvider.value.authentication,i=this._configContextProvider.value.userSession;if(e&&i&&e.IsSignedIn){this._abortControllerDeployed?(this._abortControllerDeployed.abort(),this._abortControllerDeployed=new AbortController):this._abortControllerDeployed=new AbortController;let a=F(e);try{let l=await M(e,i,this._cardsFetcher,this._cardFetcherDeployed,D,"created","desc",!1,[],[],this._abortControllerDeployed.signal,a?"My organization's solutions":"My solutions",t);l.cards.length===0||l.cards[0].typeKeywords.indexOf("Deployed")<0?(this._deployCardFetchFailedMessage=this._translations.failedToFetchNotSolution.replace("{{ITEMID}}",t),this._showDeployedCardFetchFailed=!0):this._deployedSolutions=l}catch(l){let r=l.message;r.indexOf("CONT_0001")>-1||r.indexOf("Item does not exist or is inaccessible.")>-1?(this._deployCardFetchFailedMessage=this._translations.failedToFetchWrongId.replace("{{ITEMID}}",t),this._showDeployedCardFetchFailed=!0):r.indexOf("GWM_0003")>-1||r.indexOf("You do not have permissions to access this resource or perform this operation.")>-1?(this._deployCardFetchFailedMessage=this._translations.failedToFetchWrongPermissions.replace("{{ITEMID}}",t),this._showDeployedCardFetchFailed=!0):(this._showDeployedCardFetchFailed=!0,this._deployCardFetchFailedMessage=""),console.warn(l)}}}_blurTabs(){this._allTabTitle.value?.blur(),this._resourcesTabTitle.value?.blur(),this._detailsTabTitle.value?.blur(),this._mySolutionsTabTitle.value?.blur()}_isSearchToolbarShowing(){return this._activeTab==="all-solutions"||this._activeTab==="deployments"&&this.authentication?.IsSignedIn===!0}_getDefaultSearchOptions(t){let e;if(t){let i=t.domain,a=t.industry==="AEC"?x.AEC:t.industry,l=t.offerType,r=t.searchTerm,E="",d=t.sortField,h=t.owner,b=t.filter;e=i||a?{type:i?"domain":a?"industry":""}:void 0,i&&(e=e?{...e,domain:i}:{domain:i}),a&&(e=e?{...e,industry:a}:{industry:a}),r&&(e=e?{...e,searchTerm:r}:{searchTerm:r}),e&&(e={...e,displayValue:E}),d&&(e=e?{...e,sortType:d}:{sortType:d}),l&&(d=l.toLowerCase(),e=e?{...e,sortType:d}:{sortType:d}),h&&(e=e?{...e,owner:h}:{owner:h}),b&&(e=e?{...e,filter:b}:{filter:b})}return e}_setScrollbarGutters(){let t=this._detailsTab.value?.shadowRoot?.firstElementChild;t?.style&&(t.style.scrollbarGutter="stable both-edges");let e=this._deployedCardTab.value?.shadowRoot?.firstElementChild;e?.style&&(e.style.scrollbarGutter="stable both-edges")}_setRefreshInterval(){let{userSession:t,authentication:e}=this._configContextProvider.value;if(t&&t.tokenDuration&&e?.IsSignedIn){let i=Date.now(),a=(e.Credential?.expires-i)*.95;setInterval(async()=>{if(e.Credential&&e.Credential.expires){await e.Credential?.refreshToken();let l=new Date(e.Credential.expires);t.updateToken(e.Credential.token,l),this.sessionRefreshed.emit(t.token)}},a)}}};C("solutions-deploy-app",m);return m},"identity/IdentityManager","identity/OAuthInfo","portal/Portal",a,b,c,d,e,f,h,i,j,k,l,m)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{a as u}from"./
|
|
2
|
+
import{a as u}from"./6LLQFZGG.js";import"./36I27Q5R.js";import"./GDPFKW75.js";import{b as f}from"./LI7AOAAS.js";import{F as l,G as n,H as m,J as d,K as b,h as c,i as a,r as p}from"./46DQNAMV.js";import"./OR4HXHSY.js";var _=c`:host{display:block;--solutions-theme-foreground-color: var(--calcite-color-foreground-1);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-background);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=u({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=_}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 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 focus-trap-disabled .label=${this.referenceElement} 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};
|