@arcgis/core 4.30.0-next.20240411 → 4.30.0-next.20240412

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 (117) hide show
  1. package/Color.js +1 -1
  2. package/arcade/ArcadeDate.js +1 -1
  3. package/arcade/ArcadeModuleResolver.js +1 -1
  4. package/arcade/functions/string.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/0a6330d68ffce7afe6a0.js +1 -0
  7. package/assets/esri/core/workers/chunks/{d8dc9be80a36f57144d5.js → 0a832e6277770d305065.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{8917f97888d1290f56d2.js → 0f316c7bacb6a7f22714.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{42167e3f34477afe0883.js → 14967dcef038d0c97e3d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{74bc0467d50b4ee8b9d8.js → 20e81d5bfd6b7c720789.js} +1 -1
  11. package/assets/esri/core/workers/chunks/21d7b91b91e223bb3130.js +1 -0
  12. package/assets/esri/core/workers/chunks/36ee84f94dc89648f31a.js +1 -0
  13. package/assets/esri/core/workers/chunks/{155e7d90251f3f8d52de.js → 3d905e1c69bc302448c5.js} +1 -1
  14. package/assets/esri/core/workers/chunks/42821a20e1a3d9f08276.js +1 -0
  15. package/assets/esri/core/workers/chunks/45b2f6334c001651b8ff.js +1 -0
  16. package/assets/esri/core/workers/chunks/{cb719e8496c461c283a9.js → 4d7d28a2a36eb267549c.js} +27 -27
  17. package/assets/esri/core/workers/chunks/51a91227cbc5ffc031a8.js +1 -0
  18. package/assets/esri/core/workers/chunks/{51700be6f50efba0bc82.js → 521f77cd09ec8cebe931.js} +1 -1
  19. package/assets/esri/core/workers/chunks/5283aabc9f9ff9a3866a.js +1 -0
  20. package/assets/esri/core/workers/chunks/5f0b84360611e612c2a4.js +1 -0
  21. package/assets/esri/core/workers/chunks/{fe7b3988adf0a7b0945c.js → 634b0496246e70de40a0.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{ef589ec762d6396752af.js → 636627deab56dd8a9da1.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{fb1db2a470b7a55de65b.js → 64e43bf489ac4470c798.js} +1 -1
  24. package/assets/esri/core/workers/chunks/672fffea5257e96120e0.js +1 -0
  25. package/assets/esri/core/workers/chunks/6c080bcd30ec7d321feb.js +1 -0
  26. package/assets/esri/core/workers/chunks/{d760380d16c59b245c34.js → 74285b34e8b2cb17a81c.js} +1 -1
  27. package/assets/esri/core/workers/chunks/774102d789888b353619.js +1 -0
  28. package/assets/esri/core/workers/chunks/{7ca976273f1f64f75aa7.js → 7b1b8bba3e98da3e5ded.js} +1 -1
  29. package/assets/esri/core/workers/chunks/8a4cfe3af94e2d8af07f.js +1 -0
  30. package/assets/esri/core/workers/chunks/{0aa5e2c5ac9e90250def.js → 8c0d5c4f669af3663052.js} +1 -1
  31. package/assets/esri/core/workers/chunks/933503f94409ccb2f1b1.js +1 -0
  32. package/assets/esri/core/workers/chunks/94f55f7db5279bf9d427.js +1 -0
  33. package/assets/esri/core/workers/chunks/96315e80788a3fc554d3.js +1 -0
  34. package/assets/esri/core/workers/chunks/{46407f7b8b47ac98b694.js → 9c0e1e7c4296a5d032a0.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{4f284f85d4a446c1204a.js → a597e05afa7b4dd72163.js} +1 -1
  36. package/assets/esri/core/workers/chunks/ac2719cb06204f4fd56e.js +1 -0
  37. package/assets/esri/core/workers/chunks/beff63eb3af763ddad63.js +1 -0
  38. package/assets/esri/core/workers/chunks/{22041e7989de952626e0.js → cc6a1bb0872776e3844b.js} +1 -1
  39. package/assets/esri/core/workers/chunks/d36729d658a204d7dba2.js +1 -0
  40. package/assets/esri/core/workers/chunks/d59f52a04835b3fb8008.js +1 -0
  41. package/assets/esri/core/workers/chunks/{11c8cb48d772341677f0.js → e8a7da21b8bbd5a38558.js} +1 -1
  42. package/assets/esri/core/workers/chunks/ea1b862498e1e9cee145.js +1 -0
  43. package/assets/esri/core/workers/chunks/f23901ac5ec0861ad674.js +1 -0
  44. package/assets/esri/core/workers/chunks/{8c07e1000522c3251ac0.js → fd3280b752f961c12c54.js} +1 -1
  45. package/assets/esri/core/workers/chunks/fd5655136f7441731ae8.js +1 -0
  46. package/assets/esri/core/workers/chunks/{b7fa2553444c9a2bc1e6.js → fdc22a127011833699d2.js} +1 -1
  47. package/chunks/languageUtils.js +1 -1
  48. package/chunks/persistableUrlUtils.js +1 -1
  49. package/core/Message.js +1 -1
  50. package/core/sql/DateOnly.js +1 -1
  51. package/core/sql/sqlDateParsingUtils.js +1 -1
  52. package/core/string.js +1 -1
  53. package/core/unitFormatUtils.js +1 -1
  54. package/core/urlUtils.js +1 -1
  55. package/exports/csv.js +1 -1
  56. package/identity/IdentityManagerBase.js +1 -1
  57. package/interfaces.d.ts +76 -0
  58. package/intl/locale.js +1 -1
  59. package/intl/t9n.js +1 -1
  60. package/layers/TileLayer.js +1 -1
  61. package/layers/VectorTileLayer.js +1 -1
  62. package/layers/support/arcgisLayerUrl.js +1 -1
  63. package/layers/support/fieldUtils.js +1 -1
  64. package/layers/support/labelingInfo.js +1 -1
  65. package/layers/support/rasterDatasets/CloudRaster.js +1 -1
  66. package/package.json +1 -1
  67. package/portal/PortalUser.js +1 -1
  68. package/rest/support/DirectionsFeature.js +1 -1
  69. package/support/revision.js +1 -1
  70. package/undoredo/support/ServiceVersionInfo.js +5 -0
  71. package/undoredo/support/Services.js +5 -0
  72. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  73. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  74. package/views/2d/layers/features/FeatureContainer.js +1 -1
  75. package/views/2d/layers/features/Processor.js +1 -1
  76. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  77. package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
  78. package/views/3d/webgl/RenderCamera.js +1 -1
  79. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  80. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  81. package/views/3d/webgl-engine/lib/RenderSlot.js +1 -1
  82. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  83. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  84. package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
  85. package/views/webgl/ShaderTranspiler.js +1 -1
  86. package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
  87. package/widgets/BasemapLayerList.js +1 -1
  88. package/widgets/Feature/support/featureUtils.js +1 -1
  89. package/widgets/LayerList/LayerListViewModel.js +1 -1
  90. package/widgets/LayerList/ListItem.js +1 -1
  91. package/widgets/LayerList/support/layerListUtils.js +1 -1
  92. package/widgets/LayerList.js +1 -1
  93. package/widgets/Popup.js +1 -1
  94. package/widgets/Search/support/locatorUtils.js +1 -1
  95. package/widgets/TableList/TableListViewModel.js +1 -1
  96. package/assets/esri/core/workers/chunks/34194ede2889e813bbcf.js +0 -1
  97. package/assets/esri/core/workers/chunks/4cce06bab32e9ab5033f.js +0 -1
  98. package/assets/esri/core/workers/chunks/536bcba6da08f11477ae.js +0 -1
  99. package/assets/esri/core/workers/chunks/54f702f54e99d81d843f.js +0 -1
  100. package/assets/esri/core/workers/chunks/6d64d428dc3b9eb09941.js +0 -1
  101. package/assets/esri/core/workers/chunks/7cf92ebcebfab51812ac.js +0 -1
  102. package/assets/esri/core/workers/chunks/7eb78231da0ba3a0560a.js +0 -1
  103. package/assets/esri/core/workers/chunks/8a98d957bfcbfe69786d.js +0 -1
  104. package/assets/esri/core/workers/chunks/92768688a5613ca30543.js +0 -1
  105. package/assets/esri/core/workers/chunks/9f2c84758ecad67e1ad4.js +0 -1
  106. package/assets/esri/core/workers/chunks/9f6daadc33f34a1c7282.js +0 -1
  107. package/assets/esri/core/workers/chunks/a0411f1c051f51b7d42a.js +0 -1
  108. package/assets/esri/core/workers/chunks/a49998c185fd374900fc.js +0 -1
  109. package/assets/esri/core/workers/chunks/ad8f11bb77a37c5f20de.js +0 -1
  110. package/assets/esri/core/workers/chunks/b3d905c6b100831ad3c4.js +0 -1
  111. package/assets/esri/core/workers/chunks/bd6a9816d88d757f143e.js +0 -1
  112. package/assets/esri/core/workers/chunks/c5c88f79d5a69b043869.js +0 -1
  113. package/assets/esri/core/workers/chunks/c7d4c2dec82137101fe8.js +0 -1
  114. package/assets/esri/core/workers/chunks/cb32876cb634d8c97eba.js +0 -1
  115. package/assets/esri/core/workers/chunks/cb83dbe36f9ed669127e.js +0 -1
  116. package/assets/esri/core/workers/chunks/ec6ce4fe684d8ee74c34.js +0 -1
  117. package/assets/esri/core/workers/chunks/ff17f803800c28f87842.js +0 -1
package/Color.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{hsla2rgba as t,isNamedColor as r,getNamedColor as s}from"./colorUtils.js";import{clamp as i}from"./core/mathUtils.js";import{ensureInteger as n}from"./core/accessorSupport/ensureType.js";function a(t){return i(n(t),0,255)}function e(t,r,s){return t=Number(t),isNaN(t)?s:t<r?r:t>s?s:t}function o(t,r){const s=t.toString(16).padStart(2,"0");return r?s.substring(0,1):s}class h{static blendColors(t,r,s,i=new h){return i.r=Math.round(t.r+(r.r-t.r)*s),i.g=Math.round(t.g+(r.g-t.g)*s),i.b=Math.round(t.b+(r.b-t.b)*s),i.a=t.a+(r.a-t.a)*s,i._sanitize()}static fromRgb(r,s){const i=r.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);if(i){const r=i[2].split(/\s*,\s*/),n=i[1];if("rgb"===n&&3===r.length||"rgba"===n&&4===r.length){const t=r[0];if("%"===t.charAt(t.length-1)){const t=r.map((t=>2.56*parseFloat(t)));return 4===r.length&&(t[3]=parseFloat(r[3])),h.fromArray(t,s)}return h.fromArray(r.map((t=>parseFloat(t))),s)}if("hsl"===n&&3===r.length||"hsla"===n&&4===r.length)return h.fromArray(t(parseFloat(r[0]),parseFloat(r[1])/100,parseFloat(r[2])/100,parseFloat(r[3])),s)}return null}static fromHex(t,r=new h){if("#"!==t[0]||isNaN(Number(`0x${t.substring(1)}`)))return null;switch(t.length){case 4:case 5:{const s=parseInt(t.substring(1,2),16),i=parseInt(t.substring(2,3),16),n=parseInt(t.substring(3,4),16),a=5===t.length?15:parseInt(t.substring(4),16);return h.fromArray([s+16*s,i+16*i,n+16*n,(a+16*a)/255],r)}case 7:case 9:{const s=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),n=parseInt(t.substring(5,7),16),a=7===t.length?255:parseInt(t.substring(7),16);return h.fromArray([s,i,n,a/255],r)}default:return null}}static fromArray(t,r=new h){return r._set(Number(t[0]),Number(t[1]),Number(t[2]),Number(t[3])),isNaN(r.a)&&(r.a=1),r._sanitize()}static fromString(t,i){const n=r(t)?s(t):null;return n&&h.fromArray(n,i)||h.fromRgb(t,i)||h.fromHex(t,i)}static fromJSON(t){return null!=t?new h([t[0],t[1],t[2],(t[3]??255)/255]):void 0}static toUnitRGB(t){return null!=t?[t.r/255,t.g/255,t.b/255]:null}static toUnitRGBA(t){return null!=t?[t.r/255,t.g/255,t.b/255,null!=t.a?t.a:1]:null}constructor(t){this.r=255,this.g=255,this.b=255,this.a=1,t&&this.setColor(t)}get isBright(){return.299*this.r+.587*this.g+.114*this.b>=127}setColor(t){return"string"==typeof t?h.fromString(t,this):Array.isArray(t)?h.fromArray(t,this):(this._set(t.r??0,t.g??0,t.b??0,t.a??1),t instanceof h||this._sanitize()),this}toRgb(){return[this.r,this.g,this.b]}toRgba(){return[this.r,this.g,this.b,this.a]}toHex(t){const r=t?.capitalize??!1,s=t?.digits??6,i=3===s||4===s,n=4===s||8===s,a=`#${o(this.r,i)}${o(this.g,i)}${o(this.b,i)}${n?o(Math.round(255*this.a),i):""}`;return r?a.toUpperCase():a}toCss(t=!1){const r=this.r+", "+this.g+", "+this.b;return t?`rgba(${r}, ${this.a})`:`rgb(${r})`}toString(){return this.toCss(!0)}toJSON(){return this.toArray()}toArray(t=h.AlphaMode.ALWAYS){const r=a(this.r),s=a(this.g),i=a(this.b);return t===h.AlphaMode.ALWAYS||1!==this.a?[r,s,i,a(255*this.a)]:[r,s,i]}clone(){return new h(this.toRgba())}hash(){return this.r<<24|this.g<<16|this.b<<8|255*this.a}equals(t){return null!=t&&t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a}_sanitize(){return this.r=Math.round(e(this.r,0,255)),this.g=Math.round(e(this.g,0,255)),this.b=Math.round(e(this.b,0,255)),this.a=e(this.a,0,1),this}_set(t,r,s,i){this.r=t,this.g=r,this.b=s,this.a=i}}h.prototype.declaredClass="esri.Color",function(t){var r;(r=t.AlphaMode||(t.AlphaMode={}))[r.ALWAYS=0]="ALWAYS",r[r.UNLESS_OPAQUE=1]="UNLESS_OPAQUE"}(h||(h={}));const u=h;export{u as default};
5
+ import{hsla2rgba as t,isNamedColor as r,getNamedColor as s}from"./colorUtils.js";import{clamp as i}from"./core/mathUtils.js";import{ensureInteger as n}from"./core/accessorSupport/ensureType.js";function a(t){return i(n(t),0,255)}function e(t,r,s){return t=Number(t),isNaN(t)?s:t<r?r:t>s?s:t}function o(t,r){const s=t.toString(16).padStart(2,"0");return r?s.substring(0,1):s}class h{static blendColors(t,r,s,i=new h){return i.r=Math.round(t.r+(r.r-t.r)*s),i.g=Math.round(t.g+(r.g-t.g)*s),i.b=Math.round(t.b+(r.b-t.b)*s),i.a=t.a+(r.a-t.a)*s,i._sanitize()}static fromRgb(r,s){const i=r.toLowerCase().match(/^(rgba?|hsla?)\(([\s.\-,%0-9]+)\)/);if(i){const r=i[2].split(/\s*,\s*/),n=i[1];if("rgb"===n&&3===r.length||"rgba"===n&&4===r.length){const t=r[0];if("%"===t.charAt(t.length-1)){const t=r.map((t=>2.56*parseFloat(t)));return 4===r.length&&(t[3]=parseFloat(r[3])),h.fromArray(t,s)}return h.fromArray(r.map((t=>parseFloat(t))),s)}if("hsl"===n&&3===r.length||"hsla"===n&&4===r.length)return h.fromArray(t(parseFloat(r[0]),parseFloat(r[1])/100,parseFloat(r[2])/100,parseFloat(r[3])),s)}return null}static fromHex(t,r=new h){if("#"!==t[0]||isNaN(Number(`0x${t.substring(1)}`)))return null;switch(t.length){case 4:case 5:{const s=parseInt(t.substring(1,2),16),i=parseInt(t.substring(2,3),16),n=parseInt(t.substring(3,4),16),a=5===t.length?15:parseInt(t.substring(4),16);return h.fromArray([s+16*s,i+16*i,n+16*n,(a+16*a)/255],r)}case 7:case 9:{const s=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),n=parseInt(t.substring(5,7),16),a=7===t.length?255:parseInt(t.substring(7),16);return h.fromArray([s,i,n,a/255],r)}default:return null}}static fromArray(t,r=new h){return r._set(Number(t[0]),Number(t[1]),Number(t[2]),Number(t[3])),isNaN(r.a)&&(r.a=1),r._sanitize()}static fromString(t,i){const n=r(t)?s(t):null;return n&&h.fromArray(n,i)||h.fromRgb(t,i)||h.fromHex(t,i)}static fromJSON(t){return null!=t?new h([t[0],t[1],t[2],(t[3]??255)/255]):void 0}static toUnitRGB(t){return null!=t?[t.r/255,t.g/255,t.b/255]:null}static toUnitRGBA(t){return null!=t?[t.r/255,t.g/255,t.b/255,null!=t.a?t.a:1]:null}constructor(t){this.r=255,this.g=255,this.b=255,this.a=1,t&&this.setColor(t)}get isBright(){return.299*this.r+.587*this.g+.114*this.b>=127}setColor(t){return"string"==typeof t?h.fromString(t,this):Array.isArray(t)?h.fromArray(t,this):(this._set(t.r??0,t.g??0,t.b??0,t.a??1),t instanceof h||this._sanitize()),this}toRgb(){return[this.r,this.g,this.b]}toRgba(){return[this.r,this.g,this.b,this.a]}toHex(t){const r=t?.capitalize??!1,s=t?.digits??6,i=3===s||4===s,n=4===s||8===s,a=`#${o(this.r,i)}${o(this.g,i)}${o(this.b,i)}${n?o(Math.round(255*this.a),i):""}`;return r?a.toUpperCase():a}toCss(t=!1){const r=this.r+", "+this.g+", "+this.b;return t?`rgba(${r}, ${this.a})`:`rgb(${r})`}toString(){return this.toCss(!0)}toJSON(){return this.toArray()}toArray(t=h.AlphaMode.ALWAYS){const r=a(this.r),s=a(this.g),i=a(this.b);return t===h.AlphaMode.ALWAYS||1!==this.a?[r,s,i,a(255*this.a)]:[r,s,i]}clone(){return new h(this.toRgba())}hash(){return this.r<<24|this.g<<16|this.b<<8|255*this.a}equals(t){return null!=t&&t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a}_sanitize(){return this.r=Math.round(e(this.r,0,255)),this.g=Math.round(e(this.g,0,255)),this.b=Math.round(e(this.b,0,255)),this.a=e(this.a,0,1),this}_set(t,r,s,i){this.r=t,this.g=r,this.b=s,this.a=i}}h.prototype.declaredClass="esri.Color",function(t){var r;(r=t.AlphaMode||(t.AlphaMode={}))[r.ALWAYS=0]="ALWAYS",r[r.UNLESS_OPAQUE=1]="UNLESS_OPAQUE"}(h||(h={}));const u=h;export{u 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.30/esri/copyright.txt for details.
4
4
  */
5
- import{replace as e}from"../core/string.js";import{UnknownTimeZone as t}from"../core/sql/UnknownTimeZone.js";import{DateTime as n,Zone as r,FixedOffsetZone as s,IANAZone as i}from"luxon";var o;!function(e){e.TimeZoneNotRecognized="TimeZoneNotRecognized"}(o||(o={}));const a={[o.TimeZoneNotRecognized]:"Timezone identifier has not been recognized."};class d extends Error{constructor(t,n){super(e(a[t],n)),this.declaredRootClass="esri.arcade.arcadedate.dateerror",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}function u(e,t,n){return e<t?e-t:e>n?e-n:0}function c(e,t,n){return e<t?t:e>n?n:e}class m{constructor(e){this._date=e,this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(e=0,t=1,r=1,s=0,i=0,o=0,a=0,d){if(isNaN(e)||isNaN(t)||isNaN(r)||isNaN(s)||isNaN(i)||isNaN(o)||isNaN(a))return null;const l=n.local(e,t).daysInMonth;let f=n.fromObject({day:c(r,1,l),year:e,month:c(t,1,12),hour:c(s,0,23),minute:c(i,0,59),second:c(o,0,59),millisecond:c(a,0,999)},{zone:h(d)});return f=f.plus({months:u(t,1,12),days:u(r,1,l),hours:u(s,0,23),minutes:u(i,0,59),seconds:u(o,0,59),milliseconds:u(a,0,999)}),new m(f)}static get systemTimeZoneCanonicalName(){return Intl.DateTimeFormat().resolvedOptions().timeZone??"system"}static arcadeDateAndZoneToArcadeDate(e,n){const r=h(n);return e.isUnknownTimeZone||r===t.instance?m.fromParts(e.year,e.monthJS+1,e.day,e.hour,e.minute,e.second,e.millisecond,r):new m(e._date.setZone(r))}static dateJSToArcadeDate(e){return new m(n.fromJSDate(e,{zone:"system"}))}static dateJSAndZoneToArcadeDate(e,t="system"){const r=h(t);return new m(n.fromJSDate(e,{zone:r}))}static unknownEpochToArcadeDate(e){return new m(n.fromMillis(e,{zone:t.instance}))}static unknownDateJSToArcadeDate(e){return new m(n.fromMillis(e.getTime(),{zone:t.instance}))}static epochToArcadeDate(e,t="system"){const r=h(t);return new m(n.fromMillis(e,{zone:r}))}static dateTimeToArcadeDate(e){return new m(e)}clone(){return new m(this._date)}changeTimeZone(e){const t=h(e);return m.dateTimeToArcadeDate(this._date.setZone(t))}static dateTimeAndZoneToArcadeDate(e,n){const r=h(n);return e.zone===t.instance||r===t.instance?m.fromParts(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond,r):new m(e.setZone(r))}static nowToArcadeDate(e){const t=h(e);return new m(n.fromJSDate(new Date,{zone:t}))}static nowUTCToArcadeDate(){return new m(n.utc())}get isSystem(){return"system"===this.timeZone||this.timeZone===m.systemTimeZoneCanonicalName}equals(e){return this.isSystem&&e.isSystem?this.toNumber()===e.toNumber():this.isUnknownTimeZone===e.isUnknownTimeZone&&this._date.equals(e._date)}get isUnknownTimeZone(){return this._date.zone===t.instance}get isValid(){return this._date.isValid}get hour(){return this._date.hour}get second(){return this._date.second}get day(){return this._date.day}get dayOfWeekISO(){return this._date.weekday}get dayOfWeekJS(){let e=this._date.weekday;return e>6&&(e=0),e}get millisecond(){return this._date.millisecond}get monthISO(){return this._date.month}get weekISO(){return this._date.weekNumber}get yearISO(){return this._date.weekYear}get monthJS(){return this._date.month-1}get year(){return this._date.year}get minute(){return this._date.minute}get zone(){return this._date.zone}get timeZoneOffset(){return this.isUnknownTimeZone?0:this._date.offset}get timeZone(){if(this.isUnknownTimeZone)return"unknown";if("system"===this._date.zone.type)return"system";const e=this.zone;return"fixed"===e.type?0===e.fixed?"UTC":e.formatOffset(0,"short"):e.name}stringify(){return JSON.stringify(this.toJSDate())}plus(e){return new m(this._date.plus(e))}diff(e,t="milliseconds"){return this._date.diff(e._date,t)[t]}toISODate(){return this._date.toISODate()}toISOString(e){return e?this._date.toISO({suppressMilliseconds:!0,includeOffset:!this.isUnknownTimeZone}):this._date.toISO({includeOffset:!this.isUnknownTimeZone})}toISOTime(e,t){return this._date.toISOTime({suppressMilliseconds:e,includeOffset:t&&!this.isUnknownTimeZone})}toFormat(e,t){return this.isUnknownTimeZone&&(e=e.replaceAll("Z","")),this._date.toFormat(e,t)}toJSDate(){return this._date.toJSDate()}toSQLValue(){return this._date.toFormat("yyyy-LL-dd HH:mm:ss")}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}toDateTime(){return this._date}toNumber(){return this._date.toMillis()}getTime(){return this._date.toMillis()}toUTC(){return new m(this._date.toUTC())}toLocal(){return new m(this._date.toLocal())}toString(){return this.toISOString(!0)}static fromReaderAsTimeStampOffset(e){if(!e)return null;const t=n.fromISO(e,{setZone:!0});return new m(t)}}function h(e,n=!0){if(e instanceof r)return e;if("system"===e.toLowerCase())return"system";if("utc"===e.toLowerCase())return"UTC";if("unknown"===e.toLowerCase())return t.instance;if(/^[\+\-]?[0-9]{1,2}([:][0-9]{2})?$/.test(e)){const t=s.parseSpecifier("UTC"+(e.startsWith("+")||e.startsWith("-")?"":"+")+e);if(t)return t}const a=i.create(e);if(!a.isValid){if(n)throw new d(o.TimeZoneNotRecognized);return null}return a}export{m as ArcadeDate,d as ArcadeDateError,o as ArcadeDateErrorCodes,a as arcadeDateErrorMessages,h as createDateTimeZone};
5
+ import{replace as e}from"../core/string.js";import{UnknownTimeZone as t}from"../core/sql/UnknownTimeZone.js";import{DateTime as n,Zone as r,FixedOffsetZone as s,IANAZone as i}from"luxon";var o;!function(e){e.TimeZoneNotRecognized="TimeZoneNotRecognized"}(o||(o={}));const a={[o.TimeZoneNotRecognized]:"Timezone identifier has not been recognized."};class d extends Error{constructor(t,n){super(e(a[t],n)),this.declaredRootClass="esri.arcade.arcadedate.dateerror",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}function u(e,t,n){return e<t?e-t:e>n?e-n:0}function c(e,t,n){return e<t?t:e>n?n:e}class m{constructor(e){this._date=e,this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(e=0,t=1,r=1,s=0,i=0,o=0,a=0,d){if(isNaN(e)||isNaN(t)||isNaN(r)||isNaN(s)||isNaN(i)||isNaN(o)||isNaN(a))return null;const l=n.local(e,t).daysInMonth;let f=n.fromObject({day:c(r,1,l),year:e,month:c(t,1,12),hour:c(s,0,23),minute:c(i,0,59),second:c(o,0,59),millisecond:c(a,0,999)},{zone:h(d)});return f=f.plus({months:u(t,1,12),days:u(r,1,l),hours:u(s,0,23),minutes:u(i,0,59),seconds:u(o,0,59),milliseconds:u(a,0,999)}),new m(f)}static get systemTimeZoneCanonicalName(){return Intl.DateTimeFormat().resolvedOptions().timeZone??"system"}static arcadeDateAndZoneToArcadeDate(e,n){const r=h(n);return e.isUnknownTimeZone||r===t.instance?m.fromParts(e.year,e.monthJS+1,e.day,e.hour,e.minute,e.second,e.millisecond,r):new m(e._date.setZone(r))}static dateJSToArcadeDate(e){return new m(n.fromJSDate(e,{zone:"system"}))}static dateJSAndZoneToArcadeDate(e,t="system"){const r=h(t);return new m(n.fromJSDate(e,{zone:r}))}static unknownEpochToArcadeDate(e){return new m(n.fromMillis(e,{zone:t.instance}))}static unknownDateJSToArcadeDate(e){return new m(n.fromMillis(e.getTime(),{zone:t.instance}))}static epochToArcadeDate(e,t="system"){const r=h(t);return new m(n.fromMillis(e,{zone:r}))}static dateTimeToArcadeDate(e){return new m(e)}clone(){return new m(this._date)}changeTimeZone(e){const t=h(e);return m.dateTimeToArcadeDate(this._date.setZone(t))}static dateTimeAndZoneToArcadeDate(e,n){const r=h(n);return e.zone===t.instance||r===t.instance?m.fromParts(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond,r):new m(e.setZone(r))}static nowToArcadeDate(e){const t=h(e);return new m(n.fromJSDate(new Date,{zone:t}))}static nowUTCToArcadeDate(){return new m(n.utc())}get isSystem(){return"system"===this.timeZone||this.timeZone===m.systemTimeZoneCanonicalName}equals(e){return this.isSystem&&e.isSystem?this.toNumber()===e.toNumber():this.isUnknownTimeZone===e.isUnknownTimeZone&&this._date.equals(e._date)}get isUnknownTimeZone(){return this._date.zone===t.instance}get isValid(){return this._date.isValid}get hour(){return this._date.hour}get second(){return this._date.second}get day(){return this._date.day}get dayOfWeekISO(){return this._date.weekday}get dayOfWeekJS(){let e=this._date.weekday;return e>6&&(e=0),e}get millisecond(){return this._date.millisecond}get monthISO(){return this._date.month}get weekISO(){return this._date.weekNumber}get yearISO(){return this._date.weekYear}get monthJS(){return this._date.month-1}get year(){return this._date.year}get minute(){return this._date.minute}get zone(){return this._date.zone}get timeZoneOffset(){return this.isUnknownTimeZone?0:this._date.offset}get timeZone(){if(this.isUnknownTimeZone)return"unknown";if("system"===this._date.zone.type)return"system";const e=this.zone;return"fixed"===e.type?0===e.fixed?"UTC":e.formatOffset(0,"short"):e.name}stringify(){return JSON.stringify(this.toJSDate())}plus(e){return new m(this._date.plus(e))}diff(e,t="milliseconds"){return this._date.diff(e._date,t)[t]}toISODate(){return this._date.toISODate()}toISOString(e){return e?this._date.toISO({suppressMilliseconds:!0,includeOffset:!this.isUnknownTimeZone}):this._date.toISO({includeOffset:!this.isUnknownTimeZone})}toISOTime(e,t){return this._date.toISOTime({suppressMilliseconds:e,includeOffset:t&&!this.isUnknownTimeZone})}toFormat(e,t){return this.isUnknownTimeZone&&(e=e.replaceAll("Z","")),this._date.toFormat(e,t)}toJSDate(){return this._date.toJSDate()}toSQLValue(){return this._date.toFormat("yyyy-LL-dd HH:mm:ss")}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}toDateTime(){return this._date}toNumber(){return this._date.toMillis()}getTime(){return this._date.toMillis()}toUTC(){return new m(this._date.toUTC())}toLocal(){return new m(this._date.toLocal())}toString(){return this.toISOString(!0)}static fromReaderAsTimeStampOffset(e){if(!e)return null;const t=n.fromISO(e,{setZone:!0});return new m(t)}}function h(e,n=!0){if(e instanceof r)return e;if("system"===e.toLowerCase())return"system";if("utc"===e.toLowerCase())return"UTC";if("unknown"===e.toLowerCase())return t.instance;if(/^[+-]?[0-9]{1,2}([:][0-9]{2})?$/.test(e)){const t=s.parseSpecifier("UTC"+(e.startsWith("+")||e.startsWith("-")?"":"+")+e);if(t)return t}const a=i.create(e);if(!a.isValid){if(n)throw new d(o.TimeZoneNotRecognized);return null}return a}export{m as ArcadeDate,d as ArcadeDateError,o as ArcadeDateErrorCodes,a as arcadeDateErrorMessages,h as createDateTimeZone};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import e from"../request.js";import{ModuleError as t,ModuleErrorCodes as r}from"./executionError.js";import{parseScript as o}from"./parser.js";import s from"./featureset/support/RecentlyUsedCache.js";import i from"../portal/Portal.js";class l{constructor(e){this.portalUri=e}normalizeModuleUri(e){const o=/^[a-z0-9A-Z]+(@[0-9]+\.[0-9]+\.[0-9]+)?([\?|\/].*)?$/gi,s=/(?<portalurl>.+)\/home\/item\.html\?id\=(?<itemid>.+)$/gi,c=/(?<portalurl>.+)\/sharing\/rest\/content\/users\/[a-zA-Z0-9]+\/items\/(?<itemid>.+)$/gi,u=/(?<portalurl>.+)\/sharing\/rest\/content\/items\/(?<itemid>.+)$/gi,n=/(?<itemid>.*)@(?<versionstring>[0-9]+\.[0-9]+\.[0-9]+)([\?|\/].*)?$/gi;if(e.startsWith("portal+")){let l=e.substring(7),a="",m=l,d=!1;for(const e of[s,u,c]){const t=e.exec(l);if(null!==t){const e=t.groups;m=e.itemid,a=e.portalurl,d=!0;break}}if(!1===d){if(!o.test(l))throw new t(r.UnsupportedUriProtocol,{uri:e});m=l,a=this.portalUri}m.includes("/")&&(m=m.split("/")[0]),m.includes("?")&&(m=m.split("?")[0]);let h="current";const p=n.exec(m);if(null!==p){const e=p.groups;m=e.itemid,h=e.versionstring}return l=new i({url:a}).restUrl+"/content/items/"+m+"/resources/"+h+".arc",{url:l,scheme:"portal",uri:"PO:"+l}}if(e.startsWith("mock")){if("mock"===e){return{url:"",scheme:"mock",data:'\n export var hello = 1;\n export function helloWorld() {\n return "Hello World " + hello;\n }\n ',uri:"mock"}}const t=e.replace("mock:","");if(void 0!==l.mocks[t])return{url:"",scheme:"mock",data:l.mocks[t],uri:e}}throw new t(r.UnrecognizedUri,{uri:e})}async fetchModule(e){const t=l.cachedModules.getFromCache(e.uri);if(t)return t;const r=this.fetchSource(e);l.cachedModules.addToCache(e.uri,r);let o=null;try{o=await r}catch(s){throw l.cachedModules.removeFromCache(e.uri),s}return o}async fetchSource(s){if("portal"===s.scheme){const t=await e(s.url,{responseType:"text",query:{}});if(t.data)return o(t.data,[])}if("mock"===s.scheme)return o(s.data??"",[]);throw new t(r.UnsupportedUriProtocol)}static create(e){return new l(e)}static getDefault(){return this._default??(l._default=l._moduleResolverFactory())}static set moduleResolverClass(e){this._moduleResolverFactory=e,this._default=null}}l.mocks={},l.cachedModules=new s(30),l._default=null,l._moduleResolverFactory=()=>{const e=i.getDefault();return new l(e.url)};export{l as ArcadeModuleResolver};
5
+ import e from"../request.js";import{ModuleError as t,ModuleErrorCodes as r}from"./executionError.js";import{parseScript as o}from"./parser.js";import s from"./featureset/support/RecentlyUsedCache.js";import i from"../portal/Portal.js";class l{constructor(e){this.portalUri=e}normalizeModuleUri(e){const o=/^[a-z0-9A-Z]+(@[0-9]+\.[0-9]+\.[0-9]+)?([?|/].*)?$/gi,s=/(?<portalurl>.+)\/home\/item\.html\?id=(?<itemid>.+)$/gi,c=/(?<portalurl>.+)\/sharing\/rest\/content\/users\/[a-zA-Z0-9]+\/items\/(?<itemid>.+)$/gi,u=/(?<portalurl>.+)\/sharing\/rest\/content\/items\/(?<itemid>.+)$/gi,n=/(?<itemid>.*)@(?<versionstring>[0-9]+\.[0-9]+\.[0-9]+)([?|/].*)?$/gi;if(e.startsWith("portal+")){let l=e.substring(7),a="",m=l,d=!1;for(const e of[s,u,c]){const t=e.exec(l);if(null!==t){const e=t.groups;m=e.itemid,a=e.portalurl,d=!0;break}}if(!1===d){if(!o.test(l))throw new t(r.UnsupportedUriProtocol,{uri:e});m=l,a=this.portalUri}m.includes("/")&&(m=m.split("/")[0]),m.includes("?")&&(m=m.split("?")[0]);let h="current";const p=n.exec(m);if(null!==p){const e=p.groups;m=e.itemid,h=e.versionstring}return l=new i({url:a}).restUrl+"/content/items/"+m+"/resources/"+h+".arc",{url:l,scheme:"portal",uri:"PO:"+l}}if(e.startsWith("mock")){if("mock"===e){return{url:"",scheme:"mock",data:'\n export var hello = 1;\n export function helloWorld() {\n return "Hello World " + hello;\n }\n ',uri:"mock"}}const t=e.replace("mock:","");if(void 0!==l.mocks[t])return{url:"",scheme:"mock",data:l.mocks[t],uri:e}}throw new t(r.UnrecognizedUri,{uri:e})}async fetchModule(e){const t=l.cachedModules.getFromCache(e.uri);if(t)return t;const r=this.fetchSource(e);l.cachedModules.addToCache(e.uri,r);let o=null;try{o=await r}catch(s){throw l.cachedModules.removeFromCache(e.uri),s}return o}async fetchSource(s){if("portal"===s.scheme){const t=await e(s.url,{responseType:"text",query:{}});if(t.data)return o(t.data,[])}if("mock"===s.scheme)return o(s.data??"",[]);throw new t(r.UnsupportedUriProtocol)}static create(e){return new l(e)}static getDefault(){return this._default??(l._default=l._moduleResolverFactory())}static set moduleResolverClass(e){this._moduleResolverFactory=e,this._default=null}}l.mocks={},l.cachedModules=new s(30),l._default=null,l._moduleResolverFactory=()=>{const e=i.getDefault();return new l(e.url)};export{l as ArcadeModuleResolver};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import t from"../ArcadePortal.js";import e from"../Attachment.js";import r from"../Dictionary.js";import{ArcadeExecutionError as n,ExecutionErrorCodes as a}from"../executionError.js";import{H as o,j as i,P as u,g as s,B as l,K as d,h as p,t as c,o as f,q as h,T as y,r as m,U as g,N as A,V as w,W as I,X as v,Y as U,c as b,Z as j,k as x,m as N,n as P,a as F,b as T,i as C,u as O,s as k}from"../../chunks/languageUtils.js";import{layerFieldEsriConstants as L}from"../featureset/support/shared.js";import{convertDirection as S}from"./convertdirection.js";import{XXH as z}from"./hash.js";import{hasSamePortal as D}from"../../core/urlUtils.js";import{generateUUID as R}from"../../core/uuid.js";import H from"../../geometry/Extent.js";import M from"../../geometry/Multipoint.js";import V from"../../geometry/Point.js";import W from"../../geometry/Polygon.js";import J from"../../geometry/Polyline.js";import B from"../../geometry/SpatialReference.js";import Z from"../../portal/Portal.js";function E(t){if("loaded"===t.loadStatus&&t.user?.sourceJSON){return t.user.sourceJSON}return null}function q(t,e){return!!t&&D(t,e?.restUrl||"")}function K(t,e){if(!t||!e)return t===e;if(t.x===e.x&&t.y===e.y){if(t.hasZ){if(t.z!==e.z)return!1}else if(e.hasZ)return!1;if(t.hasM){if(t.m!==e.m)return!1}else if(e.hasM)return!1;return!0}return!1}function X(o,i,u){if(null!==o)if(f(o)){if(i.updateUint8Array([61]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o)X(t,i,u);u.map.delete(o),u.currentLength--}i.updateUint8Array([199])}else if(h(o)){if(i.updateUint8Array([61]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o.toArray())X(t,i,u);u.map.delete(o),u.currentLength--}i.updateUint8Array([199])}else{if(x(o))return i.updateIntArray([o.toNumber()]),void i.updateUint8Array([241]);if(N(o))return i.updateIntArray([o.toNumber()]),void i.updateIntArray([257]);if(P(o))return i.updateIntArray([o.toNumber()]),void i.updateIntArray([263]);if(b(o))return i.updateIntArray([o.length]),i.updateWithString(o),void i.updateUint8Array([41]);if(F(o))i.updateUint8Array([!0===o?1:0,113]);else{if(T(o))return i.updateFloatArray([o]),void i.updateUint8Array([173]);if(o instanceof e)throw new n(u.context,a.UnsupportedHashType,u.node);if(o instanceof t)throw new n(u.context,a.UnsupportedHashType,u.node);if(!(o instanceof r)){if(m(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(o instanceof V)return i.updateIntArray([3833836621]),i.updateIntArray([0]),i.updateFloatArray([o.x]),i.updateIntArray([1]),i.updateFloatArray([o.y]),o.hasZ&&(i.updateIntArray([2]),i.updateFloatArray([o.z])),o.hasM&&(i.updateIntArray([3]),i.updateFloatArray([o.m])),i.updateIntArray([3765347959]),void X(o.spatialReference.wkid,i,u);if(o instanceof W){i.updateIntArray([1266616829]);for(let t=0;t<o.rings.length;t++){const e=o.rings[t],r=[];let n=null,a=null;for(let i=0;i<e.length;i++){const u=o.getPoint(t,i);if(0===i)n=u;else if(K(a,u))continue;a=u,i===e.length-1&&K(n,u)||r.push(u)}i.updateIntArray([1397116793,r.length]);for(let t=0;t<r.length;t++){const e=r[t];i.updateIntArray([3962308117,t]),X(e,i,u),i.updateIntArray([2716288009])}i.updateIntArray([2278822459])}return i.updateIntArray([3878477243]),void X(o.spatialReference.wkid,i,u)}if(o instanceof J){i.updateIntArray([4106883559]);for(let t=0;t<o.paths.length;t++){const e=o.paths[t];i.updateIntArray([1397116793,e.length]);for(let r=0;r<e.length;r++)i.updateIntArray([3962308117,r]),X(o.getPoint(t,r),i,u),i.updateIntArray([2716288009]);i.updateIntArray([2278822459])}return i.updateIntArray([2568784753]),void X(o.spatialReference.wkid,i,u)}if(o instanceof M){i.updateIntArray([588535921,o.points.length]);for(let t=0;t<o.points.length;t++){const e=o.getPoint(t);i.updateIntArray([t]),X(e,i,u)}return i.updateIntArray([1700171621]),void X(o.spatialReference.wkid,i,u)}if(o instanceof H)return i.updateIntArray([3483648373]),i.updateIntArray([0]),i.updateFloatArray([o.xmax]),i.updateIntArray([1]),i.updateFloatArray([o.xmin]),i.updateIntArray([2]),i.updateFloatArray([o.ymax]),i.updateIntArray([3]),i.updateFloatArray([o.ymin]),o.hasZ&&(i.updateIntArray([4]),i.updateFloatArray([o.zmax]),i.updateIntArray([5]),i.updateFloatArray([o.zmin])),o.hasM&&(i.updateIntArray([6]),i.updateFloatArray([o.mmax]),i.updateIntArray([7]),i.updateFloatArray([o.mmin])),i.updateIntArray([3622027469]),void X(o.spatialReference.wkid,i,u);if(o instanceof B)return i.updateIntArray([14]),void 0!==o.wkid&&null!==o.wkid&&i.updateIntArray([o.wkid]),o.wkt&&i.updateWithString(o.wkt),void(o.wkt2&&i.updateWithString(o.wkt2));if(C(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(O(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(k(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(o===l)throw new n(u.context,a.UnsupportedHashType,u.node);throw new n(u.context,a.UnsupportedHashType,u.node)}if(i.updateUint8Array([223]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o.keys()){i.updateIntArray([t.length]),i.updateWithString(t),i.updateUint8Array([251]);X(o.field(t),i,u),i.updateUint8Array([239])}u.map.delete(o),u.currentLength--}i.updateUint8Array([73])}}else i.updateUint8Array([0,139])}function Y(e,x){e.portal=function(e,r){return x(e,r,((n,a,u)=>(o(u,1,1,e,r),new t(i(u[0])))))},e.typeof=function(t,e){return x(t,e,((r,i,s)=>{o(s,1,1,t,e);const l=u(s[0]);if("Unrecognized Type"===l)throw new n(t,a.UnrecognizedType,e);return l}))},e.trim=function(t,e){return x(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).trim())))},e.tohex=function(t,e){return x(t,e,((r,n,a)=>{o(a,1,1,t,e);const i=s(a[0]);return isNaN(i)?i:i.toString(16)}))},e.upper=function(t,e){return x(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).toUpperCase())))},e.proper=function(t,e){return x(t,e,((r,n,a)=>{o(a,1,2,t,e);let u=1;2===a.length&&"firstword"===i(a[1]).toLowerCase()&&(u=2);const s=/\s/,l=i(a[0]);let d="",p=!0;for(let t=0;t<l.length;t++){let e=l[t];if(s.test(e))1===u&&(p=!0);else{e.toUpperCase()!==e.toLowerCase()&&(p?(e=e.toUpperCase(),p=!1):e=e.toLowerCase())}d+=e}return d}))},e.lower=function(t,e){return x(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).toLowerCase())))},e.guid=function(t,e){return x(t,e,((r,n,a)=>{if(o(a,0,1,t,e),a.length>0)switch(i(a[0]).toLowerCase()){case"digits":return R().replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return R();case"digits-hyphen-braces":return"{"+R()+"}";case"digits-hyphen-parentheses":return"("+R()+")"}return"{"+R()+"}"}))},e.standardizeguid=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=i(a[0]);if(""===u||null===u)return"";const s=/^(\{|\()?(?<partA>[0-9a-z]{8})(\-?)(?<partB>[0-9a-z]{4})(\-?)(?<partC>[0-9a-z]{4})(\-?)(?<partD>[0-9a-z]{4})(\-?)(?<partE>[0-9a-z]{12})(\}|\))?$/gim.exec(u);if(!s)return"";const l=s.groups;switch(u=l.partA+"-"+l.partB+"-"+l.partC+"-"+l.partD+"-"+l.partE,i(a[1]).toLowerCase()){case"digits":return u.replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return u;case"digits-hyphen-braces":return"{"+u+"}";case"digits-hyphen-parentheses":return"("+u+")"}return"{"+u+"}"}))},e.console=function(t,e){return x(t,e,((e,r,n)=>(0===n.length||(1===n.length?t.console(i(n[0])):t.console(i(n))),l)))},e.mid=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,3,t,e);let u=s(a[1]);if(isNaN(u))return"";if(u<0&&(u=0),2===a.length)return i(a[0]).substr(u);let l=s(a[2]);return isNaN(l)?"":(l<0&&(l=0),i(a[0]).substr(u,l))}))},e.find=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,3,t,e);let u=0;if(a.length>2){if(u=s(d(a[2],0)),isNaN(u))return-1;u<0&&(u=0)}return i(a[1]).indexOf(i(a[0]),u)}))},e.left=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).substr(0,u))}))},e.right=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).substr(-1*u,u))}))},e.split=function(t,e){return x(t,e,((r,n,a)=>{let u;o(a,2,4,t,e);let l=s(d(a[2],-1));const c=p(d(a[3],!1));if(-1===l||null===l||!0===c?u=i(a[0]).split(i(a[1])):(isNaN(l)&&(l=-1),l<-1&&(l=-1),u=i(a[0]).split(i(a[1]),l)),!1===c)return u;const f=[];for(let t=0;t<u.length&&!(-1!==l&&f.length>=l);t++)""!==u[t]&&void 0!==u[t]&&f.push(u[t]);return f}))},e.text=function(t,e){return x(t,e,((r,n,a)=>(o(a,1,2,t,e),c(a[0],a[1]))))},e.concatenate=function(t,e){return x(t,e,((t,e,r)=>{const n=[];if(r.length<1)return"";if(f(r[0])){const t=d(r[2],"");for(let e=0;e<r[0].length;e++)n[e]=c(r[0][e],t);return r.length>1?n.join(r[1]):n.join("")}if(h(r[0])){const t=d(r[2],"");for(let e=0;e<r[0].length();e++)n[e]=c(r[0].get(e),t);return r.length>1?n.join(r[1]):n.join("")}for(let a=0;a<r.length;a++)n[a]=c(r[a]);return n.join("")}))},e.reverse=function(t,e){return x(t,e,((r,i,u)=>{if(o(u,1,1,t,e),f(u[0])){const t=u[0].slice(0);return t.reverse(),t}if(h(u[0])){const t=u[0].toArray().slice(0);return t.reverse(),t}throw new n(t,a.InvalidParameter,e)}))},e.replace=function(t,e){return x(t,e,((r,n,a)=>{o(a,3,4,t,e);const u=i(a[0]),s=i(a[1]),l=i(a[2]);return 4!==a.length||p(a[3])?y(u,s,l):u.replace(s,l)}))},e.schema=function(t,e){return x(t,e,((o,i,u)=>{if(m(u[0])){const e=g(u[0]);return e?r.convertObjectToArcadeDictionary(e,A(t)):null}throw new n(t,a.InvalidParameter,e)}))},e.subtypes=function(t,e){return x(t,e,((i,u,s)=>{if(o(s,1,1,t,e),m(s[0])){const e=w(s[0]);return e?r.convertObjectToArcadeDictionary(e,A(t)):null}throw new n(t,a.InvalidParameter,e)}))},e.subtypecode=function(t,e){return x(t,e,((r,i,u)=>{if(o(u,1,1,t,e),m(u[0])){const t=w(u[0]);if(!t)return null;if(t.subtypeField&&u[0].hasField(t.subtypeField)){const e=u[0].field(t.subtypeField);for(const r of t.subtypes)if(r.code===e)return r.code;return null}return null}throw new n(t,a.InvalidParameter,e)}))},e.subtypename=function(t,e){return x(t,e,((r,i,u)=>{if(o(u,1,1,t,e),m(u[0])){const t=w(u[0]);if(!t)return"";if(t.subtypeField&&u[0].hasField(t.subtypeField)){const e=u[0].field(t.subtypeField);for(const r of t.subtypes)if(r.code===e)return r.name;return""}return""}throw new n(t,a.InvalidParameter,e)}))},e.gdbversion=function(t,e){return x(t,e,((r,i,u)=>{if(o(u,1,1,t,e),m(u[0]))return u[0].gdbVersion();throw new n(t,a.InvalidParameter,e)}))},e.domain=function(t,e){return x(t,e,((u,s,l)=>{if(o(l,2,3,t,e),m(l[0])){const e=I(l[0],i(l[1]),void 0===l[2]?void 0:l[2]);return e&&e.domain?"coded-value"===e.domain.type||"codedValue"===e.domain.type?r.convertObjectToArcadeDictionary({type:"codedValue",name:e.domain.name,dataType:L[e.field.type],codedValues:e.domain.codedValues.map((t=>({name:t.name,code:t.code})))},A(t)):r.convertObjectToArcadeDictionary({type:"range",name:e.domain.name,dataType:L[e.field.type],min:e.domain.minValue,max:e.domain.maxValue},A(t)):null}throw new n(t,a.InvalidParameter,e)}))},e.domainname=function(t,e){return x(t,e,((r,u,s)=>{if(o(s,2,4,t,e),m(s[0]))return v(s[0],i(s[1]),s[2],void 0===s[3]?void 0:s[3]);throw new n(t,a.InvalidParameter,e)}))},e.domaincode=function(t,e){return x(t,e,((r,u,s)=>{if(o(s,2,4,t,e),m(s[0]))return U(s[0],i(s[1]),s[2],void 0===s[3]?void 0:s[3]);throw new n(t,a.InvalidParameter,e)}))},e.urlencode=function(t,e){return x(t,e,((n,a,u)=>{if(o(u,1,1,t,e),null===u[0])return"";if(u[0]instanceof r){let t="";for(const e of u[0].keys()){const r=u[0].field(e);""!==t&&(t+="&"),t+=null===r?encodeURIComponent(e)+"=":encodeURIComponent(e)+"="+encodeURIComponent(r)}return t}return encodeURIComponent(i(u[0]))}))},e.hash=function(t,e){return x(t,e,((r,n,a)=>{o(a,1,1,t,e);const i=new z(0);return X(a[0],i,{context:t,node:e,map:new Map,currentLength:0}),i.digest()}))},e.convertdirection=function(t,e){return x(t,e,((r,n,a)=>(o(a,3,3,t,e),S(a[0],a[1],a[2]))))},e.fromjson=function(t,e){return x(t,e,((u,s,l)=>{if(o(l,1,1,t,e),!1===b(l[0]))throw new n(t,a.InvalidParameter,e);return r.convertJsonToArcade(JSON.parse(i(l[0])),A(t))}))},e.expects=function(t,e){return x(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);return l}))},e.tocharcode=function(t,e){return x(t,e,((r,u,l)=>{o(l,1,2,t,e);const p=s(d(l[1],0)),c=i(l[0]);if(0===c.length&&1===l.length)return null;if(c.length<=p||p<0)throw new n(t,a.OutOfBounds,e);return c.charCodeAt(p)}))},e.tocodepoint=function(t,e){return x(t,e,((r,u,l)=>{o(l,1,2,t,e);const p=s(d(l[1],0)),c=i(l[0]);if(0===c.length&&1===l.length)return null;if(c.length<=p||p<0)throw new n(t,a.OutOfBounds,e);return c.codePointAt(p)}))},e.fromcharcode=function(t,e){return x(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);const u=i.map((t=>Math.trunc(s(t)))).filter((t=>t>=0&&t<=65535));return 0===u.length?null:String.fromCharCode.apply(null,u)}))},e.fromcodepoint=function(t,e){return x(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);let u;try{u=i.map((t=>Math.trunc(s(t)))).filter((t=>t<=1114111&&t>>>0===t))}catch(l){return null}return 0===u.length?null:String.fromCodePoint.apply(null,u)}))},e.getuser=function(e,u){return x(e,u,((s,l,p)=>{o(p,0,2,e,u);let c=d(p[1],"");if(c=!0===c||!1===c?"":i(c),null!==c&&""!==c)return null;if(0===p.length||p[0]instanceof t){let t=null;if(t=e.services?.portal?e.services.portal:Z.getDefault(),p.length>0){if(!q(p[0].field("url"),t))return null}if(!t)return null;if(""===c){const n=E(t);if(n){const t=JSON.parse(JSON.stringify(n));for(const e of["lastLogin","created","modified"])void 0!==t[e]&&null!==t[e]&&(t[e]=new Date(t[e]));return r.convertObjectToArcadeDictionary(t,A(e))}}return null}throw new n(e,a.InvalidParameter,u)}))},e.getenvironment=function(t,e){return x(t,e,((n,a,i)=>(o(i,0,0,t,e),r.convertObjectToArcadeDictionary(j(A(t),t.spatialReference),A(t),!0))))}}export{Y as registerFunctions};
5
+ import t from"../ArcadePortal.js";import e from"../Attachment.js";import r from"../Dictionary.js";import{ArcadeExecutionError as n,ExecutionErrorCodes as a}from"../executionError.js";import{H as o,j as i,P as u,g as s,B as l,K as d,h as p,t as c,o as f,q as h,T as y,r as m,U as g,N as A,V as w,W as I,X as v,Y as U,c as b,Z as j,k as x,m as N,n as P,a as F,b as T,i as C,u as O,s as k}from"../../chunks/languageUtils.js";import{layerFieldEsriConstants as L}from"../featureset/support/shared.js";import{convertDirection as S}from"./convertdirection.js";import{XXH as z}from"./hash.js";import{hasSamePortal as D}from"../../core/urlUtils.js";import{generateUUID as R}from"../../core/uuid.js";import H from"../../geometry/Extent.js";import M from"../../geometry/Multipoint.js";import V from"../../geometry/Point.js";import W from"../../geometry/Polygon.js";import J from"../../geometry/Polyline.js";import B from"../../geometry/SpatialReference.js";import Z from"../../portal/Portal.js";function E(t){if("loaded"===t.loadStatus&&t.user?.sourceJSON){return t.user.sourceJSON}return null}function q(t,e){return!!t&&D(t,e?.restUrl||"")}function K(t,e){if(!t||!e)return t===e;if(t.x===e.x&&t.y===e.y){if(t.hasZ){if(t.z!==e.z)return!1}else if(e.hasZ)return!1;if(t.hasM){if(t.m!==e.m)return!1}else if(e.hasM)return!1;return!0}return!1}function X(o,i,u){if(null!==o)if(f(o)){if(i.updateUint8Array([61]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o)X(t,i,u);u.map.delete(o),u.currentLength--}i.updateUint8Array([199])}else if(h(o)){if(i.updateUint8Array([61]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o.toArray())X(t,i,u);u.map.delete(o),u.currentLength--}i.updateUint8Array([199])}else{if(x(o))return i.updateIntArray([o.toNumber()]),void i.updateUint8Array([241]);if(N(o))return i.updateIntArray([o.toNumber()]),void i.updateIntArray([257]);if(P(o))return i.updateIntArray([o.toNumber()]),void i.updateIntArray([263]);if(b(o))return i.updateIntArray([o.length]),i.updateWithString(o),void i.updateUint8Array([41]);if(F(o))i.updateUint8Array([!0===o?1:0,113]);else{if(T(o))return i.updateFloatArray([o]),void i.updateUint8Array([173]);if(o instanceof e)throw new n(u.context,a.UnsupportedHashType,u.node);if(o instanceof t)throw new n(u.context,a.UnsupportedHashType,u.node);if(!(o instanceof r)){if(m(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(o instanceof V)return i.updateIntArray([3833836621]),i.updateIntArray([0]),i.updateFloatArray([o.x]),i.updateIntArray([1]),i.updateFloatArray([o.y]),o.hasZ&&(i.updateIntArray([2]),i.updateFloatArray([o.z])),o.hasM&&(i.updateIntArray([3]),i.updateFloatArray([o.m])),i.updateIntArray([3765347959]),void X(o.spatialReference.wkid,i,u);if(o instanceof W){i.updateIntArray([1266616829]);for(let t=0;t<o.rings.length;t++){const e=o.rings[t],r=[];let n=null,a=null;for(let i=0;i<e.length;i++){const u=o.getPoint(t,i);if(0===i)n=u;else if(K(a,u))continue;a=u,i===e.length-1&&K(n,u)||r.push(u)}i.updateIntArray([1397116793,r.length]);for(let t=0;t<r.length;t++){const e=r[t];i.updateIntArray([3962308117,t]),X(e,i,u),i.updateIntArray([2716288009])}i.updateIntArray([2278822459])}return i.updateIntArray([3878477243]),void X(o.spatialReference.wkid,i,u)}if(o instanceof J){i.updateIntArray([4106883559]);for(let t=0;t<o.paths.length;t++){const e=o.paths[t];i.updateIntArray([1397116793,e.length]);for(let r=0;r<e.length;r++)i.updateIntArray([3962308117,r]),X(o.getPoint(t,r),i,u),i.updateIntArray([2716288009]);i.updateIntArray([2278822459])}return i.updateIntArray([2568784753]),void X(o.spatialReference.wkid,i,u)}if(o instanceof M){i.updateIntArray([588535921,o.points.length]);for(let t=0;t<o.points.length;t++){const e=o.getPoint(t);i.updateIntArray([t]),X(e,i,u)}return i.updateIntArray([1700171621]),void X(o.spatialReference.wkid,i,u)}if(o instanceof H)return i.updateIntArray([3483648373]),i.updateIntArray([0]),i.updateFloatArray([o.xmax]),i.updateIntArray([1]),i.updateFloatArray([o.xmin]),i.updateIntArray([2]),i.updateFloatArray([o.ymax]),i.updateIntArray([3]),i.updateFloatArray([o.ymin]),o.hasZ&&(i.updateIntArray([4]),i.updateFloatArray([o.zmax]),i.updateIntArray([5]),i.updateFloatArray([o.zmin])),o.hasM&&(i.updateIntArray([6]),i.updateFloatArray([o.mmax]),i.updateIntArray([7]),i.updateFloatArray([o.mmin])),i.updateIntArray([3622027469]),void X(o.spatialReference.wkid,i,u);if(o instanceof B)return i.updateIntArray([14]),void 0!==o.wkid&&null!==o.wkid&&i.updateIntArray([o.wkid]),o.wkt&&i.updateWithString(o.wkt),void(o.wkt2&&i.updateWithString(o.wkt2));if(C(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(O(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(k(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(o===l)throw new n(u.context,a.UnsupportedHashType,u.node);throw new n(u.context,a.UnsupportedHashType,u.node)}if(i.updateUint8Array([223]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o.keys()){i.updateIntArray([t.length]),i.updateWithString(t),i.updateUint8Array([251]);X(o.field(t),i,u),i.updateUint8Array([239])}u.map.delete(o),u.currentLength--}i.updateUint8Array([73])}}else i.updateUint8Array([0,139])}function Y(e,x){e.portal=function(e,r){return x(e,r,((n,a,u)=>(o(u,1,1,e,r),new t(i(u[0])))))},e.typeof=function(t,e){return x(t,e,((r,i,s)=>{o(s,1,1,t,e);const l=u(s[0]);if("Unrecognized Type"===l)throw new n(t,a.UnrecognizedType,e);return l}))},e.trim=function(t,e){return x(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).trim())))},e.tohex=function(t,e){return x(t,e,((r,n,a)=>{o(a,1,1,t,e);const i=s(a[0]);return isNaN(i)?i:i.toString(16)}))},e.upper=function(t,e){return x(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).toUpperCase())))},e.proper=function(t,e){return x(t,e,((r,n,a)=>{o(a,1,2,t,e);let u=1;2===a.length&&"firstword"===i(a[1]).toLowerCase()&&(u=2);const s=/\s/,l=i(a[0]);let d="",p=!0;for(let t=0;t<l.length;t++){let e=l[t];if(s.test(e))1===u&&(p=!0);else{e.toUpperCase()!==e.toLowerCase()&&(p?(e=e.toUpperCase(),p=!1):e=e.toLowerCase())}d+=e}return d}))},e.lower=function(t,e){return x(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).toLowerCase())))},e.guid=function(t,e){return x(t,e,((r,n,a)=>{if(o(a,0,1,t,e),a.length>0)switch(i(a[0]).toLowerCase()){case"digits":return R().replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return R();case"digits-hyphen-braces":return"{"+R()+"}";case"digits-hyphen-parentheses":return"("+R()+")"}return"{"+R()+"}"}))},e.standardizeguid=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=i(a[0]);if(""===u||null===u)return"";const s=/^(\{|\()?(?<partA>[0-9a-z]{8})(-?)(?<partB>[0-9a-z]{4})(-?)(?<partC>[0-9a-z]{4})(-?)(?<partD>[0-9a-z]{4})(-?)(?<partE>[0-9a-z]{12})(\}|\))?$/gim.exec(u);if(!s)return"";const l=s.groups;switch(u=l.partA+"-"+l.partB+"-"+l.partC+"-"+l.partD+"-"+l.partE,i(a[1]).toLowerCase()){case"digits":return u.replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return u;case"digits-hyphen-braces":return"{"+u+"}";case"digits-hyphen-parentheses":return"("+u+")"}return"{"+u+"}"}))},e.console=function(t,e){return x(t,e,((e,r,n)=>(0===n.length||(1===n.length?t.console(i(n[0])):t.console(i(n))),l)))},e.mid=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,3,t,e);let u=s(a[1]);if(isNaN(u))return"";if(u<0&&(u=0),2===a.length)return i(a[0]).substr(u);let l=s(a[2]);return isNaN(l)?"":(l<0&&(l=0),i(a[0]).substr(u,l))}))},e.find=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,3,t,e);let u=0;if(a.length>2){if(u=s(d(a[2],0)),isNaN(u))return-1;u<0&&(u=0)}return i(a[1]).indexOf(i(a[0]),u)}))},e.left=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).substr(0,u))}))},e.right=function(t,e){return x(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).substr(-1*u,u))}))},e.split=function(t,e){return x(t,e,((r,n,a)=>{let u;o(a,2,4,t,e);let l=s(d(a[2],-1));const c=p(d(a[3],!1));if(-1===l||null===l||!0===c?u=i(a[0]).split(i(a[1])):(isNaN(l)&&(l=-1),l<-1&&(l=-1),u=i(a[0]).split(i(a[1]),l)),!1===c)return u;const f=[];for(let t=0;t<u.length&&!(-1!==l&&f.length>=l);t++)""!==u[t]&&void 0!==u[t]&&f.push(u[t]);return f}))},e.text=function(t,e){return x(t,e,((r,n,a)=>(o(a,1,2,t,e),c(a[0],a[1]))))},e.concatenate=function(t,e){return x(t,e,((t,e,r)=>{const n=[];if(r.length<1)return"";if(f(r[0])){const t=d(r[2],"");for(let e=0;e<r[0].length;e++)n[e]=c(r[0][e],t);return r.length>1?n.join(r[1]):n.join("")}if(h(r[0])){const t=d(r[2],"");for(let e=0;e<r[0].length();e++)n[e]=c(r[0].get(e),t);return r.length>1?n.join(r[1]):n.join("")}for(let a=0;a<r.length;a++)n[a]=c(r[a]);return n.join("")}))},e.reverse=function(t,e){return x(t,e,((r,i,u)=>{if(o(u,1,1,t,e),f(u[0])){const t=u[0].slice(0);return t.reverse(),t}if(h(u[0])){const t=u[0].toArray().slice(0);return t.reverse(),t}throw new n(t,a.InvalidParameter,e)}))},e.replace=function(t,e){return x(t,e,((r,n,a)=>{o(a,3,4,t,e);const u=i(a[0]),s=i(a[1]),l=i(a[2]);return 4!==a.length||p(a[3])?y(u,s,l):u.replace(s,l)}))},e.schema=function(t,e){return x(t,e,((o,i,u)=>{if(m(u[0])){const e=g(u[0]);return e?r.convertObjectToArcadeDictionary(e,A(t)):null}throw new n(t,a.InvalidParameter,e)}))},e.subtypes=function(t,e){return x(t,e,((i,u,s)=>{if(o(s,1,1,t,e),m(s[0])){const e=w(s[0]);return e?r.convertObjectToArcadeDictionary(e,A(t)):null}throw new n(t,a.InvalidParameter,e)}))},e.subtypecode=function(t,e){return x(t,e,((r,i,u)=>{if(o(u,1,1,t,e),m(u[0])){const t=w(u[0]);if(!t)return null;if(t.subtypeField&&u[0].hasField(t.subtypeField)){const e=u[0].field(t.subtypeField);for(const r of t.subtypes)if(r.code===e)return r.code;return null}return null}throw new n(t,a.InvalidParameter,e)}))},e.subtypename=function(t,e){return x(t,e,((r,i,u)=>{if(o(u,1,1,t,e),m(u[0])){const t=w(u[0]);if(!t)return"";if(t.subtypeField&&u[0].hasField(t.subtypeField)){const e=u[0].field(t.subtypeField);for(const r of t.subtypes)if(r.code===e)return r.name;return""}return""}throw new n(t,a.InvalidParameter,e)}))},e.gdbversion=function(t,e){return x(t,e,((r,i,u)=>{if(o(u,1,1,t,e),m(u[0]))return u[0].gdbVersion();throw new n(t,a.InvalidParameter,e)}))},e.domain=function(t,e){return x(t,e,((u,s,l)=>{if(o(l,2,3,t,e),m(l[0])){const e=I(l[0],i(l[1]),void 0===l[2]?void 0:l[2]);return e&&e.domain?"coded-value"===e.domain.type||"codedValue"===e.domain.type?r.convertObjectToArcadeDictionary({type:"codedValue",name:e.domain.name,dataType:L[e.field.type],codedValues:e.domain.codedValues.map((t=>({name:t.name,code:t.code})))},A(t)):r.convertObjectToArcadeDictionary({type:"range",name:e.domain.name,dataType:L[e.field.type],min:e.domain.minValue,max:e.domain.maxValue},A(t)):null}throw new n(t,a.InvalidParameter,e)}))},e.domainname=function(t,e){return x(t,e,((r,u,s)=>{if(o(s,2,4,t,e),m(s[0]))return v(s[0],i(s[1]),s[2],void 0===s[3]?void 0:s[3]);throw new n(t,a.InvalidParameter,e)}))},e.domaincode=function(t,e){return x(t,e,((r,u,s)=>{if(o(s,2,4,t,e),m(s[0]))return U(s[0],i(s[1]),s[2],void 0===s[3]?void 0:s[3]);throw new n(t,a.InvalidParameter,e)}))},e.urlencode=function(t,e){return x(t,e,((n,a,u)=>{if(o(u,1,1,t,e),null===u[0])return"";if(u[0]instanceof r){let t="";for(const e of u[0].keys()){const r=u[0].field(e);""!==t&&(t+="&"),t+=null===r?encodeURIComponent(e)+"=":encodeURIComponent(e)+"="+encodeURIComponent(r)}return t}return encodeURIComponent(i(u[0]))}))},e.hash=function(t,e){return x(t,e,((r,n,a)=>{o(a,1,1,t,e);const i=new z(0);return X(a[0],i,{context:t,node:e,map:new Map,currentLength:0}),i.digest()}))},e.convertdirection=function(t,e){return x(t,e,((r,n,a)=>(o(a,3,3,t,e),S(a[0],a[1],a[2]))))},e.fromjson=function(t,e){return x(t,e,((u,s,l)=>{if(o(l,1,1,t,e),!1===b(l[0]))throw new n(t,a.InvalidParameter,e);return r.convertJsonToArcade(JSON.parse(i(l[0])),A(t))}))},e.expects=function(t,e){return x(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);return l}))},e.tocharcode=function(t,e){return x(t,e,((r,u,l)=>{o(l,1,2,t,e);const p=s(d(l[1],0)),c=i(l[0]);if(0===c.length&&1===l.length)return null;if(c.length<=p||p<0)throw new n(t,a.OutOfBounds,e);return c.charCodeAt(p)}))},e.tocodepoint=function(t,e){return x(t,e,((r,u,l)=>{o(l,1,2,t,e);const p=s(d(l[1],0)),c=i(l[0]);if(0===c.length&&1===l.length)return null;if(c.length<=p||p<0)throw new n(t,a.OutOfBounds,e);return c.codePointAt(p)}))},e.fromcharcode=function(t,e){return x(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);const u=i.map((t=>Math.trunc(s(t)))).filter((t=>t>=0&&t<=65535));return 0===u.length?null:String.fromCharCode.apply(null,u)}))},e.fromcodepoint=function(t,e){return x(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);let u;try{u=i.map((t=>Math.trunc(s(t)))).filter((t=>t<=1114111&&t>>>0===t))}catch(l){return null}return 0===u.length?null:String.fromCodePoint.apply(null,u)}))},e.getuser=function(e,u){return x(e,u,((s,l,p)=>{o(p,0,2,e,u);let c=d(p[1],"");if(c=!0===c||!1===c?"":i(c),null!==c&&""!==c)return null;if(0===p.length||p[0]instanceof t){let t=null;if(t=e.services?.portal?e.services.portal:Z.getDefault(),p.length>0){if(!q(p[0].field("url"),t))return null}if(!t)return null;if(""===c){const n=E(t);if(n){const t=JSON.parse(JSON.stringify(n));for(const e of["lastLogin","created","modified"])void 0!==t[e]&&null!==t[e]&&(t[e]=new Date(t[e]));return r.convertObjectToArcadeDictionary(t,A(e))}}return null}throw new n(e,a.InvalidParameter,u)}))},e.getenvironment=function(t,e){return x(t,e,((n,a,i)=>(o(i,0,0,t,e),r.convertObjectToArcadeDictionary(j(A(t),t.spatialReference),A(t),!0))))}}export{Y as registerFunctions};