@arcgis/core 4.30.0-next.20240612 → 4.30.0-next.20240613
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/6ae4a5e81fd398d2ebca.js +1 -0
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +0 -4
- package/assets/esri/themes/base/widgets/_SnappingControls.scss +5 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ShadowHighlight.glsl.js +4 -29
- package/chunks/Viewshed.glsl.js +145 -84
- package/interfaces.d.ts +208 -47
- package/layers/support/featureLayerUtils.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/package.json +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/NormalFromDepth.glsl.js +23 -0
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ViewshedTechniqueConfiguration.js +5 -0
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/css.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
- package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
- package/widgets/support/SnappingControls/SnappingControlsViewModel.js +1 -1
- package/widgets/support/SnappingControls/SnappingListItem.js +1 -1
- package/widgets/support/SnappingControls/snappingLayerListUtils.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/17e8791bad1e2c3a0bb1.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.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{urlToObject as n}from"../../core/urlUtils.js";import r from"../../geometry/Extent.js";import i from"../../geometry/SpatialReference.js";import{isAxesOrderReversedForWkid as s}from"../ogc/crsUtils.js";const
|
|
5
|
+
import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{urlToObject as n}from"../../core/urlUtils.js";import r from"../../geometry/Extent.js";import i from"../../geometry/SpatialReference.js";import{isAxesOrderReversedForWkid as s}from"../ogc/crsUtils.js";import{DateTime as o,FixedOffsetZone as l}from"luxon";const u={84:4326,83:4269,27:4267};function a(n){if(!n)return null;const i={idCounter:-1};if("string"==typeof n){n=(new DOMParser).parseFromString(n,"text/xml")}const s=n.documentElement;if("ServiceExceptionReport"===s.nodeName){const e=Array.prototype.slice.call(s.childNodes).map((e=>e.textContent)).join("\r\n");throw new t("wmslayer:wms-capabilities-xml-is-not-valid","The server returned errors when the WMS capabilities were requested.",e)}const o=x("Capability",s),l=x("Service",s),u=o&&x("Request",o);if(!o||!l||!u)return null;const a=x("Layer",o);if(!a)return null;const c="WMS_Capabilities"===s.nodeName||"WMT_MS_Capabilities"===s.nodeName?s.getAttribute("version"):"1.3.0",d=g("Title",l,"")||g("Name",l,""),p=g("AccessConstraints",l,""),h=/^none$/i.test(p)?"":p,N=g("Abstract",l,""),A=parseInt(g("MaxWidth",l,"5000"),10),w=parseInt(g("MaxHeight",l,"5000"),10),L=b(u,"GetMap"),F=y(u,"GetMap"),M=S(a,c,i);if(!M)return null;let T,I=0;const v=Array.prototype.slice.call(o.childNodes),R=M.sublayers??[],U=e=>{null!=e&&R.push(e)};v.forEach((e=>{"Layer"===e.nodeName&&(0===I?T=e:1===I?(M.name&&(M.name="",U(S(T,c,i))),U(S(e,c,i))):U(S(e,c,i)),I++)}));let V=M.sublayers,O=M.extent;const _=M.fullExtents??[];if(V||(V=[]),0===V.length&&V.push(M),!O){const e=new r(V[0].extent);M.extent=e.toJSON(),O=M.extent}const B=M.spatialReferences.length>0?M.spatialReferences:m(M),j=y(u,"GetFeatureInfo"),k=j?b(u,"GetFeatureInfo"):null,q=f(V),X=M.minScale||0,D=M.maxScale||0,$=M.dimensions??[],G=q.reduce(((e,t)=>e.concat(t.dimensions??[])),[]),W=$.concat(G).filter(C);let P=null;if(W.length){const t=W.map((e=>{const{extent:t}=e;return E(t)?t.map((e=>e.getTime())):t?.map((e=>[e.min.getTime(),e.max.getTime()]))})).flat(2).filter(e);P={startTimeField:null,endTimeField:null,trackIdField:void 0,timeExtent:[Math.min(...t),Math.max(...t)]}}return{copyright:h,description:N,dimensions:$,extent:O,fullExtents:_,featureInfoFormats:k,featureInfoUrl:j,mapUrl:F,maxWidth:A,maxHeight:w,maxScale:D,minScale:X,layers:q,spatialReferences:B,supportedImageFormatTypes:L,timeInfo:P,title:d,version:c}}function c(e){const t=e.filter((e=>e.popupEnabled&&e.name&&e.queryable));return t.length?t.map((({name:e})=>e)).join():null}function m(e){if(e.spatialReferences.length>0)return e.spatialReferences;if(e.sublayers)for(const t of e.sublayers){const e=m(t);if(e.length>0)return e}return[]}function f(e){let t=[];for(const n of e)t.push(n),n.sublayers?.length&&(t=t.concat(f(n.sublayers)),delete n.sublayers);return t}function d(e,t,n){return t.getAttribute(e)??n}function p(e,t,n,r){const i=x(e,n);return i?d(t,i,r):r}function x(e,t){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(w(r)&&r.nodeName===e)return r}return null}function h(e,t){if(null==t)return[];const n=[];for(let r=0;r<t.childNodes.length;r++){const i=t.childNodes[r];w(i)&&i.nodeName===e&&n.push(i)}return n}function g(e,t,n){return x(e,t)?.textContent??n}function N(e,t,n){if(!e)return null;const s=parseFloat(e.getAttribute("minx")),o=parseFloat(e.getAttribute("miny")),l=parseFloat(e.getAttribute("maxx")),u=parseFloat(e.getAttribute("maxy"));let a,c,m,f;n?(a=isNaN(o)?-Number.MAX_VALUE:o,c=isNaN(s)?-Number.MAX_VALUE:s,m=isNaN(u)?Number.MAX_VALUE:u,f=isNaN(l)?Number.MAX_VALUE:l):(a=isNaN(s)?-Number.MAX_VALUE:s,c=isNaN(o)?-Number.MAX_VALUE:o,m=isNaN(l)?Number.MAX_VALUE:l,f=isNaN(u)?Number.MAX_VALUE:u);const d=new i({wkid:t});return new r({xmin:a,ymin:c,xmax:m,ymax:f,spatialReference:d})}function y(e,t){const n=x(t,e);if(n){const e=x("DCPType",n);if(e){const t=x("HTTP",e);if(t){const e=x("Get",t);if(e){let t=p("OnlineResource","xlink:href",e,null);if(t)return t.indexOf("&")===t.length-1&&(t=t.substring(0,t.length-1)),T(t,["service","request"])}}}}return null}function b(t,n){const r=h("Operation",t);if(!r.length){return h("Format",x(n,t)).map((({textContent:e})=>e)).filter(e)}const i=[];for(const e of r)if(e.getAttribute("name")===n){const t=h("Format",e);for(const{textContent:e}of t)null!=e&&i.push(e)}return i}function A(e,t,n){const r=x(t,e);if(!r)return n;const{textContent:i}=r;if(null==i||""===i)return n;const s=Number(i);return isNaN(s)?n:s}function S(e,t,n){if(!e)return null;const o={id:n.idCounter++,fullExtents:[],parentLayerId:null,queryable:"1"===e.getAttribute("queryable"),spatialReferences:[],sublayers:null},l=x("LatLonBoundingBox",e),a=x("EX_GeographicBoundingBox",e);let c=null;l&&(c=N(l,4326)),a&&(c=new r(0,0,0,0,new i({wkid:4326})),c.xmin=parseFloat(g("westBoundLongitude",a,"0")),c.ymin=parseFloat(g("southBoundLatitude",a,"0")),c.xmax=parseFloat(g("eastBoundLongitude",a,"0")),c.ymax=parseFloat(g("northBoundLatitude",a,"0"))),l||a||(c=new r(-180,-90,180,90,new i({wkid:4326}))),o.minScale=A(e,"MaxScaleDenominator",0),o.maxScale=A(e,"MinScaleDenominator",0);const m=["1.0.0","1.1.0","1.1.1"].includes(t)?"SRS":"CRS";return Array.prototype.slice.call(e.childNodes).forEach((e=>{if("Name"===e.nodeName)o.name=e.textContent||"";else if("Title"===e.nodeName)o.title=e.textContent||"";else if("Abstract"===e.nodeName)o.description=e.textContent||"";else if("BoundingBox"===e.nodeName){const n=e.getAttribute(m);if(n&&0===n.indexOf("EPSG:")){const r=parseInt(n.substring(5),10);0===r||isNaN(r)||c||(c="1.3.0"===t?N(e,r,s(r)):N(e,r))}const r=n?.indexOf(":");if(r&&r>-1){let i=parseInt(n.substring(r+1,n.length),10);0===i||isNaN(i)||(i=u[i]??i);const l="1.3.0"===t?N(e,i,s(i)):N(e,i);l&&o.fullExtents&&o.fullExtents.push(l)}}else if(e.nodeName===m){(e.textContent?.split(" ")??[]).forEach((e=>{const t=e.includes(":")?parseInt(e.split(":")[1],10):parseInt(e,10);if(0!==t&&!isNaN(t)){const e=u[t]??t;o.spatialReferences.includes(e)||o.spatialReferences.push(e)}}))}else if("Style"!==e.nodeName||o.legendUrl){if("Layer"===e.nodeName){const r=S(e,t,n);r&&(r.parentLayerId=o.id,o.sublayers||(o.sublayers=[]),o.sublayers.push(r))}}else{const t=x("LegendURL",e);if(t){const e=x("OnlineResource",t);e&&(o.legendUrl=e.getAttribute("xlink:href"))}}})),o.extent=c?.toJSON(),o.dimensions=h("Dimension",e).filter((e=>e.getAttribute("name")&&e.getAttribute("units")&&e.textContent)).map((e=>{const t=e.getAttribute("name"),n=e.getAttribute("units"),r=e.textContent,i=e.getAttribute("unitSymbol")??void 0,s=e.getAttribute("default")??void 0,o="0"!==d("default",e,"0"),l="0"!==d("nearestValue",e,"0"),u="0"!==d("current",e,"0");if(C({name:t,units:n})){return{name:"time",units:"ISO8601",extent:R(r),default:R(s),multipleValues:o,nearestValue:l,current:u}}if(F({name:t,units:n})){return{name:"elevation",units:n,extent:I(r),unitSymbol:i,default:I(s),multipleValues:o,nearestValue:l}}return{name:t,units:n,extent:v(r),unitSymbol:i,default:v(s),multipleValues:o,nearestValue:l}})),o}function E(e){return Array.isArray(e)&&e.length>0&&e[0]instanceof Date}function w(e){return e.nodeType===Node.ELEMENT_NODE}function L(e){return void 0!==e.min&&void 0!==e.max}function F(e){return/^elevation$/i.test(e.name)&&/^(epsg|crs):\d+$/i.test(e.units)}function M(e){return!C(e)&&!F(e)}function C(e){return/^time$/i.test(e.name)&&/^iso8601$/i.test(e.units)}function T(e,t){const r=[],i=n(e);for(const n in i.query)i.query.hasOwnProperty(n)&&(t.includes(n.toLowerCase())||r.push(n+"="+i.query[n]));return i.path+(r.length?"?"+r.join("&"):"")}function I(t){if(!t)return;const n=t.includes("/"),r=t.split(",");return n?r.map((e=>{const t=e.split("/");if(t.length<2)return null;return{min:parseFloat(t[0]),max:parseFloat(t[1]),resolution:t.length>=3&&"0"!==t[2]?parseFloat(t[2]):void 0}})).filter(e):r.map((e=>parseFloat(e)))}function v(t){if(!t)return;const n=t.includes("/"),r=t.split(",");return n?r.map((e=>{const t=e.split("/");if(t.length<2)return null;return{min:t[0],max:t[1],resolution:t.length>=3&&"0"!==t[2]?t[2]:void 0}})).filter(e):r}function R(t){if(!t)return;const n=t.includes("/"),r=t.split(",");return n?r.map((e=>{const t=e.split("/");if(t.length<2)return null;return{min:U(t[0]),max:U(t[1]),resolution:t.length>=3&&"0"!==t[2]?V(t[2]):void 0}})).filter(e):r.map((e=>U(e)))}function U(e){return o.fromISO(e,{zone:l.utcInstance}).toJSDate()}function V(e){const t=/(?:p(\d+y|\d+(?:\.|,)\d+y)?(\d+m|\d+(?:\.|,)\d+m)?(\d+d|\d+(?:\.|,)\d+d)?)?(?:t(\d+h|\d+(?:\.|,)\d+h)?(\d+m|\d+(?:\.|,)\d+m)?(\d+s|\d+(?:\.|,)\d+s)?)?/i,n=e.match(t);if(!n)return null;return{years:O(n[1]),months:O(n[2]),days:O(n[3]),hours:O(n[4]),minutes:O(n[5]),seconds:O(n[6])}}function O(e){if(!e)return 0;const t=/(?:\d+(?:\.|,)\d+|\d+)/,n=e.match(t);if(!n)return 0;const r=n[0].replace(",",".");return Number(r)}function _(e){return e.toISOString().replace(/\.[0-9]{3}/,"")}const B="0000-01-01T00:00:00Z",j="9999-12-31T23:59:59Z";function k(e){if(!e||e.isAllTime||e.isEmpty)return;const{start:t,end:n}=e;if(t&&n&&t.getTime()===n.getTime())return`${_(t)}`;return`${t?_(t):B}/${n?_(n):j}`}const q=new Set([102100,3857,102113,900913]),X=new Set([3395,54004]);function D(e,t){let n=e.wkid;return null==t?n:(null!=n&&t.includes(n)||!e.latestWkid||(n=e.latestWkid),null!=n&&q.has(n)?t.find((e=>q.has(e)))||t.find((e=>X.has(e)))||102100:n)}export{V as fromISODuration,c as getPopupLayers,L as isDimensionInterval,F as isElevationDimension,M as isGenericDimension,C as isTimeDimension,D as normalizeWKID,a as parseCapabilities,k as toTimeQueryParameter};
|
package/package.json
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../config.js";import{id as s}from"../../kernel.js";import r from"../../request.js";import{isSome as i}from"../../core/arrayUtils.js";import a from"../../core/Error.js";import{IdentifiableMixin as o}from"../../core/Identifiable.js";import{JSONSupportMixin as n}from"../../core/JSONSupport.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Loadable.js";import{throwIfAbortError as p}from"../../core/promiseUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../geometry/SpatialReference.js";import{getFeatureJSON as f,getFeatureIds as h,getAttachmentEditsJSON as g,isProtectedOrPrivateVersionError as v,unpackEditResultData as S,createEditedFeatures as E}from"../../layers/graphics/applyEditsUtils.js";import{checkEditingCapabilities as b,normalizeEdits as j,normalizeGeometries as R}from"../../layers/graphics/editingSupport.js";import{emitApplyEditsEvent as w}from"../../layers/mixins/EditBusLayer.js";import{getOwningPortalUrl as F}from"../../layers/support/layerUtils.js";import I from"../../portal/PortalItem.js";import{getUserPrivileges as A}from"../../portal/support/portalItemUtils.js";import{parseUrl as U,asValidOptions as P,encode as C}from"../utils.js";import{unapplyEditsZUnitScaling as O}from"../query/operations/editsZScale.js";import{readBoolean as k,readNumber as V}from"../support/jsonUtils.js";import{isSafeToEditVersion as D,isVersionInEditSession as M,currentSessionId as N}from"../../versionManagement/support/versionManagementUtils.js";function _(e){return{data:x(e),sync:H(e),operations:J(e.capabilities,e),query:Q(e),editing:q(e)}}function x(e){return{isDataVersioned:k(e,"hasVersionedData",!1)}}function J(e,t){const s=e?e.toLowerCase().split(",").map((e=>e.trim())):[],r=s.includes("query"),i=s.includes("editing")&&!t.datesInUnknownTimezone;let a=i&&s.includes("create"),o=i&&s.includes("delete"),n=i&&s.includes("update");return i&&!(a||o||n)&&(a=o=n=!0),{supportsAdd:a,supportsDelete:o,supportsEditing:i,supportsChangeTracking:s.includes("changetracking"),supportsQuery:r,supportsQueryDataElements:k(t,"supportsQueryDataElements",!1),supportsQueryDomains:k(t,"supportsQueryDomains",!1),supportsQueryContingentValues:k(t,"supportsQueryContingentValues",!1),supportsSync:s.includes("sync"),supportsUpdate:n}}function Q(e){return{maxRecordCountFactor:V(e,"maxRecordCountFactor",void 0),maxRecordCount:V(e,"maxRecordCount",void 0)}}function q(e){const t=e?.advancedEditingCapabilities;return{supportsGlobalId:k(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:k(t,"supportsReturnServiceEditsInSourceSR",!1),supportsSplit:k(t,"supportsSplit",!1),supportsAsyncApplyEdits:k(t,"supportsAsyncApplyEdits",!1)}}function H(e){const t=e?.syncCapabilities,s=t?.supportedSyncDataOptions;return{supportsAsync:k(t,"supportsAsync",!1),supportedSyncDataOptions:{annotations:!(1&~s),dimensions:!(2&~s),contingentValues:!(4&~s),attributeRules:!(8&~s),utilityNetworkSystem:!(16&~s),annotationFullModel:!(32&~s),include3DObjects:!(64&~s),utilityNetworkMissingLayers:!(128&~s),preserveTrueCurves:!(256&~s)}}}let T=class extends(n(o(u))){constructor(e){super(e),this.url=null,this.sourceJSON=null,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1,this.userTypeExtensions=[],this.layerInfos=[],this.tableInfos=[],this.capabilities=null}read(e,t){this.sourceJSON=e,super.read(e,t)}get utilityNetworkUrl(){for(const e of this.sourceJSON.layers)if("Utility Network Layer"===e.type)return`${this.url}/${e.id}`;return null}get versionManagementServiceUrl(){return this.sourceJSON.hasBranchVersionedData?this.url.replace(/\/FeatureServer/i,"/VersionManagementServer"):null}readCapabilities(e,t){return _(t)}get effectiveCapabilities(){const e=this.capabilities;if(!e)return null;const t=l(e),{operations:s}=t;return this.userHasUpdateItemPrivileges?(s.supportsAdd=s.supportsDelete=s.supportsEditing=s.supportsQuery=s.supportsUpdate=!0,t):(this.userHasFullEditingPrivileges&&s.supportsEditing&&(s.supportsAdd=s.supportsDelete=s.supportsUpdate=!0),t)}load(e){return this.addResolvingPromise(this._fetchService(this.url,e).then((()=>this._setUserPrivileges(e)))),Promise.resolve(this)}async applyEdits(e,t){let s=null;try{const{results:r,edits:i,editedFeatures:a}=await this._internalApplyEdits(e,t),o=e=>e.filter((e=>!e.error)).map(l);let n=0;return r.map((e=>{s=w(this.url,e.id,t?.gdbVersion,!0);const r={edits:i[n],addedFeatures:o(e.addFeatureResults),updatedFeatures:o(e.updateFeatureResults),deletedFeatures:o(e.deleteFeatureResults),addedAttachments:o(e.addAttachmentResults),updatedAttachments:o(e.updateAttachmentResults),deletedAttachments:o(e.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:e.editMoment?new Date(e.editMoment):null};n+=1,a.length>0&&(r.editedFeatures=a),s.resolve(r),s=null})),r}catch(r){throw s&&s.reject(r),r}}async _setUserPrivileges(e){if(t.userPrivilegesApplied)try{const{features:{fullEdit:t},content:{updateItem:s}}=await this._fetchUserPrivileges(this.sourceJSON.serviceItemId,e);this._set("userHasFullEditingPrivileges",t),this._set("userHasUpdateItemPrivileges",s)}catch(s){p(s)}}async _fetchUserPrivileges(e,t){const r=!0,i=!1,a=!1;if(!e)return{features:{edit:r,fullEdit:i},content:{updateItem:a}};let o,n,l;try{o=await F(this.url,t)}catch(u){p(u)}try{const e=null!=t?t.signal:null;n=await(s?.getCredential(`${o}/sharing`,{prompt:!1,signal:e}))}catch(u){p(u)}if(!n)return{features:{edit:r,fullEdit:i},content:{updateItem:a}};try{if(l=new I({id:e,portal:{url:o}}),await l.load(t),l.portal.user)return A(l)}catch(u){p(u)}return{features:{edit:r,fullEdit:i},content:{updateItem:a}}}async _internalApplyEdits(e,t){const s=t?.globalIdUsed??!1,a=y.fromJSON(this.sourceJSON.spatialReference),{edits:o,options:n}=await this._processApplyEditsParams(e,t),l=await Promise.all(o.map((async e=>{const t=e.addFeatures?.map((e=>f({spatialReference:a},e,null)))??[],r=(await Promise.all(t)).filter(i),o=r.length>0?r:null,n=e.updateFeatures?.map((e=>f({spatialReference:a},e,null)))??[],l=(await Promise.all(n)).filter(i),u=l.length>0?l:null,p=h(e.identifierFields,e.deleteFeatures,s),d=p.length>0?p:null;O(o,u,a);const c=await g(e.identifierFields,e);let m=null;if(c){m={adds:c.adds.length>0?c.adds:void 0,updates:c.updates.length>0?c.updates:void 0,deletes:c.deletes.length>0?c.deletes:void 0}}return{id:e.id,adds:o,updates:u,deletes:d,attachments:m}}))),u={gdbVersion:n?.gdbVersion,rollbackOnFailure:!0,useGlobalIds:s,returnEditMoment:!0,honorSequenceOfEdits:n?.honorSequenceOfEdits,usePreviousEditMoment:n?.usePreviousEditMoment,returnServiceEditsInSourceSR:n?.returnServiceEditsInSourceSR,returnServiceEditsOption:"originalAndCurrentFeatures",async:!1};await D(this.url,t?.gdbVersion,!0);const p=M(this.url,t?.gdbVersion||null);u.edits=JSON.stringify(l);const d=U(this.url),c=P(d.query,{query:C({...u,f:"json"}),method:"post"});let m;p&&(c.authMode="immediate",c.query.sessionId=N);try{m=await r(this.url+"/applyEdits",c)}catch(S){if(!v(S))throw S;c.authMode="immediate",m=await r(this.url+"/applyEdits",c)}return{...W(m),edits:o}}async _processApplyEditsParams(e,t){const s={...t};return{edits:await Promise.all(e.map((async e=>{const s=this.effectiveCapabilities,r=e&&(e.addFeatures||e.updateFeatures||e.deleteFeatures),i=e&&(e.addAttachments||e.updateAttachments||e.deleteAttachments);if(b(e,s,t,!!r,!!i,"feature-service"),!s.data.isDataVersioned&&t?.gdbVersion)throw new a("feature-service:invalid-parameter","'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");const o=j(e,s,"feature-service");return{...await R(o),id:e.id,identifierFields:e.identifierFields}}))),options:s}}async _fetchService(e,t){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:U(e)});const s=await r(e,{responseType:"json",query:{f:"json"},...t});this.read(s.data)}};function W(e){const t=e.data,s=[];return{results:t.map((e=>{const t={addResults:e.addResults??[],updateResults:e.updateResults??[],deleteResults:e.deleteResults??[],attachments:e.attachments,editMoment:e.editMoment},r=S(t),i=e.editedFeatures,a=i?.spatialReference?new y({wkid:i?.spatialReference.wkid,wkt:i?.spatialReference.wkt,latestWkid:i?.spatialReference.latestWkid,latestVcsWkid:i?.spatialReference.latestVcsWkid,vcsWkid:i?.spatialReference.vcsWkid}):null,o=i?E(i,a):null;return o&&s.push({layerId:e.id,editedFeatures:o}),{id:e.id,editedFeatures:o,...r}})),editedFeatures:s}}e([d()],T.prototype,"url",void 0),e([d()],T.prototype,"sourceJSON",void 0),e([d()],T.prototype,"userHasFullEditingPrivileges",void 0),e([d()],T.prototype,"userHasUpdateItemPrivileges",void 0),e([d({readOnly:!0})],T.prototype,"utilityNetworkUrl",null),e([d({readOnly:!0})],T.prototype,"versionManagementServiceUrl",null),e([d()],T.prototype,"userTypeExtensions",void 0),e([d({json:{read:{source:"layers"}}})],T.prototype,"layerInfos",void 0),e([d({json:{read:{source:"tables"}}})],T.prototype,"tableInfos",void 0),e([d({readOnly:!0,json:{read:{source:["hasVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"]}}})],T.prototype,"capabilities",void 0),e([c("service","capabilities")],T.prototype,"readCapabilities",null),e([d({readOnly:!0})],T.prototype,"effectiveCapabilities",null),T=e([m("esri.rest.featureService.FeatureService")],T);const L=T;export{L as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../config.js";import{id as s}from"../../kernel.js";import r from"../../request.js";import{isSome as i}from"../../core/arrayUtils.js";import a from"../../core/Error.js";import{IdentifiableMixin as o}from"../../core/Identifiable.js";import{JSONSupportMixin as n}from"../../core/JSONSupport.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Loadable.js";import{throwIfAborted as p,throwIfAbortError as d}from"../../core/promiseUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as m}from"../../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import f from"../../geometry/SpatialReference.js";import{getFeatureJSON as h,getFeatureIds as g,getAttachmentEditsJSON as v,isProtectedOrPrivateVersionError as b,unpackEditResultData as S,createEditedFeatures as E}from"../../layers/graphics/applyEditsUtils.js";import{checkEditingCapabilities as j,normalizeEdits as w,normalizeGeometries as I}from"../../layers/graphics/editingSupport.js";import{emitApplyEditsEvent as R}from"../../layers/mixins/EditBusLayer.js";import{ensureCredentialIfSignedIn as F}from"../../layers/support/featureLayerUtils.js";import{getOwningPortalUrl as A}from"../../layers/support/layerUtils.js";import{getFeatureLayerCapabilities as C}from"../../layers/support/serviceCapabilitiesUtils.js";import U from"../../portal/PortalItem.js";import{getUserPrivileges as P}from"../../portal/support/portalItemUtils.js";import{parseUrl as O,asValidOptions as k,encode as T}from"../utils.js";import{unapplyEditsZUnitScaling as V}from"../query/operations/editsZScale.js";import{readBoolean as D,readNumber as N}from"../support/jsonUtils.js";import{isSafeToEditVersion as L,isVersionInEditSession as M,currentSessionId as _}from"../../versionManagement/support/versionManagementUtils.js";function x(e,t){const s=t.id;return{id:s,name:t.name,url:`${e}/${s}`,type:t.type||"Table"}}function Q(e){return{data:J(e),sync:$(e),operations:q(e.capabilities,e),query:W(e),editing:H(e)}}function J(e){return{isDataVersioned:D(e,"hasVersionedData",!1)}}function q(e,t){const s=e?e.toLowerCase().split(",").map((e=>e.trim())):[],r=s.includes("query"),i=s.includes("editing")&&!t.datesInUnknownTimezone;let a=i&&s.includes("create"),o=i&&s.includes("delete"),n=i&&s.includes("update");return i&&!(a||o||n)&&(a=o=n=!0),{supportsAdd:a,supportsDelete:o,supportsEditing:i,supportsChangeTracking:s.includes("changetracking"),supportsQuery:r,supportsQueryDataElements:D(t,"supportsQueryDataElements",!1),supportsQueryDomains:D(t,"supportsQueryDomains",!1),supportsQueryContingentValues:D(t,"supportsQueryContingentValues",!1),supportsSync:s.includes("sync"),supportsUpdate:n}}function W(e){return{maxRecordCountFactor:N(e,"maxRecordCountFactor",void 0),maxRecordCount:N(e,"maxRecordCount",void 0)}}function H(e){const t=e?.advancedEditingCapabilities;return{supportsGlobalId:D(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:D(t,"supportsReturnServiceEditsInSourceSR",!1),supportsSplit:D(t,"supportsSplit",!1),supportsAsyncApplyEdits:D(t,"supportsAsyncApplyEdits",!1)}}function $(e){const t=e?.syncCapabilities,s=t?.supportedSyncDataOptions;return{supportsAsync:D(t,"supportsAsync",!1),supportedSyncDataOptions:{annotations:!(1&~s),dimensions:!(2&~s),contingentValues:!(4&~s),attributeRules:!(8&~s),utilityNetworkSystem:!(16&~s),annotationFullModel:!(32&~s),include3DObjects:!(64&~s),utilityNetworkMissingLayers:!(128&~s),preserveTrueCurves:!(256&~s)}}}let G=class extends(n(o(u))){constructor(e){super(e),this.url=null,this.sourceJSON=null,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1,this.userTypeExtensions=[],this.layerInfos=null,this.tableInfos=null,this.capabilities=null}read(e,t){this.sourceJSON=e,super.read(e,t)}get utilityNetworkUrl(){if(this.sourceJSON)for(const e of this.sourceJSON.layers)if("Utility Network Layer"===e.type)return`${this.url}/${e.id}`;return null}get versionManagementServiceUrl(){return this.sourceJSON?.hasBranchVersionedData?this.url.replace(/\/FeatureServer/i,"/VersionManagementServer"):null}readLayerInfos(e,t){return(t.layers||[]).map((e=>{const{type:t,geometryType:s}=e;return{...x(this.url,e),type:t||"Feature Layer",geometryType:s}}))}readTableInfos(e,t){return(t.tables||[]).map((e=>x(this.url,e)))}readCapabilities(e,t){return Q(t)}get effectiveCapabilities(){const e=this.capabilities;if(!e)return null;const t=l(e),{operations:s}=t;return this.userHasUpdateItemPrivileges?(s.supportsAdd=s.supportsDelete=s.supportsEditing=s.supportsQuery=s.supportsUpdate=!0,t):(this.userHasFullEditingPrivileges&&s.supportsEditing&&(s.supportsAdd=s.supportsDelete=s.supportsUpdate=!0),t)}load(e){return this.addResolvingPromise(this._fetchService(this.url,e).then((()=>this._setUserPrivileges(e)))),Promise.resolve(this)}async fetchAllLayersAndTables(e){return await this.load(e),this._fetchLayersAndTablesPromise||=this._fetchLayersAndTables(this.url),p(e),this._fetchLayersAndTablesPromise}async applyEdits(e,t){let s=null;try{const{results:r,edits:i,editedFeatures:a}=await this._internalApplyEdits(e,t),o=e=>e.filter((e=>!e.error)).map(l);let n=0;return r.map((e=>{s=R(this.url,e.id,t?.gdbVersion,!0);const r={edits:i[n],addedFeatures:o(e.addFeatureResults),updatedFeatures:o(e.updateFeatureResults),deletedFeatures:o(e.deleteFeatureResults),addedAttachments:o(e.addAttachmentResults),updatedAttachments:o(e.updateAttachmentResults),deletedAttachments:o(e.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:e.editMoment?new Date(e.editMoment):null};n+=1,a.length>0&&(r.editedFeatures=a),s.resolve(r),s=null})),r}catch(r){throw s&&s.reject(r),r}}async _setUserPrivileges(e){if(t.userPrivilegesApplied)try{const{features:{fullEdit:t},content:{updateItem:s}}=await this._fetchUserPrivileges(this.sourceJSON.serviceItemId,e);this._set("userHasFullEditingPrivileges",t),this._set("userHasUpdateItemPrivileges",s)}catch(s){d(s)}}async _fetchUserPrivileges(e,t){const r=!0,i=!1,a=!1;if(!e)return{features:{edit:r,fullEdit:i},content:{updateItem:a}};let o,n,l;try{o=await A(this.url,t)}catch(u){d(u)}try{const e=null!=t?t.signal:null;n=await(s?.getCredential(`${o}/sharing`,{prompt:!1,signal:e}))}catch(u){d(u)}if(!n)return{features:{edit:r,fullEdit:i},content:{updateItem:a}};try{if(l=new U({id:e,portal:{url:o}}),await l.load(t),l.portal.user)return P(l)}catch(u){d(u)}return{features:{edit:r,fullEdit:i},content:{updateItem:a}}}async _internalApplyEdits(e,t){await F(this.url);const s=t?.globalIdUsed??!1,a=f.fromJSON(this.sourceJSON.spatialReference),{edits:o,options:n}=await this._processApplyEditsParams(e,t),l=await Promise.all(o.map((async e=>{const t=e.addFeatures?.map((e=>h({spatialReference:a},e,null)))??[],r=(await Promise.all(t)).filter(i),o=r.length>0?r:null,n=e.updateFeatures?.map((e=>h({spatialReference:a},e,null)))??[],l=(await Promise.all(n)).filter(i),u=l.length>0?l:null,p=g(e.identifierFields,e.deleteFeatures,s),d=p.length>0?p:null;V(o,u,a);const c=await v(e.identifierFields,e);let m=null;if(c){m={adds:c.adds.length>0?c.adds:void 0,updates:c.updates.length>0?c.updates:void 0,deletes:c.deletes.length>0?c.deletes:void 0}}return{id:e.id,adds:o,updates:u,deletes:d,attachments:m}}))),u={gdbVersion:n?.gdbVersion,rollbackOnFailure:!0,useGlobalIds:s,returnEditMoment:!0,honorSequenceOfEdits:n?.honorSequenceOfEdits,usePreviousEditMoment:n?.usePreviousEditMoment,returnServiceEditsInSourceSR:n?.returnServiceEditsInSourceSR,returnServiceEditsOption:"originalAndCurrentFeatures",async:!1};await L(this.url,t?.gdbVersion,!0);const p=M(this.url,t?.gdbVersion||null);u.edits=JSON.stringify(l);const d=O(this.url),c=k(d.query,{query:T({...u,f:"json"}),method:"post"});let m;p&&(c.authMode="immediate",c.query.sessionId=_);try{m=await r(this.url+"/applyEdits",c)}catch(y){if(!b(y))throw y;c.authMode="immediate",m=await r(this.url+"/applyEdits",c)}return{...z(m),edits:o}}async _processApplyEditsParams(e,t){const s={...t};return{edits:await Promise.all(e.map((async e=>{const s=this.effectiveCapabilities,r=e&&(e.addFeatures||e.updateFeatures||e.deleteFeatures),i=e&&(e.addAttachments||e.updateAttachments||e.deleteAttachments);if(j(e,s,t,!!r,!!i,"feature-service"),!s.data.isDataVersioned&&t?.gdbVersion)throw new a("feature-service:invalid-parameter","'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");const o=w(e,s,"feature-service");return{...await I(o),id:e.id,identifierFields:e.identifierFields}}))),options:s}}async _fetchService(e,t){if(this.sourceJSON)return void this.read(this.sourceJSON,{url:O(e)});const s=await r(e,{responseType:"json",query:{f:"json"},...t});this.read(s.data,{url:O(e)})}async _fetchLayersAndTables(e){const t=`${e}/layers`,s=await r(t,{responseType:"json",query:{f:"json"}});return{layers:s.data.layers.map((e=>{const{type:t,geometryType:s}=e,r=x(this.url,e),i=C(e,r.url);return{...r,type:t||"Feature Layer",geometryType:s,capabilities:i}})),tables:s.data.tables.map((e=>{const t=x(this.url,e),s=C(e,t.url);return{...t,capabilities:s}}))}}};function z(e){const t=e.data,s=[];return{results:t.map((e=>{const t={addResults:e.addResults??[],updateResults:e.updateResults??[],deleteResults:e.deleteResults??[],attachments:e.attachments,editMoment:e.editMoment},r=S(t),i=e.editedFeatures,a=i?.spatialReference?new f({wkid:i?.spatialReference.wkid,wkt:i?.spatialReference.wkt,latestWkid:i?.spatialReference.latestWkid,latestVcsWkid:i?.spatialReference.latestVcsWkid,vcsWkid:i?.spatialReference.vcsWkid}):null,o=i?E(i,a):null;return o&&s.push({layerId:e.id,editedFeatures:o}),{id:e.id,editedFeatures:o,...r}})),editedFeatures:s}}e([c()],G.prototype,"url",void 0),e([c()],G.prototype,"sourceJSON",void 0),e([c()],G.prototype,"userHasFullEditingPrivileges",void 0),e([c()],G.prototype,"userHasUpdateItemPrivileges",void 0),e([c({readOnly:!0})],G.prototype,"utilityNetworkUrl",null),e([c({readOnly:!0})],G.prototype,"versionManagementServiceUrl",null),e([c()],G.prototype,"userTypeExtensions",void 0),e([c({json:{read:{source:["layers"]}}})],G.prototype,"layerInfos",void 0),e([m("layerInfos",["layers"])],G.prototype,"readLayerInfos",null),e([c({json:{read:{source:["tables"]}}})],G.prototype,"tableInfos",void 0),e([m("tableInfos",["tables"])],G.prototype,"readTableInfos",null),e([c({readOnly:!0,json:{read:{source:["hasVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"]}}})],G.prototype,"capabilities",void 0),e([m("capabilities",["hasVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"])],G.prototype,"readCapabilities",null),e([c({readOnly:!0})],G.prototype,"effectiveCapabilities",null),G=e([y("esri.rest.featureService.FeatureService")],G);const B=G;export{B as default};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const c="20240613",a="33982be2234c621ab4a83dd7cc83a52523089798";export{c as buildDate,a as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/mat2df32.js";import{multiply as r,translate as n,identity as o,scale as s,rotate as a}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{getDashArray as l}from"./gfxUtils.js";import"../../widgets/support/widgetUtils.js";import{tsx as h}from"../../widgets/support/jsxFactory.js";const f="http://www.w3.org/2000/svg";let c=0,u=0;const d=has("android"),y=has("chrome")||d&&d>=4?"auto":"optimizeLegibility",p={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},g=/([A-DF-Za-df-z])|([-+]?\d*[.]?\d+(?:[eE][-+]?\d+)?)/g;let m={},x={};const w=Math.PI;let k=1;function b(t,e){const i=t*(w/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function j(t){return t.map((t=>`${t.command} ${t.values.join(" ")}`)).join(" ").trim()}function v(t,i,r,n,o){if(t){if("circle"===t.type)return h("circle",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",r:t.r,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-dashoffset":r.dashOffset,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("ellipse"===t.type)return h("ellipse",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("rect"===t.type)return h("rect",{fill:i,"fill-rule":"evenodd",height:t.height,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,width:t.width,x:t.x,y:t.y});if("image"===t.type)return h("image",{alt:o||"image",height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if("path"===t.type){const e="string"!=typeof t.path?j(t.path):t.path;return h("path",{d:e,fill:i,"fill-rule":"evenodd",stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width})}if("text"===t.type)return e(n),h("text",{"dominant-baseline":n.dominantBaseline,fill:i,"fill-rule":"evenodd","font-family":n.font.family,"font-size":n.font.size,"font-style":n.font.style,"font-variant":n.font.variant,"font-weight":n.font.weight,kerning:n.kerning,rotate:n.rotate,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,"text-anchor":n.align,"text-decoration":n.decoration,"text-rendering":y,x:t.x,y:t.y},t.text)}return null}function M(e){const i={fill:"none",pattern:null,linearGradient:null};if(e)if("type"in e&&"pattern"===e.type){const t="patternId-"+ ++c;i.fill=`url(#${t})`,i.pattern={id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}}}else if("type"in e&&"linear"===e.type){const r="linearGradientId-"+ ++u;i.fill=`url(#${r})`,i.linearGradient={id:r,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map((e=>({offset:e.offset,color:e.color&&new t(e.color).toString()})))}}else if(e){const r=new t(e);i.fill=r.toString()}return i}function A(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};return e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashoffset&&(i.dashOffset=e.dashoffset),e.style&&!e.dashArray&&(i.dashArray=l(e).join(",")||"none")),i}function S(t,i){const r={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const n=t.alignBaseline,o="baseline"===n?"auto":"top"===n?"text-top":"bottom"===n?"hanging":n;r.align=t.align,r.dominantBaseline=o,r.decoration=t.decoration,r.kerning=t.kerning?"auto":"0",r.rotate=t.rotated?"90":"0",e(i),r.font.style=i.style||"normal",r.font.variant=i.variant||"normal",r.font.weight=i.weight||"normal",r.font.size=i.size&&i.size.toString()||"10pt",r.font.family=i.family||"serif"}return r}function $(t){const{pattern:e,linearGradient:i}=t;if(e)return h("pattern",{height:e.height,id:e.id,patternUnits:"userSpaceOnUse",width:e.width,x:e.x,y:e.y},h("image",{height:e.image.height,href:e.image.href,width:e.image.width,x:e.image.x,y:e.image.y}));if(i){const t=i.stops.map(((t,e)=>h("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color})));return h("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},t)}return null}function N(t,e){if(!t||0===t.length)return null;const i=[];for(const r of t){const{shape:t,fill:e,stroke:n,font:o}=r,s=M(e),a=A(n),l="text"===t.type?S(t,o):null,h=v(t,s.fill,a,l);h&&i.push(h)}return h("mask",{id:e,maskUnits:"userSpaceOnUse"},h("g",null,i))}function G(t,e,i){return n(t,o(t),[e,i])}function I(t,e,i,r,n){return s(t,o(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-n*i+n,t}function z(t,e,i,r){const n=e%360*Math.PI/180;a(t,o(t),n);const s=Math.cos(n),l=Math.sin(n),h=t[4],f=t[5];return t[4]=h*s-f*l+r*l-i*s+i,t[5]=f*s+h*l-i*l-r*s+r,t}function B(t,e){m&&"left"in m?(null!=m.left&&m.left>t&&(m.left=t),(null==m.right||m.right<t)&&(m.right=t),(null==m.top||m.top>e)&&(m.top=e),(null==m.bottom||m.bottom<e)&&(m.bottom=e)):m={left:t,bottom:e,right:t,top:e}}function U(t){const e=t.args,i=e.length;let r;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(r=0;r<i;r+=2)B(e[r],e[r+1]);x.x=e[i-2],x.y=e[i-1];break;case"H":for(r=0;r<i;++r)B(e[r],x.y);x.x=e[i-1];break;case"V":for(r=0;r<i;++r)B(x.x,e[r]);x.y=e[i-1];break;case"m":{let t=0;"x"in x||(B(x.x=e[0],x.y=e[1]),t=2);for(r=t;r<i;r+=2)B(x.x+=e[r],x.y+=e[r+1]);break}case"l":case"t":for(r=0;r<i;r+=2)B(x.x+=e[r],x.y+=e[r+1]);break;case"h":for(r=0;r<i;++r)B(x.x+=e[r],x.y);break;case"v":for(r=0;r<i;++r)B(x.x,x.y+=e[r]);break;case"c":for(r=0;r<i;r+=6)B(x.x+e[r],x.y+e[r+1]),B(x.x+e[r+2],x.y+e[r+3]),B(x.x+=e[r+4],x.y+=e[r+5]);break;case"s":case"q":for(r=0;r<i;r+=4)B(x.x+e[r],x.y+e[r+1]),B(x.x+=e[r+2],x.y+=e[r+3]);break;case"A":for(r=0;r<i;r+=7)B(e[r+5],e[r+6]);x.x=e[i-2],x.y=e[i-1];break;case"a":for(r=0;r<i;r+=7)B(x.x+=e[r+5],x.y+=e[r+6])}}function F(t,e,i){const r=p[t.toLowerCase()];let n;"number"==typeof r&&(r?e.length>=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),U(n)):(n={action:t,args:[]},i.push(n),U(n)))}function O(t){const e=("string"!=typeof t.path?j(t.path):t.path).match(g),i=[];if(m={},x={},!e)return null;let r="",n=[];const o=e.length;for(let a=0;a<o;++a){const t=e[a],o=parseFloat(t);isNaN(o)?(r&&F(r,n,i),n=[],r=t):n.push(o)}F(r,n,i);const s={x:0,y:0,width:0,height:0};return m&&"left"in m&&(s.x=m.left,s.y=m.top,s.width=m.right-m.left,s.height=m.bottom-m.top),s}function T(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=O(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function E(t){const e={x:0,y:0,width:0,height:0};let i=null,r=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),r=Math.max(r,o.x+o.width),n=Math.max(n,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,r=o.x+o.width,n=o.y+o.height);return i&&(i.width=r-i.x,i.height=n-i.y),i}function L(t,e,n,o,s,a,l,h,f){let c=(l&&a?b(a,e):e)/2,u=(l&&a?b(a,n):n)/2;if(f){const t=f[0],e=f[1];c=(l&&a?b(a,t):t)/2,u=(l&&a?b(a,e):e)/2}const d=t.width+o,y=t.height+o,p=i(),g=i();let m=!1;if(s&&0!==d&&0!==y){const t=e!==n?e/n:d/y,i=e>n?e:n;let o=1,s=1;isNaN(i)||(t>1?(o=i/d,s=i/t/y):(s=i/y,o=i*t/d)),r(g,g,I(p,o,s,c,u)),m=!0}const x=t.x+(d-o)/2,w=t.y+(y-o)/2;if(r(g,g,G(p,c-x,u-w)),!m&&(d>e||y>n)){const t=d/e>y/n,i=(t?e:n)/(t?d:y);r(g,g,I(p,i,i,x,w))}return a&&r(g,g,z(p,a,x,w)),h&&r(g,g,G(p,h[0],h[1])),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function V(t,e,i){const r=t?.effects.find((t=>"bloom"===t.type));if(!r)return null;const{strength:n,radius:o}=r,s=n>0?o:0,a=(n+s)*e,l=4*n+1;return h("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},h("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*s)*(5**(e/100)*(.4+e/100)),result:"dilate"}),h("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:a/25}),h("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:a/50}),h("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},h("feFuncR",{slope:l,type:"linear"}),h("feFuncG",{slope:l,type:"linear"}),h("feFuncB",{slope:l,type:"linear"})),h("feMerge",null,h("feMergeNode",{in:"intensityBlur"}),h("feMergeNode",{in:"intensityBrightness"}),h("feGaussianBlur",{stdDeviation:n/10})))}function C(t,i,r,n={}){const o=[],s=[],a=++k,l=V(n.effectView,i,a);let c=null;if(l){const t=n.effectView?.effects.find((t=>"bloom"===t.type)),e=(t.strength?t.strength+t.radius/2:0)/3,o=i+i*e,s=r+r*e;c=[Math.max(o,10),Math.max(s,10)]}for(let e=0;e<t.length;e++){const a=t[e],l=[],f=[];let u=0,d=0,y=0;for(const t of a){const{shape:e,fill:i,stroke:r,font:s,offset:a}=t;n.ignoreStrokeWidth||"text"===e.type||(u+=r?.width||0);const h=M(i),c=A(r),p="text"===e.type?S(e,s):null;o.push($(h)),l.push(v(e,h.fill,c,p,n.ariaLabel)),f.push(T(e)),a&&(d+=a[0],y+=a[1])}const p=L(E(f),i,r,u,n.scale??!1,n.rotation,n.useRotationSize??!1,[d,y],c);let g=null;if(n.masking){const t=`mask-${e}`,i=n.masking[e];o.push(N(i,t)),g=`url(#${t})`}s.push(g?h("g",{mask:g},h("g",{transform:p},l)):h("g",{transform:p},l))}n.useRotationSize&&n.rotation&&(i=b(n.rotation,i),r=b(n.rotation,r)),l&&(e(c),i=c[0],r=c[1]);const u="display: block;";return h("svg",{"aria-labelledby":n.ariaLabel,focusable:!1,height:r,role:"img",style:u,width:i,xmlns:f},l,h("defs",null,o),l?h("g",{filter:`url(#bloom${a})`},s):s)}export{E as computeBBox,M as generateFillAttributes,A as generateStrokeAttributes,S as generateTextAttributes,T as getBoundingBox,L as getTransformMatrix,$ as renderDef,C as renderSVG,v as renderShape};
|
|
5
|
+
import t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/mat2df32.js";import{multiply as r,translate as n,identity as o,scale as s,rotate as a}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{getDashArray as l}from"./gfxUtils.js";import"../../widgets/support/widgetUtils.js";import{tsx as h}from"../../widgets/support/jsxFactory.js";const f="http://www.w3.org/2000/svg";let c=0,u=0;const d=has("android"),y=has("chrome")||d&&d>=4?"auto":"optimizeLegibility",p={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},g=/([A-DF-Za-df-z])|([-+]?\d*[.]?\d+(?:[eE][-+]?\d+)?)/g;let m={},x={};const w=Math.PI;let k=1;function b(t,e){const i=t*(w/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function j(t){return t.map((t=>`${t.command} ${t.values.join(" ")}`)).join(" ").trim()}function v(t,i,r,n,o){if(t){if("circle"===t.type)return h("circle",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",r:t.r,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-dashoffset":r.dashOffset,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("ellipse"===t.type)return h("ellipse",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("rect"===t.type)return h("rect",{fill:i,"fill-rule":"evenodd",height:t.height,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,width:t.width,x:t.x,y:t.y});if("image"===t.type)return h("image",{alt:o||"image",height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if("path"===t.type){const e="string"!=typeof t.path?j(t.path):t.path;return h("path",{d:e,fill:i,"fill-rule":"evenodd",stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width})}if("text"===t.type)return e(n),h("text",{"dominant-baseline":n.dominantBaseline,fill:i,"fill-rule":"evenodd","font-family":n.font.family,"font-size":n.font.size,"font-style":n.font.style,"font-variant":n.font.variant,"font-weight":n.font.weight,kerning:n.kerning,rotate:n.rotate,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,"text-anchor":n.align,"text-decoration":n.decoration,"text-rendering":y,x:t.x,y:t.y},t.text)}return null}function M(e){const i={fill:"none",pattern:null,linearGradient:null};if(e)if("type"in e&&"pattern"===e.type){const t="patternId-"+ ++c;i.fill=`url(#${t})`,i.pattern={id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}}}else if("type"in e&&"linear"===e.type){const r="linearGradientId-"+ ++u;i.fill=`url(#${r})`,i.linearGradient={id:r,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map((e=>({offset:e.offset,color:e.color&&new t(e.color).toString()})))}}else if(e){const r=new t(e);i.fill=r.toString()}return i}function A(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};return e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashoffset&&(i.dashOffset=e.dashoffset),e.style&&!e.dashArray&&(i.dashArray=l(e).join(",")||"none")),i}function S(t,i){const r={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const n=t.alignBaseline,o="baseline"===n?"auto":"top"===n?"text-top":"bottom"===n?"hanging":n;r.align=t.align,r.dominantBaseline=o,r.decoration=t.decoration,r.kerning=t.kerning?"auto":"0",r.rotate=t.rotated?"90":"0",e(i),r.font.style=i.style||"normal",r.font.variant=i.variant||"normal",r.font.weight=i.weight||"normal",r.font.size=i.size&&i.size.toString()||"10pt",r.font.family=i.family||"serif"}return r}function $(t){const{pattern:e,linearGradient:i}=t;if(e)return h("pattern",{height:e.height,id:e.id,patternUnits:"userSpaceOnUse",width:e.width,x:e.x,y:e.y},h("image",{height:e.image.height,href:e.image.href,width:e.image.width,x:e.image.x,y:e.image.y}));if(i){const t=i.stops.map(((t,e)=>h("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color})));return h("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},t)}return null}function N(t,e){if(!t||0===t.length)return null;const i=[];for(const r of t){const{shape:t,fill:e,stroke:n,font:o}=r,s=M(e),a=A(n),l="text"===t.type?S(t,o):null,h=v(t,s.fill,a,l);h&&i.push(h)}return h("mask",{id:e,maskUnits:"userSpaceOnUse"},h("g",null,i))}function G(t,e,i){return n(t,o(t),[e,i])}function I(t,e,i,r,n){return s(t,o(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-n*i+n,t}function z(t,e,i,r){const n=e%360*Math.PI/180;a(t,o(t),n);const s=Math.cos(n),l=Math.sin(n),h=t[4],f=t[5];return t[4]=h*s-f*l+r*l-i*s+i,t[5]=f*s+h*l-i*l-r*s+r,t}function B(t,e){m&&"left"in m?(null!=m.left&&m.left>t&&(m.left=t),(null==m.right||m.right<t)&&(m.right=t),(null==m.top||m.top>e)&&(m.top=e),(null==m.bottom||m.bottom<e)&&(m.bottom=e)):m={left:t,bottom:e,right:t,top:e}}function U(t){const e=t.args,i=e.length;let r;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(r=0;r<i;r+=2)B(e[r],e[r+1]);x.x=e[i-2],x.y=e[i-1];break;case"H":for(r=0;r<i;++r)B(e[r],x.y);x.x=e[i-1];break;case"V":for(r=0;r<i;++r)B(x.x,e[r]);x.y=e[i-1];break;case"m":{let t=0;"x"in x||(B(x.x=e[0],x.y=e[1]),t=2);for(r=t;r<i;r+=2)B(x.x+=e[r],x.y+=e[r+1]);break}case"l":case"t":for(r=0;r<i;r+=2)B(x.x+=e[r],x.y+=e[r+1]);break;case"h":for(r=0;r<i;++r)B(x.x+=e[r],x.y);break;case"v":for(r=0;r<i;++r)B(x.x,x.y+=e[r]);break;case"c":for(r=0;r<i;r+=6)B(x.x+e[r],x.y+e[r+1]),B(x.x+e[r+2],x.y+e[r+3]),B(x.x+=e[r+4],x.y+=e[r+5]);break;case"s":case"q":for(r=0;r<i;r+=4)B(x.x+e[r],x.y+e[r+1]),B(x.x+=e[r+2],x.y+=e[r+3]);break;case"A":for(r=0;r<i;r+=7)B(e[r+5],e[r+6]);x.x=e[i-2],x.y=e[i-1];break;case"a":for(r=0;r<i;r+=7)B(x.x+=e[r+5],x.y+=e[r+6])}}function F(t,e,i){const r=p[t.toLowerCase()];let n;"number"==typeof r&&(r?e.length>=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),U(n)):(n={action:t,args:[]},i.push(n),U(n)))}function O(t){const e=("string"!=typeof t.path?j(t.path):t.path).match(g),i=[];if(m={},x={},!e)return null;let r="",n=[];const o=e.length;for(let a=0;a<o;++a){const t=e[a],o=parseFloat(t);isNaN(o)?(r&&F(r,n,i),n=[],r=t):n.push(o)}F(r,n,i);const s={x:0,y:0,width:0,height:0};return m&&"left"in m&&(s.x=m.left,s.y=m.top,s.width=m.right-m.left,s.height=m.bottom-m.top),s}function T(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=O(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function E(t){const e={x:0,y:0,width:0,height:0};let i=null,r=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),r=Math.max(r,o.x+o.width),n=Math.max(n,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,r=o.x+o.width,n=o.y+o.height);return i&&(i.width=r-i.x,i.height=n-i.y),i}function L(t,e,n,o,s,a,l,h,f){let c=(l&&a?b(a,e):e)/2,u=(l&&a?b(a,n):n)/2;if(f){const t=f[0],e=f[1];c=(l&&a?b(a,t):t)/2,u=(l&&a?b(a,e):e)/2}const d=t.width+o,y=t.height+o,p=i(),g=i();let m=!1;if(s&&0!==d&&0!==y){const t=e!==n?e/n:d/y,i=e>n?e:n;let o=1,s=1;isNaN(i)||(t>1?(o=i/d,s=i/t/y):(s=i/y,o=i*t/d)),r(g,g,I(p,o,s,c,u)),m=!0}const x=t.x+(d-o)/2,w=t.y+(y-o)/2;if(r(g,g,G(p,c-x,u-w)),!m&&(d>e||y>n)){const t=d/e>y/n,i=(t?e:n)/(t?d:y);r(g,g,I(p,i,i,x,w))}return a&&r(g,g,z(p,a,x,w)),h&&r(g,g,G(p,h[0],h[1])),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function V(t,e,i){const r=t?.effects.find((t=>"bloom"===t.type));if(!r)return null;const{strength:n,radius:o}=r,s=n>0?o:0,a=(n+s)*e,l=4*n+1;return h("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},h("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*s)*(5**(e/100)*(.4+e/100)),result:"dilate"}),h("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:a/25}),h("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:a/50}),h("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},h("feFuncR",{slope:l,type:"linear"}),h("feFuncG",{slope:l,type:"linear"}),h("feFuncB",{slope:l,type:"linear"})),h("feMerge",null,h("feMergeNode",{in:"intensityBlur"}),h("feMergeNode",{in:"intensityBrightness"}),h("feGaussianBlur",{stdDeviation:n/10})))}function C(t,i,r,n={}){const o=[],s=[],a=++k,l=V(n.effectView,i,a);let c=null;if(l){const t=n.effectView?.effects.find((t=>"bloom"===t.type)),e=(t.strength?t.strength+t.radius/2:0)/3,o=i+i*e,s=r+r*e;c=[Math.max(o,10),Math.max(s,10)]}for(let e=0;e<t.length;e++){const a=t[e],l=[],f=[];let u=0,d=0,y=0;for(const t of a){const{shape:e,fill:i,stroke:r,font:s,offset:a}=t;n.ignoreStrokeWidth||"text"===e.type||(u+=r?.width||0);const h=M(i),c=A(r),p="text"===e.type?S(e,s):null;o.push($(h)),l.push(v(e,h.fill,c,p,n.ariaLabel)),f.push(T(e)),a&&(d+=a[0],y+=a[1])}const p=L(E(f),i,r,u,n.scale??!1,n.rotation,n.useRotationSize??!1,[d,y],c);let g=null;if(n.masking){const t=`mask-${e}`,i=n.masking[e];o.push(N(i,t)),g=`url(#${t})`}s.push(g?h("g",{mask:g},h("g",{transform:p},l)):h("g",{transform:p},l))}n.useRotationSize&&n.rotation&&(i=b(n.rotation,i),r=b(n.rotation,r)),l&&(e(c),i=c[0],r=c[1]);const u="display: block;";return h("svg",{"aria-label":n.ariaLabel,focusable:!1,height:r,role:"img",style:u,width:i,xmlns:f},l,h("defs",null,o),l?h("g",{filter:`url(#bloom${a})`},s):s)}export{E as computeBBox,M as generateFillAttributes,A as generateStrokeAttributes,S as generateTextAttributes,T as getBoundingBox,L as getTransformMatrix,$ as renderDef,C as renderSVG,v as renderShape};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{ReadDepth as e}from"./output/ReadDepth.glsl.js";import{CameraSpace as o}from"./util/CameraSpace.glsl.js";import{glsl as t}from"../shaderModules/interfaces.js";function i(i){const r=i.fragment;i.include(o),r.include(e),r.code.add(t`vec3 normalFromDepth(sampler2D depthMap, vec3 pixelPos, vec2 fragCoord, vec2 uv) {
|
|
6
|
+
ivec2 iuv = ivec2(uv * vec2(textureSize(depthMap, 0)));
|
|
7
|
+
float leftPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(-1, 0), 0).r);
|
|
8
|
+
float rightPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(1, 0), 0).r);
|
|
9
|
+
float bottomPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(0, -1), 0).r);
|
|
10
|
+
float topPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(0, 1), 0).r);
|
|
11
|
+
bool pickLeft = abs(pixelPos.z - leftPixelDepth) < abs(pixelPos.z - rightPixelDepth);
|
|
12
|
+
bool pickBottom = abs(pixelPos.z - bottomPixelDepth) < abs(pixelPos.z - topPixelDepth);
|
|
13
|
+
vec3 fragCoordHorizontal = pickLeft
|
|
14
|
+
? vec3(fragCoord + vec2(-1.0, 0.0), leftPixelDepth)
|
|
15
|
+
: vec3(fragCoord + vec2(1.0, 0.0), rightPixelDepth);
|
|
16
|
+
vec3 fragCoordVertical = pickBottom
|
|
17
|
+
? vec3(fragCoord + vec2(0.0, -1.0), bottomPixelDepth)
|
|
18
|
+
: vec3(fragCoord + vec2(0.0, 1.0), topPixelDepth);
|
|
19
|
+
vec3 verticalPixelPos = reconstructPosition(fragCoordHorizontal.xy, fragCoordHorizontal.z);
|
|
20
|
+
vec3 horizontalPixelPos = reconstructPosition(fragCoordVertical.xy, fragCoordVertical.z);
|
|
21
|
+
vec3 normal = normalize(cross(verticalPixelPos - pixelPos, horizontalPixelPos - pixelPos));
|
|
22
|
+
return pickLeft == pickBottom ? normal : -normal;
|
|
23
|
+
}`)}export{i as NormalFromDepth};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{throwIfAborted as d}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as _,initial as p,sync as u}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as f,invert as g,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as A}from"../../../../chunks/vec42.js";import{fromValues as P,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as S}from"../../../../chunks/boundedPlane.js";import{RenderCategory as C,InternalRenderCategory as w}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as O}from"../../terrain/TerrainRenderer.js";import{DepthFormat as y,ColorFormat as N}from"../../webgl/formats.js";import{FBOCache as D,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as v}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as H}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as F}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as U}from"../effects/RenderPlugin.js";import{RenderPluginManager as q}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{AnimationTimeStep as j}from"./AnimationTimeStep.js";import{Decorations as G,RenderRequestType as B,StencilBits as Q}from"./basicInterfaces.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{zero as W,union as X}from"./depthRange.js";import{depthRangeFromScene as Y}from"./depthRangeUtils.js";import{RenderOccludedFlag as z}from"./Material.js";import{OffscreenRendering as J}from"./OffscreenRendering.js";import{RenderContext as K,defaultRenderOccludedMask as Z}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as $,RendererTarget as ee}from"./rendererUtils.js";import{setupFeatureDefaults as te,RenderFeature as re}from"./RenderFeature.js";import{RenderPluginInput as se}from"./RenderPluginInput.js";import{RenderSlot as ie}from"./RenderSlot.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne,SnapshotSlot as he}from"./ShadowMap.js";import oe from"./SliceHelper.js";import{TransparencyPassType as de}from"./TransparencyPassType.js";import{Viewshed as le}from"./Viewshed.js";import{Transparency as _e}from"./edgeRendering/interfaces.js";import{MergedRenderer as pe}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ue}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as ce}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as me,PerformanceCategory as fe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ge}from"../../../support/RenderState.js";import{DepthStencilAttachment as Te,PixelFormat as be,PixelType as Ee,ClearBufferBit as Ae}from"../../../webgl/enums.js";class Pe{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=P(0,0,0,1),this._sliceHelper=new oe,this._blit=null,this._state=c(ge.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=O.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new j,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new se,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new D(i),this._renderStateFeatures=c(te(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._offscreen=new J(this.fboCache,this._compositingHelper),this.performanceInfo=new me(this._rctx),this._shadowMap=new ne(this.fboCache,e.viewingMode),this._viewshed=new le({fboCache:this.fboCache,view:e.view},((e,t,r)=>{t.setGLViewport(this._rctx);const{camera:s,contentCamera:i}=e;this._ensureBindParametersCamera(t,t),this._renderAllGeometry(r),this._ensureBindParametersCamera(s,i),e.camera.setGLViewport(this._rctx)})),this._shadowAccumulator=new ae(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(L.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new K(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._nodes=new F(this._renderContext),this._plugins=new q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new x,this._plugins.add(this.renderPassManager),this._plugins.add(this._viewshed),this._handles=[l((()=>this._stage.view.state.camera),(()=>n()),_),l((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(_e.TRANSPARENT):()=>{},n()}),p),l((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):R;A(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),_),l((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=H}),_)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._offscreen.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=a(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),k.prune()}get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=te(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(re.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(re.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(L.Highlight,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL,ie.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(re.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(re.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(re.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._viewshed.viewshedShadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");d(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this._stage.view.resourceController)});return this._handles.push(l((()=>r.updating),(()=>this._requestRender()),u)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;const a=$(e);let n=!1;a.forEach(((r,s)=>{if(t.done)return;let i=this._plugins.getMaterialRenderer(s);if(null==i&&r.adds.length>0){const e=new pe({material:s});e.initializeRenderContext(this._plugins._context),i=e,this._plugins.add(i)}i&&(i.modify(r),0===i.numGeometries&&(n=!0)),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),n&&this._plugins.removeEmptyMaterialRenderers(),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(L.Color,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),has.water=this._plugins.produces(L.Normal,ie.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ee.Default,s=G.ON){this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frameStart(),this._disposeBindBuffers();const i=this._offscreen,{camera:a,contentCamera:n,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(fe.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=de.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainColor=this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._viewshed.enabled;const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),p=S(this._sliceHelper.plane);s===G.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const u=i.initializeFrame(a,this._backgroundColor,r);this.hasReflections?this._bindParameters.ssr.lastFrameColor=u:u?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===G.ON;const c=this._plugins.produces(L.Color,ie.OPAQUE_TERRAIN)&&(this._terrainTransparency===O.Semitransparent||this._terrainTransparency===O.TransparentWithDraped),m=this._highQualityTransparency&&c,f=this._plugins.produces(L.Color,...Ie);this._prepareShaders(m,f),this.performanceInfo.advance(fe.PREPARE);const g=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,g),this._ensureBindParametersCamera(a,n);let T=this._renderNormals();if(this._pluginInput.set("normals",T),T){let e=null;this._needsDepth&&(e=T.getAttachment(Te),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(e),T=null}else this._renderAllGeometryDepth();this._renderShadowAccumulation(g,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=L.Color,i.bindFbo(),this._bindParameters.mainColor=i.colorTexture,this._bindParameters.mainDepth=i.depthTexture;const b=this.plugins.produces(L.Color,...we);b&&this._renderOpaqueGeometry(),this._offscreen.updateColor((e=>this._renderNodes(C.OPAQUE,e,b))),this.fboCache.debugCallback?.("opaque-color",this._offscreen.color.fbo),this._renderPlugins(ie.OPAQUE_ENVIRONMENT,fe.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(m),this._setMultipassTerrain(m),this._renderEdges(_e.OPAQUE),i.bindFbo(),this._renderPlugins(ie.VOXEL,fe.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(Re.Geometry):this._renderTransparentMaterial()),this._offscreen.updateColor((e=>this._renderNodes(C.TRANSPARENT,e,f))),this.fboCache.debugCallback?.("transparent-color",this._offscreen.color.fbo),this._renderMultipassGeometryDepth(m),this._renderHUDVisibility(),m||this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS);const E=r===ee.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(_e.TRANSPARENT);const A=c?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(fe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(v.Occluded):i.compositeToHUDVisibility(this._bindParameters,A.getTexture()),this._renderHUD(v.Occluded,i.color))),this._setTerrainCulling(!1),A&&(i.compositeToFramebuffer(this._bindParameters,A.getTexture(),ue.PremultipliedAlpha,1),A.release(),m&&(this._renderEdges(_e.OPAQUE),f&&(this._oitEnabled?this._renderOITPass(Re.Geometry):this._renderTransparentMaterial(),this.performanceInfo.advance(fe.TRANSPARENT)),this._renderEdges(_e.TRANSPARENT))),this._bindParameters.ssao=h(this._bindParameters.ssao),m&&this._renderLineCallouts(v.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),this._renderViewshed(),this._renderLaserlines(),this._renderOccluded(),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._offscreen.updateColor((e=>this._renderNodes(C.COMPOSITE,e)));const P=this._nodes.produces("aa-color"),R=!(r!==ee.Default||_||l&&s===G.ON&&r===ee.Default),I=this._pluginInput.get("composite-color"),y=R?M:this.fboCache.acquire(I.fbo.width,I.fbo.height,"aa-color"),N=P?this._renderNodes(w.ANTIALIASING,y):this._blitToDefault(I,y,!1);this._pluginInput.set(w.ANTIALIASING,N),this._renderHUD(v.NotOccluded,N);const D=this._renderNodes(w.HIGHLIGHTS,N);let x=this._renderNodes(w.MAGNIFIER,D);return l&&s===G.ON&&r===ee.Default&&!_&&(x=this._blitToDefault(x)),_?(x.attachDepth(i.depth),this._blitToDefault(this._renderNodes(C.FINAL,x)),x.detachDepth()):this._pluginInput.set(C.FINAL,x),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=p,this._isRendering=!1,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ee.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:E}}_prepareShaders(e,t){this._renderContext.output=L.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ie.LINE_CALLOUTS),t&&this._prepareTransparencySlots(),this._plugins.prepare(ie.VIEWSHED,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT,ie.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oid");return t.acquireDepth(y.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(t.fbo),this.fboCache.rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(L.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(t.fbo),this.fboCache.rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=v.NotOccluded,this._plugins.render(this._pluginInput,ie.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(fe.OBJECT_AND_LAYER_ID_COLOR),t}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===B.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0,s=t?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){if(!this._bindParameters.mainDepth)return;const{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"linear-depth");this._rctx.bindFramebuffer(i.fbo),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,this._bindParameters.mainDepth),i.fbo?.readPixels(e[0],e[1],e[2],e[3],be.RGBA,Ee.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,be.RGBA,Ee.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const{width:r,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(r,s,"edges"),n=()=>t.render(this._bindParameters,e),h=this._bindParameters.multipassGeometry.depth;this._offscreen.renderToTargets(n,a,h??i,Ce),this._offscreen.compositeToFramebuffer(this._bindParameters,a.getTexture(),ue.Alpha,1),a.release(),this.performanceInfo.advance(e===_e.OPAQUE?fe.OPAQUE_EDGES:fe.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(re.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(L.ShadowHighlight,this._shadowMap),s.moveSnapshot(he.Highlight),this._renderShadowCascades(L.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(he.ExcludeHighlight),this._renderShadowCascades(L.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(L.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(fe.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this._renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(L.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=h(this._bindParameters.depth));const{width:t,height:r}=this._offscreen,s=this.fboCache.acquire(t,r,"depth");s.attachDepth(e),e.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(L.Depth),h(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(fe.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=h(this._bindParameters.depth));const{width:e,height:t}=this._offscreen,r=this.fboCache.acquire(e,t,"depth").acquireDepth(y.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(L.Depth),h(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(fe.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=L.Depth;const{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"terrain depth").acquireDepth(y.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"geometry depth").acquireDepth(y.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(L.Depth),this._renderContext.output=t,h(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=i.obtainDepthTexture(),i.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const t=Y(e,this._plugins.plugins,this._stage.layers);return X(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._offscreen.renderToCachedFBO(null,"normals",(()=>this._renderGeometryForSSAO(L.Normal)),[0,0,0,0],N.RGBA,y.DEPTH_STENCIL_TEXTURE),s=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color");return r.retain(t+s-1),this.performanceInfo.advance(fe.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();const t=this._nodes.render("ssao",this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.OPAQUE_NO_SSAO_DEPTH,ie.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...we,ie.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...we)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...Ie)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ie.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ie.TRANSPARENT_TERRAIN);if(e!==L.Color)return void t();const{width:r,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(r,s,"transparent terrain");return this._offscreen.renderToTargets(t,a,i,[0,0,0,0]),a}_renderHUDVisibility(){this._plugins.produces(this._renderContext.output,ie.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._plugins.render(this._pluginInput,ie.OCCLUSION_PIXELS)),this._bindParameters.multipassGeometry.depth),this._offscreen.bindFbo(),this.performanceInfo.advance(fe.HUD_VISIBILITY)):this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===v.Occluded){const e=()=>this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS),{width:t,height:r,color:s}=this._offscreen,i=this.fboCache.acquireDepth(y.DEPTH16_BUFFER,t,r,"line callouts");this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS)}_renderLaserlines(){const e=this._plugins.produces(this._renderContext.output,ie.LASERLINES_CONTRAST_CONTROL);if(this._plugins.produces(this._renderContext.output,ie.LASERLINES)||e){if(this._plugins.render(this._pluginInput,ie.LASERLINES),e){const e=this._offscreen,{width:t,height:r,depth:s}=e,i=this.fboCache.acquire(t,r,"laser lines"),a=()=>this._plugins.render(this._pluginInput,ie.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Ce),e.compositeToFramebuffer(this._bindParameters,i.getTexture(),ue.PremultipliedAlpha,1),i.release()}this.performanceInfo.advance(fe.LASER_LINES)}}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOITPass(Re.HUD,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,r.getTexture(),ue.PremultipliedAlpha),r.release()}else if(e===v.Occluded){this._renderContext.output=L.Color;const t=()=>this._renderHUDElements(e),{width:r,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(y.DEPTH16_BUFFER,r,s,"hud");this._offscreen.renderToTargets(t,i,a,void 0,!0,!0),a.release()}else this._renderContext.output=L.Color,t.acquireDepth(y.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===v.Occluded?fe.HUD_OCCLUDED:fe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(L.ShadowHighlight,ie.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const e=()=>{this._renderAllGeometry(L.Highlight),this._rctx.clear(Ae.DEPTH_BUFFER_BIT),this._renderHUDElements(v.Both)},t=this._offscreen.renderToCachedFBO(null,"highlights",e,[0,0,0,0],N.RGBA4,y.DEPTH_STENCIL_TEXTURE);return t.detachDepth(),t}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(fe.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(){this._renderContext.output=L.Color,this._bindParameters.transparencyPassType=de.ColorAlpha,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=de.FrontFace,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=de.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t=v.Both){const r=e===Re.HUD,s=r?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oit hud composite"):null,i=r?()=>this._renderHUDElements(t):()=>this._renderTransparentMaterial(),a=this._renderContext.output;this._renderContext.output=L.Color,this._bindParameters.transparencyPassType=de.ColorAlpha;const n=this._offscreen.renderOITPass(i,de.ColorAlpha,r);this._bindParameters.transparencyPassType=de.FrontFace;const h=this._offscreen.renderOITPass(i,de.FrontFace,r);return this._offscreen.compositeOIT(this._bindParameters,n,h,s),s?.detachDepth(),h.release(),n.release(),this._bindParameters.transparencyPassType=de.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;Oe.clear(),this._plugins.plugins.forAll((t=>{if(!t.materialReference)return;t.queryRenderOccludedState(z.OccludeAndTransparentStencil)&&(e|=z.OccludeAndTransparentStencil,Oe.push(t))}));const t=this._offscreen,r=(r,s,i,a,n)=>{if(!(e&s))return;const{width:h,height:o,depth:d}=t,l=this.fboCache.acquire(h,o,"tmp color");t.renderToTargets(i,l,d,[0,0,0,0],a,n),t.compositeToFramebuffer(this._bindParameters,l.getTexture(),ue.PremultipliedAlpha,r),l.release()},s=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(U(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==Oe.length&&(s(ie.OCCLUDER_MATERIAL,Oe),r(.5,z.OccludeAndTransparentStencil,(()=>s(ie.TRANSPARENT_OCCLUDER_MATERIAL,Oe)),!1,!1));const i=Oe.length>0;Oe.clear(),this._plugins.plugins.forAll((t=>{if(!t.materialReference)return;const r=t.queryRenderOccludedState(z.OccludeAndTransparent),s=t.queryRenderOccludedState(z.Transparent),i=t.queryRenderOccludedState(z.Opaque);(r||s||i)&&(e|=r?z.OccludeAndTransparent:s?z.Transparent:z.Opaque,Oe.push(t))}));const a=this._plugins.renderOccludedFlags;if(e|=a,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,a>z.Occlude&&this._plugins.render(this._pluginInput,ie.OCCLUDED_TERRAIN),s(ie.OPAQUE_MATERIAL,Oe),s(ie.TRANSPARENT_MATERIAL,Oe),s(ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Oe),this._renderContext.renderOccludedMask=Z};this._renderContext.output=L.Color,r(.5,z.OccludeAndTransparent,(()=>n(z.OccludeAndTransparent)),!0,Q.OutlineVisualElementMask),r(.5,z.Transparent,(()=>n(z.Transparent)),!0,Q.OutlineVisualElementMask),r(1,z.Opaque,(()=>n(z.Opaque)),!0,Q.OutlineVisualElementMask),(i||Oe.length>0)&&this.performanceInfo.advance(fe.OCCLUDED),Oe.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._offscreen.bindFbo(),this._plugins.render(this._pluginInput,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(fe.TRANSPARENT_ENVIRONMENT)}_renderViewshed(){this._plugins.produces(this._renderContext.output,ie.VIEWSHED)&&(this._viewshed.renderHighQuality=this.isFeatureEnabled(re.HighResolutionViewshed),this._plugins.render(this._pluginInput,ie.VIEWSHED),this.performanceInfo.advance(fe.VIEWSHED))}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;t.setName(e),this._pluginInput.set(e,t);const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitToDefault(e,t=M,r=!0){this._blit||(this._blit=new V(this._techniques));const s=this._blit.render(this._rctx,e,t,this._bindParameters,this._requestRender);return this._pluginInput.set(e.name,s),r&&e.release(),s}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(g(Ne,this._bindParameters.camera.viewMatrix),g(ye,this._bindParameters.camera.projectionMatrix),T(De,Ne,ye),T(De,this._renderContext.lastFrameCamera.viewMatrix,De),T(De,this._renderContext.lastFrameCamera.projectionMatrix,De),this._reprojectionMatrix=De);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}get test(){}}var Re,Se;e([m({readOnly:!0})],Pe.prototype,"fullResolutionAtmosphere",null),e([m()],Pe.prototype,"_edgeView",void 0),e([m()],Pe.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Re||(Re={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility",e[e.ViewshedShadowMap=4]="ViewshedShadowMap"}(Se||(Se={}));const Ce=[0,0,0,0],we=[ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.OPAQUE_NO_SSAO_DEPTH],Ie=[ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH],Oe=new o,ye=E(),Ne=E(),De=E();function Me(e){return t=>e.immediate.schedule(t)}export{Se as FramebufferId,Pe as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{throwIfAborted as d}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as _,initial as p,sync as u}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as f,invert as g,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as A}from"../../../../chunks/vec42.js";import{fromValues as P,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as S}from"../../../../chunks/boundedPlane.js";import{RenderCategory as C,InternalRenderCategory as w}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as O}from"../../terrain/TerrainRenderer.js";import{DepthFormat as y,ColorFormat as N}from"../../webgl/formats.js";import{FBOCache as D,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as v}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as H}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as F}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as U}from"../effects/RenderPlugin.js";import{RenderPluginManager as q}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{AnimationTimeStep as j}from"./AnimationTimeStep.js";import{Decorations as G,RenderRequestType as B,StencilBits as Q}from"./basicInterfaces.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{zero as W,union as X}from"./depthRange.js";import{depthRangeFromScene as Y}from"./depthRangeUtils.js";import{RenderOccludedFlag as z}from"./Material.js";import{OffscreenRendering as J}from"./OffscreenRendering.js";import{RenderContext as K,defaultRenderOccludedMask as Z}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as $,RendererTarget as ee}from"./rendererUtils.js";import{setupFeatureDefaults as te,RenderFeature as re}from"./RenderFeature.js";import{RenderPluginInput as se}from"./RenderPluginInput.js";import{RenderSlot as ie}from"./RenderSlot.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne,SnapshotSlot as he}from"./ShadowMap.js";import oe from"./SliceHelper.js";import{TransparencyPassType as de}from"./TransparencyPassType.js";import{Viewshed as le}from"./Viewshed.js";import{Transparency as _e}from"./edgeRendering/interfaces.js";import{MergedRenderer as pe}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ue}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as ce}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as me,PerformanceCategory as fe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ge}from"../../../support/RenderState.js";import{DepthStencilAttachment as Te,PixelFormat as be,PixelType as Ee,ClearBufferBit as Ae}from"../../../webgl/enums.js";class Pe{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=P(0,0,0,1),this._sliceHelper=new oe,this._blit=null,this._state=c(ge.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=O.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new j,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new se,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new D(i),this._renderStateFeatures=c(te(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._offscreen=new J(this.fboCache,this._compositingHelper),this.performanceInfo=new me(this._rctx),this._shadowMap=new ne(this.fboCache,e.viewingMode),this._viewshed=new le({fboCache:this.fboCache,view:e.view},((e,t,r)=>{t.setGLViewport(this._rctx);const{camera:s,contentCamera:i}=e;this._ensureBindParametersCamera(t,t),this._renderAllGeometry(r),this._ensureBindParametersCamera(s,i),e.camera.setGLViewport(this._rctx)})),this._shadowAccumulator=new ae(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(L.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new K(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._nodes=new F(this._renderContext),this._plugins=new q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new x,this._plugins.add(this.renderPassManager),this._plugins.add(this._viewshed),this._handles=[l((()=>this._stage.view.state.camera),(()=>n()),_),l((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(_e.TRANSPARENT):()=>{},n()}),p),l((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):R;A(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),_),l((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=H}),_)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._offscreen.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=a(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),k.prune()}get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=te(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(re.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(re.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(L.Highlight,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL,ie.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(re.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(re.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(re.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._viewshed.viewshedShadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");d(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this._stage.view.resourceController)});return this._handles.push(l((()=>r.updating),(()=>this._requestRender()),u)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;const a=$(e);let n=!1;a.forEach(((r,s)=>{if(t.done)return;let i=this._plugins.getMaterialRenderer(s);if(null==i&&r.adds.length>0){const e=new pe({material:s});e.initializeRenderContext(this._plugins._context),i=e,this._plugins.add(i)}i&&(i.modify(r),0===i.numGeometries&&(n=!0)),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),n&&this._plugins.removeEmptyMaterialRenderers(),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(L.Color,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),has.water=this._plugins.produces(L.Normal,ie.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ee.Default,s=G.ON){this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frameStart(),this._disposeBindBuffers();const i=this._offscreen,{camera:a,contentCamera:n,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(fe.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=de.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainColor=this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._viewshed.enabled;const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),p=S(this._sliceHelper.plane);s===G.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const u=i.initializeFrame(a,this._backgroundColor,r);this.hasReflections?this._bindParameters.ssr.lastFrameColor=u:u?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===G.ON;const c=this._plugins.produces(L.Color,ie.OPAQUE_TERRAIN)&&(this._terrainTransparency===O.Semitransparent||this._terrainTransparency===O.TransparentWithDraped),m=this._highQualityTransparency&&c,f=this._plugins.produces(L.Color,...Ie);this._prepareShaders(m,f),this.performanceInfo.advance(fe.PREPARE);const g=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,g),this._ensureBindParametersCamera(a,n);let T=this._renderNormals();if(this._pluginInput.set("normals",T),T){let e=null;this._needsDepth&&(e=T.getAttachment(Te),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(e),T=null}else this._renderAllGeometryDepth();this._renderShadowAccumulation(g,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=L.Color,i.bindFbo(),this._bindParameters.mainColor=i.colorTexture,this._bindParameters.mainDepth=i.depthTexture;const b=this.plugins.produces(L.Color,...we);b&&this._renderOpaqueGeometry(),this._offscreen.updateColor((e=>this._renderNodes(C.OPAQUE,e,b))),this.fboCache.debugCallback?.("opaque-color",this._offscreen.color.fbo),this._renderPlugins(ie.OPAQUE_ENVIRONMENT,fe.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(m),this._setMultipassTerrain(m),this._renderEdges(_e.OPAQUE),i.bindFbo(),this._renderPlugins(ie.VOXEL,fe.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(Re.Geometry):this._renderTransparentMaterial()),this._offscreen.updateColor((e=>this._renderNodes(C.TRANSPARENT,e,f))),this.fboCache.debugCallback?.("transparent-color",this._offscreen.color.fbo),this._renderMultipassGeometryDepth(m),this._renderHUDVisibility(),m||this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS);const E=r===ee.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(_e.TRANSPARENT);const A=c?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(fe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(v.Occluded):i.compositeToHUDVisibility(this._bindParameters,A.getTexture()),this._renderHUD(v.Occluded,i.color))),this._setTerrainCulling(!1),A&&(i.compositeToFramebuffer(this._bindParameters,A.getTexture(),ue.PremultipliedAlpha,1),A.release(),m&&(this._renderEdges(_e.OPAQUE),f&&(this._oitEnabled?this._renderOITPass(Re.Geometry):this._renderTransparentMaterial(),this.performanceInfo.advance(fe.TRANSPARENT)),this._renderEdges(_e.TRANSPARENT))),this._bindParameters.ssao=h(this._bindParameters.ssao),m&&this._renderLineCallouts(v.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),this._renderViewshed(),this._renderLaserlines(),this._renderOccluded(),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._offscreen.updateColor((e=>this._renderNodes(C.COMPOSITE,e)));const P=this._nodes.produces("aa-color"),R=!(r!==ee.Default||_||l&&s===G.ON&&r===ee.Default),I=this._pluginInput.get("composite-color"),y=R?M:this.fboCache.acquire(I.fbo.width,I.fbo.height,"aa-color"),N=P?this._renderNodes(w.ANTIALIASING,y):this._blitToDefault(I,y,!1);this._pluginInput.set(w.ANTIALIASING,N),this._renderHUD(v.NotOccluded,N);const D=this._renderNodes(w.HIGHLIGHTS,N);let x=this._renderNodes(w.MAGNIFIER,D);return l&&s===G.ON&&r===ee.Default&&!_&&(x=this._blitToDefault(x)),_?(x.attachDepth(i.depth),this._blitToDefault(this._renderNodes(C.FINAL,x)),x.detachDepth()):this._pluginInput.set(C.FINAL,x),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=p,this._isRendering=!1,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ee.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:E}}_prepareShaders(e,t){this._renderContext.output=L.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ie.LINE_CALLOUTS),t&&this._prepareTransparencySlots(),this._plugins.prepare(ie.VIEWSHED,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT,ie.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oid");return t.acquireDepth(y.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(t.fbo),this.fboCache.rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(L.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(t.fbo),this.fboCache.rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=v.NotOccluded,this._plugins.render(this._pluginInput,ie.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(fe.OBJECT_AND_LAYER_ID_COLOR),t}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===B.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0,s=t?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){if(!this._bindParameters.mainDepth)return;const{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"linear-depth");this._rctx.bindFramebuffer(i.fbo),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,this._bindParameters.mainDepth),i.fbo?.readPixels(e[0],e[1],e[2],e[3],be.RGBA,Ee.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,be.RGBA,Ee.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const{width:r,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(r,s,"edges"),n=()=>t.render(this._bindParameters,e),h=this._bindParameters.multipassGeometry.depth;this._offscreen.renderToTargets(n,a,h??i,Ce),this._offscreen.compositeToFramebuffer(this._bindParameters,a.getTexture(),ue.Alpha,1),a.release(),this.performanceInfo.advance(e===_e.OPAQUE?fe.OPAQUE_EDGES:fe.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(re.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(L.ShadowHighlight,this._shadowMap),s.moveSnapshot(he.Highlight),this._renderShadowCascades(L.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(he.ExcludeHighlight),this._renderShadowCascades(L.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(L.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(fe.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this._renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(L.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=h(this._bindParameters.depth));const{width:t,height:r}=this._offscreen,s=this.fboCache.acquire(t,r,"depth");s.attachDepth(e),e.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(L.Depth),h(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(fe.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=h(this._bindParameters.depth));const{width:e,height:t}=this._offscreen,r=this.fboCache.acquire(e,t,"depth").acquireDepth(y.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(L.Depth),h(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(fe.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=L.Depth;const{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"terrain depth").acquireDepth(y.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"geometry depth").acquireDepth(y.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(L.Depth),this._renderContext.output=t,h(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=i.obtainDepthTexture(),i.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const t=Y(e,this._plugins.plugins,this._stage.layers);return X(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._offscreen.renderToCachedFBO(null,"normals",(()=>this._renderGeometryForSSAO(L.Normal)),[0,0,0,0],N.RGBA,y.DEPTH_STENCIL_TEXTURE),s=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color")+(this._viewshedEnabled?1:0);return r.retain(t+s-1),this.performanceInfo.advance(fe.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();const t=this._nodes.render("ssao",this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.OPAQUE_NO_SSAO_DEPTH,ie.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...we,ie.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...we)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...Ie)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ie.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ie.TRANSPARENT_TERRAIN);if(e!==L.Color)return void t();const{width:r,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(r,s,"transparent terrain");return this._offscreen.renderToTargets(t,a,i,[0,0,0,0]),a}_renderHUDVisibility(){this._plugins.produces(this._renderContext.output,ie.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._plugins.render(this._pluginInput,ie.OCCLUSION_PIXELS)),this._bindParameters.multipassGeometry.depth),this._offscreen.bindFbo(),this.performanceInfo.advance(fe.HUD_VISIBILITY)):this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===v.Occluded){const e=()=>this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS),{width:t,height:r,color:s}=this._offscreen,i=this.fboCache.acquireDepth(y.DEPTH16_BUFFER,t,r,"line callouts");this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS)}_renderLaserlines(){const e=this._plugins.produces(this._renderContext.output,ie.LASERLINES_CONTRAST_CONTROL);if(this._plugins.produces(this._renderContext.output,ie.LASERLINES)||e){if(this._plugins.render(this._pluginInput,ie.LASERLINES),e){const e=this._offscreen,{width:t,height:r,depth:s}=e,i=this.fboCache.acquire(t,r,"laser lines"),a=()=>this._plugins.render(this._pluginInput,ie.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Ce),e.compositeToFramebuffer(this._bindParameters,i.getTexture(),ue.PremultipliedAlpha,1),i.release()}this.performanceInfo.advance(fe.LASER_LINES)}}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOITPass(Re.HUD,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,r.getTexture(),ue.PremultipliedAlpha),r.release()}else if(e===v.Occluded){this._renderContext.output=L.Color;const t=()=>this._renderHUDElements(e),{width:r,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(y.DEPTH16_BUFFER,r,s,"hud");this._offscreen.renderToTargets(t,i,a,void 0,!0,!0),a.release()}else this._renderContext.output=L.Color,t.acquireDepth(y.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===v.Occluded?fe.HUD_OCCLUDED:fe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(L.ShadowHighlight,ie.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const e=()=>{this._renderAllGeometry(L.Highlight),this._rctx.clear(Ae.DEPTH_BUFFER_BIT),this._renderHUDElements(v.Both)},t=this._offscreen.renderToCachedFBO(null,"highlights",e,[0,0,0,0],N.RGBA4,y.DEPTH_STENCIL_TEXTURE);return t.detachDepth(),t}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(fe.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(){this._renderContext.output=L.Color,this._bindParameters.transparencyPassType=de.ColorAlpha,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=de.FrontFace,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=de.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t=v.Both){const r=e===Re.HUD,s=r?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oit hud composite"):null,i=r?()=>this._renderHUDElements(t):()=>this._renderTransparentMaterial(),a=this._renderContext.output;this._renderContext.output=L.Color,this._bindParameters.transparencyPassType=de.ColorAlpha;const n=this._offscreen.renderOITPass(i,de.ColorAlpha,r);this._bindParameters.transparencyPassType=de.FrontFace;const h=this._offscreen.renderOITPass(i,de.FrontFace,r);return this._offscreen.compositeOIT(this._bindParameters,n,h,s),s?.detachDepth(),h.release(),n.release(),this._bindParameters.transparencyPassType=de.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;Oe.clear(),this._plugins.plugins.forAll((t=>{if(!t.materialReference)return;t.queryRenderOccludedState(z.OccludeAndTransparentStencil)&&(e|=z.OccludeAndTransparentStencil,Oe.push(t))}));const t=this._offscreen,r=(r,s,i,a,n)=>{if(!(e&s))return;const{width:h,height:o,depth:d}=t,l=this.fboCache.acquire(h,o,"tmp color");t.renderToTargets(i,l,d,[0,0,0,0],a,n),t.compositeToFramebuffer(this._bindParameters,l.getTexture(),ue.PremultipliedAlpha,r),l.release()},s=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(U(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==Oe.length&&(s(ie.OCCLUDER_MATERIAL,Oe),r(.5,z.OccludeAndTransparentStencil,(()=>s(ie.TRANSPARENT_OCCLUDER_MATERIAL,Oe)),!1,!1));const i=Oe.length>0;Oe.clear(),this._plugins.plugins.forAll((t=>{if(!t.materialReference)return;const r=t.queryRenderOccludedState(z.OccludeAndTransparent),s=t.queryRenderOccludedState(z.Transparent),i=t.queryRenderOccludedState(z.Opaque);(r||s||i)&&(e|=r?z.OccludeAndTransparent:s?z.Transparent:z.Opaque,Oe.push(t))}));const a=this._plugins.renderOccludedFlags;if(e|=a,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,a>z.Occlude&&this._plugins.render(this._pluginInput,ie.OCCLUDED_TERRAIN),s(ie.OPAQUE_MATERIAL,Oe),s(ie.TRANSPARENT_MATERIAL,Oe),s(ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Oe),this._renderContext.renderOccludedMask=Z};this._renderContext.output=L.Color,r(.5,z.OccludeAndTransparent,(()=>n(z.OccludeAndTransparent)),!0,Q.OutlineVisualElementMask),r(.5,z.Transparent,(()=>n(z.Transparent)),!0,Q.OutlineVisualElementMask),r(1,z.Opaque,(()=>n(z.Opaque)),!0,Q.OutlineVisualElementMask),(i||Oe.length>0)&&this.performanceInfo.advance(fe.OCCLUDED),Oe.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._offscreen.bindFbo(),this._plugins.render(this._pluginInput,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(fe.TRANSPARENT_ENVIRONMENT)}_renderViewshed(){this._viewshedEnabled&&(this._viewshed.renderHighQuality=this.isFeatureEnabled(re.HighResolutionViewshed),this._plugins.render(this._pluginInput,ie.VIEWSHED),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.VIEWSHED))}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;t.setName(e),this._pluginInput.set(e,t);const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitToDefault(e,t=M,r=!0){this._blit||(this._blit=new V(this._techniques));const s=this._blit.render(this._rctx,e,t,this._bindParameters,this._requestRender);return this._pluginInput.set(e.name,s),r&&e.release(),s}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(g(Ne,this._bindParameters.camera.viewMatrix),g(ye,this._bindParameters.camera.projectionMatrix),T(De,Ne,ye),T(De,this._renderContext.lastFrameCamera.viewMatrix,De),T(De,this._renderContext.lastFrameCamera.projectionMatrix,De),this._reprojectionMatrix=De);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}get _viewshedEnabled(){return this._viewshed.enabled&&this._plugins.produces(this._renderContext.output,ie.VIEWSHED)}get test(){}}var Re,Se;e([m({readOnly:!0})],Pe.prototype,"fullResolutionAtmosphere",null),e([m()],Pe.prototype,"_edgeView",void 0),e([m()],Pe.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Re||(Re={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility",e[e.ViewshedShadowMap=4]="ViewshedShadowMap"}(Se||(Se={}));const Ce=[0,0,0,0],we=[ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.OPAQUE_NO_SSAO_DEPTH],Ie=[ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH],Oe=new o,ye=E(),Ne=E(),De=E();function Me(e){return t=>e.immediate.schedule(t)}export{Se as FramebufferId,Pe as Renderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Collection.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{watch as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Collection.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{watch as r,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as h,fromTranslation as d,scale as c,mul as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{z as p}from"../../../../chunks/vec32.js";import{create as m,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ShaderOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as _,ConsumesDepth as v,ConsumesNone as g}from"../effects/RenderPlugin.js";import{RenderSlot as x}from"./RenderSlot.js";import{ViewshedShadowMap as b}from"./ViewshedShadowMap.js";import{V as j}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as M}from"../shaders/ViewshedTechnique.js";import{ViewshedTechniqueConfiguration as S}from"../shaders/ViewshedTechniqueConfiguration.js";let C=class extends _{get viewshedShadowMap(){return this._viewshedShadowMap}get enabled(){return this._viewsheds.length>0}constructor(e,i){super(e),this._pluginContext=null,this.renderHighQuality=!1,this._parameters=new j,this._configuration=new S,this._viewsheds=new t,this.produces=new Map([[x.VIEWSHED,()=>!0]]),this._renderShadowMap=i}initialize(){this.addHandles(r((()=>this.view.qualitySettings.maximumPixelRatio),(e=>this._maximumPixelRatio=e),o))}destroy(){this.uninitializeRenderContext()}consumes(){return this.enabled?v:g}initializeRenderContext(e){this._pluginContext=e,this._viewshedShadowMap=new b(this.fboCache),this._viewshedShadowMap.enabled=!0}renderNode(e,t,i){const{bindParameters:s,rctx:r}=e;if(!this.enabled||!s.depth||null==i)return;const o=this._setupNormals(i);if(null!=this._technique&&this._configuration.useNormalMap===o||(this._configuration.useNormalMap=o,this._technique=this._pluginContext?.techniques.acquire(M,this._configuration)),this._technique?.compiled)for(const a of this._viewsheds){const t=e.rctx.getBoundFramebufferObject(),i=this._renderViewshedShadowCubeMap(s,a),o=this._viewshedShadowMap;i&&null!=o.depthTexture&&!o.isTextureZero&&(this._setPassParameters(a),e.rctx.bindFramebuffer(t),r.bindTechnique(this._technique,s,this._parameters),r.screen.draw())}else this._pluginContext?.requestRender()}uninitializeRenderContext(){this._pluginContext=null,this._viewshedShadowMap.dispose(),this._technique=s(this._technique)}updateViewsheds(e){const i=e.removes;null!=i&&(t.isCollection(i)?this._viewsheds.removeMany(i):this._viewsheds.remove(i));const s=e.adds;if(null!=s)if(t.isCollection(s)){const e=s.filter((e=>!this._viewsheds.includes(e)));this._viewsheds.addMany(e)}else this._viewsheds.includes(s)||this._viewsheds.add(s)}_renderViewshedShadowCubeMap(e,t){const i=this._viewshedShadowMap;if(!i.enabled)return!1;const s=i.start(e.camera,t,this.renderHighQuality,this._maximumPixelRatio);if(s)for(const r of i.faces)this._renderShadowMap(e,r,f.ViewshedShadow);return i.finish(),s}_setPassParameters(e){const t=this._parameters,s=this._viewshedShadowMap,r=e.observerRenderSpace;t.localOrigin=r,t.fovs=[i(e.horizontalFieldOfView),i(e.verticalFieldOfView)],t.headingAndTilt=[i(e.heading),i(e.tiltParallelToSurface)],t.upVector=e.tiltedUpVector;const o=V(e.targetRenderSpace,r);t.targetVector=o,t.shadowMap=s;const a=[],n=[];for(let i=0;i<s.numActiveFaces;i++)h(y,s.viewshedViewMatrices[i],r),a.push(...y.flat()),q(s.viewshedProjectionMatrices[i],y,R),n.push(...R.flat());t.viewMatrices=a,t.projectionMatrices=n}_setupNormals(e){const t=e.get("normals"),i=t?.getTexture();return this._parameters.normalTexture=i,null!=i}get test(){return{viewsheds:this._viewsheds}}};function V(e,t){const i=m();return p(i,e,t)}function q(e,t,i){const s=w(.5,.5,.5);return d(i,s),c(i,i,s),l(i,i,e),l(i,i,t),i}e([a()],C.prototype,"_pluginContext",void 0),e([a()],C.prototype,"fboCache",void 0),e([a()],C.prototype,"view",void 0),e([a()],C.prototype,"viewshedShadowMap",null),C=e([n("esri.views.3d.webgl-engine.lib.Viewshed")],C);const y=u(),R=u();export{C as Viewshed};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../chunks/vec32.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../core/shaderLibrary/
|
|
5
|
+
import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../chunks/vec32.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../core/shaderLibrary/NormalFromDepth.glsl.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/ShadowMap.js";export{b as build}from"../../../../chunks/ShadowHighlight.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/output/ReadDepth.glsl.js";import"../core/shaderLibrary/util/LocalFromScreenSpace.glsl.js";import"../core/shaderLibrary/util/RgbaFloat16Encoding.glsl.js";import"../core/shaderLibrary/util/TextureAtlasLookup.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/FloatsPassUniform.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../core/shaderModules/Matrix4sPassUniform.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";export{V as ViewshedPassParameters,b as build}from"../../../../chunks/Viewshed.glsl.js";
|
|
5
|
+
import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../core/shaderLibrary/NormalFromDepth.glsl.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/output/ReadDepth.glsl.js";import"../core/shaderLibrary/util/LocalFromScreenSpace.glsl.js";import"../core/shaderLibrary/util/RgbaFloat16Encoding.glsl.js";import"../core/shaderLibrary/util/TextureAtlasLookup.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/FloatsPassUniform.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../core/shaderModules/Matrix4sPassUniform.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";export{V as ViewshedPassParameters,b as build}from"../../../../chunks/Viewshed.glsl.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{ShaderTechniqueConfiguration as o,parameter as r}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class s extends o{constructor(){super(...arguments),this.useNormalMap=!0}}e([r()],s.prototype,"useNormalMap",void 0);export{s as ViewshedTechniqueConfiguration};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{convertDateFormatToIntlOptions as n,formatDate as r}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l,isTimeOnlyField as u}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{formatAnyDate as f,isAnyDateField as c}from"../../../smartMapping/support/utils.js";import{loadArcade as d}from"../../../support/arcadeOnDemand.js";import{getTimeZoneFormattingOptions as p}from"../../../time/timeZoneUtils.js";const y="esri.widgets.Feature.support.featureUtils",m=()=>e.getLogger(y),g=/href=(""|'')/gi,h=/(\{([^{\r\n]+)\})/g,b=/'/g,I=/^\s*expression\//i,T=/(\n)/gi,w=/[\u00A0-\u9999<>&]/gim,F=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,N=/^(?:mailto:|tel:)/,j="relationships/",Z=n("short-date-short-time");function L(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function E({type:e,value:t,event:n}){try{return"function"==typeof t?t(n):t}catch(r){return void m().error("error",`An error occurred when calling the "${e}" function`,{error:r,graphic:n.graphic,value:t})}}function v(e=""){if(e)return!N.test(e.trim().toLowerCase())}function x(e){return!!e&&I.test(e)}function A(e,t){if(!t||!x(t)||!e)return;const n=t.replace(I,"").toLowerCase();return e.find((({name:e})=>e.toLowerCase()===n))}function C(e,t){const n=A(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function M(e,t){const n=t.get(e.toLowerCase());return`{${n?.fieldName||e}}`}function U(e){return e.replaceAll(g,"")}function q(e,t){const n=$(t,e);return n?n.name:e}function R(e,t){return e&&e.map((e=>q(e,t)))}function $(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function k(e){return`${e}`.trim()}function D({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?z({formattedAttributes:t,template:Q(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function z({formattedAttributes:e,template:n,fieldInfoMap:r}){return k(U(t(t(n,(e=>M(e,r))),e)))}function O(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(b,i);t[e]=o}}function G(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>O(e,n,t))),n}function S(e,n,r){const i=(n=k(n))&&"{"!==n[0];return t(e,G(r,i||!1))}function P(e,t){return e.replaceAll(h,((e,n,r)=>{const i=$(t,r);return i?`{${i.name}}`:n}))}function Q(e,t,n){const r=P(e,n);return r?r.replaceAll(F,((e,n,r)=>S(e,n||r,t))):r}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function H(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type||"sublayer"===e.type)&&"when"in e}function B(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function J(e){return H(e)&&B(e)}function K(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&J(e.sourceLayer)}function V(e,t){const{fieldInfos:n,fieldName:r,preventPlacesFormatting:l,layer:u,timeZone:s}=t,c=Y(n,r),d=$(u,r);if(c&&!a(r)){const t=d?.type,n=c.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||n)return f(e,{format:n,fieldType:t,timeZoneOptions:{layerTimeZone:u&&"preferredTimeZone"in u?u.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:!(!u||!("datesInUnknownTimezone"in u))&&!!u.datesInUnknownTimezone}})}const p=c?.format;return"string"==typeof e&&a(r)&&p?W(e,p):"string"==typeof(e=_(e,p))||null==e||null==p?ae(e):i(e,l?{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}:o(p))}function W(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?X(e,",",", ",t):e.includes(";")?X(e,";","; ",t):e.includes(" ")?X(e," "," ",t):i(Number(e),o(t))}function X(e,t,n,r){return e.trim().split(t).map((e=>i(Number(e),o(r)))).join(n)}function Y(e,t){if(e?.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function ee({fieldName:e,graphic:t,layer:n}){if(de(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function te({fieldName:e,value:t,graphic:n,layer:r}){if(de(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n});return i&&"coded-value"===i.type?i.getName(t):null}function ne(e,t,n,i){const{creatorField:o,creationDateField:a,editorField:l,editDateField:u}=e;if(!t)return;const s=p(i&&"preferredTimeZone"in i?i.preferredTimeZone:null,!(!i||!("datesInUnknownTimezone"in i))&&!!i.datesInUnknownTimezone,n,Z,"date"),f={...Z,...s},c=t[u];if("number"==typeof c){const e=t[l];return{type:"edit",date:r(c,f),user:e}}const d=t[a];if("number"==typeof d){const e=t[o];return{type:"create",date:r(d,f),user:e}}return null}function re(e,t){const n=new Map;if(!e)return n;for(const r of e){if(!r.fieldName)continue;const e=q(r.fieldName,t);r.fieldName=e,n.set(e.toLowerCase(),r)}return n}function ie(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e?.fieldInfos;n&&t.push(...n)}})),t):t}function oe(e){return e.replaceAll(w,(e=>`&#${e.charCodeAt(0)};`))}function ae(e){return"string"==typeof e?e.replaceAll(T,'<br class="esri-text-new-line" />'):e}function le(e){const{value:t,fieldName:n,fieldInfos:r,fieldInfoMap:i,layer:o,graphic:a,timeZone:l}=e;if(null==t)return"";const s=te({fieldName:n,value:t,graphic:a,layer:o});if(s)return s;const d=ee({fieldName:n,graphic:a,layer:o});if(d)return d;if(i.get(n.toLowerCase()))return V(t,{fieldInfos:r||Array.from(i.values()),fieldName:n,layer:o,timeZone:l});const p=o?.fieldsIndex?.get(n);return p&&(c(p)||u(p))?f(t,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:l,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):ae(t)}function ue({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>me({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=le({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function se(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return m().warn(e,t),null}if(!s(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return m().warn(e,t),null}const f=n.createQuery();f.objectIds=o,f.outFields=i?.length?i:[n.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await n.queryFeatures(f,t)).features[0]}async function fe(e){if(!e.expressionInfos?.length)return!1;const t=await d(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function ce({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=n.objectIdField,a=e.attributes[o];if(null==a)return;const u=[a],s=await t.getRequiredFields(n.fieldsIndex),f=l(s,e),c=f?[]:s.includes(o)?s:[...s,o],d=t.returnGeometry||await fe(t);if(f&&!d)return;const p=await se({layer:n,graphic:e,outFields:c,objectIds:u,returnGeometry:d,spatialReference:r},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function de(e=""){return!!e&&e.includes(j)}function pe(e){return e?`${j}${e.layerId}/${e.fieldName}`:""}function ye({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=pe({layerId:n.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=le({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function me({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>ye({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>ye({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const ge=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},he=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;ge(r)||ge(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},be=({query:e,layer:t,method:n})=>{he({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})},Ie=({queryPayload:e,layer:t,method:n})=>{he({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})};function Te(e,t,n){return e&&t&&n?"sublayer"===t.type?Fe({layers:t.layer?.sublayers,map:e,relatedLayer:t,relationship:n})||Fe({layers:t.layer?.subtables,map:e,relatedLayer:t,relationship:n}):Fe({layers:e.allLayers,map:e,relatedLayer:t,relationship:n})||Fe({layers:e.allTables,map:e,relatedLayer:t,relationship:n}):null}function we(e,t){return e?.allTables.find((e=>"feature"===e.type&&e.layerId===t.id&&e.url===t.layer?.url))??t}function Fe({map:e,relationship:t,relationship:{relatedTableId:n},relatedLayer:r,layers:i}){if(!i)return null;for(const o of i){if("map-image"===o.type){const n=Fe({layers:o.sublayers,map:e,relatedLayer:r,relationship:t})||Fe({layers:o.subtables,map:e,relatedLayer:r,relationship:t});if(n)return n;continue}if(!J(o))continue;if("sublayer"===r.type){if(o!==r&&o.id===n)return o.isTable?we(e,o):o;continue}const i="scene"===r.type&&r.associatedLayer?r.associatedLayer.url:r.url;if(!i)return null;if("sublayer"!==o.type){if(o!==r&&o.url===i&&o.layerId===n)return o}else if(o!==r&&o.layer?.url===i&&o.id===n)return o.isTable?we(e,o):o}return null}function Ne(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{ae as applyTextFormattingHTML,re as createFieldInfoMap,Te as findRelatedLayer,P as fixTokens,ue as formatAttributes,ne as formatEditInfo,V as formatValueToFieldInfo,ie as getAllFieldInfos,Y as getFieldInfo,C as getFieldInfoLabel,q as getFixedFieldName,R as getFixedFieldNames,Ne as getHighlightKeyForFeature,L as getSourceLayer,E as graphicCallback,oe as htmlEntities,x as isExpressionField,H as isFeatureSupportedLayer,K as isGraphicForRelatableFeatureSupportedLayer,J as isRelatableFeatureSupportedLayer,B as isRelatableLayer,de as isRelatedField,be as preLayerQueryCallback,Ie as preRequestCallback,se as querySourceLayer,ce as queryUpdatedFeature,v as shouldOpenInNewTab,z as substituteAttributes,D as substituteFieldsInLinksAndAttributes};
|
|
5
|
+
import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{convertDateFormatToIntlOptions as n,formatDate as r}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l,isTimeOnlyField as u}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{formatAnyDate as f,isAnyDateField as c}from"../../../smartMapping/support/utils.js";import{loadArcade as d}from"../../../support/arcadeOnDemand.js";import{getTimeZoneFormattingOptions as p}from"../../../time/timeZoneUtils.js";const y="esri.widgets.Feature.support.featureUtils",m=()=>e.getLogger(y),g=/href=(""|'')/gi,h=/(\{([^{\r\n]+)\})/g,b=/'/g,I=/^\s*expression\//i,T=/(\n)/gi,w=/[\u00A0-\u9999<>&]/gim,F=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,N=/^(?:mailto:|tel:)/,j="relationships/",Z=n("short-date-short-time");function L(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function E({type:e,value:t,event:n}){try{return"function"==typeof t?t(n):t}catch(r){return void m().error("error",`An error occurred when calling the "${e}" function`,{error:r,graphic:n.graphic,value:t})}}function v(e=""){if(e)return!N.test(e.trim().toLowerCase())}function x(e){return!!e&&I.test(e)}function A(e,t){if(!t||!x(t)||!e)return;const n=t.replace(I,"").toLowerCase();return e.find((({name:e})=>e.toLowerCase()===n))}function C(e,t){const n=A(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function M(e,t){const n=t.get(e.toLowerCase());return`{${n?.fieldName||e}}`}function U(e){return e.replaceAll(g,"")}function q(e,t){const n=$(t,e);return n?n.name:e}function R(e,t){return e&&e.map((e=>q(e,t)))}function $(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function k(e){return`${e}`.trim()}function D({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?z({formattedAttributes:t,template:Q(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function z({formattedAttributes:e,template:n,fieldInfoMap:r}){return k(U(t(t(n,(e=>M(e,r))),e)))}function O(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(b,i);t[e]=o}}function G(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>O(e,n,t))),n}function S(e,n,r){const i=(n=k(n))&&"{"!==n[0];return t(e,G(r,i||!1))}function P(e,t){return e.replaceAll(h,((e,n,r)=>{const i=$(t,r);return i?`{${i.name}}`:n}))}function Q(e,t,n){const r=P(e,n);return r?r.replaceAll(F,((e,n,r)=>S(e,n||r,t))):r}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function H(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type||"sublayer"===e.type)&&"when"in e}function B(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function J(e){return H(e)&&B(e)}function K(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&J(e.sourceLayer)}function V(e,t){const{fieldInfos:n,fieldName:r,preventPlacesFormatting:l,layer:u,timeZone:s}=t,c=Y(n,r),d=$(u,r);if(c&&!a(r)){const t=d?.type,n=c.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||n)return f(e,{format:n,fieldType:t,timeZoneOptions:{layerTimeZone:u&&"preferredTimeZone"in u?u.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:!(!u||!("datesInUnknownTimezone"in u))&&!!u.datesInUnknownTimezone}})}const p=c?.format;return"string"==typeof e&&a(r)&&p?W(e,p):"string"==typeof(e=_(e,p))||null==e||null==p?ae(e):i(e,l?{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}:o(p))}function W(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?X(e,",",", ",t):e.includes(";")?X(e,";","; ",t):e.includes(" ")?X(e," "," ",t):i(Number(e),o(t))}function X(e,t,n,r){return e.trim().split(t).map((e=>i(Number(e),o(r)))).join(n)}function Y(e,t){if(e?.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function ee({fieldName:e,graphic:t,layer:n}){if(de(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function te({fieldName:e,value:t,graphic:n,layer:r}){if(de(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n});return i&&"coded-value"===i.type?i.getName(t):null}function ne(e,t,n,i){const{creatorField:o,creationDateField:a,editorField:l,editDateField:u}=e;if(!t)return;const s=p(i&&"preferredTimeZone"in i?i.preferredTimeZone:null,!(!i||!("datesInUnknownTimezone"in i))&&!!i.datesInUnknownTimezone,n,Z,"date"),f={...Z,...s},c=t[u];if("number"==typeof c){const e=t[l];return{type:"edit",date:r(c,f),user:e}}const d=t[a];if("number"==typeof d){const e=t[o];return{type:"create",date:r(d,f),user:e}}return null}function re(e,t){const n=new Map;if(!e)return n;for(const r of e){if(!r.fieldName)continue;const e=q(r.fieldName,t);r.fieldName=e,n.set(e.toLowerCase(),r)}return n}function ie(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e?.fieldInfos;n&&t.push(...n)}})),t):t}function oe(e){return e.replaceAll(w,(e=>`&#${e.charCodeAt(0)};`))}function ae(e){return"string"==typeof e?e.replaceAll(T,'<br class="esri-text-new-line" />'):e}function le(e){const{value:t,fieldName:n,fieldInfos:r,fieldInfoMap:i,layer:o,graphic:a,timeZone:l}=e;if(null==t)return"";const s=te({fieldName:n,value:t,graphic:a,layer:o});if(s)return s;const d=ee({fieldName:n,graphic:a,layer:o});if(d)return d;if(i.get(n.toLowerCase()))return V(t,{fieldInfos:r||Array.from(i.values()),fieldName:n,layer:o,timeZone:l});const p=o?.fieldsIndex?.get(n);return p&&(c(p)||u(p))?f(t,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:l,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):ae(t)}function ue({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>me({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=le({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function se(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return m().warn(e,t),null}if(!s(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return m().warn(e,t),null}const f=n.createQuery();f.objectIds=o,f.outFields=i?.length?i:[n.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await n.queryFeatures(f,t)).features[0]}async function fe(e){if(!e.expressionInfos?.length)return!1;const t=await d(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function ce({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=n.objectIdField,a=e.attributes[o];if(null==a)return;const u=[a],s=await t.getRequiredFields(n.fieldsIndex),f=l(s,e),c=f?[]:s.includes(o)?s:[...s,o],d=t.returnGeometry||await fe(t);if(f&&!d)return;const p=await se({layer:n,graphic:e,outFields:c,objectIds:u,returnGeometry:d,spatialReference:r},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function de(e=""){return!!e&&e.includes(j)}function pe(e){return e?`${j}${e.layerId}/${e.fieldName}`:""}function ye({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=pe({layerId:n.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=le({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function me({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>ye({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>ye({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const ge=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},he=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;ge(r)||ge(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},be=({query:e,layer:t,method:n})=>{he({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})},Ie=({queryPayload:e,layer:t,method:n})=>{he({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})};function Te(e,t,n){return e&&t&&n?"sublayer"===t.type?Fe({layers:t.layer?.sublayers,map:e,relatedLayer:t,relationship:n})||Fe({layers:t.layer?.subtables,map:e,relatedLayer:t,relationship:n}):Fe({layers:e.allLayers,map:e,relatedLayer:t,relationship:n})||Fe({layers:e.allTables,map:e,relatedLayer:t,relationship:n}):null}function we(e,t){return e?.allTables.find((e=>"feature"===e.type&&e.layerId===t.id&&e.url===t.layer?.url))}function Fe({map:e,relationship:t,relationship:{relatedTableId:n},relatedLayer:r,layers:i}){if(!i)return null;for(const o of i){if("map-image"===o.type){const n=Fe({layers:o.sublayers,map:e,relatedLayer:r,relationship:t})||Fe({layers:o.subtables,map:e,relatedLayer:r,relationship:t});if(n)return n;continue}if(!J(o))continue;if("sublayer"===r.type){if(o!==r&&o.id===n)return o.isTable?we(e,o):o;continue}const i="scene"===r.type&&r.associatedLayer?r.associatedLayer.url:r.url;if(!i)return null;if("sublayer"!==o.type){if(o!==r&&o.url===i&&o.layerId===n)return o}else if(o!==r&&o.layer?.url===i&&o.id===n)return o.isTable?we(e,o):o}return null}function Ne(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{ae as applyTextFormattingHTML,re as createFieldInfoMap,Te as findRelatedLayer,P as fixTokens,ue as formatAttributes,ne as formatEditInfo,V as formatValueToFieldInfo,ie as getAllFieldInfos,Y as getFieldInfo,C as getFieldInfoLabel,q as getFixedFieldName,R as getFixedFieldNames,Ne as getHighlightKeyForFeature,L as getSourceLayer,E as graphicCallback,oe as htmlEntities,x as isExpressionField,H as isFeatureSupportedLayer,K as isGraphicForRelatableFeatureSupportedLayer,J as isRelatableFeatureSupportedLayer,B as isRelatableLayer,de as isRelatedField,be as preLayerQueryCallback,Ie as preRequestCallback,se as querySourceLayer,ce as queryUpdatedFeature,v as shouldOpenInNewTab,z as substituteAttributes,D as substituteFieldsInLinksAndAttributes};
|