@arcgis/core 4.27.0-next.20230420 → 4.27.0-next.20230421

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.
Files changed (152) hide show
  1. package/WebMap.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{f64f95623d9296a91f95.js → 059ec6fd9b971de4b4c1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{1fe31a412479815e5e2d.js → 10770939900946feb20d.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{5252f3cc244204edc299.js → 1216e939d363f96b6cc6.js} +1 -1
  7. package/assets/esri/core/workers/chunks/156dad2b7fed6749bae7.js +1 -0
  8. package/assets/esri/core/workers/chunks/15a97d3e42b00ac42984.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d72c0c97cc4e30f1e4f2.js → 18704903814b9d73c708.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{852b4a6c0f3feb57cf54.js → 1db5e4c8244dbc21590c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{f0953e41d1653e66ba57.js → 2a1a5a1969e80a10dcca.js} +1 -1
  12. package/assets/esri/core/workers/chunks/33b735faa582e6f39e9a.js +1 -0
  13. package/assets/esri/core/workers/chunks/34025ac04ca02531923a.js +1 -0
  14. package/assets/esri/core/workers/chunks/3e9f3479fd8558d9e3e3.js +1 -0
  15. package/assets/esri/core/workers/chunks/{d59274ac695dfcff1143.js → 46090b69e9161bc05141.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{1b647446a6a27798c5cf.js → 47bf38d910e71ac39bb8.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{3978f4f68ada540ee3a3.js → 4f8a09b61267e5e26712.js} +1 -1
  18. package/assets/esri/core/workers/chunks/5183ecab7eddae7b70e8.js +1 -0
  19. package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js → 51a0d1dabe7415515c77.js} +2 -2
  20. package/assets/esri/core/workers/chunks/541e6efc3b491e507410.js +1 -0
  21. package/assets/esri/core/workers/chunks/5c64fd3bf057a1a5527f.js +1 -0
  22. package/assets/esri/core/workers/chunks/6047bdaf4855506f8fdb.js +1 -0
  23. package/assets/esri/core/workers/chunks/{b2358c2e27be7a5709cf.js → 6adb58f1bffc5d1c03bd.js} +1 -1
  24. package/assets/esri/core/workers/chunks/770940417e6ddbdbb9d6.js +1 -0
  25. package/assets/esri/core/workers/chunks/{1c1d8be85297c483a606.js → 77c98121223a144170e3.js} +1 -1
  26. package/assets/esri/core/workers/chunks/80117007d86be4eb3bc3.js +1 -0
  27. package/assets/esri/core/workers/chunks/838849b751805615833a.js +1 -0
  28. package/assets/esri/core/workers/chunks/{9ca395f7bc8d397b5240.js → 88197520501fcc20b6e8.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{89e8ba4fc325838bf1a9.js → 88f9dededcf60fd011ef.js} +1 -1
  30. package/assets/esri/core/workers/chunks/88fdd288ef799a7ac48a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{f11ec68ceb7c973cde74.js → 8ae7fea9f7fda38dd207.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{0d080dd1ca6a71597409.js → 9265d4e9cfab2c7bbce5.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{8d41305509fedb3603ac.js → 94041a9ced04aa281d40.js} +1 -1
  34. package/assets/esri/core/workers/chunks/98540791fcef86069e44.js +1 -0
  35. package/assets/esri/core/workers/chunks/9c1b2f82877ff79969f5.js +1 -0
  36. package/assets/esri/core/workers/chunks/a7b3cd537c9127b5e65e.js +1 -0
  37. package/assets/esri/core/workers/chunks/{3d1c697182237807ab49.js → abea316f2eac0f3086ab.js} +1 -1
  38. package/assets/esri/core/workers/chunks/ad85ade6a2cfb56cf328.js +1 -0
  39. package/assets/esri/core/workers/chunks/{25862269952c1bda910f.js → b833b4ea2973bb16792e.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{e50d1afdc878258c437e.js → be4aa835a7abfc809126.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{4fed7c08b5f4de23bb75.js → c2ec6e904f96173a7b83.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{c25aa08b869f2777dc26.js → c4488a8d857c765da30e.js} +1 -1
  43. package/assets/esri/core/workers/chunks/c5c56b6d99db96a6755a.js +2 -0
  44. package/assets/esri/core/workers/chunks/{b28883e2a13f360310b3.js → c727d38f71e52bee17e1.js} +1 -1
  45. package/assets/esri/core/workers/chunks/cf315d255f0dc8d50f21.js +1 -0
  46. package/assets/esri/core/workers/chunks/cf7676fdc09ad4835680.js +1 -0
  47. package/assets/esri/core/workers/chunks/cfad34c949cbe8a31ef8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{a2c9cb23f3e35e88da1d.js → d399b1b9cbf0737d1735.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{df7dcd035997881cf2ef.js → d5c8119d6d34628d3126.js} +1 -1
  50. package/assets/esri/core/workers/chunks/d6b6bb8aecc85d2a3f6b.js +1 -0
  51. package/assets/esri/core/workers/chunks/{8dfa32cc8453f85faab0.js → dd1f8bade9c5c3b7929b.js} +1 -1
  52. package/assets/esri/core/workers/chunks/e11e60759821746259c6.js +1 -0
  53. package/assets/esri/core/workers/chunks/{e4b65c5a4575a5c1c49f.js → e356c576f9a7521a49b3.js} +1 -1
  54. package/assets/esri/core/workers/chunks/f02edf71645eb33bf92f.js +1 -0
  55. package/assets/esri/core/workers/chunks/{3dff550c29115dd625fa.js → f1a4165c2710ca90e5ea.js} +1 -1
  56. package/assets/esri/core/workers/chunks/f57a3ee17869ced3dd33.js +1 -0
  57. package/assets/esri/core/workers/chunks/fc07f6e103d7f69a9909.js +1 -0
  58. package/chunks/WaterSurface.glsl.js +35 -20
  59. package/chunks/index.js +1 -1
  60. package/core/Loadable.js +1 -1
  61. package/core/Promise.js +1 -1
  62. package/core/accessorSupport/ensureType.js +1 -1
  63. package/core/accessorSupport/watch.js +1 -1
  64. package/core/accessorSupport/write.js +1 -1
  65. package/core/promiseUtils.js +1 -1
  66. package/core/watchUtils.js +1 -1
  67. package/core/workers/Connection.js +1 -1
  68. package/core/workers/RemoteClient.js +1 -1
  69. package/geometry/support/geodesicUtils.js +1 -1
  70. package/intl/messages.js +1 -1
  71. package/layers/graphics/data/attributeSupport.js +1 -1
  72. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  73. package/layers/mixins/ArcGISMapService.js +1 -1
  74. package/layers/support/PromiseQueue.js +1 -1
  75. package/layers/support/Sublayer.js +1 -1
  76. package/layers/support/TileKey.js +1 -1
  77. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  78. package/networks/Network.js +1 -1
  79. package/package.json +1 -1
  80. package/portal/schemas/definitions.js +1 -1
  81. package/request.js +1 -1
  82. package/support/revision.js +1 -1
  83. package/symbols/support/previewSymbol3D.js +1 -1
  84. package/symbols/support/styleUtils.js +1 -1
  85. package/symbols/support/symbolLayerUtils.js +1 -1
  86. package/symbols/support/utils.js +1 -1
  87. package/symbols/support/webStyleSymbolUtils.js +1 -1
  88. package/views/2d/engine/webgl/TextureManager.js +1 -1
  89. package/views/2d/layers/support/webStyleUtils.js +1 -1
  90. package/views/3d/input/SceneInputManager.js +1 -1
  91. package/views/3d/interactive/manipulatorUtils.js +1 -1
  92. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  93. package/views/3d/layers/graphics/ElevationQuery.js +1 -1
  94. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  95. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  96. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  97. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  98. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  99. package/views/3d/layers/graphics/webStyleUtils.js +5 -0
  100. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  101. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  102. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  103. package/views/LayerViewManager.js +1 -1
  104. package/views/PopupView.js +1 -1
  105. package/views/SceneView.js +1 -1
  106. package/views/ViewAnimation.js +1 -1
  107. package/views/input/BrowserEventSource.js +1 -1
  108. package/views/input/InputManager.js +1 -1
  109. package/views/interactive/coordinateHelper.js +1 -1
  110. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  111. package/views/support/QueueProcessor.js +1 -1
  112. package/views/ui/DefaultUI.js +1 -1
  113. package/views/ui/UI.js +1 -1
  114. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  115. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  116. package/widgets/Editor/Upload.js +1 -1
  117. package/widgets/Editor/deprecationUtils.js +1 -1
  118. package/widgets/Editor/modelUploadUtils.js +1 -1
  119. package/widgets/Editor.js +1 -1
  120. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  121. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  122. package/widgets/Feature/FeatureViewModel.js +1 -1
  123. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  124. package/widgets/Popup.js +1 -1
  125. package/assets/esri/core/workers/chunks/0cec1c16b25406858ae6.js +0 -1
  126. package/assets/esri/core/workers/chunks/27353056c3e4e8d8b8d3.js +0 -1
  127. package/assets/esri/core/workers/chunks/337d59d624ef8a89aae5.js +0 -1
  128. package/assets/esri/core/workers/chunks/4b6a903d4aeeb4eeb615.js +0 -1
  129. package/assets/esri/core/workers/chunks/4bf9bc8b52d618f395c5.js +0 -1
  130. package/assets/esri/core/workers/chunks/5ec4fedbbcbb0053cf74.js +0 -2
  131. package/assets/esri/core/workers/chunks/60e29d172a2dcf45e8d0.js +0 -1
  132. package/assets/esri/core/workers/chunks/68a15cc7c51645d31572.js +0 -1
  133. package/assets/esri/core/workers/chunks/778ecf61f07dafc51bbc.js +0 -1
  134. package/assets/esri/core/workers/chunks/7e67e071789c6d264280.js +0 -1
  135. package/assets/esri/core/workers/chunks/80d335bec34d60b7bbdc.js +0 -1
  136. package/assets/esri/core/workers/chunks/810da30f13151b72a293.js +0 -1
  137. package/assets/esri/core/workers/chunks/81485a5056aed94b3d8d.js +0 -1
  138. package/assets/esri/core/workers/chunks/8ebda132068f6b962dd9.js +0 -1
  139. package/assets/esri/core/workers/chunks/914a0c78c80aa897b1a1.js +0 -1
  140. package/assets/esri/core/workers/chunks/979ea2e3b1b164334634.js +0 -1
  141. package/assets/esri/core/workers/chunks/a0e92dd27c8f6b642dbf.js +0 -1
  142. package/assets/esri/core/workers/chunks/a6240bf258b3886a6661.js +0 -1
  143. package/assets/esri/core/workers/chunks/b1a8024bf8cdd0cd3884.js +0 -1
  144. package/assets/esri/core/workers/chunks/b366e0db9b5f27dd53a3.js +0 -1
  145. package/assets/esri/core/workers/chunks/c564055cb906857c8641.js +0 -1
  146. package/assets/esri/core/workers/chunks/c646dc9da08b509e39d6.js +0 -1
  147. package/assets/esri/core/workers/chunks/db5598944b691e43f13e.js +0 -1
  148. package/assets/esri/core/workers/chunks/eb163a2ddeb27c690308.js +0 -1
  149. package/assets/esri/core/workers/chunks/f05634909c9449533193.js +0 -1
  150. package/assets/esri/core/workers/chunks/fcebd70b089dea833c75.js +0 -1
  151. /package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js.LICENSE.txt → 51a0d1dabe7415515c77.js.LICENSE.txt} +0 -0
  152. /package/assets/esri/core/workers/chunks/{5ec4fedbbcbb0053cf74.js.LICENSE.txt → c5c56b6d99db96a6755a.js.LICENSE.txt} +0 -0
package/request.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.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"./config.js";import{id as t}from"./kernel.js";import r from"./core/Error.js";import has from"./core/has.js";import{clone as s}from"./core/lang.js";import{onAbort as o,isAbortError as a,createAbortError as n,isAborted as i}from"./core/promiseUtils.js";import{isDataProtocol as l,isBlobProtocol as u,normalize as c,getInterceptor as d,isTrustedServer as p,getOrigin as h,toHTTPS as m,addQueryParameter as f,objectToQuery as y,getProxyRule as w,getProxyUrl as g,addQueryParameters as b,hasSameOrigin as q,getAppUrl as T,addProxyRule as k}from"./core/urlUtils.js";import{isSecureProxyService as S}from"./portal/support/urlUtils.js";import{supportsApiKey as O}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as C,isNoCorsRequestRequired as v,sendNoCorsRequest as x,loadImageAsync as E}from"./support/requestUtils.js";async function L(e,t){const r=l(e),s=u(e);s||r||(e=c(e));const a={url:e,requestOptions:{...t}};let n=d(e);if(n){const e=await W(n,a);if(null!=e)return{data:e,getHeader:I,httpStatus:200,requestOptions:a.requestOptions,url:a.url};n.after||n.error||(n=null)}if(e=a.url,"image"===(t=a.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw H("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),a);if("head"===t.method){if(t.body)throw H("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),a);if(r||s)throw H("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),a)}if(await N(),U)return U.execute(e,t);const i=new AbortController;o(t,(()=>i.abort()));const p={controller:i,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:n,params:a,redoRequest:!1,useIdentity:j.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},h=await X(p);return n?.after?.(h),h}let U;const j=e.request,P="FormData"in globalThis,D=[499,498,403,401],_=["COM_0056","COM_0057","SB_0008"],F=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],I=()=>null,M=Symbol();function A(e){const t=h(e);t&&!L._corsServers.includes(t)&&L._corsServers.push(t)}function R(e){const t=h(e);return!t||t.endsWith(".arcgis.com")||L._corsServers.includes(t)||p(t)}function H(e,t,o,i){let l="Error";const u={url:o.url,requestOptions:o.requestOptions,getHeader:I,ssl:!1};if(t instanceof r)return t.details?(t.details=s(t.details),t.details.url=o.url,t.details.requestOptions=o.requestOptions):t.details=u,t;if(t){const e=i&&(e=>i.headers.get(e)),r=i&&i.status,s=t.message;s&&(l=s),e&&(u.getHeader=e),u.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,u.subCode=t.subcode,u.messageCode=t.messageCode,"string"==typeof t.details?u.messages=[t.details]:u.messages=t.details,u.raw=M in t?t[M]:t}return a(t)?n():new r(e,l,u)}async function N(){has("host-webworker")?U||(U=await import("./core/workers/request.js")):L._abortableFetch||(L._abortableFetch=globalThis.fetch.bind(globalThis))}async function B(){t||await import("./identity/IdentityManager.js")}async function $(r){const s=r.params.url,o=r.params.requestOptions,a=r.controller.signal,n=o.body;let l=null,u=null;if(P&&"HTMLFormElement"in globalThis&&(n instanceof FormData?l=n:n instanceof HTMLFormElement&&(l=new FormData(n))),"string"==typeof n&&(u=n),r.fetchOptions={cache:o.cacheBust&&!L._abortableFetch.polyfill?"no-cache":"default",credentials:"same-origin",headers:o.headers||{},method:"head"===o.method?"HEAD":"GET",mode:"cors",priority:j.priority,redirect:"follow",signal:a},(l||u)&&(r.fetchOptions.body=l||u),"anonymous"===o.authMode&&(r.useIdentity=!1),r.hasToken=!!(/token=/i.test(s)||o.query?.token||l?.get("token")),!r.hasToken&&e.apiKey&&O(s)&&(o.query||(o.query={}),o.query.token=e.apiKey,r.hasToken=!0),r.useIdentity&&!r.hasToken&&!r.credentialToken&&!z(s)&&!i(a)){let e;"immediate"===o.authMode?(await B(),e=await t.getCredential(s,{signal:a}),r.credential=e):"no-prompt"===o.authMode?(await B(),e=await t.getCredential(s,{prompt:!1,signal:a}).catch((()=>{})),r.credential=e):t&&(e=t.findCredential(s)),e&&(r.credentialToken=e.token,r.useSSL=!!e.ssl)}}function z(e){return F.some((t=>t.test(e)))}async function K(e){let r=e.params.url;const s=e.params.requestOptions,o=e.fetchOptions??{},a=u(r)||l(r),i=s.responseType||"json",c=a?0:null!=s.timeout?s.timeout:j.timeout;let d=!1;if(!a){e.useSSL&&(r=m(r)),s.cacheBust&&"default"===o.cache&&(r=f(r,"request.preventCache",Date.now()));let a={...s.query};e.credentialToken&&(a.token=e.credentialToken);let n=y(a);has("esri-url-encodes-apostrophe")&&(n=n.replace(/'/g,"%27"));const i=r.length+1+n.length;let l;d="delete"===s.method||"post"===s.method||"put"===s.method||!!s.body||i>j.maxUrlLength;const u=s.useProxy||!!w(r);if(u){const e=g(r);l=e.path,!d&&l.length+1+i>j.maxUrlLength&&(d=!0),e.query&&(a={...e.query,...a})}if("HEAD"===o.method&&(d||u)){if(d){if(i>j.maxUrlLength)throw H("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw H("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(u)throw H("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(d?(o.method="delete"===s.method?"DELETE":"put"===s.method?"PUT":"POST",s.body?r=b(r,a):(o.body=y(a),o.headers||(o.headers={}),o.headers["Content-Type"]="application/x-www-form-urlencoded")):r=b(r,a),u&&(e.useProxy=!0,r=`${l}?${r}`),a.token&&P&&o.body instanceof FormData&&!S(r)&&o.body.set("token",a.token),s.hasOwnProperty("withCredentials"))e.withCredentials=s.withCredentials;else if(!q(r,T()))if(p(r))e.withCredentials=!0;else if(t){const s=t.findServerInfo(r);s&&s.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(o.credentials="include",v(r)&&await x(d?b(r,a):r))}let O,C,E=0,U=!1;c>0&&(E=setTimeout((()=>{U=!0,e.controller.abort()}),c));try{if("native-request-init"===s.responseType)C=o,C.url=r;else if("image"!==s.responseType||"default"!==o.cache||"GET"!==o.method||d||G(s.headers)||!a&&!e.useProxy&&j.proxyUrl&&!R(r)){if(O=await L._abortableFetch(r,o),e.useProxy||A(r),"native"===s.responseType)C=O;else if("HEAD"!==o.method)if(O.ok){switch(i){case"array-buffer":C=await O.arrayBuffer();break;case"blob":case"image":C=await O.blob();break;default:C=await O.text()}if(E&&(clearTimeout(E),E=0),"json"===i||"xml"===i||"document"===i)if(C)switch(i){case"json":C=JSON.parse(C);break;case"xml":C=J(C,"application/xml");break;case"document":C=J(C,"text/html")}else C=null;if(C){if("array-buffer"===i||"blob"===i){const e=O.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&C["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(C).json();e.error&&(C=e)}catch{}}"image"===i&&C instanceof Blob&&(C=await V(URL.createObjectURL(C),e,!0))}}else C=await O.text()}else C=await V(r,e)}catch(D){if("AbortError"===D.name){if(U)throw new Error("Timeout exceeded");throw n("Request canceled")}if(!(!O&&D instanceof TypeError&&j.proxyUrl)||s.body||"delete"===s.method||"head"===s.method||"post"===s.method||"put"===s.method||e.useProxy||R(r))throw D;e.redoRequest=!0,k({proxyUrl:j.proxyUrl,urlPrefix:h(r)??""})}finally{E&&clearTimeout(E)}return[O,C]}async function W(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let o,a;try{a=await e.before(t)}catch(s){o=H("request:interceptor",s,t)}if((a instanceof Error||a instanceof r)&&(o=H("request:interceptor",a,t)),o)throw e.error&&e.error(o),o;return a}}function G(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}function J(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function X(e){let r,s;await $(e);try{do{[r,s]=await K(e)}while(!await Q(e,r,s))}catch(n){const t=H("request:server",n,e.params,r);throw t.details.ssl=e.useSSL,e.interceptor&&e.interceptor.error&&e.interceptor.error(t),t}const o=e.params.url;if(s&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(o)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!p(o)){const e=h(o,!0);e&&j.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&C(s.authorizedCrossOriginNoCorsDomains)}const a=e.credential;if(a&&t){const e=t.findServerInfo(a.server);let r=e&&e.owningSystemUrl;if(r){r=r.replace(/\/?$/,"/sharing");const e=t.findCredential(r,a.userId);e&&-1===t._getIdenticalSvcIdx(r,e)&&e.resources.unshift(r)}}return{data:s,getHeader:r?e=>r?.headers.get(e):I,httpStatus:r?.status??200,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function Q(e,r,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!r||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let a,n;if(!r.ok)throw a=new Error(`Unable to load ${r.url} status: ${r.status}`),a[M]=s,a;s&&(s.error?a=s.error:"error"===s.status&&Array.isArray(s.messages)&&(a={...s},a[M]=s,a.details=s.messages));let i,l=null;a&&(n=Number(a.code),l=a.hasOwnProperty("subcode")?Number(a.subcode):null,i=a.messageCode,i=i&&i.toUpperCase());const u=o.authMode;if(403===n&&(4===l||a.message&&a.message.toLowerCase().includes("ssl")&&!a.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===n)&&void 0!==n&&D.includes(n)&&!z(e.params.url)&&(403!==n||i&&!_.includes(i)&&(null==l||2===l&&e.credentialToken))){await B();try{const r=await t.getCredential(e.params.url,{error:H("request:server",a,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=r,e.credentialToken=r.token,e.useSSL=e.useSSL||r.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;a=c}}if(a)throw a;return!0}function V(e,t,r=!1){const s=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=j.priority,o.src=e,E(o,e,r,s)}L._abortableFetch=null,L._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];export{L as default};
5
+ import e from"./config.js";import{id as t}from"./kernel.js";import r from"./core/Error.js";import has from"./core/has.js";import{clone as s}from"./core/lang.js";import{onAbort as o,isAbortError as a,createAbortError as n,isAborted as i}from"./core/promiseUtils.js";import{isDataProtocol as l,isBlobProtocol as u,normalize as c,getInterceptor as d,isTrustedServer as p,getOrigin as h,toHTTPS as m,addQueryParameter as f,objectToQuery as y,getProxyRule as w,getProxyUrl as g,addQueryParameters as b,hasSameOrigin as q,getAppUrl as T,addProxyRule as k}from"./core/urlUtils.js";import{isSecureProxyService as S}from"./portal/support/urlUtils.js";import{supportsApiKey as O}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as C,isNoCorsRequestRequired as v,sendNoCorsRequest as x,loadImageAsync as E}from"./support/requestUtils.js";async function L(e,t){const r=l(e),s=u(e);s||r||(e=c(e));const a={url:e,requestOptions:{...t}};let n=d(e);if(n){const e=await W(n,a);if(null!=e)return{data:e,getHeader:I,httpStatus:200,requestOptions:a.requestOptions,url:a.url};n.after||n.error||(n=null)}if(e=a.url,"image"===(t=a.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw H("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),a);if("head"===t.method){if(t.body)throw H("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),a);if(r||s)throw H("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),a)}if(await N(),U)return U.execute(e,t);const i=new AbortController;o(t,(()=>i.abort()));const p={controller:i,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:n,params:a,redoRequest:!1,useIdentity:j.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},h=await X(p);return n?.after?.(h),h}let U;const j=e.request,P="FormData"in globalThis,D=[499,498,403,401],_=["COM_0056","COM_0057","SB_0008"],F=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],I=()=>null,M=Symbol();function A(e){const t=h(e);t&&!L._corsServers.includes(t)&&L._corsServers.push(t)}function R(e){const t=h(e);return!t||t.endsWith(".arcgis.com")||L._corsServers.includes(t)||p(t)}function H(e,t,o,i){let l="Error";const u={url:o.url,requestOptions:o.requestOptions,getHeader:I,ssl:!1};if(t instanceof r)return t.details?(t.details=s(t.details),t.details.url=o.url,t.details.requestOptions=o.requestOptions):t.details=u,t;if(t){const e=i&&(e=>i.headers.get(e)),r=i&&i.status,s=t.message;s&&(l=s),e&&(u.getHeader=e),u.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,u.subCode=t.subcode,u.messageCode=t.messageCode,"string"==typeof t.details?u.messages=[t.details]:u.messages=t.details,u.raw=M in t?t[M]:t}return a(t)?n():new r(e,l,u)}async function N(){has("host-webworker")?U||(U=await import("./core/workers/request.js")):L._abortableFetch||(L._abortableFetch=globalThis.fetch.bind(globalThis))}async function B(){t||await import("./identity/IdentityManager.js")}async function $(r){const s=r.params.url,o=r.params.requestOptions,a=r.controller.signal,n=o.body;let l=null,u=null;if(P&&"HTMLFormElement"in globalThis&&(n instanceof FormData?l=n:n instanceof HTMLFormElement&&(l=new FormData(n))),"string"==typeof n&&(u=n),r.fetchOptions={cache:o.cacheBust&&!("polyfill"in L._abortableFetch)?"no-cache":"default",credentials:"same-origin",headers:o.headers||{},method:"head"===o.method?"HEAD":"GET",mode:"cors",priority:j.priority,redirect:"follow",signal:a},(l||u)&&(r.fetchOptions.body=l||u),"anonymous"===o.authMode&&(r.useIdentity=!1),r.hasToken=!!(/token=/i.test(s)||o.query?.token||l?.get("token")),!r.hasToken&&e.apiKey&&O(s)&&(o.query||(o.query={}),o.query.token=e.apiKey,r.hasToken=!0),r.useIdentity&&!r.hasToken&&!r.credentialToken&&!z(s)&&!i(a)){let e;"immediate"===o.authMode?(await B(),e=await t.getCredential(s,{signal:a}),r.credential=e):"no-prompt"===o.authMode?(await B(),e=await t.getCredential(s,{prompt:!1,signal:a}).catch((()=>{})),r.credential=e):t&&(e=t.findCredential(s)),e&&(r.credentialToken=e.token,r.useSSL=!!e.ssl)}}function z(e){return F.some((t=>t.test(e)))}async function K(e){let r=e.params.url;const s=e.params.requestOptions,o=e.fetchOptions??{},a=u(r)||l(r),i=s.responseType||"json",c=a?0:null!=s.timeout?s.timeout:j.timeout;let d=!1;if(!a){e.useSSL&&(r=m(r)),s.cacheBust&&"default"===o.cache&&(r=f(r,"request.preventCache",Date.now()));let a={...s.query};e.credentialToken&&(a.token=e.credentialToken);let n=y(a);has("esri-url-encodes-apostrophe")&&(n=n.replace(/'/g,"%27"));const i=r.length+1+n.length;let l;d="delete"===s.method||"post"===s.method||"put"===s.method||!!s.body||i>j.maxUrlLength;const u=s.useProxy||!!w(r);if(u){const e=g(r);l=e.path,!d&&l.length+1+i>j.maxUrlLength&&(d=!0),e.query&&(a={...e.query,...a})}if("HEAD"===o.method&&(d||u)){if(d){if(i>j.maxUrlLength)throw H("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw H("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(u)throw H("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(d?(o.method="delete"===s.method?"DELETE":"put"===s.method?"PUT":"POST",s.body?r=b(r,a):(o.body=y(a),o.headers||(o.headers={}),o.headers["Content-Type"]="application/x-www-form-urlencoded")):r=b(r,a),u&&(e.useProxy=!0,r=`${l}?${r}`),a.token&&P&&o.body instanceof FormData&&!S(r)&&o.body.set("token",a.token),s.hasOwnProperty("withCredentials"))e.withCredentials=s.withCredentials;else if(!q(r,T()))if(p(r))e.withCredentials=!0;else if(t){const s=t.findServerInfo(r);s&&s.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(o.credentials="include",v(r)&&await x(d?b(r,a):r))}let O,C,E=0,U=!1;c>0&&(E=setTimeout((()=>{U=!0,e.controller.abort()}),c));try{if("native-request-init"===s.responseType)C=o,C.url=r;else if("image"!==s.responseType||"default"!==o.cache||"GET"!==o.method||d||G(s.headers)||!a&&!e.useProxy&&j.proxyUrl&&!R(r)){if(O=await L._abortableFetch(r,o),e.useProxy||A(r),"native"===s.responseType)C=O;else if("HEAD"!==o.method)if(O.ok){switch(i){case"array-buffer":C=await O.arrayBuffer();break;case"blob":case"image":C=await O.blob();break;default:C=await O.text()}if(E&&(clearTimeout(E),E=0),"json"===i||"xml"===i||"document"===i)if(C)switch(i){case"json":C=JSON.parse(C);break;case"xml":C=J(C,"application/xml");break;case"document":C=J(C,"text/html")}else C=null;if(C){if("array-buffer"===i||"blob"===i){const e=O.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&C["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(C).json();e.error&&(C=e)}catch{}}"image"===i&&C instanceof Blob&&(C=await V(URL.createObjectURL(C),e,!0))}}else C=await O.text()}else C=await V(r,e)}catch(D){if("AbortError"===D.name){if(U)throw new Error("Timeout exceeded");throw n("Request canceled")}if(!(!O&&D instanceof TypeError&&j.proxyUrl)||s.body||"delete"===s.method||"head"===s.method||"post"===s.method||"put"===s.method||e.useProxy||R(r))throw D;e.redoRequest=!0,k({proxyUrl:j.proxyUrl,urlPrefix:h(r)??""})}finally{E&&clearTimeout(E)}return[O,C]}async function W(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let o,a;try{a=await e.before(t)}catch(s){o=H("request:interceptor",s,t)}if((a instanceof Error||a instanceof r)&&(o=H("request:interceptor",a,t)),o)throw e.error&&e.error(o),o;return a}}function G(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}function J(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function X(e){let r,s;await $(e);try{do{[r,s]=await K(e)}while(!await Q(e,r,s))}catch(n){const t=H("request:server",n,e.params,r);throw t.details.ssl=e.useSSL,e.interceptor&&e.interceptor.error&&e.interceptor.error(t),t}const o=e.params.url;if(s&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(o)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!p(o)){const e=h(o,!0);e&&j.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&C(s.authorizedCrossOriginNoCorsDomains)}const a=e.credential;if(a&&t){const e=t.findServerInfo(a.server);let r=e&&e.owningSystemUrl;if(r){r=r.replace(/\/?$/,"/sharing");const e=t.findCredential(r,a.userId);e&&-1===t._getIdenticalSvcIdx(r,e)&&e.resources.unshift(r)}}return{data:s,getHeader:r?e=>r?.headers.get(e):I,httpStatus:r?.status??200,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function Q(e,r,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!r||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let a,n;if(!r.ok)throw a=new Error(`Unable to load ${r.url} status: ${r.status}`),a[M]=s,a;s&&(s.error?a=s.error:"error"===s.status&&Array.isArray(s.messages)&&(a={...s},a[M]=s,a.details=s.messages));let i,l=null;a&&(n=Number(a.code),l=a.hasOwnProperty("subcode")?Number(a.subcode):null,i=a.messageCode,i=i&&i.toUpperCase());const u=o.authMode;if(403===n&&(4===l||a.message&&a.message.toLowerCase().includes("ssl")&&!a.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===n)&&void 0!==n&&D.includes(n)&&!z(e.params.url)&&(403!==n||i&&!_.includes(i)&&(null==l||2===l&&e.credentialToken))){await B();try{const r=await t.getCredential(e.params.url,{error:H("request:server",a,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=r,e.credentialToken=r.token,e.useSSL=e.useSSL||r.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;a=c}}if(a)throw a;return!0}function V(e,t,r=!1){const s=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=j.priority,o.src=e,E(o,e,r,s)}L._abortableFetch=null,L._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];export{L as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- const c="20230420",e="f0177d753e7c2940e36081b2caf4a16d8320bc51";export{c as buildDate,e as commitHash};
5
+ const d="20230421",c="38552c33b71c0331f028d842d657f7d1dea3a585";export{d as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{getAssetUrl as e}from"../../assets.js";import{toHSV as t,toRGB as s}from"../../core/colorUtils.js";import"../../core/has.js";import l from"../../core/Error.js";import r from"../../core/Logger.js";import{unwrapOrThrow as n}from"../../core/maybe.js";import{eachAlways as a}from"../../core/promiseUtils.js";import{pt2px as o}from"../../core/screenUtils.js";import{defaultThematicColor as i,getPatternUrlWithColor as c,dekebabifyLineStyle as p}from"./gfxUtils.js";import{defaultPrimitive as u}from"./IconSymbol3DLayerResource.js";import{defaultPrimitive as h}from"./ObjectSymbol3DLayerResource.js";import{SymbolSizeDefaults as m,adjustColorComponentBrightness as f,getPathSymbolShapes as y,shapes as d,getExtrudeSymbolShapes as b,getTetrahedronShapes as v,getDiamondShapes as g,getCylinderShapes as k,getCubeShapes as w,getInvertedConeShapes as x,getConeShapes as M,getWaterSymbolShapes as j}from"./previewUtils.js";import{tintImageWithColor as L,renderSymbol as z}from"./renderUtils.js";import{isVolumetricSymbol as S,getIconHref as P}from"./utils.js";import{resolveWebStyleSymbol as U}from"./webStyleSymbolUtils.js";const D=m.size,O=m.maxSize,C=m.maxOutlineSize,I=m.lineWidth,R=m.tallSymbolWidth;function E(e){const t=e.outline,s=null!=e.material?e.material.color:null,l=null!=s?s.toHex():null;if(null==t||"pattern"in t&&null!=t.pattern&&"style"===t.pattern.type&&"none"===t.pattern.style)return"fill"===e.type&&"#ffffff"===l?{color:"#bdc3c7",width:.75}:null;const r=o(t.size)||0;return{color:"rgba("+(null!=t.color?t.color.toRgba():"255,255,255,1")+")",width:Math.min(r,C),style:"pattern"in t&&null!=t.pattern&&"style"===t.pattern.type?p(t.pattern.style):null,join:"butt",cap:"patternCap"in t?t.patternCap:"butt"}}function Z(t,s){const l=s&&s.resource,r=l&&l.href;if(t.thumbnail&&t.thumbnail.url)return Promise.resolve(t.thumbnail.url);if(r&&"object"!==s.type)return Promise.resolve(P(s));const n=e("esri/images/Legend/legend3dsymboldefault.png");return t.styleOrigin&&(t.styleOrigin.styleName||t.styleOrigin.styleUrl)?U(t.styleOrigin,{portal:t.styleOrigin.portal},"webRef").catch((e=>e)).then((e=>e?.thumbnail?.url||n)):Promise.resolve(n)}function q(e,l=1){const r=e.a,n=t(e),a=n.h,o=n.s/l,i=100-(100-n.v)/l,{r:c,g:p,b:u}=s({h:a,s:o,v:i});return[c,p,u,r]}function A(e){return"water"===e.type?null==e.color?null:e.color:null==e.material||null==e.material.color?null:e.material.color}function H(e,t=0){const s=A(e);if(!s){if("fill"===e.type)return null;const s=i.r,l=f(s,t);return[l,l,l,100]}const l=s.toRgba();for(let r=0;r<3;r++)l[r]=f(l[r],t);return l}async function N(t,s){const l=t.style;if("none"===l)return null;return{type:"pattern",x:0,y:0,src:await c(e(`esri/symbols/patterns/${l}.png`),s.toCss(!0)),width:5,height:5}}function T(e){return e.outline?E(e):{color:"rgba(0, 0, 0, 1)",width:1.5}}function W(e,t){const s=A(e);if(!s)return null;let l="rgba(";return l+=f(s.r,t)+",",l+=f(s.g,t)+",",l+=f(s.b,t)+",",l+s.a+");"}function $(e,t){const s=W(e,t);if(!s)return{};if("pattern"in e&&null!=e.pattern&&"style"===e.pattern.type&&"none"===e.pattern.style)return null;return{color:s,width:Math.min(e.size?o(e.size):.75,C),style:"pattern"in e&&null!=e.pattern&&"style"===e.pattern.type?p(e.pattern.style):null,cap:"cap"in e?e.cap:null,join:"join"in e?"miter"===e.join?o(2):e.join:null}}function B(e,t,s){const l=null!=s?.75*s:0;return{type:"linear",x1:l?.25*l:0,y1:l?.5*l:0,x2:l||4,y2:l?.5*l:4,colors:[{color:e,offset:0},{color:t,offset:1}]}}function F(e){const t=e.depth,s=e.height,l=e.width;return 0!==l&&0!==t&&0!==s&&l===t&&null!=l&&null!=s&&l<s}function G(e,t,s){const l=[];if(!e)return l;switch(e.type){case"icon":{const s=0,r=0,n=t,a=t;switch(e.resource&&e.resource.primitive||u){case"circle":l.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:H(e,0),stroke:E(e)});break;case"square":l.push({shape:{type:"path",path:[{command:"M",values:[s,a]},{command:"L",values:[s,r]},{command:"L",values:[n,r]},{command:"L",values:[n,a]},{command:"Z",values:[]}]},fill:H(e,0),stroke:E(e)});break;case"triangle":l.push({shape:{type:"path",path:[{command:"M",values:[s,a]},{command:"L",values:[.5*n,r]},{command:"L",values:[n,a]},{command:"Z",values:[]}]},fill:H(e,0),stroke:E(e)});break;case"cross":l.push({shape:{type:"path",path:[{command:"M",values:[.5*n,r]},{command:"L",values:[.5*n,a]},{command:"M",values:[s,.5*a]},{command:"L",values:[n,.5*a]}]},stroke:T(e)});break;case"x":l.push({shape:{type:"path",path:[{command:"M",values:[s,r]},{command:"L",values:[n,a]},{command:"M",values:[n,r]},{command:"L",values:[s,a]}]},stroke:T(e)});break;case"kite":l.push({shape:{type:"path",path:[{command:"M",values:[s,.5*a]},{command:"L",values:[.5*n,r]},{command:"L",values:[n,.5*a]},{command:"L",values:[.5*n,a]},{command:"Z",values:[]}]},fill:H(e,0),stroke:E(e)})}break}case"object":switch(e.resource&&e.resource.primitive||h){case"cone":{const r=B(H(e,0),H(e,-.6),s?R:t),n=M(t,s);l.push({shape:n[0],fill:r}),l.push({shape:n[1],fill:r});break}case"inverted-cone":{const s=H(e,0),r=B(s,H(e,-.6),t),n=x(t);l.push({shape:n[0],fill:r}),l.push({shape:n[1],fill:s});break}case"cube":{const r=w(t,s);l.push({shape:r[0],fill:H(e,0)}),l.push({shape:r[1],fill:H(e,-.3)}),l.push({shape:r[2],fill:H(e,-.5)});break}case"cylinder":{const r=B(H(e,0),H(e,-.6),s?R:t),n=k(t,s);l.push({shape:n[0],fill:r}),l.push({shape:n[1],fill:r}),l.push({shape:n[2],fill:H(e,0)});break}case"diamond":{const s=g(t);l.push({shape:s[0],fill:H(e,-.3)}),l.push({shape:s[1],fill:H(e,0)}),l.push({shape:s[2],fill:H(e,-.3)}),l.push({shape:s[3],fill:H(e,-.7)});break}case"sphere":{const s=B(H(e,0),H(e,-.6));s.x1=0,s.y1=0,s.x2=.25*t,s.y2=.25*t,l.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:s});break}case"tetrahedron":{const s=v(t);l.push({shape:s[0],fill:H(e,-.3)}),l.push({shape:s[1],fill:H(e,0)}),l.push({shape:s[2],fill:H(e,-.6)});break}}break}return l}function J(e){const t="number"==typeof e?.size?e?.size:null;return t?o(t):null}function K(e){return"icon"===e.type?"multiply":"tint"}function Q(e,t){const s=J(t),l=t?.maxSize?o(t.maxSize):null,n=t?.disableUpsampling??!1,i=e.symbolLayers,c=[];let p=0,u=0;const h=i.getItemAt(i.length-1);let m;return h&&"icon"===h.type&&(m=h.size&&o(h.size)),i.forEach((r=>{if("icon"!==r.type&&"object"!==r.type)return;const a="icon"===r.type?r.size&&o(r.size):0,i=s||a?Math.ceil(Math.min(s||a,l||O)):D;if(r&&r.resource&&r.resource.href){const t=Z(e,r).then((e=>{const t=r.get("material.color"),s=K(r);return L(e,i,t,s,n)})).then((e=>{const t=e.width,s=e.height;return p=Math.max(p,t),u=Math.max(u,s),[{shape:{type:"image",x:0,y:0,width:t,height:s,src:e.url},fill:null,stroke:null}]}));c.push(t)}else{let e=i;"icon"===r.type&&m&&s&&(e=i*(a/m));const l="tall"===t?.symbolConfig||t?.symbolConfig?.isTall||"object"===r.type&&F(r);p=Math.max(p,l?R:e),u=Math.max(u,e),c.push(Promise.resolve(G(r,e,l)))}})),a(c).then((e=>{const s=[];return e.forEach((e=>{e.value?s.push(e.value):e.error&&r.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",e.error)})),z(s,[p,u],{node:t&&t.node,scale:!1,opacity:t&&t.opacity})}))}function V(e,t){const s=e.symbolLayers,l=[],r=S(e),n=J(t),a=(t&&t.maxSize?o(t.maxSize):null)||C;let i,c=0,p=0;return s.forEach(((e,t)=>{if(!e)return;if("line"!==e.type&&"path"!==e.type)return;const s=[];switch(e.type){case"line":{const l=$(e,0);if(null==l)break;const r=l&&l.width||0;0===t&&(i=r);const o=Math.min(n||r,a),u=0===t?o:n?o*(r/i):o,h=u>I/2?2*u:I;p=Math.max(p,u),c=Math.max(c,h),l.width=u,s.push({shape:{type:"path",path:[{command:"M",values:[0,.5*p]},{command:"L",values:[c,.5*p]}]},stroke:l});break}case"path":{const t=Math.min(n||D,a),l=H(e,0),r=H(e,-.2),o=W(e,-.4),i=o?{color:o,width:1}:{};if("quad"===e.profile){const t=e.width,n=e.height,a=y(t&&n?t/n:1,0===n,0===t),o={...i,join:"bevel"};s.push({shape:a[0],fill:r,stroke:o}),s.push({shape:a[1],fill:r,stroke:o}),s.push({shape:a[2],fill:l,stroke:o})}else s.push({shape:d.pathSymbol3DLayer[0],fill:r,stroke:i}),s.push({shape:d.pathSymbol3DLayer[1],fill:l,stroke:i});p=Math.max(p,t),c=p}}l.push(s)})),Promise.resolve(z(l,[c,p],{node:t&&t.node,scale:r,opacity:t&&t.opacity}))}async function X(e,t){const s="mesh-3d"===e.type,l=e.symbolLayers,r=J(t),a=t&&t.maxSize?o(t.maxSize):null,i=r||D,c=[];let p=0,u=0,h=!1;for(let o=0;o<l.length;o++){const e=l.getItemAt(o),t=[];if(s&&"fill"!==e.type)continue;const r=d.fill[0];switch(e.type){case"fill":{const l=E(e),n=Math.min(i,a||O);p=Math.max(p,n),u=Math.max(u,n),h=!0;let o=H(e,0);const c="pattern"in e?e.pattern:null,m=A(e);!s&&null!=c&&"style"===c.type&&"solid"!==c.style&&m&&(o=await N(c,m)),t.push({shape:r,fill:o,stroke:l});break}case"line":{const s=$(e,0);if(null==s)break;const l={stroke:s,shape:r};p=Math.max(p,D),u=Math.max(u,D),t.push(l);break}case"extrude":{const s={join:"round",width:1,...$(e,-.4)},l=H(e,0),r=H(e,-.2),n=Math.min(i,a||O),o=b(n);s.width=1,t.push({shape:o[0],fill:r,stroke:s}),t.push({shape:o[1],fill:r,stroke:s}),t.push({shape:o[2],fill:l,stroke:s});const c=D,h=.7*D+.5*n;p=Math.max(p,c),u=Math.max(u,h);break}case"water":{const s=n(A(e)),l=q(s),r=q(s,2),o=q(s,3),c=j();h=!0,t.push({shape:c[0],fill:l}),t.push({shape:c[1],fill:r}),t.push({shape:c[2],fill:o});const m=Math.min(i,a||O);p=Math.max(p,m),u=Math.max(u,m);break}}c.push(t)}return z(c,[p,u],{node:t&&t.node,scale:h,opacity:t&&t.opacity})}function Y(e,t){if(0===e.symbolLayers.length)return Promise.reject(new l("symbolPreview: renderPreviewHTML3D","No symbolLayers in the symbol."));switch(e.type){case"point-3d":return Q(e,t);case"line-3d":return V(e,t);case"polygon-3d":case"mesh-3d":return X(e,t)}return Promise.reject(new l("symbolPreview: swatchInfo3D","symbol not supported."))}export{N as getPatternDescriptor,J as getSizeFromOptions,H as getSymbolLayerFill,Y as previewSymbol3D};
5
+ import{getAssetUrl as e}from"../../assets.js";import{toHSV as t,toRGB as s}from"../../core/colorUtils.js";import"../../core/has.js";import l from"../../core/Error.js";import n from"../../core/Logger.js";import{unwrapOrThrow as r}from"../../core/maybe.js";import{eachAlways as a}from"../../core/promiseUtils.js";import{pt2px as o}from"../../core/screenUtils.js";import{defaultThematicColor as i,getPatternUrlWithColor as c,dekebabifyLineStyle as p}from"./gfxUtils.js";import{defaultPrimitive as u}from"./IconSymbol3DLayerResource.js";import{defaultPrimitive as h}from"./ObjectSymbol3DLayerResource.js";import{SymbolSizeDefaults as m,adjustColorComponentBrightness as f,getPathSymbolShapes as y,shapes as d,getExtrudeSymbolShapes as b,getTetrahedronShapes as g,getDiamondShapes as k,getCylinderShapes as v,getCubeShapes as w,getInvertedConeShapes as x,getConeShapes as M,getWaterSymbolShapes as j}from"./previewUtils.js";import{tintImageWithColor as L,renderSymbol as z}from"./renderUtils.js";import{isVolumetricSymbol as S,getIconHref as U}from"./utils.js";import{resolveWebStyleSymbol as P}from"./webStyleSymbolUtils.js";const D=m.size,O=m.maxSize,C=m.maxOutlineSize,I=m.lineWidth,R=m.tallSymbolWidth;function E(e){const t=e.outline,s=null!=e.material?e.material.color:null,l=null!=s?s.toHex():null;if(null==t||"pattern"in t&&null!=t.pattern&&"style"===t.pattern.type&&"none"===t.pattern.style)return"fill"===e.type&&"#ffffff"===l?{color:"#bdc3c7",width:.75}:null;const n=o(t.size)||0;return{color:"rgba("+(null!=t.color?t.color.toRgba():"255,255,255,1")+")",width:Math.min(n,C),style:"pattern"in t&&null!=t.pattern&&"style"===t.pattern.type?p(t.pattern.style):null,join:"butt",cap:"patternCap"in t?t.patternCap:"butt"}}async function Z(t,s){if(t.thumbnail?.url)return t.thumbnail.url;if("icon"===s.type){const e=s?.resource?.href;if(e)return U(s)}const l=e("esri/images/Legend/legend3dsymboldefault.png");if(t.styleOrigin&&(t.styleOrigin.styleName||t.styleOrigin.styleUrl)){const e=await P(t.styleOrigin,{portal:t.styleOrigin.portal},"webRef").catch((()=>null));if(e&&"thumbnail"in e&&e.thumbnail?.url)return e.thumbnail.url}return l}function q(e,l=1){const n=e.a,r=t(e),a=r.h,o=r.s/l,i=100-(100-r.v)/l,{r:c,g:p,b:u}=s({h:a,s:o,v:i});return[c,p,u,n]}function A(e){return"water"===e.type?null==e.color?null:e.color:null==e.material||null==e.material.color?null:e.material.color}function H(e,t=0){const s=A(e);if(!s){if("fill"===e.type)return null;const s=i.r,l=f(s,t);return[l,l,l,100]}const l=s.toRgba();for(let n=0;n<3;n++)l[n]=f(l[n],t);return l}async function N(t,s){const l=t.style;if("none"===l)return null;return{type:"pattern",x:0,y:0,src:await c(e(`esri/symbols/patterns/${l}.png`),s.toCss(!0)),width:5,height:5}}function T(e){return e.outline?E(e):{color:"rgba(0, 0, 0, 1)",width:1.5}}function W(e,t){const s=A(e);if(!s)return null;let l="rgba(";return l+=f(s.r,t)+",",l+=f(s.g,t)+",",l+=f(s.b,t)+",",l+s.a+");"}function $(e,t){const s=W(e,t);if(!s)return{};if("pattern"in e&&null!=e.pattern&&"style"===e.pattern.type&&"none"===e.pattern.style)return null;return{color:s,width:Math.min(e.size?o(e.size):.75,C),style:"pattern"in e&&null!=e.pattern&&"style"===e.pattern.type?p(e.pattern.style):null,cap:"cap"in e?e.cap:null,join:"join"in e?"miter"===e.join?o(2):e.join:null}}function B(e,t,s){const l=null!=s?.75*s:0;return{type:"linear",x1:l?.25*l:0,y1:l?.5*l:0,x2:l||4,y2:l?.5*l:4,colors:[{color:e,offset:0},{color:t,offset:1}]}}function F(e){const t=e.depth,s=e.height,l=e.width;return 0!==l&&0!==t&&0!==s&&l===t&&null!=l&&null!=s&&l<s}function G(e,t,s){const l=[];if(!e)return l;switch(e.type){case"icon":{const s=0,n=0,r=t,a=t;switch(e.resource&&e.resource.primitive||u){case"circle":l.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:H(e,0),stroke:E(e)});break;case"square":l.push({shape:{type:"path",path:[{command:"M",values:[s,a]},{command:"L",values:[s,n]},{command:"L",values:[r,n]},{command:"L",values:[r,a]},{command:"Z",values:[]}]},fill:H(e,0),stroke:E(e)});break;case"triangle":l.push({shape:{type:"path",path:[{command:"M",values:[s,a]},{command:"L",values:[.5*r,n]},{command:"L",values:[r,a]},{command:"Z",values:[]}]},fill:H(e,0),stroke:E(e)});break;case"cross":l.push({shape:{type:"path",path:[{command:"M",values:[.5*r,n]},{command:"L",values:[.5*r,a]},{command:"M",values:[s,.5*a]},{command:"L",values:[r,.5*a]}]},stroke:T(e)});break;case"x":l.push({shape:{type:"path",path:[{command:"M",values:[s,n]},{command:"L",values:[r,a]},{command:"M",values:[r,n]},{command:"L",values:[s,a]}]},stroke:T(e)});break;case"kite":l.push({shape:{type:"path",path:[{command:"M",values:[s,.5*a]},{command:"L",values:[.5*r,n]},{command:"L",values:[r,.5*a]},{command:"L",values:[.5*r,a]},{command:"Z",values:[]}]},fill:H(e,0),stroke:E(e)})}break}case"object":switch(e.resource&&e.resource.primitive||h){case"cone":{const n=B(H(e,0),H(e,-.6),s?R:t),r=M(t,s);l.push({shape:r[0],fill:n}),l.push({shape:r[1],fill:n});break}case"inverted-cone":{const s=H(e,0),n=B(s,H(e,-.6),t),r=x(t);l.push({shape:r[0],fill:n}),l.push({shape:r[1],fill:s});break}case"cube":{const n=w(t,s);l.push({shape:n[0],fill:H(e,0)}),l.push({shape:n[1],fill:H(e,-.3)}),l.push({shape:n[2],fill:H(e,-.5)});break}case"cylinder":{const n=B(H(e,0),H(e,-.6),s?R:t),r=v(t,s);l.push({shape:r[0],fill:n}),l.push({shape:r[1],fill:n}),l.push({shape:r[2],fill:H(e,0)});break}case"diamond":{const s=k(t);l.push({shape:s[0],fill:H(e,-.3)}),l.push({shape:s[1],fill:H(e,0)}),l.push({shape:s[2],fill:H(e,-.3)}),l.push({shape:s[3],fill:H(e,-.7)});break}case"sphere":{const s=B(H(e,0),H(e,-.6));s.x1=0,s.y1=0,s.x2=.25*t,s.y2=.25*t,l.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:s});break}case"tetrahedron":{const s=g(t);l.push({shape:s[0],fill:H(e,-.3)}),l.push({shape:s[1],fill:H(e,0)}),l.push({shape:s[2],fill:H(e,-.6)});break}}break}return l}function J(e){const t="number"==typeof e?.size?e?.size:null;return t?o(t):null}function K(e){return"icon"===e.type?"multiply":"tint"}function Q(e,t){const s=J(t),l=t?.maxSize?o(t.maxSize):null,r=t?.disableUpsampling??!1,i=e.symbolLayers,c=[];let p=0,u=0;const h=i.getItemAt(i.length-1);let m;return h&&"icon"===h.type&&(m=h.size&&o(h.size)),i.forEach((n=>{if("icon"!==n.type&&"object"!==n.type)return;const a="icon"===n.type?n.size&&o(n.size):0,i=s||a?Math.ceil(Math.min(s||a,l||O)):D;if(n&&n.resource&&n.resource.href){const t=Z(e,n).then((e=>{const t=n.get("material.color"),s=K(n);return L(e,i,t,s,r)})).then((e=>{const t=e.width,s=e.height;return p=Math.max(p,t),u=Math.max(u,s),[{shape:{type:"image",x:0,y:0,width:t,height:s,src:e.url},fill:null,stroke:null}]}));c.push(t)}else{let e=i;"icon"===n.type&&m&&s&&(e=i*(a/m));const l="tall"===t?.symbolConfig||t?.symbolConfig?.isTall||"object"===n.type&&F(n);p=Math.max(p,l?R:e),u=Math.max(u,e),c.push(Promise.resolve(G(n,e,l)))}})),a(c).then((e=>{const s=[];return e.forEach((e=>{e.value?s.push(e.value):e.error&&n.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",e.error)})),z(s,[p,u],{node:t&&t.node,scale:!1,opacity:t&&t.opacity})}))}function V(e,t){const s=e.symbolLayers,l=[],n=S(e),r=J(t),a=(t&&t.maxSize?o(t.maxSize):null)||C;let i,c=0,p=0;return s.forEach(((e,t)=>{if(!e)return;if("line"!==e.type&&"path"!==e.type)return;const s=[];switch(e.type){case"line":{const l=$(e,0);if(null==l)break;const n=l&&l.width||0;0===t&&(i=n);const o=Math.min(r||n,a),u=0===t?o:r?o*(n/i):o,h=u>I/2?2*u:I;p=Math.max(p,u),c=Math.max(c,h),l.width=u,s.push({shape:{type:"path",path:[{command:"M",values:[0,.5*p]},{command:"L",values:[c,.5*p]}]},stroke:l});break}case"path":{const t=Math.min(r||D,a),l=H(e,0),n=H(e,-.2),o=W(e,-.4),i=o?{color:o,width:1}:{};if("quad"===e.profile){const t=e.width,r=e.height,a=y(t&&r?t/r:1,0===r,0===t),o={...i,join:"bevel"};s.push({shape:a[0],fill:n,stroke:o}),s.push({shape:a[1],fill:n,stroke:o}),s.push({shape:a[2],fill:l,stroke:o})}else s.push({shape:d.pathSymbol3DLayer[0],fill:n,stroke:i}),s.push({shape:d.pathSymbol3DLayer[1],fill:l,stroke:i});p=Math.max(p,t),c=p}}l.push(s)})),Promise.resolve(z(l,[c,p],{node:t&&t.node,scale:n,opacity:t&&t.opacity}))}async function X(e,t){const s="mesh-3d"===e.type,l=e.symbolLayers,n=J(t),a=t&&t.maxSize?o(t.maxSize):null,i=n||D,c=[];let p=0,u=0,h=!1;for(let o=0;o<l.length;o++){const e=l.getItemAt(o),t=[];if(s&&"fill"!==e.type)continue;const n=d.fill[0];switch(e.type){case"fill":{const l=E(e),r=Math.min(i,a||O);p=Math.max(p,r),u=Math.max(u,r),h=!0;let o=H(e,0);const c="pattern"in e?e.pattern:null,m=A(e);!s&&null!=c&&"style"===c.type&&"solid"!==c.style&&m&&(o=await N(c,m)),t.push({shape:n,fill:o,stroke:l});break}case"line":{const s=$(e,0);if(null==s)break;const l={stroke:s,shape:n};p=Math.max(p,D),u=Math.max(u,D),t.push(l);break}case"extrude":{const s={join:"round",width:1,...$(e,-.4)},l=H(e,0),n=H(e,-.2),r=Math.min(i,a||O),o=b(r);s.width=1,t.push({shape:o[0],fill:n,stroke:s}),t.push({shape:o[1],fill:n,stroke:s}),t.push({shape:o[2],fill:l,stroke:s});const c=D,h=.7*D+.5*r;p=Math.max(p,c),u=Math.max(u,h);break}case"water":{const s=r(A(e)),l=q(s),n=q(s,2),o=q(s,3),c=j();h=!0,t.push({shape:c[0],fill:l}),t.push({shape:c[1],fill:n}),t.push({shape:c[2],fill:o});const m=Math.min(i,a||O);p=Math.max(p,m),u=Math.max(u,m);break}}c.push(t)}return z(c,[p,u],{node:t&&t.node,scale:h,opacity:t&&t.opacity})}function Y(e,t){if(0===e.symbolLayers.length)return Promise.reject(new l("symbolPreview: renderPreviewHTML3D","No symbolLayers in the symbol."));switch(e.type){case"point-3d":return Q(e,t);case"line-3d":return V(e,t);case"polygon-3d":case"mesh-3d":return X(e,t)}return Promise.reject(new l("symbolPreview: swatchInfo3D","symbol not supported."))}export{N as getPatternDescriptor,J as getSizeFromOptions,H as getSymbolLayerFill,Y as previewSymbol3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../request.js";import t from"../../core/Error.js";import{throwIfAbortError as r}from"../../core/promiseUtils.js";import{normalize as o,removeFile as s}from"../../core/urlUtils.js";import n from"../../portal/Portal.js";import l from"../../portal/PortalQueryParams.js";import{enableWebStyleForceWOSR as a}from"../../support/featureFlags.js";let u={};async function f(e,t){try{return{data:(await b(e,t)).data,baseUrl:s(e),styleUrl:e}}catch(o){return r(o),null}}function i(e,t,r){const o=null!=t.portal?t.portal:n.getDefault();let s;const l=`${o.url} - ${o.user&&o.user.username} - ${e}`;return u[l]||(u[l]=y(e,o,r).then((e=>(s=e,e.fetchData()))).then((t=>({data:t,baseUrl:s.itemUrl??"",styleName:e})))),u[l]}function m(){u&&(u={})}function y(e,r,o){return r.load(o).then((()=>{const t=new l({disableExtraQuery:!0,query:`owner:${h} AND type:${j} AND typekeywords:"${e}"`});return r.queryItems(t,o)})).then((({results:r})=>{let s=null;const n=e.toLowerCase();if(r&&Array.isArray(r))for(const e of r){const t=e.typeKeywords?.some((e=>e.toLowerCase()===n));if(t&&e.type===j&&e.owner===h){s=e;break}}if(!s)throw new t("symbolstyleutils:style-not-found",`The style '${e}' could not be found`,{styleName:e});return s.load(o)}))}function c(e,r,o){return e&&null!=e.styleUrl?f(e.styleUrl,o):e&&null!=e.styleName?i(e.styleName,r,o):Promise.reject(new t("symbolstyleutils:style-url-and-name-missing","Either styleUrl or styleName is required to resolve a style"))}function p(e){return null===e||"CIMSymbolReference"===e.type?e:{type:"CIMSymbolReference",symbol:e}}function d(e,t){if("cimRef"===t)return e.cimRef;if(e.formatInfos&&!a())for(const r of e.formatInfos)if("gltf"===r.type)return r.href;return e.webRef}function b(t,r){const s={responseType:"json",query:{f:"json"},...r};return e(o(t),s)}const h="esri_en",j="Style",w="https://cdn.arcgis.com/sharing/rest/content/items/220936cc6ed342c9937abd8f180e7d1e/resources/styles/cim/{SymbolName}.json?f=json";export{w as Style2DUrlTemplate,u as cachedStyles,m as cleanupStyleUtilsCache,c as fetchStyle,p as makeCIMSymbolRef,b as requestJSON,d as symbolUrlFromStyleItem};
5
+ import e from"../../request.js";import t from"../../core/Error.js";import{throwIfAbortError as r}from"../../core/promiseUtils.js";import{normalize as o,removeFile as s}from"../../core/urlUtils.js";import n from"../../portal/Portal.js";import l from"../../portal/PortalQueryParams.js";import{enableWebStyleForceWOSR as a}from"../../support/featureFlags.js";let u={};async function f(e,t){try{return{data:(await b(e,t)).data,baseUrl:s(e),styleUrl:e}}catch(o){return r(o),null}}function i(e,t,r){const o=null!=t.portal?t.portal:n.getDefault();let s;const l=`${o.url} - ${o.user&&o.user.username} - ${e}`;return u[l]||(u[l]=y(e,o,r).then((e=>(s=e,e.fetchData()))).then((t=>({data:t,baseUrl:s.itemUrl??"",styleName:e})))),u[l]}function m(){u&&(u={})}function y(e,r,o){return r.load(o).then((()=>{const t=new l({disableExtraQuery:!0,query:`owner:${h} AND type:${j} AND typekeywords:"${e}"`});return r.queryItems(t,o)})).then((({results:r})=>{let s=null;const n=e.toLowerCase();if(r&&Array.isArray(r))for(const e of r){const t=e.typeKeywords?.some((e=>e.toLowerCase()===n));if(t&&e.type===j&&e.owner===h){s=e;break}}if(!s)throw new t("symbolstyleutils:style-not-found",`The style '${e}' could not be found`,{styleName:e});return s.load(o)}))}function c(e,r,o){return e&&null!=e.styleUrl?f(e.styleUrl,o):e&&null!=e.styleName?i(e.styleName,r,o):Promise.reject(new t("symbolstyleutils:style-url-and-name-missing","Either styleUrl or styleName is required to resolve a style"))}function p(e){return null===e||"CIMSymbolReference"===e.type?e:{type:"CIMSymbolReference",symbol:e}}function d(e,t,r=["gltf"]){if("cimRef"===t)return e.cimRef;if(e.formatInfos&&!a())for(const o of r){const t=e.formatInfos.find((e=>e.type===o));if(t)return t.href}return e.webRef}function b(t,r){const s={responseType:"json",query:{f:"json"},...r};return e(o(t),s)}const h="esri_en",j="Style",w="https://cdn.arcgis.com/sharing/rest/content/items/220936cc6ed342c9937abd8f180e7d1e/resources/styles/cim/{SymbolName}.json?f=json";export{w as Style2DUrlTemplate,u as cachedStyles,m as cleanupStyleUtilsCache,c as fetchStyle,p as makeCIMSymbolRef,b as requestJSON,d as symbolUrlFromStyleItem};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../request.js";import r from"../../core/Error.js";import o from"../../core/ItemCache.js";import{unwrapOrThrow as t}from"../../core/maybe.js";import{size as n,create as i}from"../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerSizeWithResourceSize as s,objectSymbolLayerPrimitiveBoundingBox as u}from"./symbolLayerUtils3D.js";let c=l();function l(){return new o(50)}function a(){c=l()}function m(e,o){if("icon"===e.type)return f(e,o);if("object"===e.type)return b(e,o);throw new r("symbol3d:unsupported-symbol-layer","computeLayerSize only works with symbol layers of type Icon and Object")}async function y(e,o){if("icon"===e.type)return p(e,o);if("object"===e.type)return d(e,o);throw new r("symbol3d:unsupported-symbol-layer","computeLayerSize only works with symbol layers of type Icon and Object")}async function f(e,o){if(e.resource?.href)return h(e.resource.href).then((e=>[e.width,e.height]));if(e.resource?.primitive)return null!=o?[o,o]:[256,256];throw new r("symbol3d:invalid-symbol-layer","symbol layers of type Icon must have either an href or a primitive resource")}function p(e,r){return f(e,r).then((r=>{if(null==e.size)return r;const o=r[0]/r[1];return o>1?[e.size,e.size/o]:[e.size*o,e.size]}))}function h(r){return e(r,{responseType:"image"}).then((e=>e.data))}function b(e,r){return w(e,r).then((e=>n(e)))}async function d(e,r){const o=await b(e,r);return s(o,e)}async function w(e,o){if(!e.isPrimitive){const r=t(e.resource?.href),o=c.get(r);if(void 0!==o)return o;const n=await import("../../views/3d/layers/graphics/objectResourceUtils.js"),i=await n.fetch(r,{disableTextures:!0});return c.put(r,i.referenceBoundingBox),i.referenceBoundingBox}let n=null;if(e.resource&&e.resource.primitive&&(n=i(u(e.resource.primitive)),null!=o))for(let r=0;r<n.length;r++)n[r]*=o;return n?Promise.resolve(n):Promise.reject(new r("symbol:invalid-resource","The symbol does not have a valid resource"))}export{a as clearBoundingBoxCache,f as computeIconLayerResourceSize,m as computeLayerResourceSize,y as computeLayerSize,b as computeObjectLayerResourceSize};
5
+ import e from"../../request.js";import r from"../../core/Error.js";import o from"../../core/ItemCache.js";import{c as t}from"../../chunks/vec3f64.js";import{size as i,create as n}from"../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerSizeWithResourceSize as s,objectSymbolLayerPrimitiveBoundingBox as u}from"./symbolLayerUtils3D.js";let c=a();function a(){return new o(50)}function l(){c=a()}async function f(e,o){if(e.resource?.href)return h(e.resource.href).then((e=>[e.width,e.height]));if(e.resource?.primitive)return null!=o?[o,o]:[256,256];throw new r("symbol3d:invalid-symbol-layer","symbol layers of type Icon must have either an href or a primitive resource")}function m(e,r=null){return f(e,r).then((r=>{if(null==e.size)return r;const o=r[0]/r[1];return o>1?[e.size,e.size/o]:[e.size*o,e.size]}))}function h(r){return e(r,{responseType:"image"}).then((e=>e.data))}async function p(e,r=null){const o=await y(e,r);return s(o,e)}async function y(e,o=null){if(!e.isPrimitive){const o=e.resource.href;if(!o)throw new r("symbol:invalid-resource","The symbol does not have a valid resource");const n=c.get(o);if(void 0!==n)return n;const s=await import("../../views/3d/layers/graphics/objectResourceUtils.js"),u=await s.fetch(o,{disableTextures:!0}),a=i(u.referenceBoundingBox,t());return c.put(o,a),a}if(!e.resource?.primitive)throw new r("symbol:invalid-resource","The symbol does not have a valid resource");const s=n(u(e.resource.primitive));if(null!=o)for(let r=0;r<s.length;r++)s[r]*=o;return i(s,t())}export{l as clearBoundingBoxCache,f as computeIconLayerResourceSize,m as computeIconLayerSize,y as computeObjectLayerResourceSize,p as computeObjectLayerSize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Color.js";import{isSymbol3D as t,isSymbol2D as o}from"../../symbols.js";import{forEach as n}from"../../core/asyncUtils.js";import"../../core/has.js";import{unwrapOrThrow as r}from"../../core/maybe.js";import{px2pt as l}from"../../core/screenUtils.js";import{O as i}from"../../chunks/vec3f64.js";import{effectFunctionsFromJSON as s}from"../../layers/effects/jsonUtils.js";import{getStroke as c}from"./gfxUtils.js";import{Symbol3DMaterial as u}from"./Symbol3DMaterial.js";const a=new e("white");function f(e){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const o=e.symbolLayers.getItemAt(t-1);return"outline"in o?o?.outline?.size:void 0}function y(e){if(!e)return 0;if(t(e)){const t=f(e);return null!=t?t:0}return l(c(e)?.width)}function m(e){if(null==e||!("symbolLayers"in e)||null==e.symbolLayers)return!1;switch(e.type){case"point-3d":return e.symbolLayers.some((e=>"object"===e.type));case"line-3d":return e.symbolLayers.some((e=>"path"===e.type));case"polygon-3d":return e.symbolLayers.some((e=>"object"===e.type||"extrude"===e.type));default:return!1}}function p(e){return r(e.resource).href}function h(n,r){if(!n)return null;let l=null;return t(n)?l=b(n):o(n)&&(l=n.color?new e(n.color):null),l?w(l,r):null}function b(t){const o=t.symbolLayers;if(!o)return null;let n=null;return o.forEach((e=>{"object"===e.type&&null!=e.resource?.href||(n="water"===e.type?e.color:null!=e.material?e.material.color:null)})),n?new e(n):null}function w(t,o){if(null==o||null==t)return t;const n=t.toRgba();return n[3]=n[3]*o,new e(n)}function d(e,t,o){const n=e.symbolLayers;if(!n)return;const r=e=>w(t=t??(null!=e?e:null)??(null!=o?a:null),o);n.forEach((e=>{if("object"!==e.type||null==e.resource?.href||t)if("water"===e.type)e.color=r(e.color);else{const t=null!=e.material?e.material.color:null,n=r(t);null==e.material?e.material=new u({color:n}):e.material.color=n,null!=o&&"outline"in e&&null!=e.outline&&null!=e.outline.color&&(e.outline.color=w(e.outline.color,o))}}))}function j(e,t,o){(t=t??e.color)&&(e.color=w(t,o)),null!=o&&"outline"in e&&e.outline&&e.outline.color&&(e.outline.color=w(e.outline.color,o))}function g(n,r,l){n&&(r||null!=l)&&(r&&(r=new e(r)),t(n)?d(n,r,l):o(n)&&j(n,r,l))}async function k(e,t){const o=e.symbolLayers;o&&await n(o,(async e=>L(e,t)))}async function L(e,t){switch(e.type){case"extrude":x(e,t);break;case"icon":case"line":case"text":z(e,t);break;case"path":U(e,t);break;case"object":await v(e,t)}}function z(e,t){const o=S(t);null!=o&&(e.size=o)}function S(e){for(const t of e)if("number"==typeof t)return t;return null}function x(e,t){e.size="number"==typeof t[2]?t[2]:0}async function v(e,t){const{resourceSize:o,symbolSize:n}=await O(e),r=E(t,o,n);e.width=C(t[0],n[0],o[0],r),e.depth=C(t[1],n[1],o[1],r),e.height=C(t[2],n[2],o[2],r)}function U(e,t){const o=E(t,i,[e.width,void 0,e.height]);e.width=C(t[0],e.width,1,o),e.height=C(t[2],e.height,1,o)}function E(e,t,o){for(let n=0;n<3;n++){const r=e[n];switch(r){case"symbol-value":{const e=o[n];return null!=e?e/t[n]:1}case"proportional":break;default:if(r&&t[n])return r/t[n]}}return 1}async function O(e){const t=await import("./symbolLayerUtils.js"),o=await t.computeObjectLayerResourceSize(e,10),{width:n,height:r,depth:l}=e,i=[n,l,r];let s=1;for(let c=0;c<3;c++){const e=i[c];if(null!=e){s=e/o[c];break}}for(let c=0;c<3;c++)null==i[c]&&(i[c]=o[c]*s);return{resourceSize:o,symbolSize:i}}function C(e,t,o,n){switch(e){case"proportional":return o*n;case"symbol-value":return null!=t?t:o;default:return e}}function I(e,t){const o=S(t);if(null!=o)switch(e.type){case"simple-marker":e.size=o;break;case"picture-marker":{const t=e.width/e.height;t>1?(e.width=o,e.height=o*t):(e.width=o*t,e.height=o);break}case"simple-line":e.width=o;break;case"text":e.font.size=o}}async function M(e,n){if(e&&n)return t(e)?k(e,n):void(o(e)&&I(e,n))}function R(e,n,r){if(e&&null!=n)if(t(e)){const t=e.symbolLayers;t&&t.forEach((e=>{if(e&&"object"===e.type)switch(r){case"tilt":e.tilt=n;break;case"roll":e.roll=n;break;default:e.heading=n}}))}else o(e)&&("simple-marker"!==e.type&&"picture-marker"!==e.type&&"text"!==e.type||(e.angle=n))}function A(e){if(!e)return null;const t=e.effects.filter((e=>"bloom"!==e.type)).map((e=>e.toJSON()));return s(t)}function D(e){return null!=e&&"polygon-3d"===e.type&&e.symbolLayers.some((e=>"extrude"===e.type))}async function J(e,t){const o=await e.fetchSymbol(t);return o||e.fetchCIMSymbol(t)}export{g as applyColorToSymbol,w as applyOpacityToColor,R as applyRotationToSymbol,M as applySizesToSymbol,J as fetchWebStyleSymbol,A as getCSSFilterFromEffectList,h as getColorFromSymbol,p as getIconHref,y as getSymbolOutlineSize,m as isVolumetricSymbol,D as symbolHasExtrudeSymbolLayer};
5
+ import e from"../../Color.js";import{isSymbol3D as t,isSymbol2D as o}from"../../symbols.js";import{forEach as n}from"../../core/asyncUtils.js";import"../../core/has.js";import{unwrapOrThrow as r}from"../../core/maybe.js";import{px2pt as l}from"../../core/screenUtils.js";import{O as i}from"../../chunks/vec3f64.js";import{effectFunctionsFromJSON as s}from"../../layers/effects/jsonUtils.js";import{getStroke as c}from"./gfxUtils.js";import{Symbol3DMaterial as u}from"./Symbol3DMaterial.js";const a=new e("white");function f(e){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const o=e.symbolLayers.getItemAt(t-1);return"outline"in o?o?.outline?.size:void 0}function y(e){if(!e)return 0;if(t(e)){const t=f(e);return null!=t?t:0}return l(c(e)?.width)}function m(e){if(null==e||!("symbolLayers"in e)||null==e.symbolLayers)return!1;switch(e.type){case"point-3d":return e.symbolLayers.some((e=>"object"===e.type));case"line-3d":return e.symbolLayers.some((e=>"path"===e.type));case"polygon-3d":return e.symbolLayers.some((e=>"object"===e.type||"extrude"===e.type));default:return!1}}function p(e){return r(e.resource).href}function h(n,r){if(!n)return null;let l=null;return t(n)?l=b(n):o(n)&&(l=n.color?new e(n.color):null),l?w(l,r):null}function b(t){const o=t.symbolLayers;if(!o)return null;let n=null;return o.forEach((e=>{"object"===e.type&&e.resource?.href||(n="water"===e.type?e.color:e.material?e.material.color:null)})),n?new e(n):null}function w(t,o){if(null==o||null==t)return t;const n=t.toRgba();return n[3]=n[3]*o,new e(n)}function d(e,t,o){const n=e.symbolLayers;if(!n)return;const r=e=>w(t=t??e??(null!=o?a:null),o);n.forEach((e=>{if("object"!==e.type||!e.resource?.href||t)if("water"===e.type)e.color=r(e.color);else{const t=null!=e.material?e.material.color:null,n=r(t);null==e.material?e.material=new u({color:n}):e.material.color=n,null!=o&&"outline"in e&&null!=e.outline&&null!=e.outline.color&&(e.outline.color=w(e.outline.color,o))}}))}function j(e,t,o){(t=t??e.color)&&(e.color=w(t,o)),null!=o&&"outline"in e&&e.outline&&e.outline.color&&(e.outline.color=w(e.outline.color,o))}function g(n,r,l){n&&(r||null!=l)&&(r&&(r=new e(r)),t(n)?d(n,r,l):o(n)&&j(n,r,l))}async function k(e,t){const o=e.symbolLayers;o&&await n(o,(async e=>L(e,t)))}async function L(e,t){switch(e.type){case"extrude":x(e,t);break;case"icon":case"line":case"text":z(e,t);break;case"path":U(e,t);break;case"object":await v(e,t)}}function z(e,t){const o=S(t);null!=o&&(e.size=o)}function S(e){for(const t of e)if("number"==typeof t)return t;return null}function x(e,t){e.size="number"==typeof t[2]?t[2]:0}async function v(e,t){const{resourceSize:o,symbolSize:n}=await O(e),r=E(t,o,n);e.width=C(t[0],n[0],o[0],r),e.depth=C(t[1],n[1],o[1],r),e.height=C(t[2],n[2],o[2],r)}function U(e,t){const o=E(t,i,[e.width,void 0,e.height]);e.width=C(t[0],e.width,1,o),e.height=C(t[2],e.height,1,o)}function E(e,t,o){for(let n=0;n<3;n++){const r=e[n];switch(r){case"symbol-value":{const e=o[n];return null!=e?e/t[n]:1}case"proportional":break;default:if(r&&t[n])return r/t[n]}}return 1}async function O(e){const t=await import("./symbolLayerUtils.js"),o=await t.computeObjectLayerResourceSize(e,10),{width:n,height:r,depth:l}=e,i=[n,l,r];let s=1;for(let c=0;c<3;c++){const e=i[c];if(null!=e){s=e/o[c];break}}for(let c=0;c<3;c++)null==i[c]&&(i[c]=o[c]*s);return{resourceSize:o,symbolSize:i}}function C(e,t,o,n){switch(e){case"proportional":return o*n;case"symbol-value":return null!=t?t:o;default:return e}}function I(e,t){const o=S(t);if(null!=o)switch(e.type){case"simple-marker":e.size=o;break;case"picture-marker":{const t=e.width/e.height;t>1?(e.width=o,e.height=o*t):(e.width=o*t,e.height=o);break}case"simple-line":e.width=o;break;case"text":e.font.size=o}}async function M(e,n){if(e&&n)return t(e)?k(e,n):void(o(e)&&I(e,n))}function R(e,n,r){if(e&&null!=n)if(t(e)){const t=e.symbolLayers;t&&t.forEach((e=>{if(e&&"object"===e.type)switch(r){case"tilt":e.tilt=n;break;case"roll":e.roll=n;break;default:e.heading=n}}))}else o(e)&&("simple-marker"!==e.type&&"picture-marker"!==e.type&&"text"!==e.type||(e.angle=n))}function A(e){if(!e)return null;const t=e.effects.filter((e=>"bloom"!==e.type)).map((e=>e.toJSON()));return s(t)}function D(e){return null!=e&&"polygon-3d"===e.type&&e.symbolLayers.some((e=>"extrude"===e.type))}async function J(e,t){const o=await e.fetchSymbol(t);return o||e.fetchCIMSymbol(t)}export{g as applyColorToSymbol,w as applyOpacityToColor,R as applyRotationToSymbol,M as applySizesToSymbol,J as fetchWebStyleSymbol,A as getCSSFilterFromEffectList,h as getColorFromSymbol,p as getIconHref,y as getSymbolOutlineSize,m as isVolumetricSymbol,D as symbolHasExtrudeSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{isSymbol3D as t}from"../../symbols.js";import{isDevEnvironment as e,adjustStaticAGOUrl as r}from"../../core/devEnvironmentUtils.js";import l from"../../core/Error.js";import{unwrapOrThrow as o}from"../../core/maybe.js";import{urlToObject as n,removeFile as s}from"../../core/urlUtils.js";import m from"../../portal/Portal.js";import{f as i}from"../../chunks/persistableUrlUtils.js";import{fromJSON as a}from"./jsonUtils.js";import u from"./StyleOrigin.js";import{fetchStyle as p,symbolUrlFromStyleItem as f,requestJSON as y,makeCIMSymbolRef as c,Style2DUrlTemplate as b}from"./styleUtils.js";import{Thumbnail as g}from"./Thumbnail.js";function j(t,e,r,n){const s=t.name;return null==s?Promise.reject(new l("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference")):t.styleName&&"Esri2DPointSymbolsStyle"===t.styleName?d(s,e,n):p(t,e,n).then((t=>h(o(t),s,e,r,n)))}function h(o,p,b,j,h){const d=o.data,U=b&&null!=b.portal?b.portal:m.getDefault(),N={portal:U,url:n(o.baseUrl),origin:"portal-item"},w=d.items.find((t=>t.name===p));if(!w){const t=`The symbol name '${p}' could not be found`;return Promise.reject(new l("symbolstyleutils:symbol-name-not-found",t,{symbolName:p}))}let S=i(f(w,j),N),D=w.thumbnail?.href??null;const O=w.thumbnail&&w.thumbnail.imageData;e()&&(S=r(S)??"",D=r(D));const P={portal:U,url:n(s(S)),origin:"portal-item"};return y(S,h).then((e=>{const r="cimRef"===j?c(e.data):e.data,l=a(r,P);if(l&&t(l)){if(D){const t=i(D,N);l.thumbnail=new g({url:t})}else O&&(l.thumbnail=new g({url:`data:image/png;base64,${O}`}));o.styleUrl?l.styleOrigin=new u({portal:b.portal,styleUrl:o.styleUrl,name:p}):o.styleName&&(l.styleOrigin=new u({portal:b.portal,styleName:o.styleName,name:p}))}return l}))}function d(t,e,r){const l=b.replace(/\{SymbolName\}/gi,t),o=null!=e.portal?e.portal:m.getDefault();return y(l,r).then((t=>{const e=c(t.data);return a(e,{portal:o,url:n(s(l)),origin:"portal-item"})}))}export{h as fetchSymbolFromStyle,j as resolveWebStyleSymbol};
5
+ import{isSymbol3D as t}from"../../symbols.js";import{isDevEnvironment as e,adjustStaticAGOUrl as r}from"../../core/devEnvironmentUtils.js";import l from"../../core/Error.js";import{unwrapOrThrow as o}from"../../core/maybe.js";import{urlToObject as n,removeFile as s}from"../../core/urlUtils.js";import m from"../../portal/Portal.js";import{f as i}from"../../chunks/persistableUrlUtils.js";import{fromJSON as a}from"./jsonUtils.js";import u from"./StyleOrigin.js";import{fetchStyle as p,requestJSON as f,makeCIMSymbolRef as y,Style2DUrlTemplate as c,symbolUrlFromStyleItem as b}from"./styleUtils.js";import{Thumbnail as g}from"./Thumbnail.js";function j(t,e,r,n){const s=t.name;return null==s?Promise.reject(new l("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference")):t.styleName&&"Esri2DPointSymbolsStyle"===t.styleName?U(s,e,n):p(t,e,n).then((t=>d(o(t),s,e,r,b,n)))}function h(t,e){return e.items.find((e=>e.name===t))}function d(o,p,c,b,j,d){const U=c&&null!=c.portal?c.portal:m.getDefault(),N={portal:U,url:n(o.baseUrl),origin:"portal-item"},w=h(p,o.data);if(!w){const t=`The symbol name '${p}' could not be found`;return Promise.reject(new l("symbolstyleutils:symbol-name-not-found",t,{symbolName:p}))}let S=i(j(w,b),N),D=w.thumbnail?.href??null;const O=w.thumbnail&&w.thumbnail.imageData;e()&&(S=r(S)??"",D=r(D));const P={portal:U,url:n(s(S)),origin:"portal-item"};return f(S,d).then((e=>{const r="cimRef"===b?y(e.data):e.data,l=a(r,P);if(l&&t(l)){if(D){const t=i(D,N);l.thumbnail=new g({url:t})}else O&&(l.thumbnail=new g({url:`data:image/png;base64,${O}`}));o.styleUrl?l.styleOrigin=new u({portal:c.portal,styleUrl:o.styleUrl,name:p}):o.styleName&&(l.styleOrigin=new u({portal:c.portal,styleName:o.styleName,name:p}))}return l}))}function U(t,e,r){const l=c.replace(/\{SymbolName\}/gi,t),o=null!=e.portal?e.portal:m.getDefault();return f(l,r).then((t=>{const e=y(t.data);return a(e,{portal:o,url:n(s(l)),origin:"portal-item"})}))}export{d as fetchSymbolFromStyle,h as getStyleItemFromStyle,j as resolveWebStyleSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import s from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import o from"../../../../core/Logger.js";import{nextPowerOfTwo as n}from"../../../../core/mathUtils.js";import{throwIfAborted as a,isAbortError as h}from"../../../../core/promiseUtils.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{s as u}from"../../../../chunks/vec2.js";import{c as d}from"../../../../chunks/vec2f32.js";import l from"../../../../symbols/cim/Rasterizer.js";import{SDF_TEXTURE_SIZE as m,TEXTURE_BINDING_GLYPH_ATLAS as p,TEXTURE_BINDING_SPRITE_ATLAS as g,SPRITE_PADDING as f,PATTERN_FILL_RASTERIZATION_SCALE as _}from"./definitions.js";import{MosaicType as w}from"./enums.js";import y from"./GlyphMosaic.js";import M from"./GlyphSource.js";import I from"./SDFConverter.js";import z from"./SpriteMosaic.js";import{is3D as T,charCodes as R,isSimple as v,isSVGResource as j,isImageResource as x,isMarkerPlacementInsidePolygon as S,shouldRepeat as b,getUrl as P,getPMSResourceSize as U,isGIF as B,isPNG as G,isSVGImage as C}from"./Utils.js";import{AnimatableTextureResource as A}from"./animatedFormats/AnimatableTextureResource.js";import{resize as q}from"./animatedFormats/utils.js";import{ok as E}from"./util/Result.js";import{keyFromSymbol as F}from"./util/symbolUtils.js";import{QueueProcessor as L}from"../../../support/QueueProcessor.js";import{TextureSamplingMode as N}from"../../../webgl/enums.js";const $=d(),k="arial-unicode-ms-regular",H=o.getLogger("esri.views.2d.engine.webgl.TextureManager");function O(e,t){const i=Math.round(c(t)*window.devicePixelRatio),s=i>=128?2:4;return Math.min(e,i*s)}const Q=(e,t,i)=>H.error(new s(e,t,i));class V{static fromMosaic(e,t){return new V(e,t.page,t.sdf)}constructor(e,t,i){this.mosaicType=e,this.page=t,this.sdf=i}}class Y{constructor(i,r,o){this._requestRender=i,this.resourceManager=r,this._allowNonPowerOfTwo=o,this._invalidFontsMap=new Map,this._sdfConverter=new I(m),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new L({concurrency:10,process:async(e,i)=>{a(i);try{return await t(e,{responseType:"image",signal:i})}catch(r){if(!h(r))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this._spriteMosaic=new z(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new y(1024,1024,this._glyphSource),this._rasterizer=new l(r)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}async rasterizeItem(e,t,i,s){if(null==e)return Q("mapview-null-resource","Unable to rasterize null resource"),null;switch(e.type){case"text":case"esriTS":{const t=await this._rasterizeText(e,i,s);return t.forEach((e=>this._setTextureBinding(w.GLYPH,e))),{glyphMosaicItems:t}}default:{if(T(e))return Q("mapview-invalid-type",`MapView does not support symbol type: ${e.type}`,e),null;const i=await this._rasterizeSpriteSymbol(e,t,s);return E(i)&&i&&this._setTextureBinding(w.SPRITE,i),{spriteMosaicItem:i}}}}bindTextures(e,t,i,s=!1){if(0===i.textureBinding)return;const r=this._bindingInfos[i.textureBinding-1],o=r.page,n=s?N.LINEAR_MIPMAP_LINEAR:N.LINEAR;switch(r.mosaicType){case w.SPRITE:{const i=this.sprites.getWidth(o),s=this.sprites.getHeight(o),r=u($,i,s);return this._spriteMosaic.bind(e,n,o,g),t.setUniform1i("u_texture",g),void t.setUniform2fv("u_mosaicSize",r)}case w.GLYPH:{const i=this.glyphs.width,s=this.glyphs.height,r=u($,i,s);return this._glyphMosaic.bind(e,n,o,p),t.setUniform1i("u_texture",p),void t.setUniform2fv("u_mosaicSize",r)}default:H.error("mapview-texture-manager",`Cannot handle unknown type ${r.mosaicType}`)}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|t.page<<3}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=V.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t,s){let o,n;if("cim"in e){const t=e;o=t.fontName,n=t.text}else{const t=e;o=r(t.font),n=t.text}const a=this._invalidFontsMap.has(o),h=t||R(i(n)[0]);try{const e=a?k:o;return has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e),await this._glyphMosaic.getGlyphItems(e,h,s)}catch(c){return Q("mapview-invalid-resource",`Couldn't find font ${o}. Falling back to Arial Unicode MS Regular`),this._invalidFontsMap.set(o,!0),this._glyphMosaic.getGlyphItems(k,h,s)}}async _rasterizeSpriteSymbol(e,t,i){if(v(e))return;const r=F(e);if(this._spriteMosaic.has(r))return this._spriteMosaic.getSpriteItem(r);if(j(e)||x(e)&&!S(e))return this._handleAsyncResource(r,e,i);const o=_,n=this._rasterizer.rasterizeJSONResource(e,o);if(n){const{size:t,image:i,sdf:s,simplePattern:o,rasterizationScale:a}=n;return this._addItemToMosaic(r,t,{type:"static",data:i},b(e),s,o,a)}return new s("TextureManager","unrecognized or null rasterized image")}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;s=j(t)?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s);try{await s,this._ongoingRasterizations.delete(e)}catch{this._ongoingRasterizations.delete(e)}return s}async _handleSVG(e,t,i){const s=[m,m],r=await this._sdfConverter.draw(e.path,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(r.buffer)},!1,!0,!0)}async _handleGIFOrPNG(e,t,i){const r=P(e);await this.resourceManager.fetchResource(r,i);let o=this.resourceManager.getResource(r);if(null==o)return new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}.`);let a=o.width,h=o.height;if(o instanceof HTMLImageElement){"esriPMS"===e.type&&(a=Math.round(O(o.width,U(e))),h=Math.round(o.height*(a/o.width)));const i="cim"in e?e.cim.colorSubstitutions:void 0,{size:s,sdf:r,image:n}=this._rasterizer.rasterizeImageResource(a,h,o,i);return this._addItemToMosaic(t,s,{type:"static",data:n},b(e),r,!1)}this._allowNonPowerOfTwo||(a=n(o.width+2*f)-2*f,h=n(o.height+2*f)-2*f),a===o.width&&h===o.height||(o=q(o,a,h));const c=e.animatedSymbolProperties||{},u=e.objectId,d=new A(o,this._requestRender,c,u);return this._addItemToMosaic(t,[d.width,d.height],{type:"animated",data:d},b(e),!1,!1)}async _handleImage(e,t,i){if(B(e)||G(e))return this._handleGIFOrPNG(e,t,i);const r=P(e);try{let s;const o=this.resourceManager.getResource(r);if(null!=o&&o instanceof HTMLImageElement)s=o;else{const{data:e}=await this._imageRequestQueue.push(r,{...i});s=e}if(C(r))if("width"in e&&"height"in e)s.width=c(e.width),s.height=c(e.height);else if("cim"in e){const t=e.cim;s.width=c(t.width??t.scaleX*t.size),s.height=c(t.size)}if(!s.width||!s.height)return null;let n=s.width,a=s.height;"esriPMS"===e.type&&(n=Math.round(O(s.width,U(e))),a=Math.round(s.height*(n/s.width)));const h="cim"in e?e.cim.colorSubstitutions:void 0,{size:u,sdf:d,image:l}=this._rasterizer.rasterizeImageResource(n,a,s,h);return this._addItemToMosaic(t,u,{type:"static",data:l},b(e),d,!1)}catch(o){if(!h(o))return new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${o.message}`)}}_addItemToMosaic(e,t,i,s,r,o,n){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,o,n)}}export{Y as default};
5
+ import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import s from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import o from"../../../../core/Logger.js";import{nextPowerOfTwo as n}from"../../../../core/mathUtils.js";import{throwIfAborted as a,isAbortError as h}from"../../../../core/promiseUtils.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{s as u}from"../../../../chunks/vec2.js";import{c as d}from"../../../../chunks/vec2f32.js";import l from"../../../../symbols/cim/Rasterizer.js";import{SDF_TEXTURE_SIZE as m,TEXTURE_BINDING_GLYPH_ATLAS as p,TEXTURE_BINDING_SPRITE_ATLAS as g,SPRITE_PADDING as f,PATTERN_FILL_RASTERIZATION_SCALE as _}from"./definitions.js";import{MosaicType as w}from"./enums.js";import y from"./GlyphMosaic.js";import M from"./GlyphSource.js";import I from"./SDFConverter.js";import z from"./SpriteMosaic.js";import{is3D as T,charCodes as R,isSimple as v,isSVGResource as j,isImageResource as x,isMarkerPlacementInsidePolygon as S,shouldRepeat as b,getUrl as P,getPMSResourceSize as U,isGIF as B,isPNG as G,isSVGImage as C}from"./Utils.js";import{AnimatableTextureResource as A}from"./animatedFormats/AnimatableTextureResource.js";import{resize as q}from"./animatedFormats/utils.js";import{ok as E}from"./util/Result.js";import{keyFromSymbol as F}from"./util/symbolUtils.js";import{QueueProcessor as L}from"../../../support/QueueProcessor.js";import{TextureSamplingMode as N}from"../../../webgl/enums.js";const $=d(),k="arial-unicode-ms-regular",H=o.getLogger("esri.views.2d.engine.webgl.TextureManager");function O(e,t){const i=Math.round(c(t)*window.devicePixelRatio),s=i>=128?2:4;return Math.min(e,i*s)}const Q=(e,t,i)=>H.error(new s(e,t,i));class V{static fromMosaic(e,t){return new V(e,t.page,t.sdf)}constructor(e,t,i){this.mosaicType=e,this.page=t,this.sdf=i}}class Y{constructor(i,r,o){this._requestRender=i,this.resourceManager=r,this._allowNonPowerOfTwo=o,this._invalidFontsMap=new Map,this._sdfConverter=new I(m),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new L({concurrency:10,process:async(e,i)=>{a(i);try{return await t(e,{responseType:"image",signal:i})}catch(r){if(!h(r))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this._spriteMosaic=new z(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new y(1024,1024,this._glyphSource),this._rasterizer=new l(r)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}async rasterizeItem(e,t,i,s){if(null==e)return Q("mapview-null-resource","Unable to rasterize null resource"),null;switch(e.type){case"text":case"esriTS":{const t=await this._rasterizeText(e,i,s);return t.forEach((e=>this._setTextureBinding(w.GLYPH,e))),{glyphMosaicItems:t}}default:{if(T(e))return Q("mapview-invalid-type",`MapView does not support symbol type: ${e.type}`,e),null;const i=await this._rasterizeSpriteSymbol(e,t,s);return E(i)&&i&&this._setTextureBinding(w.SPRITE,i),{spriteMosaicItem:i}}}}bindTextures(e,t,i,s=!1){if(0===i.textureBinding)return;const r=this._bindingInfos[i.textureBinding-1],o=r.page,n=s?N.LINEAR_MIPMAP_LINEAR:N.LINEAR;switch(r.mosaicType){case w.SPRITE:{const i=this.sprites.getWidth(o),s=this.sprites.getHeight(o),r=u($,i,s);return this._spriteMosaic.bind(e,n,o,g),t.setUniform1i("u_texture",g),void t.setUniform2fv("u_mosaicSize",r)}case w.GLYPH:{const i=this.glyphs.width,s=this.glyphs.height,r=u($,i,s);return this._glyphMosaic.bind(e,n,o,p),t.setUniform1i("u_texture",p),void t.setUniform2fv("u_mosaicSize",r)}default:H.error("mapview-texture-manager",`Cannot handle unknown type ${r.mosaicType}`)}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|t.page<<3}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=V.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t,s){let o,n;if("cim"in e){const t=e;o=t.fontName,n=t.text}else{const t=e;o=r(t.font),n=t.text}const a=this._invalidFontsMap.has(o),h=t||R(i(n)[0]);try{const e=a?k:o;return has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e),await this._glyphMosaic.getGlyphItems(e,h,s)}catch(c){return Q("mapview-invalid-resource",`Couldn't find font ${o}. Falling back to Arial Unicode MS Regular`),this._invalidFontsMap.set(o,!0),this._glyphMosaic.getGlyphItems(k,h,s)}}async _rasterizeSpriteSymbol(e,t,i){if(v(e))return;const r=F(e);if(this._spriteMosaic.has(r))return this._spriteMosaic.getSpriteItem(r);if(j(e)||x(e)&&!S(e))return this._handleAsyncResource(r,e,i);const o=_,n=this._rasterizer.rasterizeJSONResource(e,o);if(n){const{size:t,image:i,sdf:s,simplePattern:o,rasterizationScale:a}=n;return this._addItemToMosaic(r,t,{type:"static",data:i},b(e),s,o,a)}return new s("TextureManager","unrecognized or null rasterized image")}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;s=j(t)?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s);try{await s,this._ongoingRasterizations.delete(e)}catch{this._ongoingRasterizations.delete(e)}return s}async _handleSVG(e,t,i){const s=[m,m],r=await this._sdfConverter.draw(e.path,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(r.buffer)},!1,!0,!0)}async _handleGIFOrPNG(e,t,i){const r=P(e);await this.resourceManager.fetchResource(r,i);let o=this.resourceManager.getResource(r);if(null==o)return new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}.`);let a=o.width,h=o.height;if(o instanceof HTMLImageElement){"esriPMS"===e.type&&(a=Math.round(O(o.width,U(e))),h=Math.round(o.height*(a/o.width)));const i="cim"in e?e.cim.colorSubstitutions:void 0,{size:s,sdf:r,image:n}=this._rasterizer.rasterizeImageResource(a,h,o,i);return this._addItemToMosaic(t,s,{type:"static",data:n},b(e),r,!1)}this._allowNonPowerOfTwo||(a=n(o.width+2*f)-2*f,h=n(o.height+2*f)-2*f),a===o.width&&h===o.height||(o=q(o,a,h));const c=e.animatedSymbolProperties||{},u=e.objectId,d=new A(o,this._requestRender,c,u);return this._addItemToMosaic(t,[d.width,d.height],{type:"animated",data:d},b(e),!1,!1)}async _handleImage(e,t,i){if(B(e)||G(e))return this._handleGIFOrPNG(e,t,i);const r=P(e);try{let s;const o=this.resourceManager.getResource(r);if(null!=o&&o instanceof HTMLImageElement)s=o;else{const{data:e}=await this._imageRequestQueue.push(r,{...i});s=e}if(C(r))if("width"in e&&"height"in e)s.width=c(e.width),s.height=c(e.height);else if("cim"in e){const t=e.cim;s.width=c(t.width??t.scaleX*t.size),s.height=c(t.size)}if(!s.width||!s.height)return null;let n=s.width,a=s.height;"esriPMS"===e.type&&(n=Math.round(O(s.width,U(e))),a=Math.round(s.height*(n/s.width)));const h="cim"in e?e.cim.colorSubstitutions:void 0,{size:u,sdf:d,image:l}=this._rasterizer.rasterizeImageResource(n,a,s,h);return this._addItemToMosaic(t,u,{type:"static",data:l},b(e),d,!1)}catch(Q){if(!h(Q))return new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${Q.message}`)}}_addItemToMosaic(e,t,i,s,r,o,n){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,o,n)}}export{Y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{isDevEnvironment as t,adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import e from"../../../../core/Error.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{urlToObject as n}from"../../../../core/urlUtils.js";import s from"../../../../portal/Portal.js";import{f as l}from"../../../../chunks/persistableUrlUtils.js";import{fetchStyle as a,Style2DUrlTemplate as m,requestJSON as i,makeCIMSymbolRef as c,symbolUrlFromStyleItem as u}from"../../../../symbols/support/styleUtils.js";async function y(t,r,n){if(!t.name)throw new e("style-symbol-reference-name-missing","Missing name in style symbol reference");if(t.styleName&&"Esri2DPointSymbolsStyle"===t.styleName)return f(t,n);try{return p(await a(t,r,n),t.name,r,n)}catch(s){return o(s),null}}async function f(t,r){const e=m.replace(/\{SymbolName\}/gi,t.name);try{const t=await i(e,r);return c(t.data)}catch(n){return o(n),null}}async function p(a,m,y,f){const p=a.data,b={portal:y&&null!=y.portal?y.portal:s.getDefault(),url:n(a.baseUrl),origin:"portal-item"},d=p.items.find((t=>t.name===m));if(!d){throw new e("symbolstyleutils:symbol-name-not-found",`The symbol name '${m}' could not be found`,{symbolName:m})}let h=l(u(d,"cimRef"),b);t()&&(h=r(h));try{const t=await i(h,f);return c(t.data)}catch(j){return o(j),null}}export{y as fetchCIMSymbolReference};
5
+ import{isDevEnvironment as t,adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import o from"../../../../core/Error.js";import{throwIfAbortError as e}from"../../../../core/promiseUtils.js";import{urlToObject as s}from"../../../../core/urlUtils.js";import l from"../../../../portal/Portal.js";import{f as n}from"../../../../chunks/persistableUrlUtils.js";import{fetchStyle as m,Style2DUrlTemplate as a,requestJSON as i,makeCIMSymbolRef as c,symbolUrlFromStyleItem as y}from"../../../../symbols/support/styleUtils.js";import{getStyleItemFromStyle as u}from"../../../../symbols/support/webStyleSymbolUtils.js";async function f(t,r,s){if(!t.name)throw new o("style-symbol-reference-name-missing","Missing name in style symbol reference");if(t.styleName&&"Esri2DPointSymbolsStyle"===t.styleName)return p(t,s);try{return b(await m(t,r,s),t.name,r,s)}catch(l){return e(l),null}}async function p(t,r){const o=a.replace(/\{SymbolName\}/gi,t.name);try{const t=await i(o,r);return c(t.data)}catch(s){return e(s),null}}async function b(m,a,f,p){const b={portal:f&&null!=f.portal?f.portal:l.getDefault(),url:s(m.baseUrl),origin:"portal-item"},j=u(a,m.data);if(!j){throw new o("symbolstyleutils:symbol-name-not-found",`The symbol name '${a}' could not be found`,{symbolName:a})}let w=n(y(j,"cimRef"),b);t()&&(w=r(w));try{const t=await i(w,p);return c(t.data)}catch(U){return e(U),null}}export{f as fetchCIMSymbolReference};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import r from"../../../core/Handles.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{watch as n,initial as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{DoubleClickZoom as p}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as d}from"./handlers/DragZoom.js";import{GamepadNavigation as c}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as l}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as g}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as u}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as h}from"./handlers/PointerDownCancelAnimation.js";import{SingleKeyResetHeading as w}from"./handlers/SingleKeyResetHeading.js";import{SingleKeyResetTilt as y}from"./handlers/SingleKeyResetTilt.js";import{TwoFingerTilt as _}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as f}from"../../input/BrowserEventSource.js";import{InputManager as D,ViewEventPriorities as j}from"../../input/InputManager.js";import{PreventContextMenu as v}from"../../input/handlers/PreventContextMenu.js";import{Drag as A}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as P}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as M}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as T}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as R}from"../../input/recognizers/VerticalTwoFingerDrag.js";import{PivotPoint as b}from"../state/controllers/RotateController.js";let z=class extends e{constructor(){super(...arguments),this._handles=new r}destroy(){this._handles=o(this._handles),this.disconnect()}get primaryDragAction(){return this._get("primaryDragAction")}set primaryDragAction(t){"pan"!==t&&"rotate"!==t||t===this._get("primaryDragAction")||(this._set("primaryDragAction",t),this._updateMode())}get mode(){return this._get("mode")}set mode(t){"default"!==t&&"pro"!==t||t===this._get("mode")||(this._set("mode",t),this._updateMode())}get hasPendingInputs(){return!!this._inputManager?.hasPendingInputs}get latestPointerType(){return this._inputManager?.latestPointerType}get latestPointerLocation(){return this._inputManager?.latestPointerLocation}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.view.viewEvents.disconnect(),this._inputManager=o(this._inputManager)}connect(){const t=this.view;this._source=new f(this.view.surface,t.input);const e=[new P,new M,new T,new A(this.view.navigation),new R],r=new D({eventSource:this._source,recognizers:e});this._inputManager=r,r.installHandlers("prevent-context-menu",[new v],j.INTERNAL),this._modeDragPan=new u(t,"primary"),this._modeDragRotate=new m(t,"secondary",b.CENTER),this._modeDragZoom=new d(t,"tertiary");const o={lookAround:"b",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:"u",down:"j",headingLeft:"a",headingRight:"d",tiltUp:"w",tiltDown:"s",zoomIn:"+",zoomOut:"-"},resetHeading:"n",resetTilt:"p"};r.installHandlers("navigation",[new h(t),new p(t),new c(t),new l(t,o.pan),new g(t),new y(t,o.resetTilt),new w(t,o.resetHeading),new m(t,"primary",b.EYE,[o.lookAround]),new m(t,"secondary",b.CENTER,[o.lookAround]),new u(t,"tertiary",[o.lookAround]),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,new _(t)],j.INTERNAL),this.view.viewEvents.connect(r),this._updateMode(),this._handles.add(n((()=>this.view.navigation?.browserTouchPanEnabled),(t=>{this._source.browserTouchPanningEnabled=!t}),i))}_updateMode(){const t=this.mode,e=this.primaryDragAction,r=E.get(t)?.get(e);r&&(this._modeDragPan&&(this._modeDragPan.pointerAction=r.pan),this._modeDragRotate&&(this._modeDragRotate.pointerAction=r.rotate),this._modeDragZoom&&(this._modeDragZoom.pointerAction=r.zoom))}get test(){return{inputManager:this._inputManager,modeDragPan:this._modeDragPan,modeDragRotate:this._modeDragRotate,modeDragZoom:this._modeDragZoom}}};t([a()],z.prototype,"view",void 0),t([a({value:"pan"})],z.prototype,"primaryDragAction",null),t([a({value:"default"})],z.prototype,"mode",null),t([a({readOnly:!0})],z.prototype,"hasPendingInputs",null),t([a()],z.prototype,"latestPointerType",null),t([a()],z.prototype,"latestPointerLocation",null),t([a()],z.prototype,"multiTouchActive",null),t([a()],z.prototype,"_inputManager",void 0),z=t([s("esri.views.3d.input.SceneInputManager")],z);const E=new Map,k=new Map,C=new Map;k.set("pan",{pan:"primary",rotate:"secondary",zoom:"tertiary"}),k.set("rotate",{pan:"secondary",rotate:"primary",zoom:"tertiary"}),C.set("pan",{pan:"primary",rotate:"tertiary",zoom:"secondary"}),C.set("rotate",{pan:"tertiary",rotate:"primary",zoom:"secondary"}),E.set("default",k),E.set("pro",C);const I=z;export{I as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import r from"../../../core/Handles.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{watch as n,initial as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{DoubleClickZoom as p}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as d}from"./handlers/DragZoom.js";import{GamepadNavigation as c}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as l}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as g}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as u}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as h}from"./handlers/PointerDownCancelAnimation.js";import{SingleKeyResetHeading as w}from"./handlers/SingleKeyResetHeading.js";import{SingleKeyResetTilt as y}from"./handlers/SingleKeyResetTilt.js";import{TwoFingerTilt as _}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as f}from"../../input/BrowserEventSource.js";import{InputManager as D,ViewEventPriorities as j}from"../../input/InputManager.js";import{PreventContextMenu as v}from"../../input/handlers/PreventContextMenu.js";import{Drag as A}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as M}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as P}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as T}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as R}from"../../input/recognizers/VerticalTwoFingerDrag.js";import{PivotPoint as b}from"../state/controllers/RotateController.js";let z=class extends e{constructor(){super(...arguments),this._handles=new r}destroy(){this._handles=o(this._handles),this.disconnect()}get primaryDragAction(){return this._get("primaryDragAction")}set primaryDragAction(t){"pan"!==t&&"rotate"!==t||t===this._get("primaryDragAction")||(this._set("primaryDragAction",t),this._updateMode())}get mode(){return this._get("mode")}set mode(t){"default"!==t&&"pro"!==t||t===this._get("mode")||(this._set("mode",t),this._updateMode())}get updating(){return!!this._inputManager?.updating}get latestPointerType(){return this._inputManager?.latestPointerType}get latestPointerLocation(){return this._inputManager?.latestPointerLocation}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.view.viewEvents.disconnect(),this._inputManager=o(this._inputManager)}connect(){const t=this.view;this._source=new f(this.view.surface,t.input);const e=[new M,new P,new T,new A(this.view.navigation),new R],r=new D({eventSource:this._source,recognizers:e});this._inputManager=r,r.installHandlers("prevent-context-menu",[new v],j.INTERNAL),this._modeDragPan=new u(t,"primary"),this._modeDragRotate=new m(t,"secondary",b.CENTER),this._modeDragZoom=new d(t,"tertiary");const o={lookAround:"b",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:"u",down:"j",headingLeft:"a",headingRight:"d",tiltUp:"w",tiltDown:"s",zoomIn:"+",zoomOut:"-"},resetHeading:"n",resetTilt:"p"};r.installHandlers("navigation",[new h(t),new p(t),new c(t),new l(t,o.pan),new g(t),new y(t,o.resetTilt),new w(t,o.resetHeading),new m(t,"primary",b.EYE,[o.lookAround]),new m(t,"secondary",b.CENTER,[o.lookAround]),new u(t,"tertiary",[o.lookAround]),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,new _(t)],j.INTERNAL),this.view.viewEvents.connect(r),this._updateMode(),this._handles.add(n((()=>this.view.navigation?.browserTouchPanEnabled),(t=>{this._source.browserTouchPanningEnabled=!t}),i))}_updateMode(){const t=this.mode,e=this.primaryDragAction,r=E.get(t)?.get(e);r&&(this._modeDragPan&&(this._modeDragPan.pointerAction=r.pan),this._modeDragRotate&&(this._modeDragRotate.pointerAction=r.rotate),this._modeDragZoom&&(this._modeDragZoom.pointerAction=r.zoom))}get test(){return{inputManager:this._inputManager,modeDragPan:this._modeDragPan,modeDragRotate:this._modeDragRotate,modeDragZoom:this._modeDragZoom}}};t([a()],z.prototype,"view",void 0),t([a({value:"pan"})],z.prototype,"primaryDragAction",null),t([a({value:"default"})],z.prototype,"mode",null),t([a({readOnly:!0})],z.prototype,"updating",null),t([a()],z.prototype,"latestPointerType",null),t([a()],z.prototype,"latestPointerLocation",null),t([a()],z.prototype,"multiTouchActive",null),t([a()],z.prototype,"_inputManager",void 0),z=t([s("esri.views.3d.input.SceneInputManager")],z);const E=new Map,k=new Map,C=new Map;k.set("pan",{pan:"primary",rotate:"secondary",zoom:"tertiary"}),k.set("rotate",{pan:"secondary",rotate:"primary",zoom:"tertiary"}),C.set("pan",{pan:"primary",rotate:"tertiary",zoom:"secondary"}),C.set("rotate",{pan:"tertiary",rotate:"primary",zoom:"secondary"}),E.set("default",k),E.set("pro",C);const N=z;export{N as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../chunks/mat4.js";import{b as t,f as r,m as n,n as o}from"../../../chunks/vec3.js";import{f as i}from"../../../chunks/vec4f64.js";import{sv3d as a,sm4d as c}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as l}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as s}from"./Manipulator3D.js";import{RenderObject as u}from"./RenderObject.js";import{computeCentroid as m}from"../layers/graphics/graphicUtils.js";import{Attribute as d}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as p}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as f}from"../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as g,createSphereGeometry as w}from"../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../webgl-engine/lib/Material.js";import{VertexAttribute as h}from"../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as j}from"../webgl-engine/materials/ColorMaterial.js";import{ImageMaterial as O}from"../webgl-engine/materials/ImageMaterial.js";import{NativeLineMaterial as M}from"../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as y}from"../webgl-engine/materials/RibbonLineMaterial.js";import{ShadedColorMaterial as S}from"../webgl-engine/materials/ShadedColorMaterial.js";import{ManipulatorStateCustomFlags as v,ManipulatorStateFlags as A}from"../../interactive/interfaces.js";function F(e,t=b.OccludeAndTransparent,r=!0){const n=i(e[0],e[1],e[2],e.length>3?e[3]:1),o=e[3]<1;return r?new S({color:n,transparent:o,writeDepth:!0,cullFace:p.Back,renderOccluded:t}):new j({color:n,transparent:o,writeDepth:!0,cullFace:p.Back,renderOccluded:t})}function k(e,t=b.OccludeAndTransparent){const r=i(e[0],e[1],e[2],4===e.length?e[3]:1);return new j({color:r,transparent:!0,writeDepth:!0,cullFace:p.Front,renderOccluded:t})}const I=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1});function R(e,t){const r=new s({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:t.metadata});return L(r,t),r}function L(e,t){const r=t.material??new O({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:b.Opaque}),n=t.focusMultiplier??I.focusMultiplier,o=t.calloutLength??I.calloutLength,i=I.discRadius*(t.discScale??1),a=i*n,c=(e,t)=>{const r=[0,1,2,2,3,0];return new f(t,[[h.POSITION,new d([o-e,-e,0,o+e,-e,0,o+e,e,0,o-e,e,0],3,!0)],[h.UV0,new d([0,0,1,0,1,1,0,1],2,!0)]],[[h.POSITION,r],[h.UV0,r]])},l=t.calloutWidth??I.calloutWidth,s=new(l>1?y:M)({width:l,color:t.calloutColor,renderOccluded:b.OccludeAndTransparent}),m=g(s,[[0,0,0],[o-i,0,0]]),p=g(s,[[0,0,0],[o-a,0,0]]),w=t.customStateMask??v.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[o,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=i,e.renderObjects=[new u(c(i,r),A.Unfocused|w),new u(m,A.Unfocused|w),new u(c(a,r),A.Focused|w),new u(p,A.Focused|w)]}function T(e,t,r=v.None){const n=F(t),o=[new u(w(n,1,32,32),r)];return new s({view:e,renderObjects:o})}const U=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function D(o,i,l,s){const u=t(a.get(),o,l),m=N(u,r(a.get(),s,u),l,c.get());e(m,m);const d=n(a.get(),i,m);return Math.atan2(d[1],d[0])}function N(e,t,n,i){const c=o(a.get(),e),l=o(a.get(),t),s=r(a.get(),c,l);return i[0]=c[0],i[1]=c[1],i[2]=c[2],i[3]=0,i[4]=l[0],i[5]=l[1],i[6]=l[2],i[7]=0,i[8]=s[0],i[9]=s[1],i[10]=s[2],i[11]=0,i[12]=n[0],i[13]=n[1],i[14]=n[2],i[15]=1,i}function x(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function V(e,t,r){const n=x(e,r);null==n?z(t,r.geometry):t.elevationAlignedLocation=n}function z(e,t){if(null==t)return;const r="mesh"===t.type?t.anchor:m(t);null!=r&&(e.location=l(r))}export{D as calculateInputRotationTransform,N as calculateTranslateRotateFromBases,F as createManipulatorMaterial,k as createManipulatorOutlineMaterial,R as createRotateManipulator,T as createSphereManipulator,x as getGraphicAttachmentOrigin,V as placeAtGraphic,L as updateRotateManipulator,U as worldScaledManipulatorSettings};
5
+ import{a as e}from"../../../chunks/mat4.js";import{b as t,f as r,m as n,n as o}from"../../../chunks/vec3.js";import{f as i}from"../../../chunks/vec4f64.js";import{sv3d as a,sm4d as c}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as l}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as s}from"./Manipulator3D.js";import{RenderObject as u}from"./RenderObject.js";import{computeCentroid as m}from"../layers/graphics/graphicUtils.js";import{Attribute as d}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as p}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as f}from"../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as g,createSphereGeometry as w}from"../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../webgl-engine/lib/Material.js";import{VertexAttribute as h}from"../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as j}from"../webgl-engine/materials/ColorMaterial.js";import{ImageMaterial as O}from"../webgl-engine/materials/ImageMaterial.js";import{NativeLineMaterial as M}from"../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as y}from"../webgl-engine/materials/RibbonLineMaterial.js";import{ShadedColorMaterial as S}from"../webgl-engine/materials/ShadedColorMaterial.js";import{ManipulatorStateCustomFlags as v,ManipulatorStateFlags as A}from"../../interactive/interfaces.js";function F(e,t=b.OccludeAndTransparent,r=!0){const n=i(e[0],e[1],e[2],e.length>3?e[3]:1),o=e[3]<1,a=!o;return r?new S({color:n,transparent:o,writeDepth:a,cullFace:p.Back,renderOccluded:t}):new j({color:n,transparent:o,writeDepth:a,cullFace:p.Back,renderOccluded:t})}function k(e,t=b.OccludeAndTransparent){const r=i(e[0],e[1],e[2],4===e.length?e[3]:1);return new j({color:r,transparent:!0,writeDepth:!0,cullFace:p.Front,renderOccluded:t})}const I=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1});function R(e,t){const r=new s({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:t.metadata});return L(r,t),r}function L(e,t){const r=t.material??new O({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:b.Opaque}),n=t.focusMultiplier??I.focusMultiplier,o=t.calloutLength??I.calloutLength,i=I.discRadius*(t.discScale??1),a=i*n,c=(e,t)=>{const r=[0,1,2,2,3,0];return new f(t,[[h.POSITION,new d([o-e,-e,0,o+e,-e,0,o+e,e,0,o-e,e,0],3,!0)],[h.UV0,new d([0,0,1,0,1,1,0,1],2,!0)]],[[h.POSITION,r],[h.UV0,r]])},l=t.calloutWidth??I.calloutWidth,s=new(l>1?y:M)({width:l,color:t.calloutColor,renderOccluded:b.OccludeAndTransparent}),m=g(s,[[0,0,0],[o-i,0,0]]),p=g(s,[[0,0,0],[o-a,0,0]]),w=t.customStateMask??v.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[o,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=i,e.renderObjects=[new u(c(i,r),A.Unfocused|w),new u(m,A.Unfocused|w),new u(c(a,r),A.Focused|w),new u(p,A.Focused|w)]}function T(e,t,r=v.None){const n=F(t),o=[new u(w(n,1,32,32),r)];return new s({view:e,renderObjects:o})}const U=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function D(o,i,l,s){const u=t(a.get(),o,l),m=N(u,r(a.get(),s,u),l,c.get());e(m,m);const d=n(a.get(),i,m);return Math.atan2(d[1],d[0])}function N(e,t,n,i){const c=o(a.get(),e),l=o(a.get(),t),s=r(a.get(),c,l);return i[0]=c[0],i[1]=c[1],i[2]=c[2],i[3]=0,i[4]=l[0],i[5]=l[1],i[6]=l[2],i[7]=0,i[8]=s[0],i[9]=s[1],i[10]=s[2],i[11]=0,i[12]=n[0],i[13]=n[1],i[14]=n[2],i[15]=1,i}function x(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function V(e,t,r){const n=x(e,r);null==n?z(t,r.geometry):t.elevationAlignedLocation=n}function z(e,t){if(null==t)return;const r="mesh"===t.type?t.anchor:m(t);null!=r&&(e.location=l(r))}export{D as calculateInputRotationTransform,N as calculateTranslateRotateFromBases,F as createManipulatorMaterial,k as createManipulatorOutlineMaterial,R as createRotateManipulator,T as createSphereManipulator,x as getGraphicAttachmentOrigin,V as placeAtGraphic,L as updateRotateManipulator,U as worldScaledManipulatorSettings};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{f as e}from"../../../../chunks/mat4.js";import{c as t}from"../../../../chunks/mat4f64.js";import{s as r,m as s}from"../../../../chunks/vec3.js";import{Z as i,c as o}from"../../../../chunks/vec3f64.js";import{f as a,d as n}from"../../../../chunks/vec4f64.js";import{Object3DVisualElement as l}from"./Object3DVisualElement.js";import{lineStripsToParameters as m,createGeometry as p}from"../../support/engineContent/line.js";import{RenderOccludedFlag as h}from"../../webgl-engine/lib/Material.js";import{RibbonLineMaterial as d}from"../../webgl-engine/materials/RibbonLineMaterial.js";class u extends l{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=null!=t,this._material=null!=t?t:new d({width:1,color:a(1,0,1,1),stippleOffColor:null,stipplePattern:null,stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerColor:null,innerWidth:1,hasPolygonOffset:!1,renderOccluded:h.OccludeAndTransparent,writeDepth:!0}),this.applyProps(e)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=o(),i=o(),a=100,n=[];r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),this.geometry=[n]}setGeometryFromFrustum(e){const t=[];e.lines.forEach((e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])})),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],r=e.origin,s=e.basis1,i=e.basis2,a=.5,n=o(),l=o(),m=o(),p=o();n[0]=r[0]-s[0]*a-i[0]*a,n[1]=r[1]-s[1]*a-i[1]*a,n[2]=r[2]-s[2]*a-i[2]*a,l[0]=r[0]-s[0]*a+i[0]*a,l[1]=r[1]-s[1]*a+i[1]*a,l[2]=r[2]-s[2]*a+i[2]*a,m[0]=r[0]+s[0]*a+i[0]*a,m[1]=r[1]+s[1]*a+i[1]*a,m[2]=r[2]+s[2]*a+i[2]*a,p[0]=r[0]+s[0]*a-i[0]*a,p[1]=r[1]+s[1]*a-i[1]*a,p[2]=r[2]+s[2]*a-i[2]*a,t.push([n[0],n[1],n[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([p[0],p[1],p[2]]),t.push([n[0],n[1],n[2]]),this.geometry=[t]}setGeometryFromSegment(t){const r=t.endRenderSpace;this.transform=e(f,r);const{points:s}=t.createRenderGeometry(r,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(t,r=i){this.transform=e(f,r),this.geometry=t.map((e=>e.createRenderGeometry(r,this.view.renderCoordsHelper).points))}getTransformedGeometry(){return null==this._geometry?null:this._geometry.map((e=>e.map((e=>s(o(),e,this.transform)))))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){this._material.setParameters({color:n(e)})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:null!=e?n(e):null})}get stipplePattern(){return this._material.parameters.stipplePattern}set stipplePattern(e){null!=this._material&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:null!=e?n(e):null})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get writeDepthEnabled(){return this._material.parameters.writeDepth}set writeDepthEnabled(e){this._material.setParameters({writeDepth:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of m(this.geometry)){const r=p(this._material,t);e.addGeometry(r)}}forEachExternalMaterial(e){this._hasExternalMaterial||e(this._material)}}const f=t();export{u as LineVisualElement};
5
+ import{f as e}from"../../../../chunks/mat4.js";import{c as t}from"../../../../chunks/mat4f64.js";import{s as r,m as s}from"../../../../chunks/vec3.js";import{Z as o,c as i}from"../../../../chunks/vec3f64.js";import{f as a,d as n}from"../../../../chunks/vec4f64.js";import{Object3DVisualElement as l}from"./Object3DVisualElement.js";import{lineStripsToParameters as m,createGeometry as p}from"../../support/engineContent/line.js";import{RenderOccludedFlag as h}from"../../webgl-engine/lib/Material.js";import{RibbonLineMaterial as d}from"../../webgl-engine/materials/RibbonLineMaterial.js";class u extends l{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=null!=t,this._material=null!=t?t:new d({width:1,color:a(1,0,1,1),stippleOffColor:null,stipplePattern:null,stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerColor:null,innerWidth:1,hasPolygonOffset:!1,renderOccluded:h.OccludeAndTransparent,writeDepth:!0}),this.applyProps(e)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=i(),o=i(),a=100,n=[];r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,o),n.push([o[0],o[1],o[2]]),this.geometry=[n]}setGeometryFromFrustum(e){const t=[];e.lines.forEach((e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])})),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],r=e.origin,s=e.basis1,o=e.basis2,a=.5,n=i(),l=i(),m=i(),p=i();n[0]=r[0]-s[0]*a-o[0]*a,n[1]=r[1]-s[1]*a-o[1]*a,n[2]=r[2]-s[2]*a-o[2]*a,l[0]=r[0]-s[0]*a+o[0]*a,l[1]=r[1]-s[1]*a+o[1]*a,l[2]=r[2]-s[2]*a+o[2]*a,m[0]=r[0]+s[0]*a+o[0]*a,m[1]=r[1]+s[1]*a+o[1]*a,m[2]=r[2]+s[2]*a+o[2]*a,p[0]=r[0]+s[0]*a-o[0]*a,p[1]=r[1]+s[1]*a-o[1]*a,p[2]=r[2]+s[2]*a-o[2]*a,t.push([n[0],n[1],n[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([p[0],p[1],p[2]]),t.push([n[0],n[1],n[2]]),this.geometry=[t]}setGeometryFromSegment(t){const r=t.endRenderSpace;this.transform=e(f,r);const{points:s}=t.createRenderGeometry(r,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(t,r=o){this.transform=e(f,r),this.geometry=t.map((e=>e.createRenderGeometry(r,this.view.renderCoordsHelper).points))}getTransformedGeometry(){return null==this._geometry?null:this._geometry.map((e=>e.map((e=>s(i(),e,this.transform)))))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){const t=1===e[3];this._material.setParameters({color:n(e),writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:null!=e?n(e):null})}get stipplePattern(){return this._material.parameters.stipplePattern}set stipplePattern(e){null!=this._material&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:null!=e?n(e):null})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of m(this.geometry)){const r=p(this._material,t);e.addGeometry(r)}}forEachExternalMaterial(e){this._hasExternalMaterial||e(this._material)}}const f=t();export{u as LineVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../geometry.js";import{remove as e}from"../../../../core/arrayUtils.js";import{onAbort as t,createAbortError as r}from"../../../../core/promiseUtils.js";import{TaskPriority as s,noBudget as i}from"../../../support/Scheduler.js";import n from"../../../../geometry/Multipoint.js";class o{constructor(e,t){this.spatialReference=e,this._view=t}getElevation(e,t,r){return this._view.elevationProvider.getElevation(e,t,0,this.spatialReference,r)}async queryElevation(e,t,r,s,i){return this._view.elevationProvider.queryElevation(e,t,0,this.spatialReference,i,r,s)}}class l{constructor(e,t,r,i){this.spatialReference=t,this._getElevationQueryProvider=r,this._queries=new Array,this._queryOptions={...i,ignoreInvisibleLayers:!0},this._frameTask=e.registerTask(s.ELEVATION_QUERY,this)}destroy(){this._frameTask.remove()}queryElevation(s,i,n,o=0){return new Promise(((l,a)=>{const u={x:s,y:i,minDemResolution:o,result:{resolve:l,reject:a},signal:n};this._queries.push(u),t(n,(()=>{e(this._queries,u),a(r())}))}))}get running(){return this._queries.length>0}runTask(e){const s=this._queries;this._queries=[];const i=this._getElevationQueryProvider();if(!i)return s.forEach((e=>e.result.reject())),void e.madeProgress();const o=s.map((e=>[e.x,e.y])),l=s.reduce(((e,t)=>Math.min(e,t.minDemResolution)),1/0),a=new n({points:o,spatialReference:this.spatialReference}),u=s.length>1&&s.some((e=>!!e.signal))?new AbortController:null,h=null!=u?u.signal:s[0].signal;if(null!=u){let e=0;s.forEach((i=>t(i.signal,(()=>{e++,i.result.reject(r()),e===s.length&&u.abort()}))))}const c={...this._queryOptions,minDemResolution:l,signal:h};i.queryElevation(a,c).then((e=>{s.forEach(((t,s)=>{null!=t.signal&&t.signal.aborted?t.result.reject(r()):t.result.resolve(e.geometry.points[s][2])}))})).catch((e=>{s.forEach((t=>t.result.reject(e)))})),e.madeProgress()}get test(){const e=this;return{update:()=>e._queries.length>0&&e.runTask(i)}}}export{l as ElevationQuery,o as ViewElevationProvider};
5
+ import"../../../../geometry.js";import{remove as e}from"../../../../core/arrayUtils.js";import{createResolver as t,onAbort as r,createAbortError as s}from"../../../../core/promiseUtils.js";import{TaskPriority as i,noBudget as n}from"../../../support/Scheduler.js";import o from"../../../../geometry/Multipoint.js";class a{constructor(e,t){this.spatialReference=e,this._view=t}getElevation(e,t,r){return this._view.elevationProvider.getElevation(e,t,0,this.spatialReference,r)}async queryElevation(e,t,r,s,i){return this._view.elevationProvider.queryElevation(e,t,0,this.spatialReference,i,r,s)}}class l{constructor(e,t,r,s){this.spatialReference=t,this._getElevationQueryProvider=r,this._queries=new Array,this._queryOptions={...s,ignoreInvisibleLayers:!0},this._frameTask=e.registerTask(i.ELEVATION_QUERY,this)}destroy(){this._frameTask.remove()}queryElevation(i,n,o,a=0){const l=t(),u={x:i,y:n,minDemResolution:a,result:l,signal:o};return this._queries.push(u),r(o,(()=>{e(this._queries,u),l.reject(s())})),l.promise}get running(){return this._queries.length>0}runTask(e){const t=this._queries;this._queries=[];const i=this._getElevationQueryProvider();if(!i)return t.forEach((e=>e.result.reject())),void e.madeProgress();const n=t.map((e=>[e.x,e.y])),a=t.reduce(((e,t)=>Math.min(e,t.minDemResolution)),1/0),l=new o({points:n,spatialReference:this.spatialReference}),u=t.length>1&&t.some((e=>!!e.signal))?new AbortController:null,h=null!=u?u.signal:t[0].signal;if(null!=u){let e=0;t.forEach((i=>r(i.signal,(()=>{e++,i.result.reject(s()),e===t.length&&u.abort()}))))}const c={...this._queryOptions,minDemResolution:a,signal:h};i.queryElevation(l,c).then((e=>{t.forEach(((t,r)=>{null!=t.signal&&t.signal.aborted?t.result.reject(s()):t.result.resolve(e.geometry.points[r][2])}))})).catch((e=>{t.forEach((t=>t.result.reject(e)))})),e.madeProgress()}get test(){const e=this;return{update:()=>e._queries.length>0&&e.runTask(n)}}}export{l as ElevationQuery,a as ViewElevationProvider};