@arcgis/core 4.33.0-next.20250420 → 4.33.0-next.20250422
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/3293b4041c222299428f.js +1 -0
- package/assets/esri/core/workers/chunks/{a91f2d1deb950f46ad09.js → 4f8782b3b6ad414409e8.js} +1 -1
- package/assets/esri/core/workers/chunks/82555a39a60110ca2713.js +1 -0
- package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +1 -0
- package/assets/esri/core/workers/chunks/fd36b7aaf0d8e0c84471.js +1 -0
- package/interfaces.d.ts +365 -53
- package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/package.json +1 -1
- package/smartMapping/renderers/size.d.ts +1 -0
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/referenceSizeUtils.js +1 -1
- package/smartMapping/renderers/support/regenerateUtils.js +1 -1
- package/smartMapping/renderers/support/rendererUtils.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/widgets/Print/CustomTemplate.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print/utils.js +1 -1
- package/widgets/Print.js +1 -1
- package/assets/esri/core/workers/chunks/0a7cba60a5286ba621d4.js +0 -1
- package/assets/esri/core/workers/chunks/2cbab0c078d0b844934c.js +0 -1
- package/assets/esri/core/workers/chunks/38557792ff9516fc991b.js +0 -1
- package/assets/esri/core/workers/chunks/d28e2c9bdf514236b011.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{id as o}from"../../kernel.js";import e from"../../core/Error.js";import r from"../../core/JSONSupport.js";import{createMD5Hash as s}from"../../core/MD5.js";import{isAbortError as a}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../portal/PortalItem.js";import{formatJsonMap as u}from"../../rest/support/fileFormat.js";import{fromJSON as m}from"../../rest/support/layoutTemplate.js";import{fetchLayoutTemplateInfos as d}from"./utils.js";let
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{id as o}from"../../kernel.js";import e from"../../core/Error.js";import r from"../../core/JSONSupport.js";import{createMD5Hash as s}from"../../core/MD5.js";import{isAbortError as a}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../portal/PortalItem.js";import{formatJsonMap as u}from"../../rest/support/fileFormat.js";import{fromJSON as m}from"../../rest/support/layoutTemplate.js";import{valueUnitKebabDict as y,fetchLayoutTemplateInfos as d}from"./utils.js";let c=class extends r{constructor(t){super(t),this.description=null,this.format=null,this.state="not-loaded",this.label=null,this.layoutInfoTaskUrl=null,this.layout=null,this.layoutItem=null,this.layoutOptions=null,this.layoutTemplateInfo=null,this.type=null}get id(){return this.layoutItem?.id??`${this.layout}-${s(JSON.stringify(this.toJSON()))}`}get mapSurroundInfoOptions(){const t=this.layoutTemplateInfo?.layoutOptions?.mapSurroundInfos;if(!t)return null;const o={northArrow:[],scaleBar:[],legend:[]};for(const e of t)switch(e.type){case"CIMMarkerNorthArrow":o.northArrow.push(e);break;case"CIMScaleLine":o.scaleBar.push(e);break;case"CIMGroupElement":e.elements?.some((t=>"CIMScaleLine"===t.type))&&o.scaleBar.push(e);break;case"CIMLegend":o.legend.push(e)}return o}get pageUnits(){return y.fromJSON(this.layoutTemplateInfo?.pageUnits?.toLowerCase())}_updateLayoutOptions(t){const o=this.layoutOptions?.legend??t.layoutOptions?.hasLegend,e=this.layoutOptions?.northArrow??(this.mapSurroundInfoOptions?.northArrow.length?this.mapSurroundInfoOptions?.northArrow.some((({visible:t})=>t)):void 0),r=this.layoutOptions?.scaleBar??(this.mapSurroundInfoOptions?.scaleBar.length?this.mapSurroundInfoOptions?.scaleBar.some((({visible:t})=>t)):void 0);this._set("layoutOptions",{legend:o,northArrow:e,scaleBar:r})}async fetchLayoutItemTemplateInfo(t){const{layoutItem:r}=this;if(r?.id&&!this.layoutTemplateInfo&&"loaded"!==this.state)try{this._set("state","loading");const s=this.layoutInfoTaskUrl;if(!s)throw new e("print:invalid-layout-info-task-url","Can't fetch layout template info",{url:s});"public"!==r.access&&o&&await o.getCredential(s);const a={Layout_Item_ID:JSON.stringify({id:r.id})},i=(await d(s,a,t))[0];this.setLayoutTemplateInfo(i)}catch(s){this._set("state",a(s)?"not-loaded":"error")}}setLayoutTemplateInfo(t){this._set("layoutTemplateInfo",t),this._updateLayoutOptions(t),this._set("state","loaded")}};t([i({json:{write:!0}})],c.prototype,"description",void 0),t([n(u)],c.prototype,"format",void 0),t([i({readOnly:!0})],c.prototype,"id",null),t([i({readOnly:!0})],c.prototype,"state",void 0),t([i({json:{write:!0}})],c.prototype,"label",void 0),t([i()],c.prototype,"layoutInfoTaskUrl",void 0),t([i({json:{read:m,write:!0}})],c.prototype,"layout",void 0),t([i({type:p,json:{write:!0}})],c.prototype,"layoutItem",void 0),t([i({readOnly:!0,json:{write:!0}})],c.prototype,"layoutOptions",void 0),t([i({readOnly:!0})],c.prototype,"layoutTemplateInfo",void 0),t([i({readOnly:!0})],c.prototype,"mapSurroundInfoOptions",null),t([i({readOnly:!0})],c.prototype,"pageUnits",null),t([i()],c.prototype,"type",void 0),c=t([l("esri.widgets.Print.CustomTemplate")],c);const h=c;export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{isSome as e}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import{clone as a}from"../../core/lang.js";import r from"../../core/Loadable.js";import l from"../../core/ReactiveMap.js";import{watch as n,initial as p}from"../../core/reactiveUtils.js";import{createScreenPoint as m}from"../../core/screenUtils.js";import{unitType as u,convertUnit as h,getMetersPerUnitForSR as d,inchesPerMeter as c}from"../../core/unitUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import T from"../../geometry/Extent.js";import v from"../../geometry/SpatialReference.js";import{formatDate as w,convertDateFormatToIntlOptions as _}from"../../intl/date.js";import{getLocaleParts as I}from"../../intl/locale.js";import g from"../../portal/Portal.js";import O from"../../portal/PortalQueryParams.js";import{reArcGISOnlineDomain as b}from"../../portal/support/urlUtils.js";import{execute as x,getTaskInfo as P,PrintServiceTask as S}from"../../rest/print.js";import{formatJsonMap as E}from"../../rest/support/fileFormat.js";import{fromJSON as U}from"../../rest/support/layoutTemplate.js";import L from"../../rest/support/PrintParameters.js";import C from"../../rest/support/PrintTemplate.js";import{getExtent as k}from"../../views/2d/viewpointUtils.js";import{ViewEventPriorities as j}from"../../views/input/InputManager.js";import H from"../../views/overlay/BoxOverlayItem.js";import F from"./CustomTemplate.js";import D from"./TemplateOptions.js";import{fetchLayoutTemplateInfos as A}from"./utils.js";const W=[30,144,255,255],R=[237,211,23,255],M=[216,48,32,255],z=new Set(["GISProfessionalStdUT","GISProfessionalAdvUT"]),V=/(\/GPServer\/).+/i,G=new o({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"}),B=s.ofType(F);function q(t){t.layoutOptions??={},t.layoutOptions.customTextElements??=[];const e="date";if(!t.layoutOptions.customTextElements.find((t=>e in t))){const{customTextElements:e}=t.layoutOptions;let s=w(Date.now(),_("short-date"));"ar"===I()?.language&&(s=""+s),e.push({date:s})}}function N(t,e,s){if(!e)return;!(e.visible===s)&&t.layoutOptions&&(t.layoutOptions.elementOverrides?t.layoutOptions.elementOverrides[e.name]={visible:s}:t.layoutOptions.elementOverrides={[e.name]:{visible:s}})}let J=class extends r{constructor(t){super(t),this._serviceTemplateCustomTextElements=null,this._templateIdToCustomTemplate=new l,this._isFreeHand=!1,this._freeHandWidth=0,this._freehandHeight=0,this._asyncPrintTaskUrl=null,this._layoutInfoTaskUrl=null,this._customLayoutOptions=null,this.allowedFormats="all",this.allowedLayouts="all",this.browseTemplates=new B,this.defaultTemplates=new B,this.error=null,this.extraParameters=null,this.includeDefaultTemplates=!0,this.outSpatialReference=null,this.portal=g.getDefault(),this.portalTemplateIds=[],this.printServiceTemplates=new B,this.defaultTemplate=null,this.showPrintAreaEnabled=!1,this.printServiceUrl=null,this.printTimeout=12e4,this.templatesInfo=null,this.updateDelay=1e3,this.view=null,this.templateCustomTextElements=null,this.templateOptions=new D}initialize(){this.addHandles([n((()=>[this.showPrintAreaEnabled,this.view]),(()=>{this.showPrintAreaEnabled?this._enablePrintPreview():(this.removeHandles("overlay-handler"),this.view?.overlay?.removeItem(this._getOverlayItem()))})),n((()=>[this.templateOptions.layout,this.templateOptions.layoutItem]),(()=>{this.loaded&&this._processTemplateOptions()}))])}destroy(){this.removeHandles("overlay-handler"),this.view&&(this._overlayItem&&(this.view.overlay?.removeItem(this._overlayItem),this._overlayItem.destroy(),this._overlayItem=null),this.view=null)}get effectivePrintServiceUrl(){return this.printServiceUrl??null}get effectiveTemplateCustomTextElements(){if(!this._serviceTemplateCustomTextElements)return{};const t=a(this._serviceTemplateCustomTextElements);return this.templateCustomTextElements&&Object.keys(this.templateCustomTextElements).forEach((e=>{const s=t[e];if(s){const t=this.templateCustomTextElements?.[e];s.forEach((e=>{const[s]=Object.entries(e)[0];t?.forEach((t=>{const[i,o]=Object.entries(t)[0];s===i&&(e[s]=o)}))}))}})),Object.freeze(t)}get state(){return"loading"===this.loadStatus?"initializing":"failed"===this.loadStatus||this.error?"error":"loaded"===this.loadStatus&&this.view?.ready?"ready":"disabled"}async load(t){return this.addResolvingPromise(this._loadResources(t).catch((t=>this.error=t))),this}async print(t){const{view:e,extraParameters:s,updateDelay:o,outSpatialReference:a}=this;if(!e)throw new i("print:view-required","view is not set");q(t);const r=this._getOverlayItem(),l=t.scalePreserved||!this.showPrintAreaEnabled?void 0:k(new T,e.viewpoint,"map-only"===t.layout?[t.exportOptions.width,t.exportOptions.height]:[r.boxWidth,r.boxHeight]),n=new L({view:e,template:t,extent:l,extraParameters:s,updateDelay:o,outSpatialReference:a});try{const e=!!t.layoutItem?.id&&(this.portalTemplateIds.includes(t.layoutItem.id)||this.browseTemplates.some((e=>e.layoutItem?.id===t.layoutItem?.id)));return await x(e&&this._asyncPrintTaskUrl?this._asyncPrintTaskUrl:this.effectivePrintServiceUrl,n,{timeout:this.printTimeout})}catch(p){throw new i("print:export-error","An error occurred while exporting the web map.",{error:p})}}toPrintTemplate({attributionEnabled:t,author:e,copyright:s,customTextElements:o,dpi:a,forceFeatureAttributes:r,format:l,height:n,id:p,includeTables:m,layout:u,layoutItem:h,legendEnabled:d,northArrowEnabled:c,scale:y,scaleBarEnabled:f,scaleEnabled:T,title:v,width:w}){if(!u&&!h)throw new i("print:layout-required","layout is not set");const _=new C({attributionVisible:t,forceFeatureAttributes:r,format:l,includeTables:m,layout:u,layoutItem:h,layoutOptions:{authorText:e||"",copyrightText:s||"",customTextElements:o,titleText:v||""},outScale:y??0,scalePreserved:T});if(w&&(_.exportOptions.width=w),n&&(_.exportOptions.height=n),a&&(_.exportOptions.dpi=a),_.layoutOptions){d||(_.layoutOptions.legendLayers=[]);const t=this.getLayoutTemplateById(p)?.mapSurroundInfoOptions;if(t){const e=t.northArrow;for(const t of e)N(_,t,c);const s=t.scaleBar;for(const t of s)N(_,t,f);const i=t.legend;for(const t of i)N(_,t,d)}}return _}getLayoutTemplateById(t){return t?this._templateIdToCustomTemplate.get(t):null}async addPortalTemplate(t){if(!this.portal||!t?.id)return;try{t.loaded||await t.load()}catch{return void this.applyTemplate(this.defaultTemplate)}const e=new F({type:"browse-template",layoutInfoTaskUrl:this._layoutInfoTaskUrl,label:t.title,layoutItem:t});this._templateIdToCustomTemplate.set(e.id,e),this.browseTemplates.add(e)}removePortalTemplate(t){t.layoutItem&&this.templateOptions.id===t.layoutItem.id&&(this.defaultTemplate?this.applyTemplate(this.defaultTemplate):this.templateOptions.reset()),this.browseTemplates.remove(t),this._templateIdToCustomTemplate.delete(t.id)}async applyTemplate(t){if(!t)return void this.templateOptions.reset();!t.layout||!this.templatesInfo||this.templatesInfo.layout.choiceList.includes(t.layout)||(this.defaultTemplate?t=this.defaultTemplate:this.templateOptions.reset());const e=t.layout||t.layoutItem?.id,s=e?this.templateCustomTextElements?.[e]:void 0;if(await this.templateOptions.applyTemplate(t,{customTextElements:s,customLayoutOptions:this._customLayoutOptions}),e&&this._serviceTemplateCustomTextElements&&!this._serviceTemplateCustomTextElements[e]&&t.layoutTemplateInfo?.layoutOptions?.customTextElements){const s=a(this._serviceTemplateCustomTextElements);s[e]=t.layoutTemplateInfo.layoutOptions.customTextElements,this._serviceTemplateCustomTextElements=Object.freeze(s)}}async _loadResources(t){if(this.destroyed)return;await this._loadUrls(t);const[e,s]=await Promise.all([this._getLayoutToLayoutTemplateInfos(t),this._getPrintServiceTemplatesInfo(t)]);await this._loadAllTemplates(e,s,t),this._processPrintServiceTemplatesInfo(s),await this._processTemplateOptions(),this._updateOverLayItem()}async _processTemplateOptions(){const{layout:t,layoutItem:e}=this.templateOptions;if("map-only"!==t&&!this.templateOptions.id)if(this._customLayoutOptions={legend:this.templateOptions.legendEnabled,northArrow:this.templateOptions.northArrowEnabled,scaleBar:this.templateOptions.scaleBarEnabled},e?.id){try{e.loaded||await e.load()}catch{return void this.applyTemplate(this.defaultTemplate)}let t=this._templateIdToCustomTemplate.get(e.id);t||(t=new F({label:e.title,layoutItem:e,layoutInfoTaskUrl:this._layoutInfoTaskUrl}),this._templateIdToCustomTemplate.set(t.id,t)),await this.applyTemplate(t)}else if(t){const t=this.defaultTemplates.find((t=>t.layout===this.templateOptions.layout))??this.printServiceTemplates.find((t=>t.layout===this.templateOptions.layout));await this.applyTemplate(t??this.defaultTemplate)}}async _loadPortal(t){try{await this.portal.load(t)}catch(e){throw new i("print:could-not-load-portal","Cannot load print resource information from portal",{error:e,url:this.effectivePrintServiceUrl})}}async _loadUrls(t){if(this.printServiceUrl)this._set("effectivePrintServiceUrl",this.printServiceUrl),await this._updateLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t);else{await this._loadPortal(t);const{printTask:e,asyncPrintTask:s,layoutInfoTask:i}=this.portal?.helperServices??{};this._set("effectivePrintServiceUrl",e?.url),this._asyncPrintTaskUrl=s?.url,await this._updateLayoutInfoTaskUrl(i?.url||this.effectivePrintServiceUrl,t)}const e=this.effectivePrintServiceUrl?.toLowerCase().split("/");if(!e?.includes("gpserver"))throw new i("print:invalid-print-service-url","Can't fetch print templates information from provided URL",{url:this.effectivePrintServiceUrl})}async _updateLayoutInfoTaskUrl(t,e){if(!t)return;const s=await P(t,S.GetLayoutTemplatesInfo,e);s&&(this._layoutInfoTaskUrl=t.replace(V,`$1${encodeURI(s.displayName)}`))}_getPortalDefaultTemplates(t,e){return this.portal?.helperServices?.printTask?.templates?.filter((t=>"map_only"!==t.layout.toLowerCase()&&(!e||e.includes(U(t.layout)))))?.map((e=>{const s=F.fromJSON(e);if(s.type="default-template",s.layoutInfoTaskUrl=this._layoutInfoTaskUrl,s.layout){const e=t.get(s.layout);e&&s.setLayoutTemplateInfo(e)}return s}))??[]}async _getPortalCustomTemplates(t){if(this.printServiceUrl||!this.portal)return[];const{layoutGroupQuery:e,user:s}=this.portal,i=b.test(this.portal.url),o=s?.userLicenseTypeId,a=o&&z.has(o);if(!e||i&&!a)return[];const r=new O({query:e,disableExtraQuery:!0}),l=await this.portal.queryGroups(r,t);if(!l.total)return[];const n=l.results[0],p=new O({num:100,query:"type:Layout",sortField:n.sortField,sortOrder:n.sortOrder??void 0}),m=(await n.queryItems(p,t)).results;if(!m.length)return[];return m.map((t=>(this.portalTemplateIds.push(t.id),new F({type:"default-template",label:t.title,layoutItem:t,layoutInfoTaskUrl:this._layoutInfoTaskUrl}))))}async _loadAllTemplates(t,e,s){let i=!1;const o=e?.layout?.choiceList;if(this.includeDefaultTemplates&&this.portal&&!this.printServiceUrl){const e=this._getPortalDefaultTemplates(t,o);i=!!e.length,this.defaultTemplates.addMany(e);const a=await this._getPortalCustomTemplates(s);this.defaultTemplates.addMany(a);for(const t of this.defaultTemplates)this._templateIdToCustomTemplate.set(t.id,t)}i||t.forEach(((t,e)=>{if(!o||o.includes(e)){const s=new F({type:"print-service-template",layout:e,layoutInfoTaskUrl:this._layoutInfoTaskUrl});s.setLayoutTemplateInfo(t),this.printServiceTemplates.add(s),this._templateIdToCustomTemplate.set(s.id,s)}}))}_processPrintServiceTemplatesInfo(t){this._set("templatesInfo",t);const e=t?.layout?.defaultValue;if(e&&"map-only"!==e){const t=this.defaultTemplates.find((t=>t.layout===e))??this.printServiceTemplates.find((t=>t.layout===e))??this.defaultTemplates.at(0)??this.printServiceTemplates.at(0);this._set("defaultTemplate",t)}}async _getLayoutToLayoutTemplateInfos(t){const e=await A(this._layoutInfoTaskUrl,void 0,t),s=new Map,i={};for(const o of e){const t=U(o.layoutTemplate);s.set(t,o),i[t]=o.layoutOptions.customTextElements}return this._serviceTemplateCustomTextElements=Object.freeze(i),s}async _getPrintServiceTemplatesInfo(t){const e=await P(this.effectivePrintServiceUrl,S.ExportWebMap,t);if(!e)throw new i("print:unavailable-service-info","Can't fetch templates info from service");const{parameters:s}=e,o=s.find((({name:t})=>"Format"===t)),a=s.find((({name:t})=>"Layout_Template"===t));return{format:this._getFormat(o),layout:this._getLayout(a)}}_getFormat(t){const s="all"===this.allowedFormats?t.choiceList:t.choiceList.filter((t=>"string"!=typeof this.allowedFormats&&this.allowedFormats.some((e=>new RegExp(`\\b${e}\\b`,"i").test(t))))),i=(s.length?s:t.choiceList).map((t=>E.fromJSON(t))).filter(e),o=E.fromJSON(t.defaultValue),a=i.some((t=>new RegExp(`\\b${o}\\b`,"i").test(t)))?o:i[0];return{choiceList:i,defaultValue:a}}_getLayout(t){const s=t.choiceList.filter((t=>"map_only"!==t.toLowerCase())),i="all"===this.allowedLayouts?s:s.filter((t=>this.allowedLayouts.includes(U(t)))),o=(i.length?i:s).map(U).filter(e),a=U(t.defaultValue),r=o.includes(a)?a:o.find((t=>/(?=.*letter)(?=.*landscape)/i.test(t)))??o.find((t=>/(?=.*a4)(?=.*landscape)/i.test(t)))??o[0];return{choiceList:o,defaultValue:r}}_getOverlayItem(){return this._overlayItem||(this._overlayItem=new H({strokeDash:[5],strokeWidth:2,strokeColor:[30,144,255,255]})),this._overlayItem}_enablePrintPreview(){if(!this.view?.overlay)return;const t=this.templateOptions,e=this._getOverlayItem();this.addHandles([n((()=>[t.width,t.height,t.scaleEnabled,t.scale,t.layout,t.layoutItem,t.id,t.state,this.view?.scale,this.view?.size,this.view?.state.paddedViewState.size,this.view?.state.padding,this.loaded]),(()=>this._updateOverLayItem()),p),this.view?.on("drag",["Shift"],(t=>this._handleDrag(t)),j.WIDGET),this.view?.on("key-down",["Escape"],(()=>this._resetDrag()),j.WIDGET)],"overlay-handler"),this.view.overlay.addItem(e)}_updateOverLayItem(){if(!this.view)return;const t=this.templateOptions,e=this._getOverlayItem(),s=t.layoutItem?.id??t.layout,i=this.view,o=i.spatialReference,[a,r]=i.state.paddedViewState.size,l=i.state.padding;let n=0,p=0;if("map-only"===s)null!=t.width&&null!=t.height&&(n=t.width,p=t.height);else if(s){const e=t.id?this._templateIdToCustomTemplate.get(t.id):null,{webMapFrameSize:s,pageUnits:i}=e?.layoutTemplateInfo??{};let l=!1;if(s&&i)if(this._isFreeHand){const t=s[0]/s[1];n=this._freeHandWidth,p=this._freehandHeight,n>p?p=n/t:n=p*t}else{const t=G.fromJSON(i.toLowerCase()),e=o.unit;u(t)===u(e)?(n=h(s[0],t,e),p=h(s[1],t,e)):(l=!0,n=s[0],p=s[1])}if(!this._isFreeHand)if(t.scaleEnabled&&t.scale){const e=l?Math.min(a/n,r/p):d(o)*c*t.dpi;n*=e,p*=e}else if(0===n||0===p)n=a,p=r;else{const t=(a-.1*a)/n,e=(r-.1*r)/p,s=Math.min(t,e);n*=s,p*=s}}const{scaleEnabled:m,scale:y}=t,f=m&&y?y/this.view.scale:1;if(e.boxWidth=n*f||a,e.boxHeight=p*f||r,l&&(e.padding=l),e.backgroundWidth=a??0,e.backgroundHeight=r??0,"loading"===this.loadStatus)e.strokeColor=R;else if("loaded"===this.loadStatus)switch(this.templateOptions.state){case"pending":e.strokeColor=R;break;case"ready":e.strokeColor=W;break;case"error":e.strokeColor=M}}_resetDrag(){this._isFreeHand=!1,this._updateOverLayItem()}_handleDrag(t){switch(t.action){case"start":this._start();break;case"update":this._update(t);break;case"end":this._end()}t.stopPropagation()}_start(){this._isFreeHand=!0}_update(t){const e=this._getOverlayItem(),{x:s,y:i}=t,{x:o,y:a}=t.origin;s>o?(e.x=o,e.boxWidth=s-o):(e.x=s,e.boxWidth=o-s),i>a?(e.y=a,e.boxHeight=i-a):(e.y=i,e.boxHeight=a-i)}_end(){const t=this._getOverlayItem();if(!this.view||null==t.x||null==t.y)return;const e=this.view,s=e.toMap(m(t.x+.5*t.boxWidth,t.y+.5*t.boxHeight));t.x=null,t.y=null,e.goTo({center:s}),this._freeHandWidth=t.boxWidth,this._freehandHeight=t.boxHeight,"map-only"===this.templateOptions.layout&&(this.templateOptions.width=this._freeHandWidth,this.templateOptions.height=this._freehandHeight),this.templateOptions.scale=this.view.scale,this._updateOverLayItem()}};t([y()],J.prototype,"_serviceTemplateCustomTextElements",void 0),t([y()],J.prototype,"_templateIdToCustomTemplate",void 0),t([y()],J.prototype,"allowedFormats",void 0),t([y()],J.prototype,"allowedLayouts",void 0),t([y({type:B})],J.prototype,"browseTemplates",void 0),t([y({type:B})],J.prototype,"defaultTemplates",void 0),t([y()],J.prototype,"error",void 0),t([y()],J.prototype,"extraParameters",void 0),t([y()],J.prototype,"includeDefaultTemplates",void 0),t([y({readOnly:!0})],J.prototype,"effectivePrintServiceUrl",null),t([y()],J.prototype,"effectiveTemplateCustomTextElements",null),t([y({type:v})],J.prototype,"outSpatialReference",void 0),t([y({type:g})],J.prototype,"portal",void 0),t([y()],J.prototype,"portalTemplateIds",void 0),t([y({type:B})],J.prototype,"printServiceTemplates",void 0),t([y({readOnly:!0})],J.prototype,"defaultTemplate",void 0),t([y()],J.prototype,"showPrintAreaEnabled",void 0),t([y()],J.prototype,"printServiceUrl",void 0),t([y()],J.prototype,"printTimeout",void 0),t([y({readOnly:!0})],J.prototype,"state",null),t([y({readOnly:!0})],J.prototype,"templatesInfo",void 0),t([y()],J.prototype,"updateDelay",void 0),t([y()],J.prototype,"view",void 0),t([y()],J.prototype,"templateCustomTextElements",void 0),t([y({type:D})],J.prototype,"templateOptions",void 0),J=t([f("esri.widgets.Print.PrintViewModel")],J);const $=J;export{$ as default};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{isSome as e}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import{clone as o}from"../../core/lang.js";import a from"../../core/Loadable.js";import r from"../../core/ReactiveMap.js";import{watch as l,initial as n}from"../../core/reactiveUtils.js";import{createScreenPoint as p}from"../../core/screenUtils.js";import{unitType as m,convertUnit as h,getMetersPerUnitForSR as u,inchesPerMeter as d}from"../../core/unitUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import f from"../../geometry/Extent.js";import T from"../../geometry/SpatialReference.js";import{formatDate as v,convertDateFormatToIntlOptions as w}from"../../intl/date.js";import{getLocaleParts as _}from"../../intl/locale.js";import I from"../../portal/Portal.js";import g from"../../portal/PortalQueryParams.js";import{reArcGISOnlineDomain as O}from"../../portal/support/urlUtils.js";import{execute as x,getTaskInfo as b,PrintServiceTask as E}from"../../rest/print.js";import{formatJsonMap as P}from"../../rest/support/fileFormat.js";import{fromJSON as S}from"../../rest/support/layoutTemplate.js";import L from"../../rest/support/PrintParameters.js";import U from"../../rest/support/PrintTemplate.js";import{getExtent as k}from"../../views/2d/viewpointUtils.js";import{ViewEventPriorities as C}from"../../views/input/InputManager.js";import j from"../../views/overlay/BoxOverlayItem.js";import F from"./CustomTemplate.js";import H from"./FileLink.js";import M from"./TemplateOptions.js";import{fetchLayoutTemplateInfos as D,valueUnitKebabDict as A}from"./utils.js";const W=[30,144,255,255],R=[237,211,23,255],N=[216,48,32,255],z=new Set(["GISProfessionalStdUT","GISProfessionalAdvUT"]),V=/(\/GPServer\/).+/i,G=s.ofType(F),B=s.ofType(H);function q(t){t.layoutOptions??={},t.layoutOptions.customTextElements??=[];const e="date";if(!t.layoutOptions.customTextElements.find((t=>e in t))){const{customTextElements:e}=t.layoutOptions;let s=v(Date.now(),w("short-date"));"ar"===_()?.language&&(s=""+s),e.push({date:s})}}function $(t,e,s){if(!e)return;!(e.visible===s)&&t.layoutOptions&&(t.layoutOptions.elementOverrides?t.layoutOptions.elementOverrides[e.name]={visible:s}:t.layoutOptions.elementOverrides={[e.name]:{visible:s}})}let J=class extends a{constructor(t){super(t),this._serviceTemplateCustomTextElements=null,this._templateIdToCustomTemplate=new r,this._isFreeHand=!1,this._freeHandWidth=0,this._freehandHeight=0,this._asyncPrintTaskUrl=null,this._layoutInfoTaskUrl=null,this._customLayoutOptions=null,this._exportedFileNameMap={},this.allowedFormats="all",this.allowedLayouts="all",this.browseTemplates=new G,this.defaultTemplates=new G,this.error=null,this.exportedLinks=new B,this.extraParameters=null,this.includeDefaultTemplates=!0,this.outSpatialReference=null,this.portal=I.getDefault(),this.portalTemplateIds=[],this.printServiceTemplates=new G,this.defaultTemplate=null,this.showPrintAreaEnabled=!1,this.printServiceUrl=null,this.printTimeout=12e4,this.templatesInfo=null,this.updateDelay=1e3,this.view=null,this.templateCustomTextElements=null,this.templateOptions=new M}initialize(){this.addHandles([l((()=>[this.showPrintAreaEnabled,this.view]),(()=>{this.showPrintAreaEnabled?this._enablePrintPreview():(this.removeHandles("overlay-handler"),this.view?.overlay?.removeItem(this._getOverlayItem()))})),l((()=>[this.templateOptions.layout,this.templateOptions.layoutItem]),(()=>{this.loaded&&this._processTemplateOptions()}))])}destroy(){this.removeHandles("overlay-handler"),this.view&&(this._overlayItem&&(this.view.overlay?.removeItem(this._overlayItem),this._overlayItem.destroy(),this._overlayItem=null),this.view=null)}get effectivePrintServiceUrl(){return this.printServiceUrl??null}get effectiveTemplateCustomTextElements(){if(!this._serviceTemplateCustomTextElements)return{};const t=o(this._serviceTemplateCustomTextElements);return this.templateCustomTextElements&&Object.keys(this.templateCustomTextElements).forEach((e=>{const s=t[e];if(s){const t=this.templateCustomTextElements?.[e];s.forEach((e=>{const[s]=Object.entries(e)[0];t?.forEach((t=>{const[i,o]=Object.entries(t)[0];s===i&&(e[s]=o)}))}))}})),Object.freeze(t)}get state(){return"loading"===this.loadStatus?"initializing":"failed"===this.loadStatus||this.error?"error":"loaded"===this.loadStatus&&this.view?.ready?"ready":"disabled"}async load(t){return this.addResolvingPromise(this._loadResources(t).catch((t=>this.error=t))),this}async print(t){const{view:e,extraParameters:s,updateDelay:o,outSpatialReference:a}=this;if(!e)throw new i("print:view-required","view is not set");q(t);const r=this._getOverlayItem(),l=t.scalePreserved||!this.showPrintAreaEnabled?void 0:k(new f,e.viewpoint,"map-only"===t.layout?[t.exportOptions.width,t.exportOptions.height]:[r.boxWidth,r.boxHeight]),n=new L({view:e,template:t,extent:l,extraParameters:s,updateDelay:o,outSpatialReference:a});try{const e=!!t.layoutItem?.id&&(this.portalTemplateIds.includes(t.layoutItem.id)||this.browseTemplates.some((e=>e.layoutItem?.id===t.layoutItem?.id)));return await x(e&&this._asyncPrintTaskUrl?this._asyncPrintTaskUrl:this.effectivePrintServiceUrl,n,{timeout:this.printTimeout})}catch(p){throw new i("print:export-error","An error occurred while exporting the web map.",{error:p})}}toPrintTemplate({attributionEnabled:t,author:e,copyright:s,customTextElements:o,dpi:a,forceFeatureAttributes:r,format:l,height:n,id:p,includeTables:m,layout:h,layoutItem:u,legendEnabled:d,northArrowEnabled:c,scale:y,scaleBarEnabled:f,scaleEnabled:T,title:v,width:w}){if(!h&&!u)throw new i("print:layout-required","layout is not set");const _=new U({attributionVisible:t,forceFeatureAttributes:r,format:l,includeTables:m,layout:h,layoutItem:u,layoutOptions:{authorText:e||"",copyrightText:s||"",customTextElements:o,titleText:v||""},outScale:y??0,scalePreserved:T});if(w&&(_.exportOptions.width=w),n&&(_.exportOptions.height=n),a&&(_.exportOptions.dpi=a),_.layoutOptions){d||(_.layoutOptions.legendLayers=[]);const t=this.getLayoutTemplateById(p)?.mapSurroundInfoOptions;if(t){const e=t.northArrow;for(const t of e)$(_,t,c);const s=t.scaleBar;for(const t of s)$(_,t,f);const i=t.legend;for(const t of i)$(_,t,d)}}return _}getLayoutTemplateById(t){return t?this._templateIdToCustomTemplate.get(t):null}async addPortalTemplate(t){if(!this.portal||!t?.id)return;try{t.loaded||await t.load()}catch{return void this.applyTemplate(this.defaultTemplate)}const e=new F({type:"browse-template",layoutInfoTaskUrl:this._layoutInfoTaskUrl,label:t.title,layoutItem:t});this._templateIdToCustomTemplate.set(e.id,e),this.browseTemplates.add(e)}removePortalTemplate(t){t.layoutItem&&this.templateOptions.id===t.layoutItem.id&&(this.defaultTemplate?this.applyTemplate(this.defaultTemplate):this.templateOptions.reset()),this.browseTemplates.remove(t),this._templateIdToCustomTemplate.delete(t.id)}async applyTemplate(t){if(this.templateOptions.reset(),!t)return;if("map-only"===t)return void(this.templateOptions.layout="map-only");!t.layout||!this.templatesInfo||this.templatesInfo.layout.choiceList.includes(t.layout)||(this.defaultTemplate?t=this.defaultTemplate:this.templateOptions.reset());const e=t.layout||t.layoutItem?.id,s=e?this.templateCustomTextElements?.[e]:void 0;if(await this.templateOptions.applyTemplate(t,{customTextElements:s,customLayoutOptions:this._customLayoutOptions}),e&&this._serviceTemplateCustomTextElements&&!this._serviceTemplateCustomTextElements[e]&&t.layoutTemplateInfo?.layoutOptions?.customTextElements){const s=o(this._serviceTemplateCustomTextElements);s[e]=t.layoutTemplateInfo.layoutOptions.customTextElements,this._serviceTemplateCustomTextElements=Object.freeze(s)}}createExportedFileLink(t){const e=this.toPrintTemplate(this.templateOptions).format.toLowerCase(),s=e.includes("png")?"png":e,i=t+s;return this._updateExportedFileNameMap(i),new H({name:t,extension:s,count:this._exportedFileNameMap[i]})}export(t){const e=this.createExportedFileLink(t);this.exportedLinks.add(e);const s=this.print(this.toPrintTemplate(this.templateOptions)).then((t=>e.set({url:t?.url,state:"ready"}))).catch((t=>e.set({error:t,state:"error"})));return{link:e,promise:s}}async _loadResources(t){if(this.destroyed)return;await this._loadUrls(t);const[e,s]=await Promise.all([this._getLayoutToLayoutTemplateInfos(t),this._getPrintServiceTemplatesInfo(t)]);await this._loadAllTemplates(e,s,t),this._processPrintServiceTemplatesInfo(s),await this._processTemplateOptions(),this._updateOverLayItem();for(const{name:i,extension:o}of this.exportedLinks)i&&o&&this._updateExportedFileNameMap(`${i}${o}`)}_updateExportedFileNameMap(t){void 0!==this._exportedFileNameMap[t]?this._exportedFileNameMap[t]++:this._exportedFileNameMap[t]=0}async _processTemplateOptions(){const{layout:t,layoutItem:e}=this.templateOptions;if("map-only"!==t&&!this.templateOptions.id)if(this._customLayoutOptions={legend:this.templateOptions.legendEnabled,northArrow:this.templateOptions.northArrowEnabled,scaleBar:this.templateOptions.scaleBarEnabled},e?.id){try{e.loaded||await e.load()}catch{return void this.applyTemplate(this.defaultTemplate)}let t=this._templateIdToCustomTemplate.get(e.id);t||(t=new F({label:e.title,layoutItem:e,layoutInfoTaskUrl:this._layoutInfoTaskUrl}),this._templateIdToCustomTemplate.set(t.id,t)),await this.applyTemplate(t)}else if(t){const t=this.defaultTemplates.find((t=>t.layout===this.templateOptions.layout))??this.printServiceTemplates.find((t=>t.layout===this.templateOptions.layout));await this.applyTemplate(t??this.defaultTemplate)}}async _loadPortal(t){try{await this.portal.load(t)}catch(e){throw new i("print:could-not-load-portal","Cannot load print resource information from portal",{error:e,url:this.effectivePrintServiceUrl})}}async _loadUrls(t){if(this.printServiceUrl)this._set("effectivePrintServiceUrl",this.printServiceUrl),await this._updateLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t);else{await this._loadPortal(t);const{printTask:e,asyncPrintTask:s,layoutInfoTask:i}=this.portal?.helperServices??{};this._set("effectivePrintServiceUrl",e?.url),this._asyncPrintTaskUrl=s?.url,await this._updateLayoutInfoTaskUrl(i?.url||this.effectivePrintServiceUrl,t)}const e=this.effectivePrintServiceUrl?.toLowerCase().split("/");if(!e?.includes("gpserver"))throw new i("print:invalid-print-service-url","Can't fetch print templates information from provided URL",{url:this.effectivePrintServiceUrl})}async _updateLayoutInfoTaskUrl(t,e){if(!t)return;const s=await b(t,E.GetLayoutTemplatesInfo,e);s&&(this._layoutInfoTaskUrl=t.replace(V,`$1${encodeURI(s.displayName)}`))}_getPortalDefaultTemplates(t,e){return this.portal?.helperServices?.printTask?.templates?.filter((t=>"map_only"!==t.layout.toLowerCase()&&(!e||e.includes(S(t.layout)))))?.map((e=>{const s=F.fromJSON(e);if(s.type="default-template",s.layoutInfoTaskUrl=this._layoutInfoTaskUrl,s.layout){const e=t.get(s.layout);e&&s.setLayoutTemplateInfo(e)}return s}))??[]}async _getPortalCustomTemplates(t){if(this.printServiceUrl||!this.portal)return[];const{layoutGroupQuery:e,user:s}=this.portal,i=O.test(this.portal.url),o=s?.userLicenseTypeId,a=o&&z.has(o);if(!e||i&&!a)return[];const r=new g({query:e,disableExtraQuery:!0}),l=await this.portal.queryGroups(r,t);if(!l.total)return[];const n=l.results[0],p=new g({num:100,query:"type:Layout",sortField:n.sortField,sortOrder:n.sortOrder??void 0}),m=(await n.queryItems(p,t)).results;if(!m.length)return[];return m.map((t=>(this.portalTemplateIds.push(t.id),new F({type:"default-template",label:t.title,layoutItem:t,layoutInfoTaskUrl:this._layoutInfoTaskUrl}))))}async _loadAllTemplates(t,e,s){let i=!1;const o=e?.layout?.choiceList;if(this.includeDefaultTemplates&&this.portal&&!this.printServiceUrl){const e=this._getPortalDefaultTemplates(t,o);i=!!e.length,this.defaultTemplates.addMany(e);const a=await this._getPortalCustomTemplates(s);this.defaultTemplates.addMany(a);for(const t of this.defaultTemplates)this._templateIdToCustomTemplate.set(t.id,t)}i||t.forEach(((t,e)=>{if(!o||o.includes(e)){const s=new F({type:"print-service-template",layout:e,layoutInfoTaskUrl:this._layoutInfoTaskUrl});s.setLayoutTemplateInfo(t),this.printServiceTemplates.add(s),this._templateIdToCustomTemplate.set(s.id,s)}}))}_processPrintServiceTemplatesInfo(t){this._set("templatesInfo",t);const e=t?.layout?.defaultValue;if(e&&"map-only"!==e){const t=this.defaultTemplates.find((t=>t.layout===e))??this.printServiceTemplates.find((t=>t.layout===e))??this.defaultTemplates.at(0)??this.printServiceTemplates.at(0);this._set("defaultTemplate",t)}}async _getLayoutToLayoutTemplateInfos(t){const e=await D(this._layoutInfoTaskUrl,void 0,t),s=new Map,i={};for(const o of e){const t=S(o.layoutTemplate);s.set(t,o),i[t]=o.layoutOptions.customTextElements}return this._serviceTemplateCustomTextElements=Object.freeze(i),s}async _getPrintServiceTemplatesInfo(t){const e=await b(this.effectivePrintServiceUrl,E.ExportWebMap,t);if(!e)throw new i("print:unavailable-service-info","Can't fetch templates info from service");const{parameters:s}=e,o=s.find((({name:t})=>"Format"===t)),a=s.find((({name:t})=>"Layout_Template"===t));return{format:this._getFormat(o),layout:this._getLayout(a)}}_getFormat(t){const s="all"===this.allowedFormats?t.choiceList:t.choiceList.filter((t=>"string"!=typeof this.allowedFormats&&this.allowedFormats.some((e=>new RegExp(`\\b${e}\\b`,"i").test(t))))),i=(s.length?s:t.choiceList).map((t=>P.fromJSON(t))).filter(e),o=P.fromJSON(t.defaultValue),a=i.some((t=>new RegExp(`\\b${o}\\b`,"i").test(t)))?o:i[0];return{choiceList:i,defaultValue:a}}_getLayout(t){const s=t.choiceList.filter((t=>"map_only"!==t.toLowerCase())),i="all"===this.allowedLayouts?s:s.filter((t=>this.allowedLayouts.includes(S(t)))),o=(i.length?i:s).map(S).filter(e),a=S(t.defaultValue),r=o.includes(a)?a:o.find((t=>/(?=.*letter)(?=.*landscape)/i.test(t)))??o.find((t=>/(?=.*a4)(?=.*landscape)/i.test(t)))??o[0];return{choiceList:o,defaultValue:r}}_getOverlayItem(){return this._overlayItem||(this._overlayItem=new j({strokeDash:[5],strokeWidth:2,strokeColor:[30,144,255,255]})),this._overlayItem}_enablePrintPreview(){if(!this.view?.overlay)return;const t=this.templateOptions,e=this._getOverlayItem();this.addHandles([l((()=>[t.width,t.height,t.scaleEnabled,t.scale,t.layout,t.layoutItem,t.id,t.state,this.view?.scale,this.view?.size,this.view?.state.paddedViewState.size,this.view?.state.padding,this.loaded]),(()=>this._updateOverLayItem()),n),this.view?.on("drag",["Shift"],(t=>this._handleDrag(t)),C.WIDGET),this.view?.on("key-down",["Escape"],(()=>this._resetDrag()),C.WIDGET)],"overlay-handler"),this.view.overlay.addItem(e)}_updateOverLayItem(){if(!this.view)return;const t=this.templateOptions,e=this._getOverlayItem(),s=t.layoutItem?.id??t.layout,i=this.view,o=i.spatialReference,[a,r]=i.state.paddedViewState.size,l=i.state.padding;let n=0,p=0;if("map-only"===s)null!=t.width&&null!=t.height&&(n=t.width,p=t.height);else if(s){const e=t.id?this._templateIdToCustomTemplate.get(t.id):null,{webMapFrameSize:s,pageUnits:i}=e?.layoutTemplateInfo??{};let l=!1;if(s&&i)if(this._isFreeHand){const t=s[0]/s[1];n=this._freeHandWidth,p=this._freehandHeight,n>p?p=n/t:n=p*t}else{const t=A.fromJSON(i.toLowerCase()),e=o.unit;m(t)===m(e)?(n=h(s[0],t,e),p=h(s[1],t,e)):(l=!0,n=s[0],p=s[1])}if(!this._isFreeHand)if(t.scaleEnabled&&t.scale){const e=l?Math.min(a/n,r/p):u(o)*d*t.dpi;n*=e,p*=e}else if(0===n||0===p)n=a,p=r;else{const t=(a-.1*a)/n,e=(r-.1*r)/p,s=Math.min(t,e);n*=s,p*=s}}const{scaleEnabled:c,scale:y}=t,f=c&&y?y/this.view.scale:1;if(e.boxWidth=n*f||a,e.boxHeight=p*f||r,l&&(e.padding=l),e.backgroundWidth=a??0,e.backgroundHeight=r??0,"loading"===this.loadStatus)e.strokeColor=R;else if("loaded"===this.loadStatus)switch(this.templateOptions.state){case"pending":e.strokeColor=R;break;case"ready":e.strokeColor=W;break;case"error":e.strokeColor=N}}_resetDrag(){this._isFreeHand=!1,this._updateOverLayItem()}_handleDrag(t){switch(t.action){case"start":this._start();break;case"update":this._update(t);break;case"end":this._end()}t.stopPropagation()}_start(){this._isFreeHand=!0}_update(t){const e=this._getOverlayItem(),{x:s,y:i}=t,{x:o,y:a}=t.origin;s>o?(e.x=o,e.boxWidth=s-o):(e.x=s,e.boxWidth=o-s),i>a?(e.y=a,e.boxHeight=i-a):(e.y=i,e.boxHeight=a-i)}_end(){const t=this._getOverlayItem();if(!this.view||null==t.x||null==t.y)return;const e=this.view,s=e.toMap(p(t.x+.5*t.boxWidth,t.y+.5*t.boxHeight));t.x=null,t.y=null,e.goTo({center:s}),this._freeHandWidth=t.boxWidth,this._freehandHeight=t.boxHeight,"map-only"===this.templateOptions.layout&&(this.templateOptions.width=this._freeHandWidth,this.templateOptions.height=this._freehandHeight),this.templateOptions.scale=this.view.scale,this._updateOverLayItem()}};t([c()],J.prototype,"_serviceTemplateCustomTextElements",void 0),t([c()],J.prototype,"_templateIdToCustomTemplate",void 0),t([c()],J.prototype,"allowedFormats",void 0),t([c()],J.prototype,"allowedLayouts",void 0),t([c({type:G})],J.prototype,"browseTemplates",void 0),t([c({type:G})],J.prototype,"defaultTemplates",void 0),t([c()],J.prototype,"error",void 0),t([c({type:B})],J.prototype,"exportedLinks",void 0),t([c()],J.prototype,"extraParameters",void 0),t([c()],J.prototype,"includeDefaultTemplates",void 0),t([c({readOnly:!0})],J.prototype,"effectivePrintServiceUrl",null),t([c()],J.prototype,"effectiveTemplateCustomTextElements",null),t([c({type:T})],J.prototype,"outSpatialReference",void 0),t([c({type:I})],J.prototype,"portal",void 0),t([c()],J.prototype,"portalTemplateIds",void 0),t([c({type:G})],J.prototype,"printServiceTemplates",void 0),t([c({readOnly:!0})],J.prototype,"defaultTemplate",void 0),t([c()],J.prototype,"showPrintAreaEnabled",void 0),t([c()],J.prototype,"printServiceUrl",void 0),t([c()],J.prototype,"printTimeout",void 0),t([c({readOnly:!0})],J.prototype,"state",null),t([c({readOnly:!0})],J.prototype,"templatesInfo",void 0),t([c()],J.prototype,"updateDelay",void 0),t([c()],J.prototype,"view",void 0),t([c()],J.prototype,"templateCustomTextElements",void 0),t([c({type:M})],J.prototype,"templateOptions",void 0),J=t([y("esri.widgets.Print.PrintViewModel")],J);const Q=J;export{Q as default};
|
package/widgets/Print/utils.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import e from"../../core/Error.js";import{JSONMap as t}from"../../core/jsonMap.js";import{getTaskExecutionMode as r,PrintServiceTask as i}from"../../rest/print.js";import{execute as o}from"../../rest/geoprocessor/execute.js";import{submitJob as a}from"../../rest/geoprocessor/submitJob.js";async function s(t,s,m){if(!t)throw new e("print:invalid-layout-info-task-url","Can't fetch layout template info",{url:t});if("async"===await r(t,i.GetLayoutTemplatesInfo,m)){const e=await a(t,s,void 0,m||void 0);await e.waitForJobCompletion();return(await e.fetchResultData("Output_JSON")).value}return(await o(t,s,null,m)).results[0].value}const m=new t({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"});export{s as fetchLayoutTemplateInfos,m as valueUnitKebabDict};
|
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.33/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 i}from"../core/jsonMap.js";import{watch as a,whenOnce as l}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{ensureInteger as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import d from"../geometry/SpatialReference.js";import{isValid as m}from"../geometry/support/spatialReferenceUtils.js";import{reArcGISOnlineDomain as u}from"../portal/support/urlUtils.js";import{findToken as h}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import _ from"./Widget.js";import v from"./Print/FileLink.js";import g from"./Print/PrintViewModel.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{globalCss as y}from"./support/globalCss.js";import{Heading as w}from"./support/Heading.js";import{legacyIcon as T}from"./support/legacyIcon.js";import{isRTL as x,isActivationKey as k}from"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{tsx as S,tsxFragment as I}from"./support/jsxFactory.js";import{formatNumber as O}from"../intl/number.js";const $=t.ofType(v),E="map-only";var L;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(L||(L={}));const F="esri-print",M=`${F}__advanced-options-button`,P={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,advancedOptionsButton:M,advancedOptionsButtonContainer:`${M}-container`,advancedOptionsButtonTitle:`${M}-title`,advancedOptionsButtonIconOpened:`${M}-icon--opened`,advancedOptionsButtonIconClosed:`${M}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${M}-icon--closed-rtl`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectBlock:`${F}__template-select-block`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,formCheckboxLabel:`${F}__form-checkbox-label`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLink:`${F}__exported-file-link`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileError:`${F}__exported-file--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function A(e,t,i,a){const l=i/t,o=a/t;return{width:Math.round(e*l),height:Math.round(e*o)}}function B(e){return!isNaN(e)&&e>0}function N(e){return e?.toLowerCase()===E}function R(e){const{state:t,extension:i}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return i?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}const D=new i({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"}),j=new Map([["a3-landscape","a3-landscape"],["a3-portrait","a3-portrait"],["a4-landscape","a4-landscape"],["a4-portrait","a4-portrait"],["letter-ansi-a-landscape","ansi-a-landscape"],["letter-ansi-a-portrait","ansi-a-portrait"],["tabloid-ansi-b-landscape","ansi-b-landscape"],["tabloid-ansi-b-portrait","ansi-b-portrait"]]);let V=class extends _{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._selectedTab=L.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.exportedLinks=new $,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportEnabled=!1,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new g,this._onInput=e=>{this._selectedTab===L.layout?this.templateOptions.title=e.currentTarget.value:this._selectedTab===L.mapOnly&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const i=h(this.viewModel.effectivePrintServiceUrl),a=t.url,l=document.createElement("a");if(l.target="_blank",l.href=a,l.rel="noreferrer",l.download=t.formattedName??"",!i)return l.click(),void e.stopPropagation();e.preventDefault();const o=new URL(a);o.searchParams.set("token",i),l.href=o.href,l.click(),l.href=a},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([a((()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format]),(()=>{const{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){const t=b.apiValues;this._formats=e.format.choiceList.map((e=>{const i=t.find((t=>new RegExp(`\\b${t}\\b`,"i").test(e)))??e;return{value:i,label:e===i?e.toUpperCase():e}})).sort(((e,t)=>e.label.localeCompare(t.label)))}const t=this._formats.some((({value:e})=>new RegExp(`\\b${e}\\b`,"i").test(this.templateOptions.format)));if(!e.format.defaultValue||t);else{const t=this._formats.find((({value:t})=>new RegExp(`\\b${t}\\b`,"i").test(e.format.defaultValue)))?.value;t&&(this.templateOptions.format=t)}})),a((()=>[this.templateOptions.id,this.viewModel.loaded]),(async()=>{const{layout:e}=this.templateOptions;this._selectedTab=N(e)?L.mapOnly:L.layout,this._selectedTab===L.layout&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))})),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)}))]);for(const{name:a,extension:l}of this.exportedLinks)a&&l&&this._updateExportedFileNameMap(`${a}${l}`);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const i=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>{clearTimeout(i),this._awaitingServerResponse=!1}))}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),link:()=>import("@esri/calcite-components/dist/components/calcite-link")})}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 outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=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:i,view:a}=this,{attributionEnabled:l,author:o,copyright:n,dpi:s,format:r,height:p,layout:u,layoutItem:h,legendEnabled:b,northArrowEnabled:_,scaleBarEnabled:v,scaleEnabled:g,scale:f,width:k}=t,C="ready"!==i.state||this._awaitingServerResponse||!(u||h),I=this._renderTitleOrFileNameSection(),O=S("div",{class:P.formSectionContainer},S("calcite-label",null,e.fileFormatTitle,S("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??"pdf"}},this._formats.map((({value:e,label:t},i)=>S("calcite-combobox-item",{key:`file-format-${i}`,selected:e===this.templateOptions.format,textLabel:t,value:e})))))),$=S("calcite-label",{layout:"inline"},S("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),E=S("div",null,S("div",{class:P.formSectionContainer},S("calcite-label",null,e.template,S("calcite-block",{class:P.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:"template-select-block",loading:"loading"===this._selectedTemplate?.state,onclick:()=>this._showTemplates=!0,onkeydown:e=>{"Enter"!==e.key&&" "!==e.key||(this._showTemplates=!0)},tabIndex:0},S("calcite-icon",{class:P.templateSelectIcon,icon:(this._selectedTemplate?.layout?j.get(this._selectedTemplate.layout):null)||"custom-print",key:"template-select-icon",scale:"l",slot:"content-start"}),"error"===this._selectedTemplate?.state?S("calcite-icon",{class:P.templateSelectError,icon:"exclamation-mark-circle",key:"template-select-error",scale:"s",slot:"actions-end"}):null,S("calcite-icon",{class:P.templateSelectArrow,icon:x()?"chevron-left":"chevron-right",key:"template-select-arrow",scale:"s",slot:"actions-end"})))),$),F=S("div",{class:P.formSectionContainer},S("calcite-label",null,e.dpi,S("calcite-input-number",{bind:this,"data-input-name":"dpi",min:1,value:`${s}`,onCalciteInputNumberInput:this._handleDPIChange}))),M=S("div",{class:P.formSectionContainer},S("calcite-label",null,S("div",{class:P.srLabel},e.outSpatialReference,S("calcite-link",{href:"https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/",target:"_blank"},"(WKID)")),S("calcite-input-number",{bind:this,"data-input-name":"outSpatialReference",integer:!0,numberButtonType:"none",value:i.outSpatialReference?.wkid?.toString()??"",onCalciteInputNumberInput:({currentTarget:e})=>{const t=c(e.value);i.outSpatialReference=Number.isNaN(t)||null==t?null:new d({wkid:t}),this._isValidSpatialReference=!i.outSpatialReference||m(i.outSpatialReference)}}),this._isValidSpatialReference?null:S("div",{class:P.invalidWkidText,key:`out-sr-${i.outSpatialReference?.wkid}`},e.invalidWkid))),A=S("div",{class:this.classes(P.scaleInfoContainer,P.formSectionContainer)},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:g,"data-option-name":"scaleEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scale),S("div",{class:P.scaleInputContainer},S("calcite-input-number",{"aria-label":e.scaleLabel,"aria-valuenow":`${f}`,bind:this,class:P.scaleInput,"data-input-name":"scale",disabled:!g,value:`${f}`,onCalciteInputNumberInput:this._updateNumberInputValue}),S("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!g,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale}))),B=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:P.advancedOptionsContainer,key:"advanced-section-for-layout"},A,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?S("div",{class:P.formSectionContainer,key:"author-info"},S("calcite-label",null,e.author,S("calcite-input",{bind:this,"data-input-name":"author",value:o??"",onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?S("div",{class:P.formSectionContainer,key:"copyright-text"},S("calcite-label",null,e.copyright,S("calcite-input",{bind:this,"data-input-name":"copyright",value:n??"",onCalciteInputInput:this._updateInputValue}))):null,F,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??1?S("div",{class:P.formSectionContainer,key:"legend-info"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:!!b,"data-option-name":"legendEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?S("div",{class:P.formSectionContainer,key:"north-arrow"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:!!_,"data-option-name":"northArrowEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?S("div",{class:P.formSectionContainer,key:"scale-bar"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:!!v,"data-option-name":"scaleBarEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),N=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:P.advancedOptionsContainer},A,F,M,S("div",{class:P.formSectionContainer},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:l,"data-option-name":"attributionEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),R=this.exportedLinks.toArray(),D=this._renderExportedLinkItems(R),V={[P.exportSectionCentered]:!R.length},U=this._selectedTab===L.layout?S("section",{"aria-labelledby":`${this.id}__layoutTab`,class:P.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},S("div",{class:P.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?I:null,E,this._selectedTab===L.layout?O:null,S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(P.panelContainer,P.advancedOptionsSection),collapsible:!0,disabled:!(u||h?.id),heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},B))):this._selectedTab===L.mapOnly?S("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:P.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},S("div",{class:P.panelContainer},I,O,S("div",null,S("div",{class:this.classes(P.sizeContainer,P.formSectionContainer)},S("calcite-label",null,e.width,S("calcite-input-number",{bind:this,"data-input-name":"width",value:`${k}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("calcite-label",null,e.height,S("calcite-input-number",{bind:this,"data-input-name":"height",value:`${p}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("button",{"aria-label":e.swap,bind:this,class:this.classes(y.widgetButton,P.swapButton,T.swap),onclick:this._switchInput,type:"button"})),$),S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(P.panelContainer,P.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},N))):S("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(P.exportSection,V),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},S("div",{class:P.panelContainer},S("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:P.exportedFilesContainer},0===R.length?S("div",{class:P.exportedFilesEmpty},S("calcite-icon",{icon:"file",scale:"l"}),S("div",null,S(w,{class:P.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),S("div",null,e.exportHint))):D))),H="2d"!==a?.type,z=S("div",{class:P.panelError},a?H?e.sceneViewError:e.serviceError:e.noViewError),W=R.some((({state:e})=>"pending"===e)),q=S("div",{class:P.content,key:"panel"},S("div",null,S("ul",{bind:this,class:P.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===L.layout}`,class:P.layoutTab,"data-tab-id":L.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===L.mapOnly}`,class:P.layoutTab,"data-tab-id":L.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===L.export}`,class:P.layoutTab,"data-tab-id":L.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},W?S("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),U),this._selectedTab!==L.export?S("div",{class:this.classes(P.printButtonSection,!this.saveExportHidden&&this.portal?P.printButtonSectionDivider:null),key:"export-button-section"},!this.saveExportHidden&&this.portal?S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,S("calcite-button",{"aria-label":e.exportDescription,bind:this,class:this.classes(P.printButton),disabled:C||!(u||h?.id)&&!r,onclick:this._handlePrintMap,scale:"l",width:"full"},e.export)):null),K=S("calcite-flow",{key:"root-flow"},S("calcite-flow-item",{bind:this,key:"root-flow-item",selected:!this._showTemplates},S("div",{class:P.printWidgetContainer},this.headerVisible?S("header",{class:P.headerTitle},e.export):null,this.error||H||!a?z:q)),this._renderChooseTemplateFlowItem()),G="initializing"===i.state,J=G?this._renderLoader():K,Q={[P.panelItemsCentered]:G};return S("div",{bind:this,class:this.classes(P.base,y.widget,y.panel,Q)},J)}_getPageSizeLabel(e){if(!e)return;const t=e.layoutTemplateInfo;if(!t)return;const i=D.fromJSON(t.pageUnits.toLowerCase());return`${O(t.pageSize[0])} × ${O(t.pageSize[1])} ${o(this.messagesUnits,i,"abbr")}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;const{label:i,layout:a,layoutItem:l,type:o}=e;if("print-service-template"===o&&this.messages[a])return this.messages[a];const n=i??a??l?.id;return n?.replaceAll("_"," ")??this.messages.untitled}_getPortalTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter((({layout:t,layoutItem:i})=>!N(t)&&!!i?.id&&e.includes(i.id))):[]}_getDefaultTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter((({layout:t,layoutItem:i})=>!(N(t)||i?.id&&e.includes(i.id)))):[]}_getPrintServiceTemplates(){return this.includeDefaultTemplates&&this._getDefaultTemplates().length?[]:this.viewModel.printServiceTemplates.toArray().filter((({layout:e})=>!N(e)))}_renderLayoutTemplates(e,t=!1,i=!1){return t&&e.sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)),e.map((e=>S("calcite-list-item",{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??"",value:e},S("calcite-icon",{icon:(e.layout?j.get(e.layout):null)||"custom-print",slot:"content-start"}),"loading"===e.state?S("calcite-loader",{inline:!0,key:`template-loader-${e.id}`,label:"loading",scale:"s",slot:"content-end"}):null,"error"===e?.state?S("calcite-icon",{class:P.templateSelectError,icon:"exclamation-mark-circle",key:`template-error-${e.id}`,scale:"s",slot:"content-end"}):null,i?S("calcite-action",{icon:"trash",onclick:()=>this.viewModel.removePortalTemplate(e),slot:"actions-end",text:"delete"}):null)))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{messages:e}=this,t=u.test(this.portal?.url),i=this.viewModel.browseTemplates.toArray(),a=this._getPortalTemplates(),l=this._getDefaultTemplates(),o=this._getPrintServiceTemplates(),n=i.length+a.length+l.length+o.length>15,s=this.browseTemplateButtonOnClick?S("calcite-button",{appearance:"outline",class:n?P.browseTemplateButtonContainerFilter:P.browseTemplateButtonContainer,iconStart:"folder",key:"browse-template-button",onclick:this.browseTemplateButtonOnClick,slot:n?"filter-actions-end":"default"},n?null:e.browseTemplates):null;return S("calcite-flow-item",{bind:this,closable:!1,heading:e.chooseTemplate,key:"template-flow-item",selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},S("div",{class:P.templateSelectFlowItemContainer},S("div",{class:P.templateSelectFlowItemContent},n?null:s,S("calcite-list",{filterEnabled:n,filterProps:["label"],key:"template-list",label:e.templateList,selectionMode:"single-persist",onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},n?s:null,i.length?S("div",{key:"my-templates"},S("div",{class:P.templateSelectFlowItemListHeading},e.myTemplates,t?S("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(i,!0,!0)):null,a.length?S("div",{key:"org-templates"},S("div",{class:P.templateSelectFlowItemListHeading},e.organizationTemplates,t?S("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(a)):null,i.length||a.length?l.length?S("div",{key:"default-templates"},S("div",{class:P.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(l,!0)):null:this._renderLayoutTemplates(l,!0),i.length||a.length?o.length?S("div",{key:"service-templates"},S("div",{class:P.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(o)):null:this._renderLayoutTemplates(o))),S("div",{class:P.templateButtonContainer},S("calcite-button",{class:P.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?S("div",{class:P.formSectionContainer,key:"custom-text-elements"},e.map(((e,t)=>{const[i,a]=Object.entries(e)[0];return"date"===i?null:S("calcite-label",{key:`custom-text-elements-${i}-${t}`},i,S("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":i,value:a??"",onCalciteInputInput:this._updateInputValue}))}))):null}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:i,fileNamePlaceHolder:a}=this.messages,l=this._selectedTab===L.layout?e:t,o=this._selectedTab===L.layout?i:a,n=this._selectedTab===L.layout?this.templateOptions.title:this.templateOptions.fileName;return S("div",{class:P.formSectionContainer,key:l},S("calcite-label",null,l,S("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===L.layout||"mapOnlyTab"===t&&this._selectedTab===L.mapOnly||"exportTab"===t&&this._selectedTab===L.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[P.loader]:this._awaitingServerResponse};return S("div",{class:this.classes(e),key:"loader"})}_updateExportedFileNameMap(e){void 0!==this._exportedFileNameMap[e]?this._exportedFileNameMap[e]++:this._exportedFileNameMap[e]=0}_createFileLink(e,t){const i=t||this.messages.untitled,a=e.format.toLowerCase(),l=a.includes("png")?"png":a,o=i+l;return this._updateExportedFileNameMap(o),new v({name:i,extension:l,count:this._exportedFileNameMap[o]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,i){e.find((e=>{const[i]=Object.entries(e)[0];return i===t}))[t]=i}_updateInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:l}=this;a?this._updateCustomTextElementValue(l.customTextElements,i,t.value):l[i]=t.value}_updateNumberInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),{templateOptions:a}=this,l=Number(t.value);if(B(l))a[i]=l;else{const e=a[i];t.value=`${e}`}}_handleDPIChange(e){const{templateOptions:t}=this,i=t.dpi;this._updateNumberInputValue(e);const a=t.dpi,{height:l,width:o}=A(a,i,t.width,t.height);t.height=l,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e,saveExportEnabled:t}=this,i=this.viewModel.toPrintTemplate(e),a=this._selectedTab===L.layout?i.layoutOptions?.titleText:e.fileName,l=this._createFileLink(i,a);this.exportedLinks.add(l),this.emit("submit",{link:l,saveExportEnabled:t}),this._selectedTab=L.export,this.viewModel.print(i).then((e=>{l.set({url:e&&e.url,state:"ready"})})).catch((e=>{l.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:l,saveExportEnabled:t}),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:i}=e,a=i-t;a>0&&(e.scrollTop=a)}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){const t=this.messages,i=e.formattedName??"",{state:a}=e,o=this.saveAsButtonCallback&&"error"!==a&&this._isFormatAllowedForSaving(e.extension);return"pending"!==a&&o?S("calcite-popover",{autoClose:!0,key:`${i}-popover`,label:"Popover",offsetDistance:1,overlayPositioning:"fixed",pointerDisabled:!0,referenceElement:`${i}-popover-button`,scale:"s"},S("calcite-list",{label:""},e.portalItem?S("calcite-list-item",{label:t.openItem,onCalciteListItemSelect:()=>{const t=e.portalItem;if(!t||!t.itemPageUrl)return;const i=document.createElement("a");i.target="_blank",i.href=t.itemPageUrl,i.rel="noreferrer",i.click()}},S("calcite-icon",{icon:"launch2",key:`${i}-launch-icon`,scale:"s",slot:"content-start"})):S("calcite-list-item",{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(l((()=>e.portalItem)).then((e=>{e.itemPageUrl&&this.scheduleRender()})),await this.saveAsButtonCallback(e))}},S("calcite-icon",{icon:"save",key:`${i}-save-icon`,scale:"s",slot:"content-start"})),S("calcite-list-item",{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},S("calcite-icon",{icon:"trash",key:`${i}-delete-icon`,scale:"s",slot:"content-start"})))):null}_renderExportedLinkItemContent(e,t){const i=this.messages,{url:a,state:l}=e,o=e.formattedName??"";let r=a||null;r&&(r=n(r));const c=s(r,location.href);return S("div",{class:P.exportedFile,"data-item":e,onclick:this._handleLinkClick,slot:"content"},S("div",null,S("div",{class:P.exportedFileLinkTitle},o),S("div",{class:P.exportedFileLinkDescription},"pending"===l?i.generatingExport:t||(c?i.ready:i.linkReady))),"ready"===l?S("calcite-icon",{"aria-label":`${o}. ${i.linkReady}`,icon:c?"download-to":"launch",key:`${o}-end-icon`,scale:"s",slot:"content-end"}):null)}_renderExportedLinkItemIcon(e){const t=e.formattedName??"";return"pending"===e.state?S("calcite-loader",{class:P.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:"m",slot:"content-start"}):S("calcite-icon",{icon:R(e),key:`${t}-start-icon`,scale:"s",slot:"content-start"})}_renderExportedLinkItemAction(e,t){const{state:i}=e,a=e.formattedName??"",l=this.saveAsButtonCallback&&"error"!==i&&this._isFormatAllowedForSaving(e.extension);return"pending"!==i?S("calcite-action",{"aria-label":`${t}`,icon:l?"ellipsis":"x",id:l?`${a}-popover-button`:void 0,key:l?`${a}-saveAs-action`:`${a}-action`,onclick:l?void 0:()=>{this.exportedLinks.remove(e)},slot:"actions-end",text:`${t}`}):null}_renderExportedLinkItem(e){const t=this.messages,{error:i,state:a}=e,l=e.formattedName??"";let o;switch(a){case"pending":o=t.pending;break;case"ready":o=t.ready;break;case"error":o=t.errorMessage}const n="error"===a?"print-task:cim-symbol-unsupported"===i?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return S(I,null,S("calcite-list-item",{"aria-label":o,key:l,title:n},this._renderExportedLinkItemContent(e,n),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e,n)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return S("calcite-list",{filterEnabled:e?.length>10,label:this.messages.exportedLinksList},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||"all"===this.allowedFormatsForSaving||!(!e||!this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===L.mapOnly)this.templateOptions.reset(),this.templateOptions.layout=E;else if(this._selectedTab===L.layout){const e=this._selectedTemplate??this.viewModel.defaultTemplate;e?this.viewModel.applyTemplate(e):this.templateOptions.reset()}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,i=e.target.getAttribute("data-tab-id");if(k(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(i){case L.layout:this._toggleTab("ArrowLeft"===t?L.export:L.mapOnly);break;case L.mapOnly:this._toggleTab("ArrowLeft"===t?L.layout:L.export);break;case L.export:this._toggleTab("ArrowLeft"===t?L.mapOnly:L.layout)}e.preventDefault(),e.stopPropagation()}}};e([r()],V.prototype,"_showTemplates",void 0),e([r()],V.prototype,"_isValidSpatialReference",void 0),e([r()],V.prototype,"allowedFormats",null),e([r()],V.prototype,"allowedFormatsForSaving",void 0),e([r()],V.prototype,"allowedLayouts",null),e([r()],V.prototype,"browseTemplateButtonOnClick",void 0),e([r()],V.prototype,"error",null),e([r({type:$})],V.prototype,"exportedLinks",void 0),e([r()],V.prototype,"extraParameters",null),e([r()],V.prototype,"headerVisible",void 0),e([r()],V.prototype,"headingLevel",void 0),e([r()],V.prototype,"icon",null),e([r()],V.prototype,"includeDefaultTemplates",null),e([r()],V.prototype,"includeOrganizationTemplates",void 0),e([r()],V.prototype,"label",null),e([r(),C("esri/widgets/Print/t9n/Print")],V.prototype,"messages",void 0),e([r(),C("esri/t9n/common")],V.prototype,"messagesCommon",void 0),e([r(),C("esri/core/t9n/Units")],V.prototype,"messagesUnits",void 0),e([r({type:d})],V.prototype,"outSpatialReference",null),e([r()],V.prototype,"portal",null),e([r()],V.prototype,"saveExportEnabled",void 0),e([r()],V.prototype,"saveExportHidden",void 0),e([r()],V.prototype,"showPrintAreaEnabled",null),e([r()],V.prototype,"printServiceUrl",null),e([r()],V.prototype,"saveAsButtonCallback",void 0),e([r()],V.prototype,"templateCustomTextElements",null),e([r()],V.prototype,"templateOptions",null),e([r()],V.prototype,"view",null),e([r({type:g})],V.prototype,"viewModel",void 0),V=e([p("esri.widgets.Print")],V);const U=V;export{U as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{JSONMap as t}from"../core/jsonMap.js";import{watch as i,whenOnce as a}from"../core/reactiveUtils.js";import{unitName as l}from"../core/unitFormatUtils.js";import{addProxy as o,hasSameOrigin as n}from"../core/urlUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{ensureInteger as r}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import p from"../geometry/SpatialReference.js";import{isValid as d}from"../geometry/support/spatialReferenceUtils.js";import{reArcGISOnlineDomain as m}from"../portal/support/urlUtils.js";import{findToken as u}from"../rest/utils.js";import{formatJsonMap as h}from"../rest/support/fileFormat.js";import b from"./Widget.js";import _ from"./Print/PrintViewModel.js";import{loadCalciteComponents as v}from"./support/componentsUtils.js";import{globalCss as g}from"./support/globalCss.js";import{Heading as f}from"./support/Heading.js";import{legacyIcon as y}from"./support/legacyIcon.js";import{isRTL as w,isActivationKey as T}from"./support/widgetUtils.js";import{messageBundle as k}from"./support/decorators/messageBundle.js";import{tsx as x,tsxFragment as C}from"./support/jsxFactory.js";import{formatNumber as S}from"../intl/number.js";const I="map-only";var O;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(O||(O={}));const $="esri-print",E=`${$}__advanced-options-button`,L={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:E,advancedOptionsButtonContainer:`${E}-container`,advancedOptionsButtonTitle:`${E}-title`,advancedOptionsButtonIconOpened:`${E}-icon--opened`,advancedOptionsButtonIconClosed:`${E}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${E}-icon--closed-rtl`,swapButton:`${$}__swap-button`,printButton:`${$}__export-button`,printButtonSection:`${$}__export-button-section`,printButtonSectionDivider:`${$}__export-button-section--divider`,templateSelectContainer:`${$}__template-select-container`,templateSelectBlock:`${$}__template-select-block`,templateSelectIcon:`${$}__template-select-icon`,templateSelectError:`${$}__template-select-error`,templateSelectArrow:`${$}__template-select-arrow`,formSectionContainer:`${$}__form-section-container`,formCheckboxLabel:`${$}__form-checkbox-label`,advancedOptionsSection:`${$}__advanced-options-section`,advancedOptionsContainer:`${$}__advanced-options-container`,browseTemplateButtonContainer:`${$}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${$}__browse-template-button-container-filter`,exportedFilesContainer:`${$}__export-panel-container`,exportedFilesTitle:`${$}__export-title`,exportedFile:`${$}__exported-file`,exportedFileLink:`${$}__exported-file-link`,exportedFileLinkTitle:`${$}__exported-file-link-title`,exportedFileLinkDescription:`${$}__exported-file-link-description`,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`,srLabel:`${$}__sr-label`,invalidWkidText:`${$}__invalid-wkid-text`};function F(e,t,i,a){const l=i/t,o=a/t;return{width:Math.round(e*l),height:Math.round(e*o)}}function M(e){return!isNaN(e)&&e>0}function P(e){return e?.toLowerCase()===I}function A(e){const{state:t,extension:i}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return i?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}const B=new t({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"}),R=new Map([["a3-landscape","a3-landscape"],["a3-portrait","a3-portrait"],["a4-landscape","a4-landscape"],["a4-portrait","a4-portrait"],["letter-ansi-a-landscape","ansi-a-landscape"],["letter-ansi-a-portrait","ansi-a-portrait"],["tabloid-ansi-b-landscape","ansi-b-landscape"],["tabloid-ansi-b-portrait","ansi-b-portrait"]]);let D=class extends b{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab=O.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportEnabled=!1,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new _,this._onInput=e=>{this._selectedTab===O.layout?this.templateOptions.title=e.currentTarget.value:this._selectedTab===O.mapOnly&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const i=u(this.viewModel.effectivePrintServiceUrl),a=t.url,l=document.createElement("a");if(l.target="_blank",l.href=a,l.rel="noreferrer",l.download=t.formattedName??"",!i)return l.click(),void e.stopPropagation();e.preventDefault();const o=new URL(a);o.searchParams.set("token",i),l.href=o.href,l.click(),l.href=a},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([i((()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format]),(()=>{const{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){const t=h.apiValues;this._formats=e.format.choiceList.map((e=>{const i=t.find((t=>new RegExp(`\\b${t}\\b`,"i").test(e)))??e;return{value:i,label:e===i?e.toUpperCase():e}})).sort(((e,t)=>e.label.localeCompare(t.label)))}const t=this._formats.some((({value:e})=>new RegExp(`\\b${e}\\b`,"i").test(this.templateOptions.format)));if(!e.format.defaultValue||t);else{const t=this._formats.find((({value:t})=>new RegExp(`\\b${t}\\b`,"i").test(e.format.defaultValue)))?.value;t&&(this.templateOptions.format=t)}})),i((()=>[this.templateOptions.id,this.viewModel.loaded]),(async()=>{const{layout:e}=this.templateOptions;this._selectedTab=P(e)?O.mapOnly:O.layout,this._selectedTab===O.layout&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))})),i((()=>this.templateOptions.dpi),(e=>{e<=0&&(this.templateOptions.dpi=1)})),i((()=>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 a=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>{clearTimeout(a),this._awaitingServerResponse=!1}))}loadDependencies(){return v({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),link:()=>import("@esri/calcite-components/dist/components/calcite-link")})}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 exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}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 outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=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:i,view:a}=this,{attributionEnabled:l,author:o,copyright:n,dpi:s,format:c,height:m,layout:u,layoutItem:h,legendEnabled:b,northArrowEnabled:_,scaleBarEnabled:v,scaleEnabled:T,scale:k,width:C}=t,S="ready"!==i.state||this._awaitingServerResponse||!(u||h),I=this._renderTitleOrFileNameSection(),$=x("div",{class:L.formSectionContainer},x("calcite-label",null,e.fileFormatTitle,x("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??"pdf"}},this._formats.map((({value:e,label:t},i)=>x("calcite-combobox-item",{key:`file-format-${i}`,selected:e===this.templateOptions.format,textLabel:t,value:e})))))),E=x("calcite-label",{layout:"inline"},x("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),F=x("div",null,x("div",{class:L.formSectionContainer},x("calcite-label",null,e.template,x("calcite-block",{class:L.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:"template-select-block",loading:"loading"===this._selectedTemplate?.state,onclick:()=>this._showTemplates=!0,onkeydown:e=>{"Enter"!==e.key&&" "!==e.key||(this._showTemplates=!0)},tabIndex:0},x("calcite-icon",{class:L.templateSelectIcon,icon:(this._selectedTemplate?.layout?R.get(this._selectedTemplate.layout):null)||"custom-print",key:"template-select-icon",scale:"l",slot:"content-start"}),"error"===this._selectedTemplate?.state?x("calcite-icon",{class:L.templateSelectError,icon:"exclamation-mark-circle",key:"template-select-error",scale:"s",slot:"actions-end"}):null,x("calcite-icon",{class:L.templateSelectArrow,icon:w()?"chevron-left":"chevron-right",key:"template-select-arrow",scale:"s",slot:"actions-end"})))),E),M=x("div",{class:L.formSectionContainer},x("calcite-label",null,e.dpi,x("calcite-input-number",{bind:this,"data-input-name":"dpi",min:1,value:`${s}`,onCalciteInputNumberInput:this._handleDPIChange}))),P=x("div",{class:L.formSectionContainer},x("calcite-label",null,x("div",{class:L.srLabel},e.outSpatialReference,x("calcite-link",{href:"https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/",target:"_blank"},"(WKID)")),x("calcite-input-number",{bind:this,"data-input-name":"outSpatialReference",integer:!0,numberButtonType:"none",value:i.outSpatialReference?.wkid?.toString()??"",onCalciteInputNumberInput:({currentTarget:e})=>{const t=r(e.value);i.outSpatialReference=Number.isNaN(t)||null==t?null:new p({wkid:t}),this._isValidSpatialReference=!i.outSpatialReference||d(i.outSpatialReference)}}),this._isValidSpatialReference?null:x("div",{class:L.invalidWkidText,key:`out-sr-${i.outSpatialReference?.wkid}`},e.invalidWkid))),A=x("div",{class:this.classes(L.scaleInfoContainer,L.formSectionContainer)},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:T,"data-option-name":"scaleEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scale),x("div",{class:L.scaleInputContainer},x("calcite-input-number",{"aria-label":e.scaleLabel,"aria-valuenow":`${k}`,bind:this,class:L.scaleInput,"data-input-name":"scale",disabled:!T,value:`${k}`,onCalciteInputNumberInput:this._updateNumberInputValue}),x("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!T,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale}))),B=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:L.advancedOptionsContainer,key:"advanced-section-for-layout"},A,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?x("div",{class:L.formSectionContainer,key:"author-info"},x("calcite-label",null,e.author,x("calcite-input",{bind:this,"data-input-name":"author",value:o??"",onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?x("div",{class:L.formSectionContainer,key:"copyright-text"},x("calcite-label",null,e.copyright,x("calcite-input",{bind:this,"data-input-name":"copyright",value:n??"",onCalciteInputInput:this._updateInputValue}))):null,M,P,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??1?x("div",{class:L.formSectionContainer,key:"legend-info"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:!!b,"data-option-name":"legendEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?x("div",{class:L.formSectionContainer,key:"north-arrow"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:!!_,"data-option-name":"northArrowEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?x("div",{class:L.formSectionContainer,key:"scale-bar"},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:!!v,"data-option-name":"scaleBarEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),D=x("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:L.advancedOptionsContainer},A,M,P,x("div",{class:L.formSectionContainer},x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:l,"data-option-name":"attributionEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),N=this.exportedLinks.toArray(),V=this._renderExportedLinkItems(N),j={[L.exportSectionCentered]:!N.length},U=this._selectedTab===O.layout?x("section",{"aria-labelledby":`${this.id}__layoutTab`,class:L.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},x("div",{class:L.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?I:null,F,this._selectedTab===O.layout?$:null,x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(L.panelContainer,L.advancedOptionsSection),collapsible:!0,disabled:!(u||h?.id),heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},B))):this._selectedTab===O.mapOnly?x("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:L.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},x("div",{class:L.panelContainer},I,$,x("div",null,x("div",{class:this.classes(L.sizeContainer,L.formSectionContainer)},x("calcite-label",null,e.width,x("calcite-input-number",{bind:this,"data-input-name":"width",value:`${C}`,onCalciteInputNumberInput:this._updateNumberInputValue})),x("calcite-label",null,e.height,x("calcite-input-number",{bind:this,"data-input-name":"height",value:`${m}`,onCalciteInputNumberInput:this._updateNumberInputValue})),x("button",{"aria-label":e.swap,bind:this,class:this.classes(g.widgetButton,L.swapButton,y.swap),onclick:this._switchInput,type:"button"})),E),x("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(L.panelContainer,L.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},D))):x("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(L.exportSection,j),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},x("div",{class:L.panelContainer},x("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:L.exportedFilesContainer},0===N.length?x("div",{class:L.exportedFilesEmpty},x("calcite-icon",{icon:"file",scale:"l"}),x("div",null,x(f,{class:L.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),x("div",null,e.exportHint))):V))),H="2d"!==a?.type,z=x("div",{class:L.panelError},a?H?e.sceneViewError:e.serviceError:e.noViewError),W=N.some((({state:e})=>"pending"===e)),q=x("div",{class:L.content,key:"panel"},x("div",null,x("ul",{bind:this,class:L.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===O.layout}`,class:L.layoutTab,"data-tab-id":O.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===O.mapOnly}`,class:L.layoutTab,"data-tab-id":O.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===O.export}`,class:L.layoutTab,"data-tab-id":O.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},W?x("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),U),this._selectedTab!==O.export?x("div",{class:this.classes(L.printButtonSection,!this.saveExportHidden&&this.portal?L.printButtonSectionDivider:null),key:"export-button-section"},!this.saveExportHidden&&this.portal?x("calcite-label",{layout:"inline"},x("calcite-checkbox",{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,x("calcite-button",{"aria-label":e.exportDescription,bind:this,class:this.classes(L.printButton),disabled:S||!(u||h?.id)&&!c,onclick:this._handlePrintMap,scale:"l",width:"full"},e.export)):null),K=x("calcite-flow",{key:"root-flow"},x("calcite-flow-item",{bind:this,key:"root-flow-item",selected:!this._showTemplates},x("div",{class:L.printWidgetContainer},this.headerVisible?x("header",{class:L.headerTitle},e.export):null,this.error||H||!a?z:q)),this._renderChooseTemplateFlowItem()),G="initializing"===i.state,J=G?this._renderLoader():K,Q={[L.panelItemsCentered]:G};return x("div",{bind:this,class:this.classes(L.base,g.widget,g.panel,Q)},J)}_getPageSizeLabel(e){if(!e)return;const t=e.layoutTemplateInfo;if(!t)return;const i=B.fromJSON(t.pageUnits.toLowerCase());return`${S(t.pageSize[0])} × ${S(t.pageSize[1])} ${l(this.messagesUnits,i,"abbr")}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;const{label:i,layout:a,layoutItem:l,type:o}=e;if("print-service-template"===o&&this.messages[a])return this.messages[a];const n=i??a??l?.id;return n?.replaceAll("_"," ")??this.messages.untitled}_getPortalTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter((({layout:t,layoutItem:i})=>!P(t)&&!!i?.id&&e.includes(i.id))):[]}_getDefaultTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter((({layout:t,layoutItem:i})=>!(P(t)||i?.id&&e.includes(i.id)))):[]}_getPrintServiceTemplates(){return this.includeDefaultTemplates&&this._getDefaultTemplates().length?[]:this.viewModel.printServiceTemplates.toArray().filter((({layout:e})=>!P(e)))}_renderLayoutTemplates(e,t=!1,i=!1){return t&&e.sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)),e.map((e=>x("calcite-list-item",{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??"",value:e},x("calcite-icon",{icon:(e.layout?R.get(e.layout):null)||"custom-print",slot:"content-start"}),"loading"===e.state?x("calcite-loader",{inline:!0,key:`template-loader-${e.id}`,label:"loading",scale:"s",slot:"content-end"}):null,"error"===e?.state?x("calcite-icon",{class:L.templateSelectError,icon:"exclamation-mark-circle",key:`template-error-${e.id}`,scale:"s",slot:"content-end"}):null,i?x("calcite-action",{icon:"trash",onclick:()=>this.viewModel.removePortalTemplate(e),slot:"actions-end",text:"delete"}):null)))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{messages:e}=this,t=m.test(this.portal?.url),i=this.viewModel.browseTemplates.toArray(),a=this._getPortalTemplates(),l=this._getDefaultTemplates(),o=this._getPrintServiceTemplates(),n=i.length+a.length+l.length+o.length>15,s=this.browseTemplateButtonOnClick?x("calcite-button",{appearance:"outline",class:n?L.browseTemplateButtonContainerFilter:L.browseTemplateButtonContainer,iconStart:"folder",key:"browse-template-button",onclick:this.browseTemplateButtonOnClick,slot:n?"filter-actions-end":"default"},n?null:e.browseTemplates):null;return x("calcite-flow-item",{bind:this,closable:!1,heading:e.chooseTemplate,key:"template-flow-item",selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},x("div",{class:L.templateSelectFlowItemContainer},x("div",{class:L.templateSelectFlowItemContent},n?null:s,x("calcite-list",{filterEnabled:n,filterProps:["label"],key:"template-list",label:e.templateList,selectionMode:"single-persist",onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},n?s:null,i.length?x("div",{key:"my-templates"},x("div",{class:L.templateSelectFlowItemListHeading},e.myTemplates,t?x("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(i,!0,!0)):null,a.length?x("div",{key:"org-templates"},x("div",{class:L.templateSelectFlowItemListHeading},e.organizationTemplates,t?x("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(a)):null,i.length||a.length?l.length?x("div",{key:"default-templates"},x("div",{class:L.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(l,!0)):null:this._renderLayoutTemplates(l,!0),i.length||a.length?o.length?x("div",{key:"service-templates"},x("div",{class:L.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(o)):null:this._renderLayoutTemplates(o))),x("div",{class:L.templateButtonContainer},x("calcite-button",{class:L.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?x("div",{class:L.formSectionContainer,key:"custom-text-elements"},e.map(((e,t)=>{const[i,a]=Object.entries(e)[0];return"date"===i?null:x("calcite-label",{key:`custom-text-elements-${i}-${t}`},i,x("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":i,value:a??"",onCalciteInputInput:this._updateInputValue}))}))):null}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:i,fileNamePlaceHolder:a}=this.messages,l=this._selectedTab===O.layout?e:t,o=this._selectedTab===O.layout?i:a,n=this._selectedTab===O.layout?this.templateOptions.title:this.templateOptions.fileName;return x("div",{class:L.formSectionContainer,key:l},x("calcite-label",null,l,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===O.layout||"mapOnlyTab"===t&&this._selectedTab===O.mapOnly||"exportTab"===t&&this._selectedTab===O.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[L.loader]:this._awaitingServerResponse};return x("div",{class:this.classes(e),key:"loader"})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,i){e.find((e=>{const[i]=Object.entries(e)[0];return i===t}))[t]=i}_updateInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:l}=this;a?this._updateCustomTextElementValue(l.customTextElements,i,t.value):l[i]=t.value}_updateNumberInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),{templateOptions:a}=this,l=Number(t.value);if(M(l))a[i]=l;else{const e=a[i];t.value=`${e}`}}_handleDPIChange(e){const{templateOptions:t}=this,i=t.dpi;this._updateNumberInputValue(e);const a=t.dpi,{height:l,width:o}=F(a,i,t.width,t.height);t.height=l,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e,saveExportEnabled:t}=this,i=this._selectedTab===O.layout?e.title:e.fileName,{link:a,promise:l}=this.viewModel.export(i||this.messages.untitled);this.emit("submit",{link:a,saveExportEnabled:t}),this._selectedTab=O.export,l.then((e=>{this.emit("complete",{link:e,saveExportEnabled:t}),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:i}=e,a=i-t;a>0&&(e.scrollTop=a)}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){const t=this.messages,i=e.formattedName??"",{state:l}=e,o=this.saveAsButtonCallback&&"error"!==l&&this._isFormatAllowedForSaving(e.extension);return"pending"!==l&&o?x("calcite-popover",{autoClose:!0,key:`${i}-popover`,label:"Popover",offsetDistance:1,overlayPositioning:"fixed",pointerDisabled:!0,referenceElement:`${i}-popover-button`,scale:"s"},x("calcite-list",{label:""},e.portalItem?x("calcite-list-item",{label:t.openItem,onCalciteListItemSelect:()=>{const t=e.portalItem;if(!t||!t.itemPageUrl)return;const i=document.createElement("a");i.target="_blank",i.href=t.itemPageUrl,i.rel="noreferrer",i.click()}},x("calcite-icon",{icon:"launch2",key:`${i}-launch-icon`,scale:"s",slot:"content-start"})):x("calcite-list-item",{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(a((()=>e.portalItem)).then((e=>{e.itemPageUrl&&this.scheduleRender()})),await this.saveAsButtonCallback(e))}},x("calcite-icon",{icon:"save",key:`${i}-save-icon`,scale:"s",slot:"content-start"})),x("calcite-list-item",{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},x("calcite-icon",{icon:"trash",key:`${i}-delete-icon`,scale:"s",slot:"content-start"})))):null}_renderExportedLinkItemContent(e,t){const i=this.messages,{url:a,state:l}=e,s=e.formattedName??"";let r=a||null;r&&(r=o(r));const c=n(r,location.href);return x("div",{class:L.exportedFile,"data-item":e,onclick:this._handleLinkClick,slot:"content"},x("div",null,x("div",{class:L.exportedFileLinkTitle},s),x("div",{class:L.exportedFileLinkDescription},"pending"===l?i.generatingExport:t||(c?i.ready:i.linkReady))),"ready"===l?x("calcite-icon",{"aria-label":`${s}. ${i.linkReady}`,icon:c?"download-to":"launch",key:`${s}-end-icon`,scale:"s",slot:"content-end"}):null)}_renderExportedLinkItemIcon(e){const t=e.formattedName??"";return"pending"===e.state?x("calcite-loader",{class:L.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:"m",slot:"content-start"}):x("calcite-icon",{icon:A(e),key:`${t}-start-icon`,scale:"s",slot:"content-start"})}_renderExportedLinkItemAction(e,t){const{state:i}=e,a=e.formattedName??"",l=this.saveAsButtonCallback&&"error"!==i&&this._isFormatAllowedForSaving(e.extension);return"pending"!==i?x("calcite-action",{"aria-label":`${t}`,icon:l?"ellipsis":"x",id:l?`${a}-popover-button`:void 0,key:l?`${a}-saveAs-action`:`${a}-action`,onclick:l?void 0:()=>{this.exportedLinks.remove(e)},slot:"actions-end",text:`${t}`}):null}_renderExportedLinkItem(e){const t=this.messages,{error:i,state:a}=e,l=e.formattedName??"";let o;switch(a){case"pending":o=t.pending;break;case"ready":o=t.ready;break;case"error":o=t.errorMessage}const n="error"===a?"print-task:cim-symbol-unsupported"===i?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return x(C,null,x("calcite-list-item",{"aria-label":o,key:l,title:n},this._renderExportedLinkItemContent(e,n),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e,n)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return x("calcite-list",{filterEnabled:e?.length>10,label:this.messages.exportedLinksList},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||"all"===this.allowedFormatsForSaving||!(!e||!this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===O.mapOnly)this.viewModel.applyTemplate(I);else if(this._selectedTab===O.layout){const e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,i=e.target.getAttribute("data-tab-id");if(T(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(i){case O.layout:this._toggleTab("ArrowLeft"===t?O.export:O.mapOnly);break;case O.mapOnly:this._toggleTab("ArrowLeft"===t?O.layout:O.export);break;case O.export:this._toggleTab("ArrowLeft"===t?O.mapOnly:O.layout)}e.preventDefault(),e.stopPropagation()}}};e([s()],D.prototype,"_showTemplates",void 0),e([s()],D.prototype,"_isValidSpatialReference",void 0),e([s()],D.prototype,"allowedFormats",null),e([s()],D.prototype,"allowedFormatsForSaving",void 0),e([s()],D.prototype,"allowedLayouts",null),e([s()],D.prototype,"browseTemplateButtonOnClick",void 0),e([s()],D.prototype,"error",null),e([s()],D.prototype,"exportedLinks",null),e([s()],D.prototype,"extraParameters",null),e([s()],D.prototype,"headerVisible",void 0),e([s()],D.prototype,"headingLevel",void 0),e([s()],D.prototype,"icon",null),e([s()],D.prototype,"includeDefaultTemplates",null),e([s()],D.prototype,"includeOrganizationTemplates",void 0),e([s()],D.prototype,"label",null),e([s(),k("esri/widgets/Print/t9n/Print")],D.prototype,"messages",void 0),e([s(),k("esri/t9n/common")],D.prototype,"messagesCommon",void 0),e([s(),k("esri/core/t9n/Units")],D.prototype,"messagesUnits",void 0),e([s({type:p})],D.prototype,"outSpatialReference",null),e([s()],D.prototype,"portal",null),e([s()],D.prototype,"saveExportEnabled",void 0),e([s()],D.prototype,"saveExportHidden",void 0),e([s()],D.prototype,"showPrintAreaEnabled",null),e([s()],D.prototype,"printServiceUrl",null),e([s()],D.prototype,"saveAsButtonCallback",void 0),e([s()],D.prototype,"templateCustomTextElements",null),e([s()],D.prototype,"templateOptions",null),e([s()],D.prototype,"view",null),e([s({type:_})],D.prototype,"viewModel",void 0),D=e([c("esri.widgets.Print")],D);const N=D;export{N as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4111],{8303:(t,e,r)=>{r.d(e,{A:()=>C});var s=r(90237),o=r(92602),i=r(70333),n=r(78888),a=r(60999),p=r(49186),u=r(53966),l=r(97768),d=r(74887),c=r(84952),y=r(10107),h=(r(44208),r(87811),r(36005)),m=r(40608),g=r(43937),f=r(77548),v=r(20655),w=r(80812),F=r(41318),A=r(10407);const C=t=>{let e=class extends t{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=(0,l.pR)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(t){t!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",t))}readPortalItem(t,e,r){if(e.itemId)return new w.default({id:e.itemId,portal:r?.portal})}writePortalItem(t,e){t?.id&&(e.itemId=t.id)}async loadFromPortal(t,e){if(this.portalItem?.id)try{const{load:s}=await r.e(1204).then(r.bind(r,41204));return(0,d.Te)(e),await s({instance:this,supportedTypes:t.supportedTypes,validateItem:t.validateItem,supportsData:t.supportsData,layerModuleTypeMap:t.layerModuleTypeMap,populateGroupLayer:t.populateGroupLayer},e)}catch(t){throw(0,d.zf)(t)||u.A.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${t}`),t}}async finishLoadEditablePortalLayer(t){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(t).catch((t=>((0,d.QP)(t),!0))))}async setUserPrivileges(t,e){if(!o.A.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(e);if(this.url)try{const{features:{edit:r,fullEdit:s},content:{updateItem:o}}=await this._fetchUserPrivileges(t,e);this._set("userHasEditingPrivileges",r),this._set("userHasFullEditingPrivileges",s),this._set("userHasUpdateItemPrivileges",o)}catch(t){(0,d.QP)(t)}}async _fetchUserPrivileges(t,e){let r=this.portalItem;if(!t||!r||!r.loaded||r.sourceUrl)return this._fetchFallbackUserPrivileges(e);const s=!i.id?.findCredential(this.url),o=t===r.id;if(o&&r.portal.user)return this._getUserPrivileges(r,s);let n,a;if(o)n=r.portal.url;else try{n=await(0,f.wI)(this.url,e)}catch(t){(0,d.QP)(t)}if(!n||!(0,c.b8)(n,r.portal.url))return this._fetchFallbackUserPrivileges(e);try{const t=null!=e?e.signal:null;a=await(i.id?.getCredential(`${n}/sharing`,{prompt:!1,signal:t}))}catch(t){(0,d.QP)(t)}const p=!0,u=!1,l=!1;if(!a)return{features:{edit:p,fullEdit:u},content:{updateItem:l}};try{if(o?await r.reload():(r=new w.default({id:t,portal:{url:n}}),await r.load(e)),r.portal.user)return this._getUserPrivileges(r,s)}catch(t){(0,d.QP)(t)}return{features:{edit:p,fullEdit:u},content:{updateItem:l}}}_getUserPrivileges(t,e){const r=(0,A.It)(t);return e&&(r.features.edit=!0),r}async _fetchFallbackUserPrivileges(t){let e=!0;try{e=await this._fetchUserHasEditingPrivileges(t)}catch(t){(0,d.QP)(t)}return{features:{edit:e,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(t){const e=this.url?i.id?.findCredential(this.url):null;if(!e)return!0;const r=I.credential===e?I.user:await this._fetchEditingUser(t);return I.credential=e,I.user=r,null==r?.privileges||r.privileges.includes("features:user:edit")}async _fetchEditingUser(t){const e=this.portalItem?.portal?.user;if(e)return e;const r=i.id?.findServerInfo(this.url??"");if(!r?.owningSystemUrl)return null;const s=`${r.owningSystemUrl}/sharing/rest`,o=v.A.getDefault();if(o&&o.loaded&&(0,c.S8)(o.restUrl)===(0,c.S8)(s))return o.user;const p=`${s}/community/self`,u=null!=t?t.signal:null,l=await(0,a.Ke)((0,n.A)(p,{authMode:"no-prompt",query:{f:"json"},signal:u}));return l.ok?F.A.fromJSON(l.value.data):null}read(t,e){e&&(e.layer=this),super.read(t,e)}write(t,e){const r=e?.portal,s=this.portalItem?.id&&(this.portalItem.portal||v.A.getDefault());return r&&s&&!(0,c.ut)(s.restUrl,r.restUrl)?(e.messages&&e.messages.push(new p.A("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(t,{...e,layer:this})}};return(0,s._)([(0,y.MZ)({type:w.default})],e.prototype,"portalItem",null),(0,s._)([(0,h.w)("web-document","portalItem",["itemId"])],e.prototype,"readPortalItem",null),(0,s._)([(0,g.K)("web-document","portalItem",{itemId:{type:String}})],e.prototype,"writePortalItem",null),(0,s._)([(0,y.MZ)({clonable:!1})],e.prototype,"resourceReferences",void 0),(0,s._)([(0,y.MZ)({type:Boolean,readOnly:!0})],e.prototype,"userHasEditingPrivileges",void 0),(0,s._)([(0,y.MZ)({type:Boolean,readOnly:!0})],e.prototype,"userHasFullEditingPrivileges",void 0),(0,s._)([(0,y.MZ)({type:Boolean,readOnly:!0})],e.prototype,"userHasUpdateItemPrivileges",void 0),e=(0,s._)([(0,m.$)("esri.layers.mixins.PortalLayer")],e),e},I={credential:null,user:null}},18768:(t,e,r)=>{r.d(e,{b:()=>p});var s=r(90237),o=r(53966),i=r(10107),n=(r(44208),r(87811),r(40608)),a=r(60694);const p=t=>{let e=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const t=(0,a.qg)(this.url);if(t?.title)return t.title}return this._get("title")||""}set title(t){this._set("title",t)}set url(t){this._set("url",(0,a.Jf)(t,o.A.getLogger(this)))}};return(0,s._)([(0,i.MZ)()],e.prototype,"title",null),(0,s._)([(0,i.MZ)({type:String})],e.prototype,"url",null),e=(0,s._)([(0,n.$)("esri.layers.mixins.ArcGISService")],e),e}},20557:(t,e,r)=>{r.d(e,{Fm:()=>p,Hz:()=>y,JQ:()=>c,JZ:()=>F,ND:()=>m,R_:()=>n,U9:()=>d,fu:()=>o,nr:()=>h,oF:()=>i,rq:()=>u,z$:()=>l});const s=[["binary","application/octet-stream","bin",""]];function o(t,e){return null!=f(e.name,t?.supportedFormats??[])}function i(t,e){if(!t)return!1;const r=u(e,t.supportedFormats??[]);return null!=r&&t.editFormats.includes(r)}function n(t,e){return v(function(t,e){const r=t.toLowerCase();return g(e).find((t=>w(t)===r))}(t,e))}function a(t,e){return v(f(t,e))}function p(t,e){return w(function(t,e){return g(e).find((e=>v(e)===t))}(t,e))}function u(t,e){return a(t.name,e)??n(t.type,e)}function l(t,e,r){return n(t,r)??a(e,r)}function d({supportedFormats:t}){return l("model/gltf-binary","glb",t)}function c(t){const e=d(t);return null!=e&&t.editFormats.includes(e)}function y(t){if(!t)return null;const e=d(t),r=function({supportedFormats:t}){return l("model/gltf+json","gltf",t)}(t);let s=null;for(const o of t.queryFormats){if(o===e)return o;o===r&&(s=o)}return s}function h({supportedFormats:t}){return l("application/esri3do-SR_world","wld",t)}function m({supportedFormats:t}){return l("application/esri3do-SR_prj","prj",t)}function g(t){return[...s,...t]}function f(t,e){const r=t.toLowerCase();return g(e).find((t=>function(t){return t?.[2].split(",").map((t=>t.toLowerCase()))??[]}(t).some((t=>r.endsWith(t)))))}function v(t){return t?.[0]}function w(t){return t?.[1].toLowerCase()}function F(t){return t.tables?.find((t=>"assetMaps"===t.role))}},22453:(t,e,r)=>{r.d(e,{S:()=>h,d:()=>T});var s=r(44208),o=r(60694),i=r(20557);function n(t,e,r){return!!p(t,e,r)}function a(t,e,r){return p(t,e,r)}function p(t,e,r){return t&&t.hasOwnProperty(e)?t[e]:r}const u={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"};function l(t){const e=t?.supportedSpatialAggregationStatistics?.map((t=>t.toLowerCase()));return{envelope:!!e?.includes("envelopeaggregate"),centroid:!!e?.includes("centroidaggregate"),convexHull:!!e?.includes("convexhullaggregate")}}function d(t,e){const r=t?.supportedOperationsWithCacheHint?.map((t=>t.toLowerCase()));return!!r?.includes(e.toLowerCase())}function c(t){const e=t?.supportedStatisticTypes?.map((t=>t.toLowerCase()));return{count:!!e?.includes("count"),sum:!!e?.includes("sum"),min:!!e?.includes("min"),max:!!e?.includes("max"),avg:!!e?.includes("avg"),var:!!e?.includes("var"),stddev:!!e?.includes("stddev"),percentileContinuous:!!e?.includes("percentile_continuous"),percentileDiscrete:!!e?.includes("percentile_discrete"),envelope:!!e?.includes("envelopeaggregate"),centroid:!!e?.includes("centroidaggregate"),convexHull:!!e?.includes("convexhullaggregate")}}function y(t){const e=t?.supportedNormalizationTypes?.map((t=>t.toLowerCase()));return{field:!!e?.includes("field"),log:!!e?.includes("log"),naturalLog:!!e?.includes("naturallog"),percentOfTotal:!!e?.includes("percentoftotal"),squareRoot:!!e?.includes("squareroot")}}function h(t,e){return{analytics:m(t),attachment:g(t),data:f(t),metadata:v(t),operations:w(t.capabilities,t,e),query:F(t,e),queryAttributeBins:I(t),queryRelated:A(t),queryTopFeatures:C(t),editing:_(t)}}function m(t){return{supportsCacheHint:d(t.advancedQueryCapabilities,"queryAnalytics")}}function g(t){const e=t.attachmentProperties,r={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:d(t.advancedQueryCapabilities,"queryAttachments"),supportsOrderByFields:n(t.advancedQueryCapabilities,"supportsQueryAttachmentOrderByFields",!1),supportsResize:n(t,"supportsAttachmentsResizing",!1)};return e&&Array.isArray(e)&&e.forEach((t=>{const e=u[t.name];e&&(r[e]=!!t.isEnabled)})),r}function f(t){return{isVersioned:n(t,"isDataVersioned",!1),isBranchVersioned:n(t,"isDataBranchVersioned",!1),supportsAttachment:n(t,"hasAttachments",!1),supportsM:n(t,"hasM",!1),supportsZ:n(t,"hasZ",!1)}}function v(t){return{supportsAdvancedFieldProperties:n(t,"supportsFieldDescriptionProperty",!1)}}function w(t,e,r){const s=t?.toLowerCase().split(",").map((t=>t.trim()))??[],i=r?(0,o.qg)(r):null,a=s.includes("MapServer"===i?.serverType?"data":"query"),p=s.includes("editing")&&!e.datesInUnknownTimezone;let u=p&&s.includes("create"),l=p&&s.includes("delete"),d=p&&s.includes("update");const c=s.includes("changetracking"),y=e.advancedQueryCapabilities;return p&&!(u||l||d)&&(u=l=d=!0),{supportsCalculate:n(e,"supportsCalculate",!1),supportsTruncate:n(e,"supportsTruncate",!1),supportsValidateSql:n(e,"supportsValidateSql",!1),supportsAdd:u,supportsDelete:l,supportsEditing:p,supportsChangeTracking:c,supportsQuery:a,supportsQueryAnalytics:n(y,"supportsQueryAnalytic",!1),supportsQueryAttachments:n(y,"supportsQueryAttachments",!1),supportsQueryBins:n(y,"supportsQueryBins",!1),supportsQueryTopFeatures:n(y,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:n(e,"supportsAttachmentsResizing",!1),supportsSync:s.includes("sync"),supportsUpdate:d,supportsExceedsLimitStatistics:n(e,"supportsExceedsLimitStatistics",!1),supportsAsyncConvert3D:n(e,"supportsAsyncConvert3D",!1)}}function F(t,e){const r=t.advancedQueryCapabilities,p=t.ownershipBasedAccessControlForFeatures,u=t.archivingInfo,c=t.currentVersion,y=e?.includes("MapServer"),h=!y||c>=(0,s.A)("mapserver-pbf-version-support"),m=(0,o.Wo)(e),g=new Set((t.supportedQueryFormats??"").split(",").map((t=>t.toLowerCase().trim())));return{maxRecordCount:a(t,"maxRecordCount",void 0),maxRecordCountFactor:a(t,"maxRecordCountFactor",void 0),maxUniqueIDCount:a(t,"maxUniqueIDCount",void 0),standardMaxRecordCount:a(t,"standardMaxRecordCount",void 0),supportedSpatialAggregationStatistics:l(r),supportsCacheHint:n(r,"supportsQueryWithCacheHint",!1)||d(r,"query"),supportsCentroid:n(r,"supportsReturningGeometryCentroid",!1),supportsCompactGeometry:m,supportsCurrentUser:n(r,"supportsCurrentUserQueries",!1),supportsDefaultSpatialReference:n(r,"supportsDefaultSR",!1),supportsDisjointSpatialRelationship:n(r,"supportsDisjointSpatialRel",!1),supportsDistance:n(r,"supportsQueryWithDistance",!1),supportsDistinct:n(r,"supportsDistinct",t.supportsAdvancedQueries),supportsExtent:n(r,"supportsReturningQueryExtent",!1),supportsFormatPBF:h&&g.has("pbf"),supportsFullTextSearch:n(r,"supportsFullTextSearch",!1),supportsGeometryProperties:n(r,"supportsReturningGeometryProperties",!1),supportsHavingClause:n(r,"supportsHavingClause",!1),supportsHistoricMoment:n(u,"supportsQueryWithHistoricMoment",!1),supportsMaxRecordCountFactor:n(r,"supportsMaxRecordCountFactor",!1),supportsOrderBy:n(r,"supportsOrderBy",t.supportsAdvancedQueries),supportsPagination:n(r,"supportsPagination",!1),supportsPercentileStatistics:n(r,"supportsPercentileStatistics",!1),supportsQuantization:n(t,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:n(t,"supportsQuantizationEditMode",!1),supportsQueryByAnonymous:n(p,"allowAnonymousToQuery",!0),supportsQueryByOthers:n(p,"allowOthersToQuery",!0),supportsQueryGeometry:n(t,"supportsReturningQueryGeometry",!1),supportsResultType:n(r,"supportsQueryWithResultType",!1),supportsReturnMesh:!!(0,i.Hz)(t.infoFor3D),supportsSpatialAggregationStatistics:n(r,"supportsSpatialAggregationStatistics",!1),supportsSqlExpression:n(r,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:n(t,"useStandardizedQueries",!1),supportsStatistics:n(r,"supportsStatistics",t.supportsStatistics),supportsTopFeaturesQuery:n(r,"supportsTopFeaturesQuery",!1),supportsTrueCurve:n(r,"supportsTrueCurve",!1),tileMaxRecordCount:a(t,"tileMaxRecordCount",void 0)}}function A(t){const e=t.advancedQueryCapabilities,r=n(e,"supportsAdvancedQueryRelated",!1);return{supportsPagination:n(e,"supportsQueryRelatedPagination",!1),supportsCount:r,supportsOrderBy:r,supportsCacheHint:d(e,"queryRelated")}}function C(t){return{supportsCacheHint:d(t.advancedQueryCapabilities,"queryTopFilter")}}function I(t){const e=t?t.queryBinsCapabilities:void 0;return{supportsDate:n(e,"supportsDateBin",!1),supportsFixedInterval:n(e,"supportsFixedIntervalBin",!1),supportsAutoInterval:n(e,"supportsAutoIntervalBin",!1),supportsFixedBoundaries:n(e,"supportsFixedBoundariesBin",!1),supportsStackBy:n(e,"supportsStackBy",!1),supportsSplitBy:n(e,"supportsSplitBy",!1),supportsSnapToData:n(e,"supportsSnapToData",!1),supportsReturnFullIntervalBin:n(e,"supportsReturnFullIntervalBin",!1),supportsFirstDayOfWeek:n(e,"supportsFirstDayOfWeek",!1),supportsNormalization:n(e,"supportsNormalization",!1),supportedStatistics:c(e),supportedNormalizationTypes:y(e)}}function _(t){const e=t.ownershipBasedAccessControlForFeatures,r=t?t.advancedEditingCapabilities:void 0;return{supportsGeometryUpdate:n(t,"allowGeometryUpdates",!0),supportsGlobalId:n(t,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:n(t,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:n(t,"supportsRollbackOnFailureParameter",!1),supportsUpdateWithoutM:n(t,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:n(t,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:n(e,"allowAnonymousToDelete",!0),supportsDeleteByOthers:n(e,"allowOthersToDelete",!0),supportsUpdateByAnonymous:n(e,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:n(e,"allowOthersToUpdate",!0),supportsAsyncApplyEdits:n(r,"supportsAsyncApplyEdits",!1),zDefault:a(t,"zDefault",void 0)}}function T(t){return{operations:{supportsAppend:n(t,"supportsAppend",!1),supportsCoverageQuery:t?.playbackInfo?.klv["0601"]??!1,supportsExportClip:n(t,"supportsExportClip",!1),supportsExportFrameset:n(t,"supportsExportFrameset",!1),supportsMensuration:n(t,"supportsMensuration",!1),supportsPreviews:n(t,"supportsPreviews",!1),supportsUpdate:n(t,"supportsUpdate",!1)}}}},29005:(t,e,r)=>{r.d(e,{A:()=>d});var s=r(90237),o=r(69540),i=r(66552),n=r(25482),a=r(10107),p=(r(44208),r(53966),r(87811),r(40608));const u=new i.J({esriFeatureEditToolAutoCompletePolygon:"auto-complete-polygon",esriFeatureEditToolCircle:"circle",esriFeatureEditToolEllipse:"ellipse",esriFeatureEditToolFreehand:"freehand",esriFeatureEditToolLine:"line",esriFeatureEditToolNone:"none",esriFeatureEditToolPoint:"point",esriFeatureEditToolPolygon:"polygon",esriFeatureEditToolRectangle:"rectangle",esriFeatureEditToolArrow:"arrow",esriFeatureEditToolTriangle:"triangle",esriFeatureEditToolLeftArrow:"left-arrow",esriFeatureEditToolRightArrow:"right-arrow",esriFeatureEditToolUpArrow:"up-arrow",esriFeatureEditToolDownArrow:"down-arrow"});let l=class extends(o.A.ClonableMixin(n.A)){constructor(t){super(t),this.name=null,this.description=null,this.drawingTool=null,this.prototype=null,this.thumbnail=null}};(0,s._)([(0,a.MZ)({json:{write:!0}})],l.prototype,"name",void 0),(0,s._)([(0,a.MZ)({json:{write:!0}})],l.prototype,"description",void 0),(0,s._)([(0,a.MZ)({json:{read:u.read,write:u.write}})],l.prototype,"drawingTool",void 0),(0,s._)([(0,a.MZ)({json:{write:!0}})],l.prototype,"prototype",void 0),(0,s._)([(0,a.MZ)({json:{write:!0}})],l.prototype,"thumbnail",void 0),l=(0,s._)([(0,p.$)("esri.layers.support.FeatureTemplate")],l);const d=l},37352:(t,e,r)=>{r.d(e,{A:()=>l});var s,o=r(90237),i=r(5503),n=r(25482),a=r(10107),p=(r(44208),r(53966),r(87811),r(40608));let u=s=class extends n.A{constructor(t){super(t),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new i.A}clone(){return new s({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};(0,o._)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],u.prototype,"floorField",void 0),(0,o._)([(0,a.MZ)({json:{read:!1,write:!1}})],u.prototype,"viewAllMode",void 0),(0,o._)([(0,a.MZ)({json:{read:!1,write:!1}})],u.prototype,"viewAllLevelIds",void 0),u=s=(0,o._)([(0,p.$)("esri.layers.support.LayerFloorInfo")],u);const l=u},45067:(t,e,r)=>{r.d(e,{A:()=>c});var s=r(90237),o=r(69540),i=r(66552),n=r(25482),a=r(10107),p=(r(44208),r(53966),r(87811),r(40608));const u=new i.J({esriRelCardinalityOneToOne:"one-to-one",esriRelCardinalityOneToMany:"one-to-many",esriRelCardinalityManyToMany:"many-to-many"}),l=new i.J({esriRelRoleOrigin:"origin",esriRelRoleDestination:"destination"});let d=class extends(o.A.ClonableMixin(n.A)){constructor(t){super(t),this.cardinality=null,this.catalogId=null,this.composite=null,this.id=null,this.keyField=null,this.keyFieldInRelationshipTable=null,this.name=null,this.relatedTableId=null,this.relationshipTableId=null,this.role=null}};(0,s._)([(0,a.MZ)({json:{read:u.read,write:u.write}})],d.prototype,"cardinality",void 0),(0,s._)([(0,a.MZ)({json:{name:"catalogID"}})],d.prototype,"catalogId",void 0),(0,s._)([(0,a.MZ)({json:{read:!0,write:!0}})],d.prototype,"composite",void 0),(0,s._)([(0,a.MZ)({json:{read:!0,write:!0}})],d.prototype,"id",void 0),(0,s._)([(0,a.MZ)({json:{read:!0,write:!0}})],d.prototype,"keyField",void 0),(0,s._)([(0,a.MZ)({json:{read:!0,write:!0}})],d.prototype,"keyFieldInRelationshipTable",void 0),(0,s._)([(0,a.MZ)({json:{read:!0,write:!0}})],d.prototype,"name",void 0),(0,s._)([(0,a.MZ)({json:{read:!0,write:!0}})],d.prototype,"relatedTableId",void 0),(0,s._)([(0,a.MZ)({json:{read:!0,write:!0}})],d.prototype,"relationshipTableId",void 0),(0,s._)([(0,a.MZ)({json:{read:l.read,write:l.write}})],d.prototype,"role",void 0),d=(0,s._)([(0,p.$)("esri.layers.support.Relationship")],d);const c=d},52136:(t,e,r)=>{r.d(e,{p:()=>n});var s=r(90237),o=r(10107),i=(r(44208),r(53966),r(87811),r(40608));const n=t=>{let e=class extends t{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(t){null!=t?this._override("apiKey",t):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return(0,s._)([(0,o.MZ)({type:String})],e.prototype,"apiKey",null),e=(0,s._)([(0,i.$)("esri.layers.mixins.APIKeyMixin")],e),e}},69208:(t,e,r)=>{r.d(e,{d:()=>n});var s=r(90237),o=r(10107),i=(r(44208),r(53966),r(87811),r(40608));const n=t=>{let e=class extends t{constructor(){super(...arguments),this.customParameters=null}};return(0,s._)([(0,o.MZ)({type:Object,json:{write:{overridePolicy:t=>({enabled:!!(t&&Object.keys(t).length>0)})}}})],e.prototype,"customParameters",void 0),e=(0,s._)([(0,i.$)("esri.layers.mixins.CustomParametersMixin")],e),e}}}]);
|