@arcgis/core 4.30.7 → 4.30.9

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/interfaces.d.ts CHANGED
@@ -107642,7 +107642,7 @@ declare namespace __esri {
107642
107642
  */
107643
107643
  readonly relatedLayer: FeatureLayer | SceneLayer;
107644
107644
  /**
107645
- * Returns the first relationship from [layer's](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-RelationshipColumn.html#layer) `relationships` that matches the [relationshipId](relationshipId).
107645
+ * Returns the first relationship from [layer's](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-RelationshipColumn.html#layer) `relationships` that matches the [relationshipId](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-RelationshipColumn.html#relationshipId).
107646
107646
  *
107647
107647
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-RelationshipColumn.html#relationship)
107648
107648
  */
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.30";let t,i=r;i="4.30.7";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.30";let t,i=r;i="4.30.9";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.30.7",
3
+ "version": "4.30.9",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- const e="20240709",a="a3bf6191bdb06e64f3f9ce36ea155a1a70cfbc0e";export{e as buildDate,a as commitHash};
5
+ const e="20240724",c="ac51c09e1d17be02f839eb2e22bd05fd7a16c2d3";export{e as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import t from"../DisplayEntity.js";import e from"../DisplayRecord.js";import{VertexDataWriter as r}from"./VertexDataWriter.js";import i from"../util/Writer.js";class n{constructor(e,r=0){this._id=e,this._sizeHint=r,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new i(Uint32Array,this._sizeHint*t.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],r=this._entities.buffer();for(const i of this._instanceIdToVertexData.values())e.push(i.serialize(t));return{message:{data:e,entities:r},transferList:t}}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,r,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t}metricEnd(){const t=this._current.writer;this._current.metric.bounds.length&&t.writeMetric(this._current.metric)}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0)}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset)}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,r=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=r}recordEnd(t=0){const r=this._current.vertexStart,i=this._current.writer.vertexCount-r;if(!i)return!1;const n=this._current.indexStart,s=this._current.writer.indexCount-n;return this._recordIndexStart=n,this._recordIndexCount=s,this._recordVertexStart=r,this._recordVertexCount=i,this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,n,s,r,i,t),!0}copyLast(t,r){const i=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,i,this._recordVertexCount,0);const n=this._current.writer.indexWriter,s=this._current.writer.vertexWriter,o=this._recordIndexStart+this._recordIndexCount,c=this._recordVertexCount;for(let e=this._recordIndexStart;e!==o;e++){const t=n.getValue(e);n.push(t+c)}const u=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,h=this._recordVertexStart*u,_=(this._recordVertexStart+this._recordVertexCount)*u;for(let e=h;e!==_;e++){const t=s.getValue(e);s.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=t*a,f=r*a;for(let e=i*u;e<=s.length;e+=u)s.i1616Add(e+x,y,f)}copyLastFrom(t,e,r){const i=t._entities.getValue(t._entityIdIndex);if(i!==this._entities.getValue(this._entityIdIndex)){const e=t._entities.getValueF32(t._entitySortKeyIndex);this.entityStart(i,e)}this.recordStart(t._current.instanceId,t._current.writer.layout,t._current.textureKey);const n=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,s=this._current.vertexStart,o=t._current.vertexStart-s,c=this._current.writer.indexWriter,u=this._current.writer.vertexWriter,h=t._current.writer.indexWriter,_=t._current.writer.vertexWriter;for(let l=t._current.indexStart;l!==h.length;l++){const t=h.getValue(l);c.push(t-o)}for(let l=t._current.vertexStart*n;l!==_.length;l++){const t=_.getValue(l);u.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=e*a,f=r*a;for(let l=s*n;l<=u.length;l+=n)u.i1616Add(l+x,y,f);this.recordEnd()}_getVertexWriter(t,e){const i=this._instanceIdToVertexData;return i.has(t)||i.set(t,new r(t,e,this._sizeHint)),i.get(t)}}export{n as MeshData};
5
+ import t from"../DisplayEntity.js";import e from"../DisplayRecord.js";import{VertexDataWriter as r}from"./VertexDataWriter.js";import i from"../util/Writer.js";class n{constructor(e,r=0){this._id=e,this._sizeHint=r,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._didEntityStart=!1,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new i(Uint32Array,this._sizeHint*t.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],r=this._entities.buffer();for(const i of this._instanceIdToVertexData.values())e.push(i.serialize(t));return{message:{data:e,entities:r},transferList:t}}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,r,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t}metricEnd(){const t=this._current.writer;this._current.metric.bounds.length&&t.writeMetric(this._current.metric)}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0),this._didEntityStart=!0}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){if(!this._didEntityStart)return;0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset),this._didEntityStart=!1}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,r=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=r}recordEnd(t=0){const r=this._current.vertexStart,i=this._current.writer.vertexCount-r;if(!i)return!1;const n=this._current.indexStart,s=this._current.writer.indexCount-n;return this._recordIndexStart=n,this._recordIndexCount=s,this._recordVertexStart=r,this._recordVertexCount=i,this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,n,s,r,i,t),!0}copyLast(t,r){const i=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,i,this._recordVertexCount,0);const n=this._current.writer.indexWriter,s=this._current.writer.vertexWriter,o=this._recordIndexStart+this._recordIndexCount,c=this._recordVertexCount;for(let e=this._recordIndexStart;e!==o;e++){const t=n.getValue(e);n.push(t+c)}const u=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,h=this._recordVertexStart*u,_=(this._recordVertexStart+this._recordVertexCount)*u;for(let e=h;e!==_;e++){const t=s.getValue(e);s.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=t*a,S=r*a;for(let e=i*u;e<=s.length;e+=u)s.i1616Add(e+x,y,S)}copyLastFrom(t,e,r){const i=t._entities.getValue(t._entityIdIndex);if(i!==this._entities.getValue(this._entityIdIndex)){const e=t._entities.getValueF32(t._entitySortKeyIndex);this.entityStart(i,e)}this.recordStart(t._current.instanceId,t._current.writer.layout,t._current.textureKey);const n=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,s=this._current.vertexStart,o=t._current.vertexStart-s,c=this._current.writer.indexWriter,u=this._current.writer.vertexWriter,h=t._current.writer.indexWriter,_=t._current.writer.vertexWriter;for(let f=t._current.indexStart;f!==h.length;f++){const t=h.getValue(f);c.push(t-o)}for(let f=t._current.vertexStart*n;f!==_.length;f++){const t=_.getValue(f);u.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=e*a,S=r*a;for(let f=s*n;f<=u.length;f+=n)u.i1616Add(f+x,y,S);this.recordEnd()}_getVertexWriter(t,e){const i=this._instanceIdToVertexData;return i.has(t)||i.set(t,new r(t,e,this._sizeHint)),i.get(t)}}export{n as MeshData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{location as i,option as o,uniform as s,ComputeVertexInput as l,input as r}from"../../GraphShaderModule.js";import{Vec3 as a,min as p,max as u,Float as n,Mat3 as d,Vec4 as m,ifElse as y,lessThan as h,equal as c,texture2D as x,clamp as V,abs as v,mix as w,distance as f,greaterThan as S,Vec2 as b,negate as g,step as z}from"../../graph/glsl.js";import{MarkerConstants as C}from"./markerConstants.js";import{FeatureVertexInput as M,FeatureFragmentInput as _,AFeatureShader as j}from"../shaders/AFeatureShader.js";import{c256ToRad as R,softEdgeRatio as U}from"../shaders/constants.js";import{distPointTriangle as N,xyToBarycentric as F,inTriangle as D,failHittest as I}from"../shaders/hittestUtils.js";import{MosaicInfo as O}from"../shaders/MosaicInfo.js";import{getBit as k,getBitBool as q,rgba2float as A}from"../shaders/utils.js";import{VisualVariableColor as P}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as T}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as G}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as H}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as L}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as B}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as E}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableOpacity as J,getVisualVariableColor as K,getVisualVariableSize as Q,getVisualVariableRotation as W}from"../shaders/vvUtils.js";class X extends M{}t([i(3,m)],X.prototype,"color",void 0),t([i(4,m)],X.prototype,"outlineColor",void 0),t([i(5,b)],X.prototype,"offset",void 0),t([i(6,b)],X.prototype,"textureUV",void 0),t([i(7,m)],X.prototype,"sizing",void 0),t([i(8,n)],X.prototype,"placementAngle",void 0),t([i(9,n)],X.prototype,"sizeRatio",void 0),t([i(10,b)],X.prototype,"zoomRange",void 0);class Y extends l{}t([i(12,b)],Y.prototype,"offsetNextVertex1",void 0),t([i(13,b)],Y.prototype,"offsetNextVertex2",void 0),t([i(14,b)],Y.prototype,"textureUVNextVertex1",void 0),t([i(15,b)],Y.prototype,"textureUVNextVertex2",void 0);class Z extends _{}function $(t,e,i,o){return e.multiply(t.x).add(i.multiply(t.y)).add(o.multiply(t.z))}function tt(t){return t.multiply(t).divide(128)}class et extends j{constructor(){super(...arguments),this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"],textureUV:["textureUVNextVertex1","textureUVNextVertex2"]}}vertex(t,e){const i=tt(t.sizing.x),o=tt(t.sizing.y),s=tt(t.sizing.z),l=t.placementAngle,r=k(t.bitset,C.bitset.isSDF),y=k(t.bitset,C.bitset.isMapAligned),h=k(t.bitset,C.bitset.scaleSymbolsProportionally),c=q(t.bitset,C.bitset.colorLocked),x=J(this,t.id),V=K(this,t.id,t.color,c).multiply(x),v=this.view.displayViewScreenMat3.multiply(new a(t.pos.xy,1)),w=Q(this,t.id,s).divide(s),f=i.multiply(w),S=t.offset.xy.multiply(w);let b=o.multiply(h.multiply(w.subtract(1)).add(1));b=p(b,u(f.subtract(.99),new n(0)));const g=u(b,new n(1)),z=p(b,new n(1)),M=d.fromRotation(l.multiply(R)),_=W(this,t.id),j=this._getViewRotationMatrix(y).multiply(_).multiply(M).multiply(new a(S.xy,0)),U=this.clip(t.id,t.zoomRange),N=new m(v.xy.add(j.xy),U,1),F=t.textureUV.divide(this.mosaicInfo.size),D=t.outlineColor.multiply(z),I=k(t.bitset,C.bitset.overrideOutlineColor),O=t.sizeRatio.multiply(f).multiply(.5);return{glPosition:N,color:V,textureUV:F,outlineColor:D,outlineSize:g,distanceToPx:O,isSDF:r,overrideOutlineColor:I,...this.maybeRunHittest(t,e,{pos:t.pos,size:f,sizeCorrection:w,isMapAligned:y,outlineSize:g,distanceToPx:O,isSDF:r})}}fragment(t){const e=this._getColor(t.textureUV,t);return this.getFragmentOutput(e,t)}hittest(t,e,i){return y(h(i.size,this.hittestRequest.smallSymbolSizeThreshold),this._hittestSmallMarker(t,e,i),this._hittestMarker(t,e,i))}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new n(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getViewScreenMatrix(t){const e=this.view.viewMat3.multiply(this.view.tileMat3),i=this.view.tileMat3,o=new n(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getColor(t,e){return y(c(e.isSDF,new n(1)),this._getSDFColor(t,e),this._getSpriteColor(t,e))}_getSpriteColor(t,e){return x(this.mosaicInfo.texture,t).multiply(e.color)}_getSDFColor(t,e){const i=x(this.mosaicInfo.texture,t),o=new n(.5).subtract(A(i)).multiply(e.distanceToPx).multiply(U),s=V(new n(.5).subtract(o),new n(0),new n(1)),l=e.color.multiply(s);let r=e.outlineSize;this.highlight&&(r=u(r,e.overrideOutlineColor.multiply(4)));const a=r.multiply(.5),p=v(o).subtract(a),d=V(new n(.5).subtract(p),new n(0),new n(1)),m=w(e.outlineColor,e.color,e.overrideOutlineColor).multiply(d);return new n(1).subtract(m.a).multiply(l).add(m)}_hittestSmallMarker(t,e,i){const{position:o,distance:s,smallSymbolDistance:l}=this.hittestRequest,r=s.subtract(l),{viewMat3:p,tileMat3:u}=this.view,n=p.multiply(u).multiply(new a(i.pos,1)).xy,d=i.size.multiply(.5);return f(n,o).subtract(d).add(r)}_hittestMarker(t,e,i){const{pos:o,sizeCorrection:s,isMapAligned:l}=i,r=new a(t.offset.multiply(s),0),p=new a(e.offsetNextVertex1.multiply(s),0),u=new a(e.offsetNextVertex2.multiply(s),0),{viewMat3:n,tileMat3:d}=this.view,m=n.multiply(d).multiply(new a(o,1)),h=this._getViewScreenMatrix(l),c=m.add(h.multiply(r)).xy,x=m.add(h.multiply(p)).xy,V=m.add(h.multiply(u)).xy,v=this.hittestRequest.position,w=this.hittestRequest.distance,f=N(v,o,x,V);return y(S(f,w),f,this._hittestSamples(c,x,V,t,e,i))}_hittestSamples(t,e,i,o,s,l){const{outlineSize:r,isSDF:a,distanceToPx:p}=l,u=this.hittestRequest.position,d=this.hittestRequest.distance,y=F(u.add(new b(g(d),g(d))),t,e,i),h=F(u.add(new b(0,g(d))),t,e,i),c=F(u.add(new b(d,g(d))),t,e,i),x=F(u.add(new b(g(d),0)),t,e,i),V=F(u,t,e,i),v=F(u.add(new b(d,0)),t,e,i),w=F(u.add(new b(g(d),d)),t,e,i),f=F(u.add(new b(0,d)),t,e,i),S=F(u.add(new b(d,d)),t,e,i),C=o.textureUV.divide(this.mosaicInfo.size),M=s.textureUVNextVertex1.divide(this.mosaicInfo.size),_=s.textureUVNextVertex2.divide(this.mosaicInfo.size),j={color:new m(1),outlineColor:new m(1),overrideOutlineColor:new n(1),outlineSize:r,distanceToPx:p,isSDF:a};let R=new n(0);return R=R.add(D(y).multiply(this._getColor($(y,C,M,_),j).a)),R=R.add(D(h).multiply(this._getColor($(h,C,M,_),j).a)),R=R.add(D(c).multiply(this._getColor($(c,C,M,_),j).a)),R=R.add(D(x).multiply(this._getColor($(x,C,M,_),j).a)),R=R.add(D(V).multiply(this._getColor($(V,C,M,_),j).a)),R=R.add(D(v).multiply(this._getColor($(v,C,M,_),j).a)),R=R.add(D(w).multiply(this._getColor($(w,C,M,_),j).a)),R=R.add(D(f).multiply(this._getColor($(f,C,M,_),j).a)),R=R.add(D(S).multiply(this._getColor($(S,C,M,_),j).a)),z(R,new n(.05)).multiply(I(this.hittestRequest))}}t([o(P)],et.prototype,"visualVariableColor",void 0),t([o(T)],et.prototype,"visualVariableOpacity",void 0),t([o(G)],et.prototype,"visualVariableRotation",void 0),t([o(H)],et.prototype,"visualVariableSizeMinMaxValue",void 0),t([o(L)],et.prototype,"visualVariableSizeScaleStops",void 0),t([o(B)],et.prototype,"visualVariableSizeStops",void 0),t([o(E)],et.prototype,"visualVariableSizeUnitValue",void 0),t([s(O)],et.prototype,"mosaicInfo",void 0),t([e(0,r(X)),e(1,r(Y))],et.prototype,"vertex",null),t([e(0,r(Z))],et.prototype,"fragment",null);export{Z as MarkerFragmentInput,et as MarkerShader,X as MarkerVertexInput};
5
+ import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{location as i,option as o,uniform as s,ComputeVertexInput as l,input as r}from"../../GraphShaderModule.js";import{Vec3 as a,min as p,max as n,Float as u,Mat3 as d,Vec4 as m,ifElse as y,lessThan as h,equal as c,texture2D as x,clamp as v,abs as V,mix as w,distance as f,greaterThan as S,Vec2 as b,negate as g,step as z}from"../../graph/glsl.js";import{MarkerConstants as M}from"./markerConstants.js";import{FeatureVertexInput as C,FeatureFragmentInput as _,AFeatureShader as R}from"../shaders/AFeatureShader.js";import{c256ToRad as j,softEdgeRatio as U}from"../shaders/constants.js";import{distPointTriangle as N,xyToBarycentric as F,inTriangle as D,failHittest as I}from"../shaders/hittestUtils.js";import{MosaicInfo as O}from"../shaders/MosaicInfo.js";import{getBit as k,getBitBool as q,rgba2float as A}from"../shaders/utils.js";import{VisualVariableColor as P}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as T}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as G}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as H}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as L}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as B}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as E}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableOpacity as J,getVisualVariableColor as K,getVisualVariableSize as Q,getVisualVariableRotation as W}from"../shaders/vvUtils.js";class X extends C{}t([i(3,m)],X.prototype,"color",void 0),t([i(4,m)],X.prototype,"outlineColor",void 0),t([i(5,b)],X.prototype,"offset",void 0),t([i(6,b)],X.prototype,"textureUV",void 0),t([i(7,m)],X.prototype,"sizing",void 0),t([i(8,u)],X.prototype,"placementAngle",void 0),t([i(9,u)],X.prototype,"sizeRatio",void 0),t([i(10,b)],X.prototype,"zoomRange",void 0);class Y extends l{}t([i(12,b)],Y.prototype,"offsetNextVertex1",void 0),t([i(13,b)],Y.prototype,"offsetNextVertex2",void 0),t([i(14,b)],Y.prototype,"textureUVNextVertex1",void 0),t([i(15,b)],Y.prototype,"textureUVNextVertex2",void 0);class Z extends _{}function $(t,e,i,o){return e.multiply(t.x).add(i.multiply(t.y)).add(o.multiply(t.z))}function tt(t){return t.multiply(t).divide(128)}class et extends R{constructor(){super(...arguments),this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"],textureUV:["textureUVNextVertex1","textureUVNextVertex2"]}}vertex(t,e){const i=tt(t.sizing.x),o=tt(t.sizing.y),s=tt(t.sizing.z),l=t.placementAngle,r=k(t.bitset,M.bitset.isSDF),y=k(t.bitset,M.bitset.isMapAligned),h=k(t.bitset,M.bitset.scaleSymbolsProportionally),c=q(t.bitset,M.bitset.colorLocked),x=J(this,t.id),v=K(this,t.id,t.color,c).multiply(x),V=this.view.displayViewScreenMat3.multiply(new a(t.pos.xy,1)),w=Q(this,t.id,s).divide(s),f=i.multiply(w),S=t.offset.xy.multiply(w);let b=o.multiply(h.multiply(w.subtract(1)).add(1));b=p(b,n(f.subtract(.99),new u(0)));const g=n(b,new u(1)),z=p(b,new u(1)),C=d.fromRotation(l.multiply(j)),_=W(this,t.id),R=this._getViewRotationMatrix(y).multiply(_).multiply(C).multiply(new a(S.xy,0)),U=this.clip(t.id,t.zoomRange),N=new m(V.xy.add(R.xy),U,1),F=t.textureUV.divide(this.mosaicInfo.size),D=t.outlineColor.multiply(z),I=k(t.bitset,M.bitset.overrideOutlineColor),O=t.sizeRatio.multiply(f).multiply(.5);return{glPosition:N,color:v,textureUV:F,outlineColor:D,outlineSize:g,distanceToPx:O,isSDF:r,overrideOutlineColor:I,...this.maybeRunHittest(t,e,{pos:t.pos,size:f,sizeCorrection:w,isMapAligned:y,vvRotationMat3:_,placementMat3:C,outlineSize:g,distanceToPx:O,isSDF:r})}}fragment(t){const e=this._getColor(t.textureUV,t);return this.getFragmentOutput(e,t)}hittest(t,e,i){return y(h(i.size,this.hittestRequest.smallSymbolSizeThreshold),this._hittestSmallMarker(t,e,i),this._hittestMarker(t,e,i))}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getViewScreenMatrix(t){const e=this.view.viewMat3.multiply(this.view.tileMat3),i=this.view.tileMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getColor(t,e){return y(c(e.isSDF,new u(1)),this._getSDFColor(t,e),this._getSpriteColor(t,e))}_getSpriteColor(t,e){return x(this.mosaicInfo.texture,t).multiply(e.color)}_getSDFColor(t,e){const i=x(this.mosaicInfo.texture,t),o=new u(.5).subtract(A(i)).multiply(e.distanceToPx).multiply(U),s=v(new u(.5).subtract(o),new u(0),new u(1)),l=e.color.multiply(s);let r=e.outlineSize;this.highlight&&(r=n(r,e.overrideOutlineColor.multiply(4)));const a=r.multiply(.5),p=V(o).subtract(a),d=v(new u(.5).subtract(p),new u(0),new u(1)),m=w(e.outlineColor,e.color,e.overrideOutlineColor).multiply(d);return new u(1).subtract(m.a).multiply(l).add(m)}_hittestSmallMarker(t,e,i){const{position:o,distance:s,smallSymbolDistance:l}=this.hittestRequest,r=s.subtract(l),{viewMat3:p,tileMat3:n}=this.view,u=p.multiply(n).multiply(new a(i.pos,1)).xy,d=i.size.multiply(.5);return f(u,o).subtract(d).add(r)}_hittestMarker(t,e,i){const{pos:o,sizeCorrection:s,isMapAligned:l}=i,r=new a(t.offset.multiply(s),0),p=new a(e.offsetNextVertex1.multiply(s),0),n=new a(e.offsetNextVertex2.multiply(s),0),{viewMat3:u,tileMat3:d}=this.view,m=u.multiply(d).multiply(new a(o,1)),h=this._getViewScreenMatrix(l).multiply(i.vvRotationMat3).multiply(i.placementMat3),c=m.add(h.multiply(r)).xy,x=m.add(h.multiply(p)).xy,v=m.add(h.multiply(n)).xy,V=this.hittestRequest.position,w=this.hittestRequest.distance,f=N(V,c,x,v);return y(S(f,w),f,this._hittestSamples(c,x,v,t,e,i))}_hittestSamples(t,e,i,o,s,l){const{outlineSize:r,isSDF:a,distanceToPx:p}=l,n=this.hittestRequest.position,d=this.hittestRequest.distance,y=F(n.add(new b(g(d),g(d))),t,e,i),h=F(n.add(new b(0,g(d))),t,e,i),c=F(n.add(new b(d,g(d))),t,e,i),x=F(n.add(new b(g(d),0)),t,e,i),v=F(n,t,e,i),V=F(n.add(new b(d,0)),t,e,i),w=F(n.add(new b(g(d),d)),t,e,i),f=F(n.add(new b(0,d)),t,e,i),S=F(n.add(new b(d,d)),t,e,i),M=o.textureUV.divide(this.mosaicInfo.size),C=s.textureUVNextVertex1.divide(this.mosaicInfo.size),_=s.textureUVNextVertex2.divide(this.mosaicInfo.size),R={color:new m(1),outlineColor:new m(1),overrideOutlineColor:new u(1),outlineSize:r,distanceToPx:p,isSDF:a};let j=new u(0);return j=j.add(D(y).multiply(this._getColor($(y,M,C,_),R).a)),j=j.add(D(h).multiply(this._getColor($(h,M,C,_),R).a)),j=j.add(D(c).multiply(this._getColor($(c,M,C,_),R).a)),j=j.add(D(x).multiply(this._getColor($(x,M,C,_),R).a)),j=j.add(D(v).multiply(this._getColor($(v,M,C,_),R).a)),j=j.add(D(V).multiply(this._getColor($(V,M,C,_),R).a)),j=j.add(D(w).multiply(this._getColor($(w,M,C,_),R).a)),j=j.add(D(f).multiply(this._getColor($(f,M,C,_),R).a)),j=j.add(D(S).multiply(this._getColor($(S,M,C,_),R).a)),z(j,new u(.05)).multiply(I(this.hittestRequest))}}t([o(P)],et.prototype,"visualVariableColor",void 0),t([o(T)],et.prototype,"visualVariableOpacity",void 0),t([o(G)],et.prototype,"visualVariableRotation",void 0),t([o(H)],et.prototype,"visualVariableSizeMinMaxValue",void 0),t([o(L)],et.prototype,"visualVariableSizeScaleStops",void 0),t([o(B)],et.prototype,"visualVariableSizeStops",void 0),t([o(E)],et.prototype,"visualVariableSizeUnitValue",void 0),t([s(O)],et.prototype,"mosaicInfo",void 0),t([e(0,r(X)),e(1,r(Y))],et.prototype,"vertex",null),t([e(0,r(Z))],et.prototype,"fragment",null);export{Z as MarkerFragmentInput,et as MarkerShader,X as MarkerVertexInput};
package/widgets/Print.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{JSONMap as l}from"../core/jsonMap.js";import{clone as i}from"../core/lang.js";import{watch as a}from"../core/reactiveUtils.js";import{unitName as o}from"../core/unitFormatUtils.js";import{addProxy as n,hasSameOrigin as s}from"../core/urlUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{reArcGISOnlineDomain as p}from"../portal/support/urlUtils.js";import{getToken as d}from"../rest/utils.js";import{toJSON as u}from"../rest/support/fileFormat.js";import m from"./Widget.js";import h from"./Print/FileLink.js";import b from"./Print/PrintViewModel.js";import{loadCalciteComponents as y}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import{Heading as f}from"./support/Heading.js";import{legacyIcon as g}from"./support/legacyIcon.js";import{isRTL as v,isActivationKey as w}from"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{tsx as x}from"./support/jsxFactory.js";import{formatNumber as C}from"../intl/number.js";const O=t.ofType(h),I="MAP_ONLY";var k;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(k||(k={}));const $="esri-print",L=`${$}__advanced-options-button`,S={base:$,headerTitle:`${$}__header-title`,layoutTabList:`${$}__layout-tab-list`,layoutTab:`${$}__layout-tab`,layoutSection:`${$}__layout-section`,mapOnlySection:`${$}__map-only-section`,panelItemsCentered:`${$}__panel-items--centered`,loader:`${$}__loader`,advancedOptionsButton:L,advancedOptionsButtonContainer:`${L}-container`,advancedOptionsButtonTitle:`${L}-title`,advancedOptionsButtonIconOpened:`${L}-icon--opened`,advancedOptionsButtonIconClosed:`${L}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${L}-icon--closed-rtl`,swapButton:`${$}__swap-button`,printButton:`${$}__export-button`,templateSelectContainer:`${$}__template-select-container`,templateSelectBlock:`${$}__template-select-block`,templateSelectIcon:`${$}__template-select-icon`,formSectionContainer:`${$}__form-section-container`,formCheckboxLabel:`${$}__form-checkbox-label`,advancedOptionsSection:`${$}__advanced-options-section`,advancedOptionsContainer:`${$}__advanced-options-container`,browseTemplateButtonContainer:`${$}__browse-template-button-container`,exportedFilesContainer:`${$}__export-panel-container`,exportedFilesTitle:`${$}__export-title`,exportedFile:`${$}__exported-file`,exportedFileLink:`${$}__exported-file-link`,exportedFileLinkTitle:`${$}__exported-file-link-title`,exportedFilesEmpty:`${$}__exported-files-empty`,printWidgetContainer:`${$}__container`,content:`${$}__content`,panelContainer:`${$}__panel-container`,scaleInfoContainer:`${$}__scale-info-container`,scaleInputContainer:`${$}__scale-input-container`,scaleInput:`${$}__scale-input`,sizeContainer:`${$}__size-container`,panelError:`${$}__panel--error`,exportedFileError:`${$}__exported-file--error`,exportedFileLoader:`${$}__exported-file--loader`,exportSection:`${$}__export-section`,exportSectionCentered:`${$}__export-section--centered`,templateButtonContainer:`${$}__template-button-container`,templateDoneButton:`${$}__template-done-button`,templateSelectFlowItemContainer:`${$}__template-select-flow-item-container`,templateSelectFlowItemContent:`${$}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${$}__template-select-flow-item-list-heading`};function M(e,t,l,i){const a=l/t,o=i/t;return{width:Math.round(e*a),height:Math.round(e*o)}}function E(e){return!isNaN(e)&&e>0}function F(e){return e?.toUpperCase()===I}function j(e){const{state:t,extension:l}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return l?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}function P(e,t){return!!t&&e.some((e=>e.layoutItem?.id===t||e.layout===t))}const A=new l({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"});let B=class extends m{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._selectedTab=k.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedLayout=null,this._abortController=null,this._showTemplates=!1,this.browseTemplateButtonOnClick=null,this.exportedLinks=new O,this.headingLevel=3,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new b,this._onInput=e=>{this._selectedTab===k.layout?this.templateOptions.title=e.target.value:this._selectedTab===k.mapOnly&&(this.templateOptions.fileName=e.target.value)},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&this.exportedLinks.remove(t)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const l=d(this.viewModel.effectivePrintServiceUrl),i=t.url,a=document.createElement("a");if(a.target="_blank",a.href=i,a.rel="noreferrer",a.download=t.formattedName??"",!l)return a.click(),void e.stopPropagation();e.preventDefault();const o=new URL(i);o.searchParams.set("token",l),a.href=o.href,a.click(),a.href=i},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([a((()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format.defaultValue]),(([e,t])=>{if(t&&!e)return void(this.templateOptions.format=t);if(!e||!t||!this.viewModel.templatesInfo)return;if(this.viewModel.templatesInfo.format.choiceList.includes(e))return;const l=this.viewModel.templatesInfo.format.choiceList.find((t=>t.toUpperCase().includes(`(${e.toUpperCase()})`)));this.templateOptions.format=l??t})),a((()=>[this.templateOptions.layout,this.viewModel.templatesInfo?.layout.defaultValue]),(async([e,t])=>{if(this._selectedTab=F(e)?k.mapOnly:k.layout,this._selectedTab!==k.layout)return;const{includeDefaultTemplates:l,viewModel:a,_selectedLayout:o}=this,{portalTemplateIds:n,browseTemplates:s,templatesInfo:r}=a,c=a.defaultTemplates.filter((({layoutItem:e})=>n.includes(e?.id))),p=a.defaultTemplates.filter((({layoutItem:e})=>!n.includes(e?.id))),d=l&&p.length;if(e){(d?P(p,e):r?.layout.choiceList.includes(e))||P(c,e)||P(s,e)||(this.templateOptions.layout=null,this.templateOptions.layoutItem=null)}else{o&&((d?P(p,o):r?.layout.choiceList.includes(o))||P(c,o)||P(s,o))?await this._applyTemplate(o):(this.templateOptions.layout=null,this.templateOptions.layoutItem=null),this.templateOptions.layout||d||!t||await this._applyTemplate(t)}this._selectedLayout=this.templateOptions.layout;const u=!!this.templateOptions.layout&&this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=u?i(u):null})),a((()=>this.templateOptions.dpi),(e=>{e<=0&&(this.templateOptions.dpi=1)})),a((()=>this.viewModel.view?.scale),(e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}))]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const l=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>{clearTimeout(l),this._awaitingServerResponse=!1}))}loadDependencies(){return y({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip.js")})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return"print"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{messages:e,templateOptions:t,viewModel:l,view:i}=this,{attributionEnabled:a,author:o,copyright:n,dpi:s,format:r,height:c,layout:p,legendEnabled:d,northArrowEnabled:m,scaleEnabled:h,scale:b,width:y}=t,w="ready"!==l.state||this._awaitingServerResponse||!p,T=this._renderTitleOrFileNameSection(),C=x("div",{class:S.formSectionContainer},x("calcite-label",null,e.fileFormatTitle,x("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({target:e})=>{this.templateOptions.format=e.selectedItems[0].value}},l.templatesInfo?.format?.choiceList.sort().map(((e,t)=>x("calcite-combobox-item",{key:`file-format-${t}`,selected:e===this.templateOptions.format,textLabel:u(e),value:e})))))),O=x("calcite-label",{layout:"inline"},x("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.target.checked}}),e.printPreview),I=x("div",null,x("div",{class:S.formSectionContainer},x("calcite-label",null,e.template,x("div",{class:S.templateSelectContainer,onclick:()=>{this._showTemplates=!0}},x("calcite-block",{class:S.templateSelectBlock,description:this._getPageSizeLabel(p),heading:this._getTemplateLabel()}),x("calcite-icon",{class:S.templateSelectIcon,icon:v()?"chevron-left":"chevron-right",scale:"s"})))),O),$=x("div",{class:S.formSectionContainer},x("calcite-label",null,e.dpi,x("calcite-input",{bind:this,"data-input-name":"dpi",min:1,tabIndex:0,type:"number",value:`${s}`,onCalciteInputInput:this._handleDPIChange}))),L=x("div",{class:this.classes(S.scaleInfoContainer,S.formSectionContainer)},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:h,"data-option-name":"scaleEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),x("div",{class:S.scaleInputContainer},x("calcite-input",{"aria-label":e.scaleLabel,"aria-valuenow":`${b}`,bind:this,class:S.scaleInput,"data-input-name":"scale",disabled:!h,tabIndex:0,type:"number",value:`${b}`,onCalciteInputInput:this._updateInputValue}),x("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!h,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale,tabIndex:0}))),M=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:S.advancedOptionsContainer,key:"advanced-section-for-layout"},L,this.viewModel.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?x("div",{class:S.formSectionContainer,key:"author-info"},x("calcite-label",null,e.author,x("calcite-input",{bind:this,"data-input-name":"author",tabIndex:0,value:o??"",onCalciteInputInput:this._updateInputValue}))):null,this.viewModel.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?x("div",{class:S.formSectionContainer,key:"copyright-text"},x("calcite-label",null,e.copyright,x("calcite-input",{bind:this,"data-input-name":"copyright",tabIndex:0,value:n??"",onCalciteInputInput:this._updateInputValue}))):null,$,this._renderCustomTextElementSection(),this.viewModel.layoutTemplateInfo?.layoutOptions?.hasLegend??1?x("div",{class:S.formSectionContainer,key:"legend-info"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:d,"data-option-name":"legendEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this.viewModel.layoutTemplateNorthArrowInfo??1?x("div",{class:S.formSectionContainer,key:"north-arrow"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:m,"data-option-name":"northArrowEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null),E=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:S.advancedOptionsContainer},L,$,x("div",{class:S.formSectionContainer},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:a,"data-option-name":"attributionEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),F=this.exportedLinks.toArray(),j=this._renderExportedLink(F),P={[S.exportSectionCentered]:!F.length},A=this._selectedTab===k.layout?x("section",{"aria-labelledby":`${this.id}__layoutTab`,class:S.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},x("div",{class:S.panelContainer},this.viewModel.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?T:null,I,this._selectedTab===k.layout?C:null,x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(S.panelContainer,S.advancedOptionsSection),collapsible:!0,disabled:!p,heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},M))):this._selectedTab===k.mapOnly?x("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:S.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},x("div",{class:S.panelContainer},T,C,x("div",null,x("div",{class:this.classes(S.sizeContainer,S.formSectionContainer)},x("calcite-label",null,e.width,x("calcite-input",{bind:this,"data-input-name":"width",tabIndex:0,type:"number",value:`${y}`,onCalciteInputInput:this._updateInputValue})),x("calcite-label",null,e.height,x("calcite-input",{bind:this,"data-input-name":"height",tabIndex:0,type:"number",value:`${c}`,onCalciteInputInput:this._updateInputValue})),x("button",{"aria-label":e.swap,bind:this,class:this.classes(_.widgetButton,S.swapButton,g.swap),onclick:this._switchInput,tabIndex:0,type:"button"})),O),x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(S.panelContainer,S.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},E))):x("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(S.exportSection,P),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},x("div",{class:S.panelContainer},x("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:S.exportedFilesContainer},0===F.length?x("div",{class:S.exportedFilesEmpty},x("calcite-icon",{icon:"file",scale:"l"}),x("div",null,x(f,{class:S.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),x("div",null,e.exportHint))):j))),B={[_.buttonDisabled]:w||!p&&!r},D=!i||"2d"!==i.type,U=x("div",{class:S.panelError},D?e.sceneViewError:e.serviceError),N=F.some((({state:e})=>"pending"===e)),V=x("div",{class:S.content,key:"panel"},x("div",null,x("ul",{bind:this,class:S.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===k.layout}`,class:S.layoutTab,"data-tab-id":k.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===k.mapOnly}`,class:S.layoutTab,"data-tab-id":k.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===k.export}`,class:S.layoutTab,"data-tab-id":k.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},N?x("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),A),this._selectedTab!==k.export?x("button",{"aria-label":e.exportDescription,bind:this,class:this.classes(S.printButton,_.button,B),disabled:w,onclick:this._handlePrintMap,tabIndex:0,type:"button"},e.export):null),R=x("calcite-flow",{key:"root-flow"},x("calcite-flow-item",{bind:this,key:"root-flow-item"},x("div",{class:S.printWidgetContainer},x("header",{class:S.headerTitle},e.export),this.error||D||!i?U:V)),this._renderChooseTemplateFlowItem()),z="initializing"===l.state,H=z?this._renderLoader():R,W={[S.panelItemsCentered]:z};return x("div",{bind:this,class:this.classes(S.base,_.widget,_.panel,W)},H)}_getPageSizeLabel(e){if(!e)return;const t=this.viewModel.getLayoutTemplateInfo(e);if(!t)return;const l=A.fromJSON(t.pageUnits.toLowerCase());return`${C(t.pageSize[0])} x ${C(t.pageSize[1])} ${o(this.messagesUnits,l,"abbr")}`}_getTemplateLabel(){const{messages:e,includeDefaultTemplates:t,templateOptions:l,viewModel:i}=this,{layout:a}=l,o=a?(t?i.defaultTemplates.find((({layoutItem:e,layout:t})=>a===e?.id||a===t)):null)??i.browseTemplates.find((({layoutItem:e})=>a===e?.id)):null;return o?.label?.replaceAll("_"," ")??e[a]??a?.replaceAll("_"," ")??e.selectTemplate}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{includeDefaultTemplates:e,messages:t,viewModel:l}=this,{defaultTemplates:i,templatesInfo:a,browseTemplates:o,portalTemplateIds:n}=l,s=p.test(this.portal?.url),r=o.length?o.toArray().sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)).map(((e,i)=>{const a=e.layoutItem?.id??e.layout,o=this._getPageSizeLabel(a),n=a===this.templateOptions.layout;return x("calcite-list-item",{description:o,key:`browse-template-${i}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:n,title:e.description??"",value:a},!o&&n&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`browse-template-loader-${i}`,label:"loading",scale:"s",slot:"content-end"}):null,x("calcite-action",{icon:"trash",onclick:()=>l.removePortalTemplate(e),slot:"actions-end",text:"delete"}))})):null,c=i.length&&e?i.toArray().filter((({label:e,layoutItem:t})=>!F(e)&&n.includes(t?.id))).map(((e,l)=>{const i=e.layoutItem?.id??e.layout,a=this._getPageSizeLabel(i),o=i===this.templateOptions.layout;return x("calcite-list-item",{description:a,key:`portal-template-${i}-${o}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:o,title:e.description??"",value:i},!a&&o&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`portal-template-loader-${l}`,label:"loading",scale:"s",slot:"content-end"}):null)})):null,d=i.length&&e?i.toArray().filter((({label:e,layoutItem:t})=>!F(e)&&!n.includes(t?.id))).sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)).map(((e,l)=>{const i=e.layoutItem?.id??e.layout,a=this._getPageSizeLabel(i),o=i===this.templateOptions.layout;return x("calcite-list-item",{description:a,key:`default-template-${l}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:o,title:e.description??"",value:i},!a&&o&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`default-template-loader-${l}`,label:"loading",scale:"s",slot:"content-end"}):null)})):null,u=!a?.layout?.choiceList.length||e&&d?.length?null:a.layout.choiceList.map((e=>({label:t[e]??e.replaceAll("_"," "),value:e}))).sort(((e,t)=>e.label>t.label?1:0)).map((({label:e,value:t},l)=>x("calcite-list-item",{description:this._getPageSizeLabel(t),key:`service-template-${l}`,label:e,selected:t===this.templateOptions.layout,value:t}))),m=(r?.length??0)+(c?.length??0)+(d?.length??0)+(u?.length??0)>15;return x("calcite-flow-item",{bind:this,closable:!1,heading:t.chooseTemplate,key:"template-flow-item",onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},x("div",{class:S.templateSelectFlowItemContainer},x("div",{class:S.templateSelectFlowItemContent},this.browseTemplateButtonOnClick?x("calcite-button",{appearance:"outline",class:S.browseTemplateButtonContainer,key:"browse-template-button",onclick:this.browseTemplateButtonOnClick},"Browse Templates"):null,x("calcite-list",{filterEnabled:m,key:"template-list",selectionMode:"single-persist",onCalciteListChange:({target:e})=>this._applyTemplate(e.selectedItems[0].value)},r?.length?x("div",{key:"my-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.myTemplates,x("calcite-chip",{appearance:"outline",kind:"neutral",scale:"s",value:t.beta},t.beta)),r):null,c?.length?x("div",{key:"org-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.organizationTemplates,s?x("calcite-chip",{appearance:"outline",kind:"neutral",scale:"s",value:t.beta},t.beta):null),c):null,r?.length||c?.length?d?.length?x("div",{key:"default-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.defaultTemplates),d):null:d,r?.length||c?.length?u?.length?x("div",{key:"service-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.defaultTemplates),u):null:u)),x("div",{class:S.templateButtonContainer},x("calcite-button",{class:S.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?x("div",{class:S.formSectionContainer,key:"custom-text-elements"},e.map(((e,t)=>{const[l,i]=Object.entries(e)[0];return"date"===l?null:x("calcite-label",{key:`custom-text-elements-${l}-${t}`},l,x("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":l,value:i??"",onCalciteInputInput:this._updateInputValue}))}))):null}async _applyTemplate(e){if(this._abortController&&(this._abortController.abort(),this._abortController=null),!e)return;const t=this.viewModel.defaultTemplates.find((({layoutItem:t})=>e===t?.id))??this.viewModel.browseTemplates.find((({layoutItem:t})=>e===t?.id));if(!t)return this.templateOptions.layout=e,void(this.templateOptions.layoutItem=null);const{layoutItem:l}=t,a=t.format??this.templateOptions.format,o=l?.id??t.layout??this.templateOptions.layout;if(this.templateOptions.layout=o,!t.layoutOptions)try{this._abortController=new AbortController,await this.viewModel.fetchLayoutTemplateInfo(t,{signal:this._abortController.signal})}catch(p){return}finally{this._abortController=null}const n=t.layoutOptions?.legend??this.templateOptions.legendEnabled,s=t.layoutOptions?.northArrow??this.templateOptions.northArrowEnabled,r=o?this.viewModel.effectiveTemplateCustomTextElements[o]:null,c=r?i(r):null;this.templateOptions.set({customTextElements:c,format:a,layout:o,layoutItem:l,legendEnabled:n,northArrowEnabled:s})}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:l,fileNamePlaceHolder:i}=this.messages,a=this._selectedTab===k.layout?e:t,o=this._selectedTab===k.layout?l:i,n=this._selectedTab===k.layout?this.templateOptions.title:this.templateOptions.fileName;return x("div",{class:S.formSectionContainer,key:a},x("calcite-label",null,a,x("calcite-input",{placeholder:o,value:n??"",onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._selectedTab===k.layout||"mapOnlyTab"===t&&this._selectedTab===k.mapOnly||"exportTab"===t&&this._selectedTab===k.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[S.loader]:this._awaitingServerResponse};return x("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const l=t||this.messages.untitled,i=e.format.toLowerCase(),a=i.includes("png")?"png":i,o=l+a;return void 0!==this._exportedFileNameMap[o]?this._exportedFileNameMap[o]++:this._exportedFileNameMap[o]=0,new h({name:l,extension:a,count:this._exportedFileNameMap[o]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,l){e.find((e=>{const[l]=Object.entries(e)[0];return l===t}))[t]=l}_updateInputValue(e){const t=e.target,l=t.getAttribute("data-input-name"),i=!!t["data-input-custom"],{templateOptions:a}=this;if(i)return void this._updateCustomTextElementValue(a.customTextElements,l,t.value);let o;if("number"===t.type){const e=Number(t.value);if(!E(e)){const e=a[l];return void(t.value=`${e}`)}o=e}else o=t.value;a[l]=o}_handleDPIChange(e){const{templateOptions:t}=this,l=t.dpi;this._updateInputValue(e);const i=t.dpi,{height:a,width:o}=M(i,l,t.width,t.height);t.height=a,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),l=this._selectedTab===k.layout?t.layoutOptions?.titleText:e.fileName,i=this._createFileLink(t,l);this.exportedLinks.add(i),this.emit("submit",{link:i}),this._selectedTab=k.export,this.viewModel.print(t).then((e=>{i.set({url:e&&e.url,state:"ready"})})).catch((e=>{i.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:i}),this.scheduleRender()}))}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:l}=e,i=l-t;i>0&&(e.scrollTop=i)}_toggleInputValue(e){const t=e.target,l=t.getAttribute("data-option-name");this.templateOptions[l]=t.checked,"scaleEnabled"===l&&this._resetToCurrentScale()}_renderExportedLink(e){const t=this.messages,l=e.map((e=>{const{error:l,url:i,state:a}=e,o=e.formattedName??"",r="error"===a,c="pending"===a,p="ready"===a;let d=i||null;d&&(d=n(d));const u=s(i,location.href);let m;m=c?t.pending:p?t.ready:t.errorMessage;const h=r?"print-task:cim-symbol-unsupported"===l?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return x("calcite-list-item",{"aria-label":m,class:S.exportedFile,"data-item":e,description:c?t.generatingExport:h||(u?t.ready:t.linkReady),key:o,label:o,title:h,onCalciteListItemSelect:this._handleLinkClick},c?x("calcite-loader",{class:S.exportedFileLoader,inline:!0,key:`${o}-loader`,label:t.generatingExport,scale:"m",slot:"content-start"}):x("calcite-icon",{icon:j(e),key:`${o}-start-icon`,scale:"s",slot:"content-start"}),p?x("calcite-icon",{"aria-label":`${o}. ${t.linkReady}`,icon:u?"download-to":"launch",key:`${o}-end-icon`,scale:"s",slot:"content-end"}):null,c?null:x("calcite-action",{"aria-label":`${h}`,"data-item":e,icon:"x",key:`${o}-action`,onclick:this._removeLink,slot:"actions-end",text:`${h}`}))}));return x("calcite-list",{filterEnabled:e?.length>10},l)}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===k.mapOnly)this.templateOptions.layout=I,this.templateOptions.layoutItem=null,this.templateOptions.customTextElements=null;else if(this._selectedTab===k.layout){const e=this._selectedLayout??(this.includeDefaultTemplates&&this.viewModel.defaultTemplates.length?null:this.viewModel.templatesInfo?.layout?.defaultValue);e?this._applyTemplate(e):(this.templateOptions.layout=null,this.templateOptions.layoutItem=null,this.templateOptions.customTextElements=null)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,l=e.target.getAttribute("data-tab-id");if(w(t))return this._toggleTab(l),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(l){case k.layout:this._toggleTab("ArrowLeft"===t?k.export:k.mapOnly);break;case k.mapOnly:this._toggleTab("ArrowLeft"===t?k.layout:k.export);break;case k.export:this._toggleTab("ArrowLeft"===t?k.mapOnly:k.layout)}e.preventDefault(),e.stopPropagation()}}};e([r()],B.prototype,"_showTemplates",void 0),e([r()],B.prototype,"allowedFormats",null),e([r()],B.prototype,"allowedLayouts",null),e([r()],B.prototype,"browseTemplateButtonOnClick",void 0),e([r()],B.prototype,"error",null),e([r({type:O})],B.prototype,"exportedLinks",void 0),e([r()],B.prototype,"extraParameters",null),e([r()],B.prototype,"headingLevel",void 0),e([r()],B.prototype,"icon",null),e([r()],B.prototype,"includeDefaultTemplates",null),e([r()],B.prototype,"label",null),e([r(),T("esri/widgets/Print/t9n/Print")],B.prototype,"messages",void 0),e([r(),T("esri/t9n/common")],B.prototype,"messagesCommon",void 0),e([r(),T("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),e([r()],B.prototype,"portal",null),e([r()],B.prototype,"showPrintAreaEnabled",null),e([r()],B.prototype,"printServiceUrl",null),e([r()],B.prototype,"templateCustomTextElements",null),e([r()],B.prototype,"templateOptions",null),e([r()],B.prototype,"view",null),e([r({type:b})],B.prototype,"viewModel",void 0),B=e([c("esri.widgets.Print")],B);const D=B;export{D as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{JSONMap as l}from"../core/jsonMap.js";import{clone as i}from"../core/lang.js";import{watch as a}from"../core/reactiveUtils.js";import{unitName as o}from"../core/unitFormatUtils.js";import{addProxy as n,hasSameOrigin as s}from"../core/urlUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{reArcGISOnlineDomain as p}from"../portal/support/urlUtils.js";import{getToken as d}from"../rest/utils.js";import{toJSON as u}from"../rest/support/fileFormat.js";import m from"./Widget.js";import h from"./Print/FileLink.js";import b from"./Print/PrintViewModel.js";import{loadCalciteComponents as y}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import{Heading as f}from"./support/Heading.js";import{legacyIcon as g}from"./support/legacyIcon.js";import{isRTL as v,isActivationKey as w}from"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{tsx as x}from"./support/jsxFactory.js";import{formatNumber as C}from"../intl/number.js";const O=t.ofType(h),I="MAP_ONLY";var k;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(k||(k={}));const $="esri-print",L=`${$}__advanced-options-button`,S={base:$,headerTitle:`${$}__header-title`,layoutTabList:`${$}__layout-tab-list`,layoutTab:`${$}__layout-tab`,layoutSection:`${$}__layout-section`,mapOnlySection:`${$}__map-only-section`,panelItemsCentered:`${$}__panel-items--centered`,loader:`${$}__loader`,advancedOptionsButton:L,advancedOptionsButtonContainer:`${L}-container`,advancedOptionsButtonTitle:`${L}-title`,advancedOptionsButtonIconOpened:`${L}-icon--opened`,advancedOptionsButtonIconClosed:`${L}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${L}-icon--closed-rtl`,swapButton:`${$}__swap-button`,printButton:`${$}__export-button`,templateSelectContainer:`${$}__template-select-container`,templateSelectBlock:`${$}__template-select-block`,templateSelectIcon:`${$}__template-select-icon`,formSectionContainer:`${$}__form-section-container`,formCheckboxLabel:`${$}__form-checkbox-label`,advancedOptionsSection:`${$}__advanced-options-section`,advancedOptionsContainer:`${$}__advanced-options-container`,browseTemplateButtonContainer:`${$}__browse-template-button-container`,exportedFilesContainer:`${$}__export-panel-container`,exportedFilesTitle:`${$}__export-title`,exportedFile:`${$}__exported-file`,exportedFileLink:`${$}__exported-file-link`,exportedFileLinkTitle:`${$}__exported-file-link-title`,exportedFilesEmpty:`${$}__exported-files-empty`,printWidgetContainer:`${$}__container`,content:`${$}__content`,panelContainer:`${$}__panel-container`,scaleInfoContainer:`${$}__scale-info-container`,scaleInputContainer:`${$}__scale-input-container`,scaleInput:`${$}__scale-input`,sizeContainer:`${$}__size-container`,panelError:`${$}__panel--error`,exportedFileError:`${$}__exported-file--error`,exportedFileLoader:`${$}__exported-file--loader`,exportSection:`${$}__export-section`,exportSectionCentered:`${$}__export-section--centered`,templateButtonContainer:`${$}__template-button-container`,templateDoneButton:`${$}__template-done-button`,templateSelectFlowItemContainer:`${$}__template-select-flow-item-container`,templateSelectFlowItemContent:`${$}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${$}__template-select-flow-item-list-heading`};function M(e,t,l,i){const a=l/t,o=i/t;return{width:Math.round(e*a),height:Math.round(e*o)}}function E(e){return!isNaN(e)&&e>0}function F(e){return e?.toUpperCase()===I}function j(e){const{state:t,extension:l}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return l?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}function P(e,t){return!!t&&e.some((e=>e.layoutItem?.id===t||e.layout===t))}const A=new l({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"});let B=class extends m{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._selectedTab=k.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedLayout=null,this._abortController=null,this._showTemplates=!1,this.browseTemplateButtonOnClick=null,this.exportedLinks=new O,this.headingLevel=3,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new b,this._onInput=e=>{this._selectedTab===k.layout?this.templateOptions.title=e.target.value:this._selectedTab===k.mapOnly&&(this.templateOptions.fileName=e.target.value)},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&this.exportedLinks.remove(t)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const l=d(this.viewModel.effectivePrintServiceUrl),i=t.url,a=document.createElement("a");if(a.target="_blank",a.href=i,a.rel="noreferrer",a.download=t.formattedName??"",!l)return a.click(),void e.stopPropagation();e.preventDefault();const o=new URL(i);o.searchParams.set("token",l),a.href=o.href,a.click(),a.href=i},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([a((()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format.defaultValue]),(([e,t])=>{if(t&&!e)return void(this.templateOptions.format=t);if(!e||!t||!this.viewModel.templatesInfo)return;if(this.viewModel.templatesInfo.format.choiceList.includes(e))return;const l=this.viewModel.templatesInfo.format.choiceList.find((t=>t.toUpperCase().includes(`(${e.toUpperCase()})`)));this.templateOptions.format=l??t})),a((()=>[this.templateOptions.layout,this.viewModel.templatesInfo?.layout.defaultValue]),(async([e,t])=>{if(this._selectedTab=F(e)?k.mapOnly:k.layout,this._selectedTab!==k.layout)return;const{includeDefaultTemplates:l,viewModel:a,_selectedLayout:o}=this,{portalTemplateIds:n,browseTemplates:s,templatesInfo:r}=a,c=a.defaultTemplates.filter((({layoutItem:e})=>n.includes(e?.id))),p=a.defaultTemplates.filter((({layoutItem:e})=>!n.includes(e?.id))),d=l&&p.length;if(e){(d?P(p,e):r?.layout.choiceList.includes(e))||P(c,e)||P(s,e)||(this.templateOptions.layout=null,this.templateOptions.layoutItem=null)}else{o&&((d?P(p,o):r?.layout.choiceList.includes(o))||P(c,o)||P(s,o))?await this._applyTemplate(o):(this.templateOptions.layout=null,this.templateOptions.layoutItem=null),this.templateOptions.layout||d||!t||await this._applyTemplate(t)}this._selectedLayout=this.templateOptions.layout;const u=!!this.templateOptions.layout&&this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=u?i(u):null})),a((()=>this.templateOptions.dpi),(e=>{e<=0&&(this.templateOptions.dpi=1)})),a((()=>this.viewModel.view?.scale),(e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}))]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const l=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>{clearTimeout(l),this._awaitingServerResponse=!1}))}loadDependencies(){return y({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip.js")})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return"print"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{messages:e,templateOptions:t,viewModel:l,view:i}=this,{attributionEnabled:a,author:o,copyright:n,dpi:s,format:r,height:c,layout:p,legendEnabled:d,northArrowEnabled:m,scaleEnabled:h,scale:b,width:y}=t,w="ready"!==l.state||this._awaitingServerResponse||!p,T=this._renderTitleOrFileNameSection(),C=x("div",{class:S.formSectionContainer},x("calcite-label",null,e.fileFormatTitle,x("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({target:e})=>{this.templateOptions.format=e.selectedItems[0].value}},l.templatesInfo?.format?.choiceList.sort().map(((e,t)=>x("calcite-combobox-item",{key:`file-format-${t}`,selected:e===this.templateOptions.format,textLabel:u(e),value:e})))))),O=x("calcite-label",{layout:"inline"},x("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.target.checked}}),e.printPreview),I=x("div",null,x("div",{class:S.formSectionContainer},x("calcite-label",null,e.template,x("div",{class:S.templateSelectContainer,onclick:()=>{this._showTemplates=!0}},x("calcite-block",{class:S.templateSelectBlock,description:this._getPageSizeLabel(p),heading:this._getTemplateLabel()}),x("calcite-icon",{class:S.templateSelectIcon,icon:v()?"chevron-left":"chevron-right",scale:"s"})))),O),$=x("div",{class:S.formSectionContainer},x("calcite-label",null,e.dpi,x("calcite-input",{bind:this,"data-input-name":"dpi",min:1,tabIndex:0,type:"number",value:`${s}`,onCalciteInputInput:this._handleDPIChange}))),L=x("div",{class:this.classes(S.scaleInfoContainer,S.formSectionContainer)},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:h,"data-option-name":"scaleEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),x("div",{class:S.scaleInputContainer},x("calcite-input",{"aria-label":e.scaleLabel,"aria-valuenow":`${b}`,bind:this,class:S.scaleInput,"data-input-name":"scale",disabled:!h,tabIndex:0,type:"number",value:`${b}`,onCalciteInputInput:this._updateInputValue}),x("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!h,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale,tabIndex:0}))),M=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:S.advancedOptionsContainer,key:"advanced-section-for-layout"},L,this.viewModel.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?x("div",{class:S.formSectionContainer,key:"author-info"},x("calcite-label",null,e.author,x("calcite-input",{bind:this,"data-input-name":"author",tabIndex:0,value:o??"",onCalciteInputInput:this._updateInputValue}))):null,this.viewModel.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?x("div",{class:S.formSectionContainer,key:"copyright-text"},x("calcite-label",null,e.copyright,x("calcite-input",{bind:this,"data-input-name":"copyright",tabIndex:0,value:n??"",onCalciteInputInput:this._updateInputValue}))):null,$,this._renderCustomTextElementSection(),this.viewModel.layoutTemplateInfo?.layoutOptions?.hasLegend??1?x("div",{class:S.formSectionContainer,key:"legend-info"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:d,"data-option-name":"legendEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this.viewModel.layoutTemplateNorthArrowInfo?x("div",{class:S.formSectionContainer,key:"north-arrow"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:m,"data-option-name":"northArrowEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null),E=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:S.advancedOptionsContainer},L,$,x("div",{class:S.formSectionContainer},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:a,"data-option-name":"attributionEnabled",tabIndex:0,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),F=this.exportedLinks.toArray(),j=this._renderExportedLink(F),P={[S.exportSectionCentered]:!F.length},A=this._selectedTab===k.layout?x("section",{"aria-labelledby":`${this.id}__layoutTab`,class:S.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},x("div",{class:S.panelContainer},this.viewModel.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?T:null,I,this._selectedTab===k.layout?C:null,x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(S.panelContainer,S.advancedOptionsSection),collapsible:!0,disabled:!p,heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},M))):this._selectedTab===k.mapOnly?x("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:S.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},x("div",{class:S.panelContainer},T,C,x("div",null,x("div",{class:this.classes(S.sizeContainer,S.formSectionContainer)},x("calcite-label",null,e.width,x("calcite-input",{bind:this,"data-input-name":"width",tabIndex:0,type:"number",value:`${y}`,onCalciteInputInput:this._updateInputValue})),x("calcite-label",null,e.height,x("calcite-input",{bind:this,"data-input-name":"height",tabIndex:0,type:"number",value:`${c}`,onCalciteInputInput:this._updateInputValue})),x("button",{"aria-label":e.swap,bind:this,class:this.classes(_.widgetButton,S.swapButton,g.swap),onclick:this._switchInput,tabIndex:0,type:"button"})),O),x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(S.panelContainer,S.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},E))):x("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(S.exportSection,P),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},x("div",{class:S.panelContainer},x("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:S.exportedFilesContainer},0===F.length?x("div",{class:S.exportedFilesEmpty},x("calcite-icon",{icon:"file",scale:"l"}),x("div",null,x(f,{class:S.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),x("div",null,e.exportHint))):j))),B={[_.buttonDisabled]:w||!p&&!r},D=!i||"2d"!==i.type,U=x("div",{class:S.panelError},D?e.sceneViewError:e.serviceError),N=F.some((({state:e})=>"pending"===e)),V=x("div",{class:S.content,key:"panel"},x("div",null,x("ul",{bind:this,class:S.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===k.layout}`,class:S.layoutTab,"data-tab-id":k.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===k.mapOnly}`,class:S.layoutTab,"data-tab-id":k.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===k.export}`,class:S.layoutTab,"data-tab-id":k.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},N?x("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),A),this._selectedTab!==k.export?x("button",{"aria-label":e.exportDescription,bind:this,class:this.classes(S.printButton,_.button,B),disabled:w,onclick:this._handlePrintMap,tabIndex:0,type:"button"},e.export):null),R=x("calcite-flow",{key:"root-flow"},x("calcite-flow-item",{bind:this,key:"root-flow-item"},x("div",{class:S.printWidgetContainer},x("header",{class:S.headerTitle},e.export),this.error||D||!i?U:V)),this._renderChooseTemplateFlowItem()),z="initializing"===l.state,H=z?this._renderLoader():R,W={[S.panelItemsCentered]:z};return x("div",{bind:this,class:this.classes(S.base,_.widget,_.panel,W)},H)}_getPageSizeLabel(e){if(!e)return;const t=this.viewModel.getLayoutTemplateInfo(e);if(!t)return;const l=A.fromJSON(t.pageUnits.toLowerCase());return`${C(t.pageSize[0])} x ${C(t.pageSize[1])} ${o(this.messagesUnits,l,"abbr")}`}_getTemplateLabel(){const{messages:e,includeDefaultTemplates:t,templateOptions:l,viewModel:i}=this,{layout:a}=l,o=a?(t?i.defaultTemplates.find((({layoutItem:e,layout:t})=>a===e?.id||a===t)):null)??i.browseTemplates.find((({layoutItem:e})=>a===e?.id)):null;return o?.label?.replaceAll("_"," ")??e[a]??a?.replaceAll("_"," ")??e.selectTemplate}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{includeDefaultTemplates:e,messages:t,viewModel:l}=this,{defaultTemplates:i,templatesInfo:a,browseTemplates:o,portalTemplateIds:n}=l,s=p.test(this.portal?.url),r=o.length?o.toArray().sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)).map(((e,i)=>{const a=e.layoutItem?.id??e.layout,o=this._getPageSizeLabel(a),n=a===this.templateOptions.layout;return x("calcite-list-item",{description:o,key:`browse-template-${i}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:n,title:e.description??"",value:a},!o&&n&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`browse-template-loader-${i}`,label:"loading",scale:"s",slot:"content-end"}):null,x("calcite-action",{icon:"trash",onclick:()=>l.removePortalTemplate(e),slot:"actions-end",text:"delete"}))})):null,c=i.length&&e?i.toArray().filter((({label:e,layoutItem:t})=>!F(e)&&n.includes(t?.id))).map(((e,l)=>{const i=e.layoutItem?.id??e.layout,a=this._getPageSizeLabel(i),o=i===this.templateOptions.layout;return x("calcite-list-item",{description:a,key:`portal-template-${i}-${o}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:o,title:e.description??"",value:i},!a&&o&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`portal-template-loader-${l}`,label:"loading",scale:"s",slot:"content-end"}):null)})):null,d=i.length&&e?i.toArray().filter((({label:e,layoutItem:t})=>!F(e)&&!n.includes(t?.id))).sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)).map(((e,l)=>{const i=e.layoutItem?.id??e.layout,a=this._getPageSizeLabel(i),o=i===this.templateOptions.layout;return x("calcite-list-item",{description:a,key:`default-template-${l}`,label:e?.label?.replaceAll("_"," ")??t.untitled,selected:o,title:e.description??"",value:i},!a&&o&&e.layoutItem?.id?x("calcite-loader",{inline:!0,key:`default-template-loader-${l}`,label:"loading",scale:"s",slot:"content-end"}):null)})):null,u=!a?.layout?.choiceList.length||e&&d?.length?null:a.layout.choiceList.map((e=>({label:t[e]??e.replaceAll("_"," "),value:e}))).sort(((e,t)=>e.label>t.label?1:0)).map((({label:e,value:t},l)=>x("calcite-list-item",{description:this._getPageSizeLabel(t),key:`service-template-${l}`,label:e,selected:t===this.templateOptions.layout,value:t}))),m=(r?.length??0)+(c?.length??0)+(d?.length??0)+(u?.length??0)>15;return x("calcite-flow-item",{bind:this,closable:!1,heading:t.chooseTemplate,key:"template-flow-item",onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},x("div",{class:S.templateSelectFlowItemContainer},x("div",{class:S.templateSelectFlowItemContent},this.browseTemplateButtonOnClick?x("calcite-button",{appearance:"outline",class:S.browseTemplateButtonContainer,key:"browse-template-button",onclick:this.browseTemplateButtonOnClick},"Browse Templates"):null,x("calcite-list",{filterEnabled:m,key:"template-list",selectionMode:"single-persist",onCalciteListChange:({target:e})=>this._applyTemplate(e.selectedItems[0].value)},r?.length?x("div",{key:"my-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.myTemplates,x("calcite-chip",{appearance:"outline",kind:"neutral",scale:"s",value:t.beta},t.beta)),r):null,c?.length?x("div",{key:"org-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.organizationTemplates,s?x("calcite-chip",{appearance:"outline",kind:"neutral",scale:"s",value:t.beta},t.beta):null),c):null,r?.length||c?.length?d?.length?x("div",{key:"default-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.defaultTemplates),d):null:d,r?.length||c?.length?u?.length?x("div",{key:"service-templates"},x("div",{class:S.templateSelectFlowItemListHeading},t.defaultTemplates),u):null:u)),x("div",{class:S.templateButtonContainer},x("calcite-button",{class:S.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?x("div",{class:S.formSectionContainer,key:"custom-text-elements"},e.map(((e,t)=>{const[l,i]=Object.entries(e)[0];return"date"===l?null:x("calcite-label",{key:`custom-text-elements-${l}-${t}`},l,x("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":l,value:i??"",onCalciteInputInput:this._updateInputValue}))}))):null}async _applyTemplate(e){if(this._abortController&&(this._abortController.abort(),this._abortController=null),!e)return;const t=this.viewModel.defaultTemplates.find((({layoutItem:t})=>e===t?.id))??this.viewModel.browseTemplates.find((({layoutItem:t})=>e===t?.id));if(!t)return this.templateOptions.layout=e,void(this.templateOptions.layoutItem=null);const{layoutItem:l}=t,a=t.format??this.templateOptions.format,o=l?.id??t.layout??this.templateOptions.layout;if(this.templateOptions.layout=o,!t.layoutOptions)try{this._abortController=new AbortController,await this.viewModel.fetchLayoutTemplateInfo(t,{signal:this._abortController.signal})}catch(p){return}finally{this._abortController=null}const n=t.layoutOptions?.legend??this.templateOptions.legendEnabled,s=t.layoutOptions?.northArrow??this.templateOptions.northArrowEnabled,r=o?this.viewModel.effectiveTemplateCustomTextElements[o]:null,c=r?i(r):null;this.templateOptions.set({customTextElements:c,format:a,layout:o,layoutItem:l,legendEnabled:n,northArrowEnabled:s})}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:l,fileNamePlaceHolder:i}=this.messages,a=this._selectedTab===k.layout?e:t,o=this._selectedTab===k.layout?l:i,n=this._selectedTab===k.layout?this.templateOptions.title:this.templateOptions.fileName;return x("div",{class:S.formSectionContainer,key:a},x("calcite-label",null,a,x("calcite-input",{placeholder:o,value:n??"",onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._selectedTab===k.layout||"mapOnlyTab"===t&&this._selectedTab===k.mapOnly||"exportTab"===t&&this._selectedTab===k.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[S.loader]:this._awaitingServerResponse};return x("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const l=t||this.messages.untitled,i=e.format.toLowerCase(),a=i.includes("png")?"png":i,o=l+a;return void 0!==this._exportedFileNameMap[o]?this._exportedFileNameMap[o]++:this._exportedFileNameMap[o]=0,new h({name:l,extension:a,count:this._exportedFileNameMap[o]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,l){e.find((e=>{const[l]=Object.entries(e)[0];return l===t}))[t]=l}_updateInputValue(e){const t=e.target,l=t.getAttribute("data-input-name"),i=!!t["data-input-custom"],{templateOptions:a}=this;if(i)return void this._updateCustomTextElementValue(a.customTextElements,l,t.value);let o;if("number"===t.type){const e=Number(t.value);if(!E(e)){const e=a[l];return void(t.value=`${e}`)}o=e}else o=t.value;a[l]=o}_handleDPIChange(e){const{templateOptions:t}=this,l=t.dpi;this._updateInputValue(e);const i=t.dpi,{height:a,width:o}=M(i,l,t.width,t.height);t.height=a,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),l=this._selectedTab===k.layout?t.layoutOptions?.titleText:e.fileName,i=this._createFileLink(t,l);this.exportedLinks.add(i),this.emit("submit",{link:i}),this._selectedTab=k.export,this.viewModel.print(t).then((e=>{i.set({url:e&&e.url,state:"ready"})})).catch((e=>{i.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:i}),this.scheduleRender()}))}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:l}=e,i=l-t;i>0&&(e.scrollTop=i)}_toggleInputValue(e){const t=e.target,l=t.getAttribute("data-option-name");this.templateOptions[l]=t.checked,"scaleEnabled"===l&&this._resetToCurrentScale()}_renderExportedLink(e){const t=this.messages,l=e.map((e=>{const{error:l,url:i,state:a}=e,o=e.formattedName??"",r="error"===a,c="pending"===a,p="ready"===a;let d=i||null;d&&(d=n(d));const u=s(i,location.href);let m;m=c?t.pending:p?t.ready:t.errorMessage;const h=r?"print-task:cim-symbol-unsupported"===l?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return x("calcite-list-item",{"aria-label":m,class:S.exportedFile,"data-item":e,description:c?t.generatingExport:h||(u?t.ready:t.linkReady),key:o,label:o,title:h,onCalciteListItemSelect:this._handleLinkClick},c?x("calcite-loader",{class:S.exportedFileLoader,inline:!0,key:`${o}-loader`,label:t.generatingExport,scale:"m",slot:"content-start"}):x("calcite-icon",{icon:j(e),key:`${o}-start-icon`,scale:"s",slot:"content-start"}),p?x("calcite-icon",{"aria-label":`${o}. ${t.linkReady}`,icon:u?"download-to":"launch",key:`${o}-end-icon`,scale:"s",slot:"content-end"}):null,c?null:x("calcite-action",{"aria-label":`${h}`,"data-item":e,icon:"x",key:`${o}-action`,onclick:this._removeLink,slot:"actions-end",text:`${h}`}))}));return x("calcite-list",{filterEnabled:e?.length>10},l)}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===k.mapOnly)this.templateOptions.layout=I,this.templateOptions.layoutItem=null,this.templateOptions.customTextElements=null;else if(this._selectedTab===k.layout){const e=this._selectedLayout??(this.includeDefaultTemplates&&this.viewModel.defaultTemplates.length?null:this.viewModel.templatesInfo?.layout?.defaultValue);e?this._applyTemplate(e):(this.templateOptions.layout=null,this.templateOptions.layoutItem=null,this.templateOptions.customTextElements=null)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,l=e.target.getAttribute("data-tab-id");if(w(t))return this._toggleTab(l),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(l){case k.layout:this._toggleTab("ArrowLeft"===t?k.export:k.mapOnly);break;case k.mapOnly:this._toggleTab("ArrowLeft"===t?k.layout:k.export);break;case k.export:this._toggleTab("ArrowLeft"===t?k.mapOnly:k.layout)}e.preventDefault(),e.stopPropagation()}}};e([r()],B.prototype,"_showTemplates",void 0),e([r()],B.prototype,"allowedFormats",null),e([r()],B.prototype,"allowedLayouts",null),e([r()],B.prototype,"browseTemplateButtonOnClick",void 0),e([r()],B.prototype,"error",null),e([r({type:O})],B.prototype,"exportedLinks",void 0),e([r()],B.prototype,"extraParameters",null),e([r()],B.prototype,"headingLevel",void 0),e([r()],B.prototype,"icon",null),e([r()],B.prototype,"includeDefaultTemplates",null),e([r()],B.prototype,"label",null),e([r(),T("esri/widgets/Print/t9n/Print")],B.prototype,"messages",void 0),e([r(),T("esri/t9n/common")],B.prototype,"messagesCommon",void 0),e([r(),T("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),e([r()],B.prototype,"portal",null),e([r()],B.prototype,"showPrintAreaEnabled",null),e([r()],B.prototype,"printServiceUrl",null),e([r()],B.prototype,"templateCustomTextElements",null),e([r()],B.prototype,"templateOptions",null),e([r()],B.prototype,"view",null),e([r({type:b})],B.prototype,"viewModel",void 0),B=e([c("esri.widgets.Print")],B);const D=B;export{D as default};