@arcgis/coding-components 5.2.0-next.91 → 5.2.0-next.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{J4VBP7HA.js → 3KIKNRZV.js} +1 -1
- package/dist/cdn/{CQQVSACB.js → 3XGBQPFC.js} +1 -1
- package/dist/cdn/{ADG6PXX4.js → 5R3KBYY6.js} +1 -1
- package/dist/cdn/{CVQAVENI.js → 7OM23EVO.js} +1 -1
- package/dist/cdn/{4RQ6CTEX.js → AGZBL3MZ.js} +1 -1
- package/dist/cdn/{LY5JOQB7.js → AK3ZSUQ7.js} +1 -1
- package/dist/cdn/{VZ6DLSKR.js → CLPF64WZ.js} +1 -1
- package/dist/cdn/{O5LFPM4K.js → DFRZVVZZ.js} +1 -1
- package/dist/cdn/{5K6QWS7J.js → E5HJD45C.js} +1 -1
- package/dist/cdn/{CPX3K3UL.js → EUV7H33D.js} +1 -1
- package/dist/cdn/{6O5PGCTL.js → H2CMIQ2V.js} +1 -1
- package/dist/cdn/{JHACGQHF.js → HTMNRPYU.js} +1 -1
- package/dist/cdn/{VT2O42CL.js → ILDO72KX.js} +1 -1
- package/dist/cdn/{6UXWS2RY.js → J4OHMIVH.js} +1 -1
- package/dist/cdn/{WXA37GUM.js → J6FJWQ6O.js} +1 -1
- package/dist/cdn/LEFE3FVL.js +35 -0
- package/dist/cdn/{5A6ECP7V.js → P6Q7UVSV.js} +1 -1
- package/dist/cdn/{ZXHMUT2I.js → QAMR6MWW.js} +1 -1
- package/dist/cdn/{BBERXRDY.js → VLBBZP5D.js} +1 -1
- package/dist/cdn/{3AAE55DK.js → Z7HAJ23B.js} +1 -1
- package/dist/cdn/assets/code-editor/arcade.worker.js +3392 -3375
- package/dist/cdn/index.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +6 -6
- package/dist/cdn/BZWB7A55.js +0 -35
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as N}from"./SWPINDTI.js";import c from"./BBERXRDY.js";import b from"./CPX3K3UL.js";import{c as ae,d as se}from"./J4VBP7HA.js";import a from"./STN3LSQR.js";import{d as oe}from"./MZMKV7FA.js";import{a as te}from"./RQZK3XV2.js";import"./L7OEI4ZV.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as W,G as K,H as X,I as Z,J as M,L as ee,h as Q,j as d,k as j,l as V,t as H,x as G,y as J,z as Y}from"./PM4JFKBG.js";import{a as w}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([xe,ne,Se,re,ce,{getDeclaredVoxelMembers:Te,getDeclaredPixelMembers:Ae},Ce,{property:b,subclass:Ie},{G:q,w:ie,x:F},,P])=>{var C=class extends Y{constructor(e){if(super(e),this.it=V,e.type!==G.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===V||e==null)return this._t=void 0,this.it=e;if(e===j)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};C.directiveName="unsafeHTML",C.resultType=1;var I=J(C);var Me=Q`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-dialog{--calcite-dialog-content-space: initial;--calcite-dialog-size-y: initial}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,$=class extends Error{constructor({message:e,code:t,subCode:a,details:o,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=a,this.details=o,this.source=n}};function le(i){if(!i)return;let e=i.indexOf('{"error":');if(e!==-1)try{let t=i.slice(e),a=JSON.parse(t);if(a&&typeof a=="object"&&a.error)return a.error}catch{return}}async function Ee(i){let{baseUrl:e,skillId:t,message:a,authToken:o,previousConversationId:n,context:r}=i,p=t?`${e}/skills/${t}/chat`:`${e}/chat`,c=[],s={message:a,context:r};n&&(s.conversation_id=n);let u;try{u=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(s),responseType:"json"})}catch(f){let v=f,x=v.details?.rawResponse||v.message||String(f),T=le(x);throw T?new $(T):f}let l=u.data;c.push(l);let h=l.conversationId,S=l.inquiryId,k=l.sequenceNumber;async function E(){let f=0,v=100;for(;f<v;){await new Promise(A=>setTimeout(A,1e3));let x=Re(h,k,S),T;try{T=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(x),responseType:"json"})}catch(A){let L=A,ke=L.details?.rawResponse||L.message||String(A),B=le(ke);throw B?new $(B):A}let y=T.data;if(y.context?.kind==="ArcgisErrorAsContext"&&y.context.error)throw new $({message:y.context.error.message||"ArcGIS Assistant error",code:y.context.error.code,subCode:y.context.error.subCode,details:y.context.error.details,source:"polling-response"});if(c.push(y),k=y.sequenceNumber,f++,!y.hasMore)break}if(f===v)throw new $({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let R=120*1e3;return await Promise.race([E(),new Promise((f,v)=>setTimeout(()=>v(new $({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),R))]),c}function Re(i,e,t){return{conversationId:i,inquiryId:t,ackSequenceNumber:e}}function Ve(i){return i.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":i.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":i.message}var Fe=({notices:i})=>i.length?d`<div class="border-block-end">${N(i,e=>e.id??e.title,e=>d`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&d`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&d`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,qe=i=>{let e=i.value.length,t=72,a=180,o=i.offsetWidth,n=Math.max(1,Math.floor(o/8)),r=Math.ceil(e/n),p=t+(r-2)*24;i.style.setProperty("--calcite-text-area-min-height",`${Math.min(p,a)}px`)},Pe=({promptValidationMessage:i,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:a,setContextReducedNoticeDismissed:o,setErrorMessage:n,messages:r})=>{let p=[];if(i&&p.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:i,closable:!0}),e&&p.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!a){let c=r.contextreduced??"Context reduced",s=r.contextreducedmessage??"The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";p.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:c,message:s,closable:!0,onClose:()=>o(!0)})}return p};function Ne({messages:i}){return d`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta??"Beta"}>${i.beta??"Beta"}</calcite-chip>`}function _e({popoverContent:i,messages:e}){return d`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer??"Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${i}</div></calcite-popover>`}function De({errorMessage:i,slot:e}){return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??M}>${i}</calcite-input-message></div>`}function Ue({active:i,setActive:e,messages:t}){return d`<calcite-alert slot=alerts .open=${i} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function Oe({context:i,messages:e}){return i?d`<div class="gaps">${i.profileId&&d`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",i.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",i.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function ze({isDisabled:i,isReadOnly:e,setQuestion:t,setIsViewingResult:a,textAreaRef:o,question:n,errorMessage:r,setErrorMessage:p,promptValidationMessage:c,setPromptValidationMessage:s,submitQuestion:u,messages:l,mode:h,assistantRef:S,context:k,contextReducedNoticeDismissed:E,setContextReducedNoticeDismissed:R}){let f=k?.contextTooLarge??!1,v=Pe({promptValidationMessage:c,errorMessage:r,contextTooBig:f,contextReducedNoticeDismissed:E,setContextReducedNoticeDismissed:R,setErrorMessage:p,messages:l});return d`<div class="text-area-wrapper">${Fe({notices:v})}<calcite-text-area scale=s resize=vertical .readOnly=${i||e} class=${Z(v.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${l.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${x=>{qe(x.target),t(x.target.value)}} ${K(o)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${k&&Oe({context:k,messages:l})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${h!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${i} @click=${async()=>{a(!1),t("")}} .label=${l.startover??"Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${h!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async()=>{a(!1),t("")}} class="hidden-below-380" scale=s>${l.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async()=>{if(p(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-below-380">${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} id=small-submit-button @click=${async()=>{if(p(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-above-380" .label=${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`}var Le="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Be="https://www.esri.com/en-us/privacy/privacy-statements";function Qe({setOpen:i,messages:e,feedback:t,learnMoreUrl:a,setFeedback:o,onSubmit:n}){return t.active?d`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>i(!1)}><calcite-panel .heading=${e.submitfeedback??"Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${r=>o({...t,text:r.target.value})} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo??"Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${r=>{o({...t,termsAccepted:r.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${I((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Be} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${Le} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${I((e.feedbackhelps??"Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}",`<calcite-link href=${a} target="_blank">${e.learnmore??"Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${()=>i(!1)} .disabled=${t.submitting}>${e.cancel??"Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit??"Submit"}</calcite-button></div></calcite-panel></calcite-sheet>`:null}function de({promptingEnabled:i,messages:e,slot:t,helpTopicUrl:a}){return d`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??M} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div>${i?d`<p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${I((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${a} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:d`<p>${e.useofassistant??"The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg??"AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps??"Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege??"Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`}function je({messages:i,onProceed:e,onExit:t,helpTopicUrl:a}){return d`<calcite-dialog close-disabled placement=top .heading=${i.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${I((i.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${a} target="_blank">${i.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit??"Exit"}</calcite-button></calcite-dialog>`}function He({messages:i,suggestions:e,onSuggestionClick:t}){return d`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(a=>d`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${()=>t?.(a)}>${a}</calcite-button>`)}</div></calcite-block>`}var pe=200;function ue({hidden:i=!1,expanded:e=!1,messages:t,cards:a,heading:o,collapsible:n=!1,showEffectsIcon:r=!1,onCopyCode:p,standalone:c}){return d`<calcite-block .hidden=${i} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${r&&d`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${N(a,s=>s.conversationId,s=>d`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length>pe?`${s.priorPrompt.slice(0,pe)}...`:s.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${s.conversationId}-${c?"standalone":"list"}`} @click=${u=>{let l=u.currentTarget;navigator.clipboard.writeText(s.priorPrompt).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${s.message&&c&&d`<div class="response-error-container">${De({errorMessage:s.message})}</div>`||""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext??"Response Context"} scale=s>${s.message&&!c&&d`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${Ge({card:s,messages:t})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${s.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor??"Add to editor"} .id=${`add-to-editor-button-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start>${t.addtoeditor??"Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor??"Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${()=>s.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.replaceineditor??"Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${u=>{let l=u.currentTarget;p(s.code).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard??"Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup??"Thumbs up"} scale=s icon=thumbs-up @click=${s.onThumbsUp} .id=${`thumbs-up-${s.conversationId}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.helpful??"Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown??"Thumbs down"} scale=s icon=thumbs-down @click=${s.onThumbsDown} .id=${`thumbs-down-${s.conversationId}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ge=({card:i,messages:e})=>{let t=H(),a=`response-chip-profile-${i.conversationId}-${t}`,o=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",i.profileId);return d`<calcite-tooltip .referenceElement=${a} placement=top-start class="contained-popover-or-tooltip">${o}</calcite-tooltip><calcite-chip .label=${i.profileId} scale=s appearance=outline icon=map-information id=${a??M}>${i.profileId}</calcite-chip>`},me=i=>i.type==="featureSet";function we(i){return i&&i!=="dataCatalogDatastore"?i:void 0}var _=i=>{if(!ie(i))return[];let e=[];return i.relationships?.forEach(t=>{e.push(t.toJSON())}),e},D=i=>i.length>0?{relationships:i}:{},Je=i=>oe(i).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),U=i=>i?{fields:Je(i)}:{fields:[]};async function he(i){let e=await i.loadSource(),t=F(e)&&e.isTable,a=_(e);return{name:i.name,type:"featureSet",isTable:t,...U(e?.fields),...D(a)}}async function $e(i){switch(i.type){case"feature":{let t=await i.loadSource(),a=_(t);return{name:i.name,type:i.type,...U(t?.fields),...D(a)}}case"featureSet":{let t=await i.loadSource(),a=F(t)&&t.isTable;return{name:i.name,type:"featureSet",...a?{isTable:a}:{},...U(t?.fields),...D(_(t))}}case"featureSetCollection":{let t=await i.loadSource(),a=t?.layers.filter(me)??[],o=t?.tables.filter(me)??[],n=await Promise.all(a.map(he)),r=await Promise.all(o.map(he));return{name:i.name,type:"featureSetCollection",layers:n,tables:r}}case"dictionary":{let t=await Promise.all(i.dictionaryVariables.filter(q).map($e));return{name:i.name,type:"dictionary",attributes:t}}case"pixel":{let t=await i.loadSource();if(!t)return{name:i.name,type:"pixel"};let a=await Ae(t);return{name:i.name,type:"pixel",members:a.map(ge)}}case"voxel":{let t=await i.loadSource();if(!t)return{name:i.name,type:"voxel"};let a=await Te(t);return{name:i.name,type:"voxel",members:a.map(ge)}}case"array":let e=we(i.elementType.type);return{name:i.name,type:"array",...e?{elementType:e}:{}};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:i.name,type:i.type}}}function ge(i){if(i.type==="array"){let e=we(i.elementType.type);return{name:i.name,type:"array",...e?{elementType:e}:{}}}return{name:i.name,type:i.type}}async function Ye(i){return{variables:await Promise.all(i.variables.filter(q).map($e))}}var We=1e5;function Ke(i){let e=new TextEncoder().encode(i).length;return Math.ceil(e/3.5)}function O(i){return Ke(JSON.stringify(i))}function Xe(i){let e=a=>({name:a.name,type:a.type,...a.isTable?{isTable:a.isTable}:{},...a.relationships?{relationships:a.relationships}:{}}),t=a=>{switch(a.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:a.name,type:a.type,..."isTable"in a&&a.isTable?{isTable:a.isTable}:{},..."relationships"in a?{relationships:a.relationships}:{}};case"featureSetCollection":return{name:a.name,type:"featureSetCollection",layers:a.layers.map(e),tables:a.tables.map(e)};case"dictionary":return{name:a.name,type:"dictionary",attributes:a.attributes.map(t)};case"pixel":case"voxel":return{name:a.name,type:a.type};case"array":return{name:a.name,type:"array",...a.elementType?{elementType:a.elementType}:{}};default:return a}};return{variables:i.variables.map(t)}}function Ze(i){let e=i.variables,t=e.length,a=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],o=a?[a]:[];return{context:{variables:o},wasReduced:t!==o.length,reducedToVariableName:a?.name}}function et(i){return O(i)>We}var tt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,g=(i,e,t,a)=>{for(var o=a>1?void 0:a?it(e,t):e,n=i.length-1,r;n>=0;n--)(r=i[n])&&(o=(a?r(e,t,o):r(o))||o);return a&&o&&tt(e,t,o),o},m=class extends Ce{constructor(i){super(i),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};g([b()],m.prototype,"viewMode",2);g([b()],m.prototype,"confirmationActive",2);g([b()],m.prototype,"contextReducedNoticeDismissed",2);g([b()],m.prototype,"splashActive",2);g([b()],m.prototype,"isSubmitting",2);g([b()],m.prototype,"errorMessage",2);g([b()],m.prototype,"promptValidationMessage",2);g([b()],m.prototype,"question",2);g([b()],m.prototype,"history",2);g([b()],m.prototype,"feedback",2);g([b()],m.prototype,"context",2);m=g([Ie("ArcadeAssistantViewState")],m);var at="arcade_generation",st="ArcadeCodeRequest",be="visualization",fe="ArcadeAssistant",ot=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras","conversation_id","privacy_statement"],ve=[],ye=!0,z=class extends X{constructor(){super(...arguments),this.textAreaRef=W(),this.messages=te(),this._feedbackService=void 0,this.viewState=new m,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=!1,a;if(this.viewState.feedback.item.isCurrentResult&&this.viewState.viewMode==="result"){let h=this.viewState.context??await this.getProfileAndMetadata(this.getModel()?.uri??""),S=this.viewState.feedback.item.contextSnapshot;a={...h,editor_code:S?.editor_code??"",diagnostics:S?.diagnostics},t=!0}else a=this.viewState.feedback.item.contextSnapshot;let o=re.applicationName;!o&&!this.appVersion&&w("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:n,text:r,termsAccepted:p,item:{question:c,formattedScript:s,conversationId:u}}=this.viewState.feedback,l={user_evaluation:n,your_comments:r||void 0,question:c??"",answer:this.encodeForFeedback(s),useragent:navigator.userAgent,_source:fe,version:this.appVersion||o||"NOT_SET",context:a?JSON.stringify({...a,editor_code:this.encodeForFeedback(a.editor_code),isSnapshot:!t}):"",extras:a?.profileId??"",conversation_id:u??"",privacy_statement:p?"I_agree":""};try{await e.applyEdits({addFeatures:[new ce({attributes:l})]})}catch(h){w("error",this,"Error submitting feedback.",{detail:{error:h}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.promptingEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,promptingEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,diagnostics:0,disableQuestionAnswerLogging:5}}static{this.styles=Me}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
|
|
2
|
+
import{a as N}from"./SWPINDTI.js";import c from"./VLBBZP5D.js";import b from"./EUV7H33D.js";import{c as ae,d as se}from"./3KIKNRZV.js";import a from"./STN3LSQR.js";import{d as oe}from"./MZMKV7FA.js";import{a as te}from"./RQZK3XV2.js";import"./L7OEI4ZV.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./LEFE3FVL.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as W,G as K,H as X,I as Z,J as M,L as ee,h as Q,j as d,k as j,l as V,t as H,x as G,y as J,z as Y}from"./PM4JFKBG.js";import{a as w}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([xe,ne,Se,re,ce,{getDeclaredVoxelMembers:Te,getDeclaredPixelMembers:Ae},Ce,{property:b,subclass:Ie},{G:q,w:ie,x:F},,P])=>{var C=class extends Y{constructor(e){if(super(e),this.it=V,e.type!==G.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===V||e==null)return this._t=void 0,this.it=e;if(e===j)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};C.directiveName="unsafeHTML",C.resultType=1;var I=J(C);var Me=Q`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-dialog{--calcite-dialog-content-space: initial;--calcite-dialog-size-y: initial}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,$=class extends Error{constructor({message:e,code:t,subCode:a,details:o,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=a,this.details=o,this.source=n}};function le(i){if(!i)return;let e=i.indexOf('{"error":');if(e!==-1)try{let t=i.slice(e),a=JSON.parse(t);if(a&&typeof a=="object"&&a.error)return a.error}catch{return}}async function Ee(i){let{baseUrl:e,skillId:t,message:a,authToken:o,previousConversationId:n,context:r}=i,p=t?`${e}/skills/${t}/chat`:`${e}/chat`,c=[],s={message:a,context:r};n&&(s.conversation_id=n);let u;try{u=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(s),responseType:"json"})}catch(f){let v=f,x=v.details?.rawResponse||v.message||String(f),T=le(x);throw T?new $(T):f}let l=u.data;c.push(l);let h=l.conversationId,S=l.inquiryId,k=l.sequenceNumber;async function E(){let f=0,v=100;for(;f<v;){await new Promise(A=>setTimeout(A,1e3));let x=Re(h,k,S),T;try{T=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(x),responseType:"json"})}catch(A){let L=A,ke=L.details?.rawResponse||L.message||String(A),B=le(ke);throw B?new $(B):A}let y=T.data;if(y.context?.kind==="ArcgisErrorAsContext"&&y.context.error)throw new $({message:y.context.error.message||"ArcGIS Assistant error",code:y.context.error.code,subCode:y.context.error.subCode,details:y.context.error.details,source:"polling-response"});if(c.push(y),k=y.sequenceNumber,f++,!y.hasMore)break}if(f===v)throw new $({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let R=120*1e3;return await Promise.race([E(),new Promise((f,v)=>setTimeout(()=>v(new $({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),R))]),c}function Re(i,e,t){return{conversationId:i,inquiryId:t,ackSequenceNumber:e}}function Ve(i){return i.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":i.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":i.message}var Fe=({notices:i})=>i.length?d`<div class="border-block-end">${N(i,e=>e.id??e.title,e=>d`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&d`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&d`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,qe=i=>{let e=i.value.length,t=72,a=180,o=i.offsetWidth,n=Math.max(1,Math.floor(o/8)),r=Math.ceil(e/n),p=t+(r-2)*24;i.style.setProperty("--calcite-text-area-min-height",`${Math.min(p,a)}px`)},Pe=({promptValidationMessage:i,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:a,setContextReducedNoticeDismissed:o,setErrorMessage:n,messages:r})=>{let p=[];if(i&&p.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:i,closable:!0}),e&&p.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!a){let c=r.contextreduced??"Context reduced",s=r.contextreducedmessage??"The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";p.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:c,message:s,closable:!0,onClose:()=>o(!0)})}return p};function Ne({messages:i}){return d`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta??"Beta"}>${i.beta??"Beta"}</calcite-chip>`}function _e({popoverContent:i,messages:e}){return d`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer??"Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${i}</div></calcite-popover>`}function De({errorMessage:i,slot:e}){return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??M}>${i}</calcite-input-message></div>`}function Ue({active:i,setActive:e,messages:t}){return d`<calcite-alert slot=alerts .open=${i} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function Oe({context:i,messages:e}){return i?d`<div class="gaps">${i.profileId&&d`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",i.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",i.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function ze({isDisabled:i,isReadOnly:e,setQuestion:t,setIsViewingResult:a,textAreaRef:o,question:n,errorMessage:r,setErrorMessage:p,promptValidationMessage:c,setPromptValidationMessage:s,submitQuestion:u,messages:l,mode:h,assistantRef:S,context:k,contextReducedNoticeDismissed:E,setContextReducedNoticeDismissed:R}){let f=k?.contextTooLarge??!1,v=Pe({promptValidationMessage:c,errorMessage:r,contextTooBig:f,contextReducedNoticeDismissed:E,setContextReducedNoticeDismissed:R,setErrorMessage:p,messages:l});return d`<div class="text-area-wrapper">${Fe({notices:v})}<calcite-text-area scale=s resize=vertical .readOnly=${i||e} class=${Z(v.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${l.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${x=>{qe(x.target),t(x.target.value)}} ${K(o)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${k&&Oe({context:k,messages:l})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${h!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${i} @click=${async()=>{a(!1),t("")}} .label=${l.startover??"Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${h!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async()=>{a(!1),t("")}} class="hidden-below-380" scale=s>${l.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async()=>{if(p(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-below-380">${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} id=small-submit-button @click=${async()=>{if(p(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-above-380" .label=${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`}var Le="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Be="https://www.esri.com/en-us/privacy/privacy-statements";function Qe({setOpen:i,messages:e,feedback:t,learnMoreUrl:a,setFeedback:o,onSubmit:n}){return t.active?d`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>i(!1)}><calcite-panel .heading=${e.submitfeedback??"Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${r=>o({...t,text:r.target.value})} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo??"Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${r=>{o({...t,termsAccepted:r.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${I((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Be} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${Le} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${I((e.feedbackhelps??"Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}",`<calcite-link href=${a} target="_blank">${e.learnmore??"Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${()=>i(!1)} .disabled=${t.submitting}>${e.cancel??"Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit??"Submit"}</calcite-button></div></calcite-panel></calcite-sheet>`:null}function de({promptingEnabled:i,messages:e,slot:t,helpTopicUrl:a}){return d`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??M} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div>${i?d`<p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${I((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${a} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:d`<p>${e.useofassistant??"The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg??"AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps??"Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege??"Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`}function je({messages:i,onProceed:e,onExit:t,helpTopicUrl:a}){return d`<calcite-dialog close-disabled placement=top .heading=${i.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${I((i.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${a} target="_blank">${i.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit??"Exit"}</calcite-button></calcite-dialog>`}function He({messages:i,suggestions:e,onSuggestionClick:t}){return d`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(a=>d`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${()=>t?.(a)}>${a}</calcite-button>`)}</div></calcite-block>`}var pe=200;function ue({hidden:i=!1,expanded:e=!1,messages:t,cards:a,heading:o,collapsible:n=!1,showEffectsIcon:r=!1,onCopyCode:p,standalone:c}){return d`<calcite-block .hidden=${i} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${r&&d`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${N(a,s=>s.conversationId,s=>d`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length>pe?`${s.priorPrompt.slice(0,pe)}...`:s.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${s.conversationId}-${c?"standalone":"list"}`} @click=${u=>{let l=u.currentTarget;navigator.clipboard.writeText(s.priorPrompt).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${s.message&&c&&d`<div class="response-error-container">${De({errorMessage:s.message})}</div>`||""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext??"Response Context"} scale=s>${s.message&&!c&&d`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${Ge({card:s,messages:t})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${s.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor??"Add to editor"} .id=${`add-to-editor-button-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start>${t.addtoeditor??"Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor??"Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${()=>s.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.replaceineditor??"Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${u=>{let l=u.currentTarget;p(s.code).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard??"Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup??"Thumbs up"} scale=s icon=thumbs-up @click=${s.onThumbsUp} .id=${`thumbs-up-${s.conversationId}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.helpful??"Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown??"Thumbs down"} scale=s icon=thumbs-down @click=${s.onThumbsDown} .id=${`thumbs-down-${s.conversationId}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ge=({card:i,messages:e})=>{let t=H(),a=`response-chip-profile-${i.conversationId}-${t}`,o=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",i.profileId);return d`<calcite-tooltip .referenceElement=${a} placement=top-start class="contained-popover-or-tooltip">${o}</calcite-tooltip><calcite-chip .label=${i.profileId} scale=s appearance=outline icon=map-information id=${a??M}>${i.profileId}</calcite-chip>`},me=i=>i.type==="featureSet";function we(i){return i&&i!=="dataCatalogDatastore"?i:void 0}var _=i=>{if(!ie(i))return[];let e=[];return i.relationships?.forEach(t=>{e.push(t.toJSON())}),e},D=i=>i.length>0?{relationships:i}:{},Je=i=>oe(i).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),U=i=>i?{fields:Je(i)}:{fields:[]};async function he(i){let e=await i.loadSource(),t=F(e)&&e.isTable,a=_(e);return{name:i.name,type:"featureSet",isTable:t,...U(e?.fields),...D(a)}}async function $e(i){switch(i.type){case"feature":{let t=await i.loadSource(),a=_(t);return{name:i.name,type:i.type,...U(t?.fields),...D(a)}}case"featureSet":{let t=await i.loadSource(),a=F(t)&&t.isTable;return{name:i.name,type:"featureSet",...a?{isTable:a}:{},...U(t?.fields),...D(_(t))}}case"featureSetCollection":{let t=await i.loadSource(),a=t?.layers.filter(me)??[],o=t?.tables.filter(me)??[],n=await Promise.all(a.map(he)),r=await Promise.all(o.map(he));return{name:i.name,type:"featureSetCollection",layers:n,tables:r}}case"dictionary":{let t=await Promise.all(i.dictionaryVariables.filter(q).map($e));return{name:i.name,type:"dictionary",attributes:t}}case"pixel":{let t=await i.loadSource();if(!t)return{name:i.name,type:"pixel"};let a=await Ae(t);return{name:i.name,type:"pixel",members:a.map(ge)}}case"voxel":{let t=await i.loadSource();if(!t)return{name:i.name,type:"voxel"};let a=await Te(t);return{name:i.name,type:"voxel",members:a.map(ge)}}case"array":let e=we(i.elementType.type);return{name:i.name,type:"array",...e?{elementType:e}:{}};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:i.name,type:i.type}}}function ge(i){if(i.type==="array"){let e=we(i.elementType.type);return{name:i.name,type:"array",...e?{elementType:e}:{}}}return{name:i.name,type:i.type}}async function Ye(i){return{variables:await Promise.all(i.variables.filter(q).map($e))}}var We=1e5;function Ke(i){let e=new TextEncoder().encode(i).length;return Math.ceil(e/3.5)}function O(i){return Ke(JSON.stringify(i))}function Xe(i){let e=a=>({name:a.name,type:a.type,...a.isTable?{isTable:a.isTable}:{},...a.relationships?{relationships:a.relationships}:{}}),t=a=>{switch(a.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:a.name,type:a.type,..."isTable"in a&&a.isTable?{isTable:a.isTable}:{},..."relationships"in a?{relationships:a.relationships}:{}};case"featureSetCollection":return{name:a.name,type:"featureSetCollection",layers:a.layers.map(e),tables:a.tables.map(e)};case"dictionary":return{name:a.name,type:"dictionary",attributes:a.attributes.map(t)};case"pixel":case"voxel":return{name:a.name,type:a.type};case"array":return{name:a.name,type:"array",...a.elementType?{elementType:a.elementType}:{}};default:return a}};return{variables:i.variables.map(t)}}function Ze(i){let e=i.variables,t=e.length,a=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],o=a?[a]:[];return{context:{variables:o},wasReduced:t!==o.length,reducedToVariableName:a?.name}}function et(i){return O(i)>We}var tt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,g=(i,e,t,a)=>{for(var o=a>1?void 0:a?it(e,t):e,n=i.length-1,r;n>=0;n--)(r=i[n])&&(o=(a?r(e,t,o):r(o))||o);return a&&o&&tt(e,t,o),o},m=class extends Ce{constructor(i){super(i),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};g([b()],m.prototype,"viewMode",2);g([b()],m.prototype,"confirmationActive",2);g([b()],m.prototype,"contextReducedNoticeDismissed",2);g([b()],m.prototype,"splashActive",2);g([b()],m.prototype,"isSubmitting",2);g([b()],m.prototype,"errorMessage",2);g([b()],m.prototype,"promptValidationMessage",2);g([b()],m.prototype,"question",2);g([b()],m.prototype,"history",2);g([b()],m.prototype,"feedback",2);g([b()],m.prototype,"context",2);m=g([Ie("ArcadeAssistantViewState")],m);var at="arcade_generation",st="ArcadeCodeRequest",be="visualization",fe="ArcadeAssistant",ot=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras","conversation_id","privacy_statement"],ve=[],ye=!0,z=class extends X{constructor(){super(...arguments),this.textAreaRef=W(),this.messages=te(),this._feedbackService=void 0,this.viewState=new m,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=!1,a;if(this.viewState.feedback.item.isCurrentResult&&this.viewState.viewMode==="result"){let h=this.viewState.context??await this.getProfileAndMetadata(this.getModel()?.uri??""),S=this.viewState.feedback.item.contextSnapshot;a={...h,editor_code:S?.editor_code??"",diagnostics:S?.diagnostics},t=!0}else a=this.viewState.feedback.item.contextSnapshot;let o=re.applicationName;!o&&!this.appVersion&&w("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:n,text:r,termsAccepted:p,item:{question:c,formattedScript:s,conversationId:u}}=this.viewState.feedback,l={user_evaluation:n,your_comments:r||void 0,question:c??"",answer:this.encodeForFeedback(s),useragent:navigator.userAgent,_source:fe,version:this.appVersion||o||"NOT_SET",context:a?JSON.stringify({...a,editor_code:this.encodeForFeedback(a.editor_code),isSnapshot:!t}):"",extras:a?.profileId??"",conversation_id:u??"",privacy_statement:p?"I_agree":""};try{await e.applyEdits({addFeatures:[new ce({attributes:l})]})}catch(h){w("error",this,"Error submitting feedback.",{detail:{error:h}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.promptingEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,promptingEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,diagnostics:0,disableQuestionAnswerLogging:5}}static{this.styles=Me}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
|
|
3
3
|
// ${this.messages.disclaimerpt2??"AI-generated content may be inaccurate. Review before using."}`}get assistantOverviewDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}get usingTheAssitantDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}async openPrompt(e){if(this.closed=!1,!this.promptingEnabled)return;e&&this.updateViewState({question:e,viewMode:"prompt"});let t=this.textAreaRef.value;t&&t.setFocus()}async destroy(){}connectedCallback(){super.connectedCallback(),this.updateViewState({history:ve,splashActive:ye})}loaded(){let e=async()=>{let t=this.getModel();if(!t){this.updateViewState({context:void 0});return}let a=await this.getProfileAndMetadata(t.uri);this.updateViewState({context:a,contextReducedNoticeDismissed:a.contextTooLarge?!1:this.viewState.contextReducedNoticeDismissed})};this.manager.onLifecycle(()=>{e();let t=P.onModelContextDidChange(async()=>{e().catch(a=>{w("error",this,"Error setting context.",{detail:{error:a}})})});return{remove:()=>{t.dispose()}}})}disconnectedCallback(){super.disconnectedCallback(),ve=this.viewState.history,ye=this.viewState.splashActive,this.copySuccessTimer&&(clearTimeout(this.copySuccessTimer),this.copySuccessTimer=void 0)}createFeedbackContextSnapshot(e){let t=Xe(e.metadata);return{...e,metadata:t,estimatedTokens:O(t)}}withEditorState(e,t){return{...e,editor_code:t?.getValue()??this.getModel()?.getValue()??"",diagnostics:this.diagnostics}}encodeForFeedback(e){return encodeURIComponent(e??"")}updateViewState(e){this.viewState.set(e)}getHistoryCards(){return this.viewState.history.reduce((e,t)=>(!t.script||(e.push({priorPrompt:t.question,code:t.formattedScript||t.error||"",profileId:t.profile??be,onAddToEditor:a=>{ae(this.editorRef.editorInstance,t.formattedScript??"",a,this.disclaimerComment)},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),conversationId:t.conversationId??"",message:t.message}),this.viewState.viewMode),e),[])}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new Se({url:this.feedbackServiceUrl});await e.load();let t=ot.filter(a=>!e.fields.some(o=>o.name===a));if(t.length>0){w("error",this,`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);return}return this._feedbackService=e,e}async logInteractionToFeedbackService(e){if(this.disableQuestionAnswerLogging||!e.question)return;let t;try{t=await this.ensureFeedbackService()}catch(r){w("error",this,"Error initializing feedback service for interaction logging.",{detail:{error:r}});return}if(!t)return;let a=re.applicationName,o=e.contextSnapshot,n={question:e.question,answer:this.encodeForFeedback(e.answer),useragent:navigator.userAgent,_source:fe,version:this.appVersion||a||"NOT_SET",context:o?JSON.stringify({...o,isSnapshot:!0}):"",extras:o?.profileId??"",conversation_id:e.conversationId??"",privacy_statement:""};try{await t.applyEdits({addFeatures:[new ce({attributes:n})]})}catch(r){w("error",this,"Error logging arcade assistant question/answer interaction.",{detail:{error:r}})}}getModel(){return this.editorRef.editorInstance?.getModel()}async submitQuestion(){if(!this.viewState.question)return;let e=this.viewState.question;this.updateViewState({isSubmitting:!0,errorMessage:void 0});let t,a;try{let o=this.getModel();if(!o||!this.serviceUrl)return;let n=this.viewState.context??await this.getProfileAndMetadata(o.uri),r=this.withEditorState(n,o);t=this.createFeedbackContextSnapshot(r);let p=await this.getToken(),c=await Ee({baseUrl:this.serviceUrl,skillId:at,message:e,authToken:p,context:{kind:st,context:{profile_id:r.profileId,metadata:[r.metadata],editor_code:r.editor_code,...r.diagnostics?.length?{diagnostics:r.diagnostics}:{}}}});a=c?.[0]?.conversationId;let s=c.find(u=>u.context?.kind==="ArcadeCodeResponse");if(!s){await this.logInteractionToFeedbackService({question:e,answer:"No ArcadeCodeResponse returned.",contextSnapshot:t,conversationId:a});return}if(s.context?.kind==="ArcadeCodeResponse"){let u=this.createFeedbackContextSnapshot(r),l=se(s?.context?.arcadeCode?.code??"");this.updateViewState({history:[{script:s?.context?.arcadeCode?.code,formattedScript:l,error:void 0,question:e,profile:n.profileId,conversationId:s.conversationId,isCurrentResult:!0,contextSnapshot:u,...s.message?{message:s.message}:{}},...this.viewState.history.map(h=>({...h,isCurrentResult:!1}))],viewMode:"result",errorMessage:void 0}),await this.logInteractionToFeedbackService({question:e,answer:l,contextSnapshot:t,conversationId:s.conversationId})}}catch(o){let n=o instanceof Error&&o.name==="ArcadeAssistantError"?Ve(o)||this.messages.erroroccurred||"An error occurred.":this.messages.erroroccurred||"An error occurred.";this.updateViewState({errorMessage:n}),await this.logInteractionToFeedbackService({question:e,answer:n,contextSnapshot:t,conversationId:a}),w("error",this,"Error submitting question",{detail:{error:o}})}finally{this.updateViewState({isSubmitting:!1})}}async getToken(){let{token:e}=await xe.getCredential(this.portalUrl);return e}async getProfileAndMetadata(e){let t=be,a=P.getEditorProfileForModel(e);a?.loaded||await a?.loadSource();let o=this.editorRef.profile;o&&"id"in o&&(t=o.id);let n=a?await Ye(a):{variables:[]},r=et(n),p=r?Ze(n):void 0,c=p?p.context:n,s=O(c);return{profileId:t,metadata:c,contextTooLarge:r,reducedToVariableName:p?.reducedToVariableName,estimatedTokens:s}}onCopyCode(e){let t=e?`${this.disclaimerComment}
|
|
4
4
|
${e}`:"";return navigator.clipboard.writeText(t)}render(){if(this.closed)return null;let e=this.viewState.viewMode==="result",t=this.getHistoryCards();return this.promptingEnabled?d`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive&&d`<calcite-scrim></calcite-scrim>`||""}${Ne({messages:this.messages})}${_e({messages:this.messages,popoverContent:de({promptingEnabled:this.promptingEnabled,messages:this.messages,helpTopicUrl:this.usingTheAssitantDocUrl})})}<calcite-shell class="unstyled-shell">${this.viewState.splashActive&&je({messages:this.messages,onProceed:()=>{this.updateViewState({splashActive:!1})},helpTopicUrl:this.assistantOverviewDocUrl,onExit:a=>this.closePanel?.(a)})||""}${Ue({active:this.viewState.confirmationActive,setActive:a=>this.updateViewState({confirmationActive:a}),messages:this.messages})}${ze({isDisabled:this.viewState.isSubmitting,isReadOnly:!1,setQuestion:this.setQuestionState,setIsViewingResult:a=>this.updateViewState({viewMode:a?"result":"prompt"}),mode:e?"refine":"prompt",textAreaRef:this.textAreaRef,question:this.viewState.question,errorMessage:this.viewState.errorMessage,setErrorMessage:a=>this.updateViewState({errorMessage:a}),promptValidationMessage:this.viewState.promptValidationMessage,setPromptValidationMessage:a=>this.updateViewState({promptValidationMessage:a}),submitQuestion:this.submitQuestion.bind(this),assistantRef:this.el,messages:this.messages,context:this.viewState.context,contextReducedNoticeDismissed:this.viewState.contextReducedNoticeDismissed,setContextReducedNoticeDismissed:a=>this.updateViewState({contextReducedNoticeDismissed:a})})}<calcite-block-group .label=${this.messages.interactiveblocks??"interactive blocks"}>${!e&&!this.viewState.isSubmitting&&He({messages:this.messages,suggestions:[this.messages.prompsuggestion1??"",this.messages.prompsuggestion2??""],onSuggestionClick:this.onSuggestionClick})||""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse??"Generating response..."}></calcite-block>${ue({expanded:e,messages:this.messages,collapsible:!0,showEffectsIcon:!0,cards:t.length?[t[0]]:[],heading:this.messages.besteffort??"Here's the assistant's best effort",hidden:this.viewState.isSubmitting||!e,onCopyCode:this.onCopyCode.bind(this),standalone:!0})}${ue({expanded:!e,messages:this.messages,collapsible:!0,cards:e?t.slice(1):t,heading:this.messages.recentprompts??"Recent prompts",hidden:this.viewState.isSubmitting||this.viewState.history.length===0,onCopyCode:this.onCopyCode.bind(this)})}</calcite-block-group>${this.viewState.feedback.active?Qe({setOpen:this.handleFeedbackSheetClose,messages:this.messages,onSubmit:this.handleFeedbackSubmit,feedback:this.viewState.feedback,setFeedback:this.setFeedbackState,learnMoreUrl:this.assistantOverviewDocUrl}):null}</calcite-shell></calcite-flow-item></calcite-flow>`:d`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${de({slot:"content-top",messages:this.messages,promptingEnabled:this.promptingEnabled,helpTopicUrl:this.usingTheAssitantDocUrl})}</calcite-flow-item></calcite-flow>`}};ee("arcgis-arcade-coding-assistant",z);return z},"identity/IdentityManager","request","layers/FeatureLayer","config","Graphic","applications/Components/arcadeEditorUtils","core/Accessor","core/accessorSupport/decorators",a,b,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import d from"./
|
|
2
|
+
import d from"./AGZBL3MZ.js";import c from"./P6Q7UVSV.js";import b from"./EUV7H33D.js";import"./3KIKNRZV.js";import a from"./STN3LSQR.js";import"./MZMKV7FA.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./LEFE3FVL.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import"./PM4JFKBG.js";import"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,{a:a,b:b,c:c}])=>{return{getSqlExprDiagnosticService:b,getSqlExprWorker:a,setupMode:c}},a,b,c,d)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
var ut;(function(i){function e(t){return typeof t=="string"}i.is=e})(ut||(ut={}));var ge;(function(i){function e(t){return typeof t=="string"}i.is=e})(ge||(ge={}));var ot;(function(i){i.MIN_VALUE=-2147483648,i.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&i.MIN_VALUE<=t&&t<=i.MAX_VALUE}i.is=e})(ot||(ot={}));var Y;(function(i){i.MIN_VALUE=0,i.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&i.MIN_VALUE<=t&&t<=i.MAX_VALUE}i.is=e})(Y||(Y={}));var I;(function(i){function e(n,r){return n===Number.MAX_VALUE&&(n=Y.MAX_VALUE),r===Number.MAX_VALUE&&(r=Y.MAX_VALUE),{line:n,character:r}}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&o.uinteger(r.line)&&o.uinteger(r.character)}i.is=t})(I||(I={}));var A;(function(i){function e(n,r,s,a){if(o.uinteger(n)&&o.uinteger(r)&&o.uinteger(s)&&o.uinteger(a))return{start:I.create(n,r),end:I.create(s,a)};if(I.is(n)&&I.is(r))return{start:n,end:r};throw new Error(`Range#create called with invalid arguments[${n}, ${r}, ${s}, ${a}]`)}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&I.is(r.start)&&I.is(r.end)}i.is=t})(A||(A={}));var Q;(function(i){function e(n,r){return{uri:n,range:r}}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&A.is(r.range)&&(o.string(r.uri)||o.undefined(r.uri))}i.is=t})(Q||(Q={}));var ct;(function(i){function e(n,r,s,a){return{targetUri:n,targetRange:r,targetSelectionRange:s,originSelectionRange:a}}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&A.is(r.targetRange)&&o.string(r.targetUri)&&A.is(r.targetSelectionRange)&&(A.is(r.originSelectionRange)||o.undefined(r.originSelectionRange))}i.is=t})(ct||(ct={}));var xe;(function(i){function e(n,r,s,a){return{red:n,green:r,blue:s,alpha:a}}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&o.numberRange(r.red,0,1)&&o.numberRange(r.green,0,1)&&o.numberRange(r.blue,0,1)&&o.numberRange(r.alpha,0,1)}i.is=t})(xe||(xe={}));var lt;(function(i){function e(n,r){return{range:n,color:r}}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&A.is(r.range)&&xe.is(r.color)}i.is=t})(lt||(lt={}));var dt;(function(i){function e(n,r,s){return{label:n,textEdit:r,additionalTextEdits:s}}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&o.string(r.label)&&(o.undefined(r.textEdit)||O.is(r))&&(o.undefined(r.additionalTextEdits)||o.typedArray(r.additionalTextEdits,O.is))}i.is=t})(dt||(dt={}));var ht;(function(i){i.Comment="comment",i.Imports="imports",i.Region="region"})(ht||(ht={}));var pt;(function(i){function e(n,r,s,a,c,l){let f={startLine:n,endLine:r};return o.defined(s)&&(f.startCharacter=s),o.defined(a)&&(f.endCharacter=a),o.defined(c)&&(f.kind=c),o.defined(l)&&(f.collapsedText=l),f}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&o.uinteger(r.startLine)&&o.uinteger(r.startLine)&&(o.undefined(r.startCharacter)||o.uinteger(r.startCharacter))&&(o.undefined(r.endCharacter)||o.uinteger(r.endCharacter))&&(o.undefined(r.kind)||o.string(r.kind))}i.is=t})(pt||(pt={}));var Ee;(function(i){function e(n,r){return{location:n,message:r}}i.create=e;function t(n){let r=n;return o.defined(r)&&Q.is(r.location)&&o.string(r.message)}i.is=t})(Ee||(Ee={}));var ee;(function(i){i.Error=1,i.Warning=2,i.Information=3,i.Hint=4})(ee||(ee={}));var ft;(function(i){i.Unnecessary=1,i.Deprecated=2})(ft||(ft={}));var Dt;(function(i){function e(t){let n=t;return o.objectLiteral(n)&&o.string(n.href)}i.is=e})(Dt||(Dt={}));var te;(function(i){function e(n,r,s,a,c,l){let f={range:n,message:r};return o.defined(s)&&(f.severity=s),o.defined(a)&&(f.code=a),o.defined(c)&&(f.source=c),o.defined(l)&&(f.relatedInformation=l),f}i.create=e;function t(n){var r;let s=n;return o.defined(s)&&A.is(s.range)&&o.string(s.message)&&(o.number(s.severity)||o.undefined(s.severity))&&(o.integer(s.code)||o.string(s.code)||o.undefined(s.code))&&(o.undefined(s.codeDescription)||o.string((r=s.codeDescription)===null||r===void 0?void 0:r.href))&&(o.string(s.source)||o.undefined(s.source))&&(o.undefined(s.relatedInformation)||o.typedArray(s.relatedInformation,Ee.is))}i.is=t})(te||(te={}));var j;(function(i){function e(n,r,...s){let a={title:n,command:r};return o.defined(s)&&s.length>0&&(a.arguments=s),a}i.create=e;function t(n){let r=n;return o.defined(r)&&o.string(r.title)&&o.string(r.command)}i.is=t})(j||(j={}));var O;(function(i){function e(s,a){return{range:s,newText:a}}i.replace=e;function t(s,a){return{range:{start:s,end:s},newText:a}}i.insert=t;function n(s){return{range:s,newText:""}}i.del=n;function r(s){let a=s;return o.objectLiteral(a)&&o.string(a.newText)&&A.is(a.range)}i.is=r})(O||(O={}));var Ce;(function(i){function e(n,r,s){let a={label:n};return r!==void 0&&(a.needsConfirmation=r),s!==void 0&&(a.description=s),a}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&o.string(r.label)&&(o.boolean(r.needsConfirmation)||r.needsConfirmation===void 0)&&(o.string(r.description)||r.description===void 0)}i.is=t})(Ce||(Ce={}));var z;(function(i){function e(t){let n=t;return o.string(n)}i.is=e})(z||(z={}));var mt;(function(i){function e(s,a,c){return{range:s,newText:a,annotationId:c}}i.replace=e;function t(s,a,c){return{range:{start:s,end:s},newText:a,annotationId:c}}i.insert=t;function n(s,a){return{range:s,newText:"",annotationId:a}}i.del=n;function r(s){let a=s;return O.is(a)&&(Ce.is(a.annotationId)||z.is(a.annotationId))}i.is=r})(mt||(mt={}));var Fe;(function(i){function e(n,r){return{textDocument:n,edits:r}}i.create=e;function t(n){let r=n;return o.defined(r)&&Be.is(r.textDocument)&&Array.isArray(r.edits)}i.is=t})(Fe||(Fe={}));var Ae;(function(i){function e(n,r,s){let a={kind:"create",uri:n};return r!==void 0&&(r.overwrite!==void 0||r.ignoreIfExists!==void 0)&&(a.options=r),s!==void 0&&(a.annotationId=s),a}i.create=e;function t(n){let r=n;return r&&r.kind==="create"&&o.string(r.uri)&&(r.options===void 0||(r.options.overwrite===void 0||o.boolean(r.options.overwrite))&&(r.options.ignoreIfExists===void 0||o.boolean(r.options.ignoreIfExists)))&&(r.annotationId===void 0||z.is(r.annotationId))}i.is=t})(Ae||(Ae={}));var ye;(function(i){function e(n,r,s,a){let c={kind:"rename",oldUri:n,newUri:r};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(c.options=s),a!==void 0&&(c.annotationId=a),c}i.create=e;function t(n){let r=n;return r&&r.kind==="rename"&&o.string(r.oldUri)&&o.string(r.newUri)&&(r.options===void 0||(r.options.overwrite===void 0||o.boolean(r.options.overwrite))&&(r.options.ignoreIfExists===void 0||o.boolean(r.options.ignoreIfExists)))&&(r.annotationId===void 0||z.is(r.annotationId))}i.is=t})(ye||(ye={}));var be;(function(i){function e(n,r,s){let a={kind:"delete",uri:n};return r!==void 0&&(r.recursive!==void 0||r.ignoreIfNotExists!==void 0)&&(a.options=r),s!==void 0&&(a.annotationId=s),a}i.create=e;function t(n){let r=n;return r&&r.kind==="delete"&&o.string(r.uri)&&(r.options===void 0||(r.options.recursive===void 0||o.boolean(r.options.recursive))&&(r.options.ignoreIfNotExists===void 0||o.boolean(r.options.ignoreIfNotExists)))&&(r.annotationId===void 0||z.is(r.annotationId))}i.is=t})(be||(be={}));var Se;(function(i){function e(t){let n=t;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(r=>o.string(r.kind)?Ae.is(r)||ye.is(r)||be.is(r):Fe.is(r)))}i.is=e})(Se||(Se={}));var gt;(function(i){function e(n){return{uri:n}}i.create=e;function t(n){let r=n;return o.defined(r)&&o.string(r.uri)}i.is=t})(gt||(gt={}));var xt;(function(i){function e(n,r){return{uri:n,version:r}}i.create=e;function t(n){let r=n;return o.defined(r)&&o.string(r.uri)&&o.integer(r.version)}i.is=t})(xt||(xt={}));var Be;(function(i){function e(n,r){return{uri:n,version:r}}i.create=e;function t(n){let r=n;return o.defined(r)&&o.string(r.uri)&&(r.version===null||o.integer(r.version))}i.is=t})(Be||(Be={}));var Et;(function(i){function e(n,r,s,a){return{uri:n,languageId:r,version:s,text:a}}i.create=e;function t(n){let r=n;return o.defined(r)&&o.string(r.uri)&&o.string(r.languageId)&&o.integer(r.version)&&o.string(r.text)}i.is=t})(Et||(Et={}));var H;(function(i){i.PlainText="plaintext",i.Markdown="markdown";function e(t){let n=t;return n===i.PlainText||n===i.Markdown}i.is=e})(H||(H={}));var q;(function(i){function e(t){let n=t;return o.objectLiteral(t)&&H.is(n.kind)&&o.string(n.value)}i.is=e})(q||(q={}));var b;(function(i){i.Text=1,i.Method=2,i.Function=3,i.Constructor=4,i.Field=5,i.Variable=6,i.Class=7,i.Interface=8,i.Module=9,i.Property=10,i.Unit=11,i.Value=12,i.Enum=13,i.Keyword=14,i.Snippet=15,i.Color=16,i.File=17,i.Reference=18,i.Folder=19,i.EnumMember=20,i.Constant=21,i.Struct=22,i.Event=23,i.Operator=24,i.TypeParameter=25})(b||(b={}));var S;(function(i){i.PlainText=1,i.Snippet=2})(S||(S={}));var Ct;(function(i){i.Deprecated=1})(Ct||(Ct={}));var Ft;(function(i){function e(n,r,s){return{newText:n,insert:r,replace:s}}i.create=e;function t(n){let r=n;return r&&o.string(r.newText)&&A.is(r.insert)&&A.is(r.replace)}i.is=t})(Ft||(Ft={}));var B;(function(i){i.asIs=1,i.adjustIndentation=2})(B||(B={}));var At;(function(i){function e(t){let n=t;return n&&(o.string(n.detail)||n.detail===void 0)&&(o.string(n.description)||n.description===void 0)}i.is=e})(At||(At={}));var yt;(function(i){function e(t){return{label:t}}i.create=e})(yt||(yt={}));var bt;(function(i){function e(t,n){return{items:t||[],isIncomplete:!!n}}i.create=e})(bt||(bt={}));var ie;(function(i){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}i.fromPlainText=e;function t(n){let r=n;return o.string(r)||o.objectLiteral(r)&&o.string(r.language)&&o.string(r.value)}i.is=t})(ie||(ie={}));var St;(function(i){function e(t){let n=t;return!!n&&o.objectLiteral(n)&&(q.is(n.contents)||ie.is(n.contents)||o.typedArray(n.contents,ie.is))&&(t.range===void 0||A.is(t.range))}i.is=e})(St||(St={}));var Bt;(function(i){function e(t,n){return n?{label:t,documentation:n}:{label:t}}i.create=e})(Bt||(Bt={}));var wt;(function(i){function e(t,n,...r){let s={label:t};return o.defined(n)&&(s.documentation=n),o.defined(r)?s.parameters=r:s.parameters=[],s}i.create=e})(wt||(wt={}));var It;(function(i){i.Text=1,i.Read=2,i.Write=3})(It||(It={}));var kt;(function(i){function e(t,n){let r={range:t};return o.number(n)&&(r.kind=n),r}i.create=e})(kt||(kt={}));var Lt;(function(i){i.File=1,i.Module=2,i.Namespace=3,i.Package=4,i.Class=5,i.Method=6,i.Property=7,i.Field=8,i.Constructor=9,i.Enum=10,i.Interface=11,i.Function=12,i.Variable=13,i.Constant=14,i.String=15,i.Number=16,i.Boolean=17,i.Array=18,i.Object=19,i.Key=20,i.Null=21,i.EnumMember=22,i.Struct=23,i.Event=24,i.Operator=25,i.TypeParameter=26})(Lt||(Lt={}));var vt;(function(i){i.Deprecated=1})(vt||(vt={}));var Tt;(function(i){function e(t,n,r,s,a){let c={name:t,kind:n,location:{uri:s,range:r}};return a&&(c.containerName=a),c}i.create=e})(Tt||(Tt={}));var Nt;(function(i){function e(t,n,r,s){return s!==void 0?{name:t,kind:n,location:{uri:r,range:s}}:{name:t,kind:n,location:{uri:r}}}i.create=e})(Nt||(Nt={}));var Pt;(function(i){function e(n,r,s,a,c,l){let f={name:n,detail:r,kind:s,range:a,selectionRange:c};return l!==void 0&&(f.children=l),f}i.create=e;function t(n){let r=n;return r&&o.string(r.name)&&o.number(r.kind)&&A.is(r.range)&&A.is(r.selectionRange)&&(r.detail===void 0||o.string(r.detail))&&(r.deprecated===void 0||o.boolean(r.deprecated))&&(r.children===void 0||Array.isArray(r.children))&&(r.tags===void 0||Array.isArray(r.tags))}i.is=t})(Pt||(Pt={}));var Mt;(function(i){i.Empty="",i.QuickFix="quickfix",i.Refactor="refactor",i.RefactorExtract="refactor.extract",i.RefactorInline="refactor.inline",i.RefactorRewrite="refactor.rewrite",i.Source="source",i.SourceOrganizeImports="source.organizeImports",i.SourceFixAll="source.fixAll"})(Mt||(Mt={}));var ne;(function(i){i.Invoked=1,i.Automatic=2})(ne||(ne={}));var Ut;(function(i){function e(n,r,s){let a={diagnostics:n};return r!=null&&(a.only=r),s!=null&&(a.triggerKind=s),a}i.create=e;function t(n){let r=n;return o.defined(r)&&o.typedArray(r.diagnostics,te.is)&&(r.only===void 0||o.typedArray(r.only,o.string))&&(r.triggerKind===void 0||r.triggerKind===ne.Invoked||r.triggerKind===ne.Automatic)}i.is=t})(Ut||(Ut={}));var _t;(function(i){function e(n,r,s){let a={title:n},c=!0;return typeof r=="string"?(c=!1,a.kind=r):j.is(r)?a.command=r:a.edit=r,c&&s!==void 0&&(a.kind=s),a}i.create=e;function t(n){let r=n;return r&&o.string(r.title)&&(r.diagnostics===void 0||o.typedArray(r.diagnostics,te.is))&&(r.kind===void 0||o.string(r.kind))&&(r.edit!==void 0||r.command!==void 0)&&(r.command===void 0||j.is(r.command))&&(r.isPreferred===void 0||o.boolean(r.isPreferred))&&(r.edit===void 0||Se.is(r.edit))}i.is=t})(_t||(_t={}));var jt;(function(i){function e(n,r){let s={range:n};return o.defined(r)&&(s.data=r),s}i.create=e;function t(n){let r=n;return o.defined(r)&&A.is(r.range)&&(o.undefined(r.command)||j.is(r.command))}i.is=t})(jt||(jt={}));var Ot;(function(i){function e(n,r){return{tabSize:n,insertSpaces:r}}i.create=e;function t(n){let r=n;return o.defined(r)&&o.uinteger(r.tabSize)&&o.boolean(r.insertSpaces)}i.is=t})(Ot||(Ot={}));var zt;(function(i){function e(n,r,s){return{range:n,target:r,data:s}}i.create=e;function t(n){let r=n;return o.defined(r)&&A.is(r.range)&&(o.undefined(r.target)||o.string(r.target))}i.is=t})(zt||(zt={}));var Vt;(function(i){function e(n,r){return{range:n,parent:r}}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&A.is(r.range)&&(r.parent===void 0||i.is(r.parent))}i.is=t})(Vt||(Vt={}));var $t;(function(i){i.namespace="namespace",i.type="type",i.class="class",i.enum="enum",i.interface="interface",i.struct="struct",i.typeParameter="typeParameter",i.parameter="parameter",i.variable="variable",i.property="property",i.enumMember="enumMember",i.event="event",i.function="function",i.method="method",i.macro="macro",i.keyword="keyword",i.modifier="modifier",i.comment="comment",i.string="string",i.number="number",i.regexp="regexp",i.operator="operator",i.decorator="decorator"})($t||($t={}));var Rt;(function(i){i.declaration="declaration",i.definition="definition",i.readonly="readonly",i.static="static",i.deprecated="deprecated",i.abstract="abstract",i.async="async",i.modification="modification",i.documentation="documentation",i.defaultLibrary="defaultLibrary"})(Rt||(Rt={}));var Wt;(function(i){function e(t){let n=t;return o.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}i.is=e})(Wt||(Wt={}));var Ht;(function(i){function e(n,r){return{range:n,text:r}}i.create=e;function t(n){let r=n;return r!=null&&A.is(r.range)&&o.string(r.text)}i.is=t})(Ht||(Ht={}));var qt;(function(i){function e(n,r,s){return{range:n,variableName:r,caseSensitiveLookup:s}}i.create=e;function t(n){let r=n;return r!=null&&A.is(r.range)&&o.boolean(r.caseSensitiveLookup)&&(o.string(r.variableName)||r.variableName===void 0)}i.is=t})(qt||(qt={}));var Gt;(function(i){function e(n,r){return{range:n,expression:r}}i.create=e;function t(n){let r=n;return r!=null&&A.is(r.range)&&(o.string(r.expression)||r.expression===void 0)}i.is=t})(Gt||(Gt={}));var Kt;(function(i){function e(n,r){return{frameId:n,stoppedLocation:r}}i.create=e;function t(n){let r=n;return o.defined(r)&&A.is(n.stoppedLocation)}i.is=t})(Kt||(Kt={}));var we;(function(i){i.Type=1,i.Parameter=2;function e(t){return t===1||t===2}i.is=e})(we||(we={}));var Ie;(function(i){function e(n){return{value:n}}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&(r.tooltip===void 0||o.string(r.tooltip)||q.is(r.tooltip))&&(r.location===void 0||Q.is(r.location))&&(r.command===void 0||j.is(r.command))}i.is=t})(Ie||(Ie={}));var Jt;(function(i){function e(n,r,s){let a={position:n,label:r};return s!==void 0&&(a.kind=s),a}i.create=e;function t(n){let r=n;return o.objectLiteral(r)&&I.is(r.position)&&(o.string(r.label)||o.typedArray(r.label,Ie.is))&&(r.kind===void 0||we.is(r.kind))&&r.textEdits===void 0||o.typedArray(r.textEdits,O.is)&&(r.tooltip===void 0||o.string(r.tooltip)||q.is(r.tooltip))&&(r.paddingLeft===void 0||o.boolean(r.paddingLeft))&&(r.paddingRight===void 0||o.boolean(r.paddingRight))}i.is=t})(Jt||(Jt={}));var Xt;(function(i){function e(t){return{kind:"snippet",value:t}}i.createSnippet=e})(Xt||(Xt={}));var Zt;(function(i){function e(t,n,r,s){return{insertText:t,filterText:n,range:r,command:s}}i.create=e})(Zt||(Zt={}));var Yt;(function(i){function e(t){return{items:t}}i.create=e})(Yt||(Yt={}));var Qt;(function(i){i.Invoked=0,i.Automatic=1})(Qt||(Qt={}));var ei;(function(i){function e(t,n){return{range:t,text:n}}i.create=e})(ei||(ei={}));var ti;(function(i){function e(t,n){return{triggerKind:t,selectedCompletionInfo:n}}i.create=e})(ti||(ti={}));var ii;(function(i){function e(t){let n=t;return o.objectLiteral(n)&&ge.is(n.uri)&&o.string(n.name)}i.is=e})(ii||(ii={}));var ni;(function(i){function e(s,a,c,l){return new ke(s,a,c,l)}i.create=e;function t(s){let a=s;return!!(o.defined(a)&&o.string(a.uri)&&(o.undefined(a.languageId)||o.string(a.languageId))&&o.uinteger(a.lineCount)&&o.func(a.getText)&&o.func(a.positionAt)&&o.func(a.offsetAt))}i.is=t;function n(s,a){let c=s.getText(),l=r(a,(x,E)=>{let F=x.range.start.line-E.range.start.line;return F===0?x.range.start.character-E.range.start.character:F}),f=c.length;for(let x=l.length-1;x>=0;x--){let E=l[x],F=s.offsetAt(E.range.start),g=s.offsetAt(E.range.end);if(g<=f)c=c.substring(0,F)+E.newText+c.substring(g,c.length);else throw new Error("Overlapping edit");f=F}return c}i.applyEdits=n;function r(s,a){if(s.length<=1)return s;let c=s.length/2|0,l=s.slice(0,c),f=s.slice(c);r(l,a),r(f,a);let x=0,E=0,F=0;for(;x<l.length&&E<f.length;)a(l[x],f[E])<=0?s[F++]=l[x++]:s[F++]=f[E++];for(;x<l.length;)s[F++]=l[x++];for(;E<f.length;)s[F++]=f[E++];return s}})(ni||(ni={}));var ke=class{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],t=this._content,n=!0;for(let r=0;r<t.length;r++){n&&(e.push(r),n=!1);let s=t.charAt(r);n=s==="\r"||s===`
|
|
3
|
+
`,s==="\r"&&r+1<t.length&&t.charAt(r+1)===`
|
|
4
|
+
`&&r++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,r=t.length;if(r===0)return I.create(0,e);for(;n<r;){let a=Math.floor((n+r)/2);t[a]>e?r=a:n=a+1}let s=n-1;return I.create(s,e-t[s])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,r),n)}get lineCount(){return this.getLineOffsets().length}},o;(function(i){let e=Object.prototype.toString;function t(g){return typeof g<"u"}i.defined=t;function n(g){return typeof g>"u"}i.undefined=n;function r(g){return g===!0||g===!1}i.boolean=r;function s(g){return e.call(g)==="[object String]"}i.string=s;function a(g){return e.call(g)==="[object Number]"}i.number=a;function c(g,P,me){return e.call(g)==="[object Number]"&&P<=g&&g<=me}i.numberRange=c;function l(g){return e.call(g)==="[object Number]"&&-2147483648<=g&&g<=2147483647}i.integer=l;function f(g){return e.call(g)==="[object Number]"&&0<=g&&g<=2147483647}i.uinteger=f;function x(g){return e.call(g)==="[object Function]"}i.func=x;function E(g){return g!==null&&typeof g=="object"}i.objectLiteral=E;function F(g,P){return Array.isArray(g)&&g.every(P)}i.typedArray=F})(o||(o={}));var V={False:"false",Null:"null",True:"true"},m={Break:"break",Continue:"continue",Else:"else",For:"for",Function:"function",If:"if",Import:"import",Export:"export",In:"in",Return:"return",Var:"var",While:"while"},Le={From:"from",Of:"of"},u={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BlockComment:"BlockComment",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",ContinueStatement:"ContinueStatement",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",LineComment:"LineComment",Literal:"Literal",LogicalExpression:"LogicalExpression",MemberAccessChainExpression:"MemberAccessChainExpression",MemberExpression:"MemberExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SafeMemberExpression:"SafeMemberExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement"},Pe=["++","--"],di=["-","+","!","~"],hi=["=","/=","*=","%=","+=","-="],pi=["||","&&"],Si=["|","&",">>","<<",">>>","^","==","!=","<","<=",">",">=","+","-","*","/","%"],T="?.",G={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},h={Unknown:0,BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,Template:10},Bi=["Unknown","Boolean","<end>","Identifier","Keyword","Null","Numeric","Punctuator","String","RegularExpression","Template"],d={InvalidModuleUri:"InvalidModuleUri",ForInOfLoopInitializer:"ForInOfLoopInitializer",IdentifierExpected:"IdentifierExpected",InvalidEscapedReservedWord:"InvalidEscapedReservedWord",InvalidExpression:"InvalidExpression",InvalidFunctionIdentifier:"InvalidFunctionIdentifier",InvalidHexEscapeSequence:"InvalidHexEscapeSequence",InvalidLeftHandSideInAssignment:"InvalidLeftHandSideInAssignment",InvalidLeftHandSideInForIn:"InvalidLeftHandSideInForIn",InvalidTemplateHead:"InvalidTemplateHead",InvalidVariableAssignment:"InvalidVariableAssignment",KeyMustBeString:"KeyMustBeString",NoFunctionInsideBlock:"NoFunctionInsideBlock",NoFunctionInsideFunction:"NoFunctionInsideFunction",ModuleExportRootOnly:"ModuleExportRootOnly",ModuleImportRootOnly:"ModuleImportRootOnly",PunctuatorExpected:"PunctuatorExpected",TemplateOctalLiteral:"TemplateOctalLiteral",UnexpectedBoolean:"UnexpectedBoolean",UnexpectedEndOfScript:"UnexpectedEndOfScript",UnexpectedIdentifier:"UnexpectedIdentifier",UnexpectedKeyword:"UnexpectedKeyword",UnexpectedNull:"UnexpectedNull",UnexpectedNumber:"UnexpectedNumber",UnexpectedPunctuator:"UnexpectedPunctuator",UnexpectedString:"UnexpectedString",UnexpectedTemplate:"UnexpectedTemplate",UnexpectedToken:"UnexpectedToken"},ze={[d.InvalidModuleUri]:"Module uri must be a text literal.",[d.ForInOfLoopInitializer]:"for-in loop variable declaration may not have an initializer.",[d.IdentifierExpected]:"'${value}' is an invalid identifier.",[d.InvalidEscapedReservedWord]:"Keyword cannot contain escaped characters.",[d.InvalidExpression]:"Invalid expression.",[d.InvalidFunctionIdentifier]:"'${value}' is an invalid function identifier.",[d.InvalidHexEscapeSequence]:"Invalid hexadecimal escape sequence.",[d.InvalidLeftHandSideInAssignment]:"Invalid left-hand side in assignment.",[d.InvalidLeftHandSideInForIn]:"Invalid left-hand side in for-in.",[d.InvalidTemplateHead]:"Invalid template structure.",[d.InvalidVariableAssignment]:"Invalid variable assignment.",[d.KeyMustBeString]:"Object property keys must be a word starting with a letter.",[d.NoFunctionInsideBlock]:"Functions cannot be declared inside of code blocks.",[d.NoFunctionInsideFunction]:"Functions cannot be declared inside another function.",[d.ModuleExportRootOnly]:"Module exports cannot be declared inside of code blocks.",[d.ModuleImportRootOnly]:"Module import cannot be declared inside of code blocks.",[d.PunctuatorExpected]:"'${value}' expected.",[d.TemplateOctalLiteral]:"Octal literals are not allowed in template literals.",[d.UnexpectedBoolean]:"Unexpected boolean literal.",[d.UnexpectedEndOfScript]:"Unexpected end of Arcade expression.",[d.UnexpectedIdentifier]:"Unexpected identifier.",[d.UnexpectedKeyword]:"Unexpected keyword.",[d.UnexpectedNull]:"Unexpected null literal.",[d.UnexpectedNumber]:"Unexpected number.",[d.UnexpectedPunctuator]:"Unexpected punctuator.",[d.UnexpectedString]:"Unexpected text literal.",[d.UnexpectedTemplate]:"Unexpected quasi '${value}'.",[d.UnexpectedToken]:"Unexpected token '${value}'."},$=class i extends Error{constructor({code:e,index:t,line:n,column:r,len:s=0,description:a,data:c}){super(a??e),this.declaredRootClass="esri.arcade.lib.diagnostic",this.name="ParsingError",this.code=e,this.index=t,this.line=n,this.column=r,this.len=s,this.data=c,this.description=a,this.range={start:{line:n,column:r-1},end:{line:n,column:r+s}},Error.captureStackTrace?.(this,i)}};function wi(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.Program}function v(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.BlockStatement}function Ii(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.BlockComment}function Ve(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.EmptyStatement}function fi(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.ExpressionStatement}function $e(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.FunctionDeclaration}function re(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.IfStatement}function se(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.VariableDeclaration}function K(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.ArrayExpression}function ae(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.BinaryExpression}function ue(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.Identifier}function Re(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.Literal}function oe(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.LogicalExpression}function We(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.ObjectExpression}function He(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.MemberExpression}function Di(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.SafeMemberExpression}function mi(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.MemberAccessChainExpression}function gi(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.UnaryExpression}function xi(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.UpdateExpression}function qe(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.VariableDeclarator}function Ei(i){return!!i&&typeof i=="object"&&"type"in i&&i.type===u.Property}function ve(i,e){return e.loc.end.line===i.loc.start.line&&e.loc.end.column<=i.loc.start.column}function ri(i,e){return i.range[0]>=e.range[0]&&i.range[1]<=e.range[1]}var Me=class{constructor(){this.comments=[],this._nodeStack=[],this._newComments=[]}insertInnerComments(e){if(!v(e)||e.body.length!==0)return;let t=[];for(let n=this._newComments.length-1;n>=0;n--){let r=this._newComments[n];e.range[1]>=r.range[0]&&(t.unshift(r),this._newComments.splice(n,1))}t.length&&(e.innerComments=t)}attachTrailingComments(e){let t=this._nodeStack.at(-1);if(!t)return;if(v(e)&&ri(t,e))for(let r=this._newComments.length-1;r>=0;r--){let s=this._newComments[r];ri(s,e)&&(t.trailingComments=[...t.trailingComments??[],s],this._newComments.splice(r,1))}let n=[];if(this._newComments.length>0)for(let r=this._newComments.length-1;r>=0;r--){let s=this._newComments[r];ve(s,t)?(t.trailingComments=[...t.trailingComments??[],s],this._newComments.splice(r,1)):ve(s,e)&&(n.unshift(s),this._newComments.splice(r,1))}if(t.trailingComments){let r=t.trailingComments[0];ve(r,e)&&(n=[...n,...t.trailingComments],delete t.trailingComments)}n.length>0&&(e.trailingComments=n)}attachLeadingComments(e){let t;for(;this._nodeStack.length>0;){let s=this._nodeStack[this._nodeStack.length-1];if(e.range[0]<=s.range[0]){t=s,this._nodeStack.pop();continue}break}let n=[],r=[];if(t!=null){if(!t.leadingComments)return;for(let s=t.leadingComments.length-1;s>=0;s--){let a=t.leadingComments[s];if(e.range[0]>=a.range[1]){n.unshift(a),t.leadingComments.splice(s,1);continue}qe(e)&&!Ii(a)&&(r.unshift(a),t.leadingComments.splice(s,1))}t.leadingComments.length===0&&delete t.leadingComments,n.length&&(e.leadingComments=n),r.length&&(e.trailingComments=[...r,...e.trailingComments??[]]);return}for(let s=this._newComments.length-1;s>=0;s--){let a=this._newComments[s];e.range[0]>=a.range[0]&&(n.unshift(a),this._newComments.splice(s,1))}n.length&&(e.leadingComments=n)}attachComments(e){if(wi(e)&&e.body.length>0){let t=this._nodeStack.at(-1);if(t){t.trailingComments=[...t.trailingComments??[],...this._newComments],this._newComments.length=0,this._nodeStack.pop();return}e.trailingComments=[...this._newComments],this._newComments.length=0;return}this.attachTrailingComments(e),this.attachLeadingComments(e),this.insertInnerComments(e),this._nodeStack.push(e)}collectComment(e){this.comments.push(e),this._newComments.push(e)}},ki=/\$\{(.*?)\}/gu;function Ue(i,e){let t=ze[i];return e?t.replace(ki,(n,r)=>e[r]?.toString()??""):t}var _e=class{constructor(e=!1){this.tolerant=e,this.errors=[]}recordError(e){this.errors.push(e)}tolerate(e){if(this.tolerant)this.recordError(e);else throw e}throwError(e){throw e.description??=Ue(e.code,e.data),new $(e)}tolerateError(e){e.description??=Ue(e.code,e.data);let t=new $(e);if(this.tolerant)this.recordError(t);else throw t}};function si(i,e){if(!i)throw new Error(`ASSERT: ${e}`)}var ai={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/u,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC5F\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/u},D={fromCodePoint(i){return i<65536?String.fromCharCode(i):String.fromCharCode(55296+(i-65536>>10))+String.fromCharCode(56320+(i-65536&1023))},isWhiteSpace(i){return i===32||i===9||i===11||i===12||i===160||i>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(i)},isLineTerminator(i){return i===10||i===13||i===8232||i===8233},isIdentifierStart(i){return i===36||i===95||i>=65&&i<=90||i>=97&&i<=122||i===92||i>=128&&ai.NonAsciiIdentifierStart.test(D.fromCodePoint(i))},isIdentifierPart(i){return i===36||i===95||i>=65&&i<=90||i>=97&&i<=122||i>=48&&i<=57||i===92||i>=128&&ai.NonAsciiIdentifierPart.test(D.fromCodePoint(i))},isDecimalDigit(i){return i>=48&&i<=57},isHexDigit(i){return i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102},isOctalDigit(i){return i>=48&&i<=55}};function ui(i){return"0123456789abcdef".indexOf(i.toLowerCase())}function Te(i){return"01234567".indexOf(i)}var N=[[],[],[]];Pe.forEach(i=>N[i.length-1].push(i));di.forEach(i=>N[i.length-1].push(i));pi.forEach(i=>N[i.length-1].push(i));hi.forEach(i=>N[i.length-1].push(i));Si.forEach(i=>N[i.length-1].push(i));N[T.length-1].push(T);var je=class{constructor(e,t){this.source=e,this.errorHandler=t,this._length=e.length,this.index=0,this.lineNumber=1,this.lineStart=0,this.curlyStack=[]}saveState(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart,curlyStack:this.curlyStack.slice()}}restoreState(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart,this.curlyStack=e.curlyStack}eof(){return this.index>=this._length}throwUnexpectedToken(e=d.UnexpectedToken){this.errorHandler.throwError({code:e,index:this.index,line:this.lineNumber,column:this.index-this.lineStart+1,data:{value:this.source.charAt(this.index)}})}tolerateUnexpectedToken(e=d.UnexpectedToken){this.errorHandler.tolerateError({code:e,index:this.index,line:this.lineNumber,column:this.index-this.lineStart+1})}skipSingleLineComment(e){let t=[],n=this.index-e,r={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{line:0,column:0}};for(;!this.eof();){let a=this.source.charCodeAt(this.index);if(this.index+=1,D.isLineTerminator(a)){r.end={line:this.lineNumber,column:this.index-this.lineStart-1};let c={multiLine:!1,start:n+e,end:this.index-1,range:[n,this.index-1],loc:r};return t.push(c),a===13&&this.source.charCodeAt(this.index)===10&&(this.index+=1),this.lineNumber+=1,this.lineStart=this.index,t}}r.end={line:this.lineNumber,column:this.index-this.lineStart};let s={multiLine:!1,start:n+e,end:this.index,range:[n,this.index],loc:r};return t.push(s),t}skipMultiLineComment(){let e=[],t=this.index-2,n={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{line:0,column:0}};for(;!this.eof();){let s=this.source.charCodeAt(this.index);if(D.isLineTerminator(s))s===13&&this.source.charCodeAt(this.index+1)===10&&(this.index+=1),this.lineNumber+=1,this.index+=1,this.lineStart=this.index;else if(s===42){if(this.source.charCodeAt(this.index+1)===47){this.index+=2,n.end={line:this.lineNumber,column:this.index-this.lineStart};let a={multiLine:!0,start:t+2,end:this.index-2,range:[t,this.index],loc:n};return e.push(a),e}this.index+=1}else this.index+=1}n.end={line:this.lineNumber,column:this.index-this.lineStart};let r={multiLine:!0,start:t+2,end:this.index,range:[t,this.index],loc:n};return e.push(r),this.tolerateUnexpectedToken(),e}scanComments(){let e=[];for(;!this.eof();){let t=this.source.charCodeAt(this.index);if(D.isWhiteSpace(t))this.index+=1;else if(D.isLineTerminator(t))this.index+=1,t===13&&this.source.charCodeAt(this.index)===10&&(this.index+=1),this.lineNumber+=1,this.lineStart=this.index;else if(t===47)if(t=this.source.charCodeAt(this.index+1),t===47){this.index+=2;let n=this.skipSingleLineComment(2);e=[...e,...n]}else if(t===42){this.index+=2;let n=this.skipMultiLineComment();e=[...e,...n]}else break;else break}return e}isKeyword(e){switch(e=e.toLowerCase(),e.length){case 2:return e===m.If||e===m.In;case 3:return e===m.Var||e===m.For;case 4:return e===m.Else;case 5:return e===m.Break||e===m.While;case 6:return e===m.Return||e===m.Import||e===m.Export;case 8:return e===m.Function||e===m.Continue;default:return!1}}codePointAt(e){let t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){let n=this.source.charCodeAt(e+1);n>=56320&&n<=57343&&(t=(t-55296)*1024+n-56320+65536)}return t}scanHexEscape(e){let t=e==="u"?4:2,n=0;for(let r=0;r<t;r++)if(!this.eof()&&D.isHexDigit(this.source.charCodeAt(this.index)))n=n*16+ui(this.source[this.index]??""),this.index+=1;else return null;return String.fromCharCode(n)}scanUnicodeCodePointEscape(){let e=this.source[this.index],t=0;for(e==="}"&&this.throwUnexpectedToken();!this.eof()&&(e=this.source[this.index]??"",this.index+=1,!!D.isHexDigit(e.charCodeAt(0)));)t=t*16+ui(e);return(t>1114111||e!=="}")&&this.throwUnexpectedToken(),D.fromCodePoint(t)}getIdentifier(){let e=this.index;for(this.index+=1;!this.eof();){let t=this.source.charCodeAt(this.index);if(t===92)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(D.isIdentifierPart(t))this.index+=1;else break}return this.source.slice(e,this.index)}getComplexIdentifier(){let e=this.codePointAt(this.index),t=D.fromCodePoint(e);this.index+=t.length;let n;for(e===92&&(this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),this.index+=1,this.source[this.index]==="{"?(this.index+=1,n=this.scanUnicodeCodePointEscape()):(n=this.scanHexEscape("u"),(n===null||n==="\\"||!D.isIdentifierStart(n.charCodeAt(0)))&&this.throwUnexpectedToken()),t=n);!this.eof()&&(e=this.codePointAt(this.index),!!D.isIdentifierPart(e));)n=D.fromCodePoint(e),t+=n,this.index+=n.length,e===92&&(t=t.substring(0,t.length-1),this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),this.index+=1,this.source[this.index]==="{"?(this.index+=1,n=this.scanUnicodeCodePointEscape()):(n=this.scanHexEscape("u"),(n===null||n==="\\"||!D.isIdentifierPart(n.charCodeAt(0)))&&this.throwUnexpectedToken()),t+=n);return t}octalToDecimal(e){let t=e!=="0",n=Te(e);return!this.eof()&&D.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=n*8+Te(this.source[this.index]??""),this.index+=1,"0123".includes(e)&&!this.eof()&&D.isOctalDigit(this.source.charCodeAt(this.index))&&(n=n*8+Te(this.source[this.index]??""),this.index+=1)),{code:n,octal:t}}scanIdentifier(){let e,t=this.index,n=this.source.charCodeAt(t)===92?this.getComplexIdentifier():this.getIdentifier();if(n.length===1?e=h.Identifier:this.isKeyword(n)?e=h.Keyword:n.toLowerCase()===V.Null?e=h.NullLiteral:n.toLowerCase()===V.True||n.toLowerCase()===V.False?e=h.BooleanLiteral:e=h.Identifier,e!==h.Identifier&&t+n.length!==this.index){let r=this.index;this.index=t,this.tolerateUnexpectedToken(d.InvalidEscapedReservedWord),this.index=r}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanPunctuator(){let e=this.index,t=this.source[this.index]??"";switch(t){case"(":case"{":t==="{"&&this.curlyStack.push("{"),this.index+=1;break;case".":this.index+=1;break;case"}":this.index+=1,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"~":this.index+=1;break;default:for(let n=N.length;n>0;n--)if(t=this.source.substring(this.index,this.index+n),N[n-1]?.includes(t)){this.index+=n;break}}return this.index===e&&this.throwUnexpectedToken(),{type:h.Punctuator,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}scanHexLiteral(e){let t="";for(;!this.eof()&&D.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index],this.index+=1;return t.length===0&&this.throwUnexpectedToken(),D.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:h.NumericLiteral,value:Number.parseInt(`0x${t}`,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}scanBinaryLiteral(e){let t="";for(;!this.eof();){let n=this.source[this.index];if(n!=="0"&&n!=="1")break;t+=this.source[this.index],this.index+=1}if(t.length===0&&this.throwUnexpectedToken(),!this.eof()){let n=this.source.charCodeAt(this.index);(D.isIdentifierStart(n)||D.isDecimalDigit(n))&&this.throwUnexpectedToken()}return{type:h.NumericLiteral,value:Number.parseInt(t,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}scanOctalLiteral(e,t){let n="",r=!1;for(D.isOctalDigit(e.charCodeAt(0))&&(r=!0,n=`0${this.source[this.index]}`),this.index+=1;!this.eof()&&D.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index],this.index+=1;return!r&&n.length===0&&this.throwUnexpectedToken(),(D.isIdentifierStart(this.source.charCodeAt(this.index))||D.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:h.NumericLiteral,value:Number.parseInt(n,8),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanNumericLiteral(){let e=this.index,t=this.source[e]??"";si(D.isDecimalDigit(t.charCodeAt(0))||t===".","Numeric literal must start with a decimal digit or a decimal point");let n="";if(t!=="."){if(n=this.source[this.index]??"",this.index+=1,t=this.source[this.index]??"",n==="0"){if(t==="x"||t==="X")return this.index+=1,this.scanHexLiteral(e);if(t==="b"||t==="B")return this.index+=1,this.scanBinaryLiteral(e);if(t==="o"||t==="O")return this.scanOctalLiteral(t,e)}for(;D.isDecimalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index],this.index+=1;t=this.source[this.index]??""}if(t==="."){for(n+=this.source[this.index],this.index+=1;D.isDecimalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index],this.index+=1;t=this.source[this.index]??""}if(t==="e"||t==="E")if(n+=this.source[this.index],this.index+=1,t=this.source[this.index]??"",(t==="+"||t==="-")&&(n+=this.source[this.index],this.index+=1),D.isDecimalDigit(this.source.charCodeAt(this.index)))for(;D.isDecimalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index],this.index+=1;else this.throwUnexpectedToken();return D.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:h.NumericLiteral,value:Number.parseFloat(n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}scanStringLiteral(){let e=this.index,t=this.source[e];si(t==="'"||t==='"',"String literal must starts with a quote"),this.index+=1;let n=!1,r="";for(;!this.eof();){let s=this.source[this.index]??"";if(this.index+=1,s===t){t="";break}if(s==="\\")if(s=this.source[this.index]??"",this.index+=1,!s||!D.isLineTerminator(s.charCodeAt(0)))switch(s){case"u":if(this.source[this.index]==="{")this.index+=1,r+=this.scanUnicodeCodePointEscape();else{let a=this.scanHexEscape(s);a===null&&this.throwUnexpectedToken(),r+=a}break;case"x":{let a=this.scanHexEscape(s);a===null&&this.throwUnexpectedToken(d.InvalidHexEscapeSequence),r+=a;break}case"n":r+=`
|
|
5
|
+
`;break;case"r":r+="\r";break;case"t":r+=" ";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;case"8":case"9":r+=s,this.tolerateUnexpectedToken();break;default:if(s&&D.isOctalDigit(s.charCodeAt(0))){let a=this.octalToDecimal(s);n=a.octal||n,r+=String.fromCharCode(a.code)}else r+=s;break}else this.lineNumber+=1,s==="\r"&&this.source[this.index]===`
|
|
6
|
+
`&&(this.index+=1),this.lineStart=this.index;else{if(D.isLineTerminator(s.charCodeAt(0)))break;r+=s}}return t!==""&&(this.index=e,this.throwUnexpectedToken()),{type:h.StringLiteral,value:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}scanTemplate(){let e="",t=!1,n=this.index,r=this.source[n]==="`",s=!1,a=2;for(this.index+=1;!this.eof();){let c=this.source[this.index]??"";if(this.index+=1,c==="`"){a=1,s=!0,t=!0;break}if(c==="$"){if(this.source[this.index]==="{"){this.curlyStack.push("${"),this.index+=1,t=!0;break}e+=c;continue}if(c==="\\"){if(c=this.source[this.index]??"",this.index+=1,D.isLineTerminator(c.charCodeAt(0)))this.lineNumber+=1,c==="\r"&&this.source[this.index]===`
|
|
7
|
+
`&&(this.index+=1),this.lineStart=this.index;else switch(c){case"n":e+=`
|
|
8
|
+
`;break;case"r":e+="\r";break;case"t":e+=" ";break;case"u":if(this.source[this.index]==="{")this.index+=1,e+=this.scanUnicodeCodePointEscape();else{let l=this.index,f=this.scanHexEscape(c);f!==null?e+=f:(this.index=l,e+=c)}break;case"x":{let l=this.scanHexEscape(c);l===null&&this.throwUnexpectedToken(d.InvalidHexEscapeSequence),e+=l;break}case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:c==="0"?(D.isDecimalDigit(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(d.TemplateOctalLiteral),e+="\0"):D.isOctalDigit(c.charCodeAt(0))?this.throwUnexpectedToken(d.TemplateOctalLiteral):e+=c;break}continue}if(D.isLineTerminator(c.charCodeAt(0))){this.lineNumber+=1,c==="\r"&&this.source[this.index]===`
|
|
9
|
+
`&&(this.index+=1),this.lineStart=this.index,e+=`
|
|
10
|
+
`;continue}e+=c}return t||this.throwUnexpectedToken(),r||this.curlyStack.pop(),{type:h.Template,value:this.source.slice(n+1,this.index-a),cooked:e,head:r,tail:s,lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}lex(){if(this.eof())return{type:h.EOF,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};let e=this.source.charCodeAt(this.index);return D.isIdentifierStart(e)?this.scanIdentifier():e===40||e===41||e===59?this.scanPunctuator():e===39||e===34?this.scanStringLiteral():e===46?D.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():D.isDecimalDigit(e)?this.scanNumericLiteral():e===96||e===125&&this.curlyStack[this.curlyStack.length-1]==="${"?this.scanTemplate():e>=55296&&e<57343&&D.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()}},w={None:0,Function:1,IfClause:2,ForLoop:4,ForOfLoop:8,WhileLoop:16},Ne={AsObject:0,Automatic:1};function oi(i,e=0){let t=i.start-i.lineStart,n=i.lineNumber;return t<0&&(t+=e,n-=1),{index:i.start,line:n,column:t}}function ci(i){return[{index:i.range[0],...i.loc.start},{index:i.range[1],...i.loc.end}]}function li(i){return i in G?G[i]:0}var Oe=class{constructor(e,t={},n){this.delegate=n,this.hasLineTerminator=!1,this.options={tokens:typeof t.tokens=="boolean"&&t.tokens,comments:typeof t.comments=="boolean"&&t.comments,tolerant:typeof t.tolerant=="boolean"&&t.tolerant},this.options.comments&&(this.commentHandler=new Me),this.errorHandler=new _e(this.options.tolerant),this.scanner=new je(e,this.errorHandler),this.context={isAssignmentTarget:!1,blockContext:w.None,curlyParsingType:Ne.AsObject},this.rawToken={type:h.EOF,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.endMarker={index:0,line:this.scanner.lineNumber,column:0},this.readNextRawToken(),this.endMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}throwIfInvalidType(e,t,{validTypes:n,invalidTypes:r}){n?.some(s=>e.type===s)||r?.some(s=>e.type===s)&&this.throwError(d.InvalidExpression,t)}throwError(e,t,n=this.endMarker){let{index:r,line:s,column:a}=t,c=n.index-r-1;this.errorHandler.throwError({code:e,index:r,line:s,column:a+1,len:c})}tolerateError(e,t){throw new Error("######################################### !!!")}unexpectedTokenError(e={}){let{rawToken:t}=e,{code:n,data:r}=e,s;if(t){if(!n)switch(t.type){case h.EOF:n=d.UnexpectedEndOfScript;break;case h.Identifier:n=d.UnexpectedIdentifier;break;case h.NumericLiteral:n=d.UnexpectedNumber;break;case h.StringLiteral:n=d.UnexpectedString;break;case h.Template:n=d.UnexpectedTemplate;break}s=t.value.toString()}else s="ILLEGAL";n??=d.UnexpectedToken,r??={value:s};let a=Ue(n,r);if(t){let f=t.start,x=t.lineNumber,E=t.start-t.lineStart+1;return new $({code:n,index:f,line:x,column:E,len:t.end-t.start-1,data:r,description:a})}let{index:c,line:l}=this.endMarker;return new $({code:n,index:c,line:l,column:this.endMarker.column+1,data:r,description:a})}throwUnexpectedToken(e={}){throw e.rawToken??=this.rawToken,this.unexpectedTokenError(e)}collectComments(e){let{commentHandler:t}=this;!t||!e.length||e.forEach(n=>{let r={type:n.multiLine?u.BlockComment:u.LineComment,value:this.getSourceValue(n),range:n.range,loc:n.loc};t.collectComment(r)})}peekAhead(e){let t=()=>(this.scanner.scanComments(),this.scanner.lex()),n=this.scanner.saveState(),r=e.call(this,t);return this.scanner.restoreState(n),r}getSourceValue(e){return this.scanner.source.slice(e.start,e.end)}convertToToken(e){return{type:Bi[e.type],value:this.getSourceValue(e),range:[e.start,e.end],loc:{start:{line:this.startMarker.line,column:this.startMarker.column},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}}}readNextRawToken(){this.endMarker.index=this.scanner.index,this.endMarker.line=this.scanner.lineNumber,this.endMarker.column=this.scanner.index-this.scanner.lineStart;let e=this.rawToken;this.collectComments(this.scanner.scanComments()),this.scanner.index!==this.startMarker.index&&(this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart),this.rawToken=this.scanner.lex(),this.hasLineTerminator=e.lineNumber!==this.rawToken.lineNumber,this.options.tokens&&this.rawToken.type!==h.EOF&&this.tokens.push(this.convertToToken(this.rawToken))}captureStartMarker(){return{index:this.startMarker.index,line:this.startMarker.line,column:this.startMarker.column}}getItemLocation(e){return{range:[e.index,this.endMarker.index],loc:{start:{line:e.line,column:e.column},end:{line:this.endMarker.line,column:this.endMarker.column}}}}finalize(e){return(this.delegate??this.commentHandler)&&(this.commentHandler?.attachComments(e),this.delegate?.(e)),e}expectPunctuator(e){let t=this.rawToken;if(this.matchPunctuator(e)){this.readNextRawToken();return}this.throwUnexpectedToken({rawToken:t,code:d.PunctuatorExpected,data:{value:e}})}expectKeyword(e){if(this.rawToken.type===h.Keyword&&this.rawToken.value.toLowerCase()===e.toString()){this.readNextRawToken();return}this.throwUnexpectedToken({rawToken:this.rawToken})}expectContextualKeyword(e){if(this.rawToken.type===h.Identifier&&this.rawToken.value.toLowerCase()===e){this.readNextRawToken();return}this.throwUnexpectedToken({rawToken:this.rawToken})}matchKeyword(e){return this.rawToken.type===h.Keyword&&this.rawToken.value.toLowerCase()===e}matchContextualKeyword(e){return this.rawToken.type===h.Identifier&&this.rawToken.value===e}matchPunctuator(e){return this.rawToken.type===h.Punctuator&&this.rawToken.value===e}getMatchingPunctuator(e){if(typeof e=="string"&&(e=e.split("")),!(this.rawToken.type!==h.Punctuator||!e.length))return e.find(this.matchPunctuator.bind(this))}isolateCoverGrammar(e){let t=this.context.isAssignmentTarget;this.context.isAssignmentTarget=!0;let n=e.call(this);return this.context.isAssignmentTarget=t,n}inheritCoverGrammar(e){let t=this.context.isAssignmentTarget;this.context.isAssignmentTarget=!0;let n=e.call(this);return this.context.isAssignmentTarget&&=t,n}withBlockContext(e,t){let n=this.context.blockContext;this.context.blockContext|=e;let r=this.context.curlyParsingType;this.context.curlyParsingType=Ne.Automatic;let s=t.call(this);return this.context.blockContext=n,this.context.curlyParsingType=r,s}consumeSemicolon(){if(this.matchPunctuator(";")){this.readNextRawToken();return}if(!this.hasLineTerminator){if(this.rawToken.type===h.EOF||this.matchPunctuator("}")){this.endMarker.index=this.startMarker.index,this.endMarker.line=this.startMarker.line,this.endMarker.column=this.startMarker.column;return}this.throwUnexpectedToken({rawToken:this.rawToken})}}parsePrimaryExpression(){let e=this.captureStartMarker(),t=this.rawToken;switch(t.type){case h.Identifier:return this.readNextRawToken(),this.finalize({type:u.Identifier,name:t.value,...this.getItemLocation(e)});case h.NumericLiteral:case h.StringLiteral:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:u.Literal,value:t.value,raw:this.getSourceValue(t),isString:typeof t.value=="string",...this.getItemLocation(e)});case h.BooleanLiteral:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:u.Literal,value:t.value.toLowerCase()===V.True,raw:this.getSourceValue(t),isString:!1,...this.getItemLocation(e)});case h.NullLiteral:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:u.Literal,value:null,raw:this.getSourceValue(t),isString:!1,...this.getItemLocation(e)});case h.Template:return this.parseTemplateLiteral();case h.Punctuator:switch(t.value){case"(":return this.inheritCoverGrammar(this.parseGroupExpression.bind(this));case"[":return this.inheritCoverGrammar(this.parseArrayInitializer.bind(this));case"{":return this.inheritCoverGrammar(this.parseObjectExpression.bind(this));default:return this.throwUnexpectedToken({rawToken:this.rawToken})}case h.Keyword:return this.context.isAssignmentTarget=!1,this.throwUnexpectedToken({rawToken:this.rawToken});default:return this.throwUnexpectedToken({rawToken:this.rawToken})}}parseArrayInitializer(){let e=this.captureStartMarker();this.expectPunctuator("[");let t=[];for(;!this.matchPunctuator("]");){let n=this.captureStartMarker();this.matchPunctuator(",")?(this.readNextRawToken(),this.throwError(d.InvalidExpression,n)):(t.push(this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this))),this.matchPunctuator("]")||this.expectPunctuator(","))}return this.expectPunctuator("]"),this.finalize({type:u.ArrayExpression,elements:t,...this.getItemLocation(e)})}parseObjectPropertyKey(){let e=this.captureStartMarker(),t=this.rawToken;switch(t.type){case h.StringLiteral:return this.readNextRawToken(),this.finalize({type:u.Literal,value:t.value,raw:this.getSourceValue(t),isString:!0,...this.getItemLocation(e)});case h.Identifier:case h.BooleanLiteral:case h.NullLiteral:case h.Keyword:return this.readNextRawToken(),this.finalize({type:u.Identifier,name:t.value,...this.getItemLocation(e)});default:this.throwError(d.KeyMustBeString,e)}}parseObjectProperty(){let e=this.rawToken,t=this.captureStartMarker(),n=this.parseObjectPropertyKey(),r=!1,s=null;return this.matchPunctuator(":")?(this.readNextRawToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this))):e.type===h.Identifier?(r=!0,s=this.finalize({type:u.Identifier,name:e.value,...this.getItemLocation(t)})):this.throwUnexpectedToken({rawToken:this.rawToken}),this.finalize({type:u.Property,kind:"init",key:n,value:s,shorthand:r,...this.getItemLocation(t)})}parseObjectExpression(){let e=this.captureStartMarker();this.expectPunctuator("{");let t=[];for(;!this.matchPunctuator("}");)t.push(this.parseObjectProperty()),this.matchPunctuator("}")||this.expectPunctuator(",");return this.expectPunctuator("}"),this.finalize({type:u.ObjectExpression,properties:t,...this.getItemLocation(e)})}parseTemplateElement(e=!1){let t=this.rawToken;t.type!==h.Template&&this.throwUnexpectedToken({rawToken:t}),e&&!t.head&&this.throwUnexpectedToken({code:d.InvalidTemplateHead,rawToken:t});let n=this.captureStartMarker();this.readNextRawToken();let{value:r,cooked:s,tail:a}=t,c=this.finalize({type:u.TemplateElement,value:{raw:r,cooked:s},tail:a,...this.getItemLocation(n)});return c.loc.start.column+=1,c.loc.end.column-=a?1:2,c}parseTemplateLiteral(){let e=this.captureStartMarker(),t=[],n=[],r=this.parseTemplateElement(!0);for(n.push(r);!r.tail;)t.push(this.parseExpression()),r=this.parseTemplateElement(),n.push(r);return this.finalize({type:u.TemplateLiteral,quasis:n,expressions:t,...this.getItemLocation(e)})}parseGroupExpression(){this.expectPunctuator("(");let e=this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this));return this.expectPunctuator(")"),e}parseArguments(){this.expectPunctuator("(");let e=[];if(!this.matchPunctuator(")"))for(;;){let t=this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this));if(e.push(t),this.matchPunctuator(")")||(this.expectPunctuator(","),this.matchPunctuator(")")))break}return this.expectPunctuator(")"),e}parseMemberName(){let e=this.rawToken,t=this.captureStartMarker();return this.readNextRawToken(),e.type!==h.NullLiteral&&e.type!==h.Identifier&&e.type!==h.Keyword&&e.type!==h.BooleanLiteral&&this.throwUnexpectedToken({rawToken:e}),this.finalize({type:u.Identifier,name:e.value,...this.getItemLocation(t)})}parseLeftHandSideExpression(){let e=this.captureStartMarker(),t=this.inheritCoverGrammar(this.parsePrimaryExpression.bind(this)),n=!1,r;for(;r=this.getMatchingPunctuator(["(","[",".",T]);){let s=!1;switch(r===T&&(n=!0,s=!0,this.expectPunctuator(T),this.getMatchingPunctuator("[")?r="[":r="."),r){case"(":{this.context.isAssignmentTarget=!1;let a=this.parseArguments();t=this.finalize({type:u.CallExpression,callee:t,arguments:a,...this.getItemLocation(e)});continue}case"[":{this.context.isAssignmentTarget=!s,this.expectPunctuator("[");let a=this.isolateCoverGrammar(()=>this.parseExpression());this.expectPunctuator("]"),t=this.finalize({type:s?u.SafeMemberExpression:u.MemberExpression,computed:!0,object:t,property:a,...this.getItemLocation(e)});continue}case".":{this.context.isAssignmentTarget=!s,s||this.expectPunctuator(".");let a=this.parseMemberName();t=this.finalize({type:s?u.SafeMemberExpression:u.MemberExpression,computed:!1,object:t,property:a,...this.getItemLocation(e)});continue}}}return n?this.finalize({type:u.MemberAccessChainExpression,expression:t,...this.getItemLocation(e)}):t}parseUpdateExpression(){let e=this.captureStartMarker(),t=this.getMatchingPunctuator(Pe);if(t){this.readNextRawToken();let a=this.captureStartMarker(),c=this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));return c.type!==u.Identifier&&c.type!==u.MemberExpression&&c.type!==u.CallExpression&&this.throwError(d.InvalidExpression,a),this.context.isAssignmentTarget||this.tolerateError(d.InvalidLeftHandSideInAssignment,e),this.context.isAssignmentTarget=!1,this.finalize({type:u.UpdateExpression,operator:t,argument:c,prefix:!0,...this.getItemLocation(e)})}let n=this.captureStartMarker(),r=this.inheritCoverGrammar(this.parseLeftHandSideExpression.bind(this)),s=this.captureStartMarker();return this.hasLineTerminator||(t=this.getMatchingPunctuator(Pe),!t)?r:(r.type!==u.Identifier&&r.type!==u.MemberExpression&&this.throwError(d.InvalidExpression,n,s),this.context.isAssignmentTarget||this.tolerateError(d.InvalidLeftHandSideInAssignment,e),this.readNextRawToken(),this.context.isAssignmentTarget=!1,this.finalize({type:u.UpdateExpression,operator:t,argument:r,prefix:!1,...this.getItemLocation(e)}))}parseUnaryExpression(){let e=this.getMatchingPunctuator(di);if(e){let t=this.captureStartMarker();this.readNextRawToken();let n=this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));return this.context.isAssignmentTarget=!1,this.finalize({type:u.UnaryExpression,operator:e,argument:n,prefix:!0,...this.getItemLocation(t)})}return this.parseUpdateExpression()}parseBinaryExpression(){let e=this.rawToken,t=this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));if(this.rawToken.type!==h.Punctuator)return t;let n=this.rawToken.value,r=li(n);if(r===0)return t;this.readNextRawToken(),this.context.isAssignmentTarget=!1;let s=[e,this.rawToken],a=t,c=this.inheritCoverGrammar(this.parseUnaryExpression.bind(this)),l=[a,n,c],f=[r];for(;this.rawToken.type===h.Punctuator&&(r=li(this.rawToken.value))>0;){for(;l.length>2&&r<=f[f.length-1];){c=l.pop();let F=l.pop();f.pop(),a=l.pop(),s.pop();let g=s[s.length-1],P=oi(g,g.lineStart);l.push(this.finalize(this.createBinaryOrLogicalExpression(P,F,a,c)))}l.push(this.rawToken.value),f.push(r),s.push(this.rawToken),this.readNextRawToken(),l.push(this.inheritCoverGrammar(this.parseUnaryExpression.bind(this)))}let x=l.length-1;t=l[x];let E=s.pop();for(;x>1;){let F=s.pop();if(!F)break;let g=E?.lineStart,P=oi(F,g),me=l[x-1];t=this.finalize(this.createBinaryOrLogicalExpression(P,me,l[x-2],t)),x-=2,E=F}return t}createBinaryOrLogicalExpression(e,t,n,r){return pi.includes(t)?((n.type===u.AssignmentExpression||n.type===u.UpdateExpression)&&this.throwError(d.InvalidExpression,...ci(n)),(r.type===u.AssignmentExpression||r.type===u.UpdateExpression)&&this.throwError(d.InvalidExpression,...ci(n)),{type:u.LogicalExpression,operator:t,left:n,right:r,...this.getItemLocation(e)}):{type:u.BinaryExpression,operator:t,left:n,right:r,...this.getItemLocation(e)}}parseAssignmentExpression(){let e=this.captureStartMarker(),t=this.inheritCoverGrammar(this.parseBinaryExpression.bind(this)),n=this.captureStartMarker(),r=this.getMatchingPunctuator(hi);if(!r)return t;t.type!==u.Identifier&&t.type!==u.MemberExpression&&this.throwError(d.InvalidExpression,e,n),this.context.isAssignmentTarget||this.tolerateError(d.InvalidLeftHandSideInAssignment,e),this.matchPunctuator("=")||(this.context.isAssignmentTarget=!1),this.readNextRawToken();let s=this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this));return this.finalize({type:u.AssignmentExpression,left:t,operator:r,right:s,...this.getItemLocation(e)})}parseExpression(){return this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this))}parseStatements(e){let t=[];for(;this.rawToken.type!==h.EOF&&!this.matchPunctuator(e);){let n=this.parseStatementListItem();Ve(n)||t.push(n)}return t}parseStatementListItem(){return this.context.isAssignmentTarget=!0,this.matchKeyword(m.Function)?this.parseFunctionDeclaration():this.matchKeyword(m.Export)?this.parseExportDeclaration():this.matchKeyword(m.Import)?this.parseImportDeclaration():this.parseStatement()}parseBlock(){let e=this.captureStartMarker();this.expectPunctuator("{");let t=this.parseStatements("}");return this.expectPunctuator("}"),this.finalize({type:u.BlockStatement,body:t,...this.getItemLocation(e)})}parseObjectStatement(){let e=this.captureStartMarker(),t=this.parseObjectExpression();return this.finalize({type:u.ExpressionStatement,expression:t,...this.getItemLocation(e)})}parseBlockOrObjectStatement(){return this.context.curlyParsingType===Ne.AsObject?this.parseObjectStatement():this.peekAhead(e=>{let t=e();return!(t.type!==h.Identifier&&t.type!==h.StringLiteral||(t=e(),t.type!==h.Punctuator||t.value!==":"))})?this.parseObjectStatement():this.parseBlock()}parseIdentifier(){let e=this.rawToken;if(e.type!==h.Identifier)return null;let t=this.captureStartMarker();return this.readNextRawToken(),this.finalize({type:u.Identifier,name:e.value,...this.getItemLocation(t)})}parseVariableDeclarator(){let e=this.captureStartMarker(),t=this.parseIdentifier();t||this.throwUnexpectedToken({code:d.IdentifierExpected});let n=null;if(this.matchPunctuator("=")){this.readNextRawToken();let r=this.rawToken;try{n=this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this))}catch{this.throwUnexpectedToken({rawToken:r,code:d.InvalidVariableAssignment})}}return this.finalize({type:u.VariableDeclarator,id:t,init:n,...this.getItemLocation(e)})}parseVariableDeclarators(){let e=[this.parseVariableDeclarator()];for(;this.matchPunctuator(",");)this.readNextRawToken(),e.push(this.parseVariableDeclarator());return e}parseVariableDeclaration(){let e=this.captureStartMarker();this.expectKeyword(m.Var);let t=this.parseVariableDeclarators();return this.consumeSemicolon(),this.finalize({type:u.VariableDeclaration,declarations:t,kind:"var",...this.getItemLocation(e)})}parseEmptyStatement(){let e=this.captureStartMarker();return this.expectPunctuator(";"),this.finalize({type:u.EmptyStatement,...this.getItemLocation(e)})}parseExpressionStatement(){let e=this.captureStartMarker(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize({type:u.ExpressionStatement,expression:t,...this.getItemLocation(e)})}parseIfClause(){return this.withBlockContext(w.IfClause,this.parseStatement.bind(this))}parseIfStatement(){let e=this.captureStartMarker();this.expectKeyword(m.If),this.expectPunctuator("(");let t=this.captureStartMarker(),n=this.parseExpression(),r=this.captureStartMarker();this.expectPunctuator(")"),(n.type===u.AssignmentExpression||n.type===u.UpdateExpression)&&this.throwError(d.InvalidExpression,t,r);let s=this.parseIfClause(),a=null;return this.matchKeyword(m.Else)&&(this.readNextRawToken(),a=this.parseIfClause()),this.finalize({type:u.IfStatement,test:n,consequent:s,alternate:a,...this.getItemLocation(e)})}parseWhileStatement(){let e=this.captureStartMarker();this.expectKeyword(m.While),this.expectPunctuator("(");let t=this.captureStartMarker(),n=this.parseExpression(),r=this.captureStartMarker();this.expectPunctuator(")"),(n.type===u.AssignmentExpression||n.type===u.UpdateExpression)&&this.throwError(d.InvalidExpression,t,r);let s=this.withBlockContext(w.WhileLoop,this.parseStatement.bind(this));return this.finalize({type:u.WhileStatement,test:n,body:s,...this.getItemLocation(e)})}parseForStatement(){let e=u.ForStatement,t=null,n=null,r=null,s=null,a=null,c=this.captureStartMarker();if(this.expectKeyword(m.For),this.expectPunctuator("("),this.matchKeyword(m.Var)){let f=this.captureStartMarker();this.readNextRawToken();let x=this.parseVariableDeclarators();t=this.finalize({type:u.VariableDeclaration,declarations:x,kind:"var",...this.getItemLocation(f)});let E=this.matchKeyword(m.In),F=this.matchContextualKeyword(Le.Of);x.length===1&&(E||F)&&(x[0].init&&this.throwError(d.ForInOfLoopInitializer,f),e=E?u.ForInStatement:u.ForOfStatement,s=t)}else if(!this.matchPunctuator(";")){let f=this.context.isAssignmentTarget,x=this.captureStartMarker();t=this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this));let E=this.matchKeyword(m.In),F=this.matchContextualKeyword(Le.Of);E||F?(this.context.isAssignmentTarget||this.tolerateError(d.InvalidLeftHandSideInForIn,x),t.type!==u.Identifier&&this.throwError(d.InvalidLeftHandSideInForIn,x),e=E?u.ForInStatement:u.ForOfStatement,s=t):this.context.isAssignmentTarget=f}e===u.ForStatement?(this.expectPunctuator(";"),n=this.matchPunctuator(";")?null:this.isolateCoverGrammar(this.parseExpression.bind(this)),this.expectPunctuator(";"),r=this.matchPunctuator(")")?null:this.isolateCoverGrammar(this.parseExpression.bind(this))):(this.readNextRawToken(),a=this.parseExpression()),this.expectPunctuator(")");let l=this.withBlockContext(e===u.ForOfStatement?w.ForOfLoop:w.ForLoop,()=>this.isolateCoverGrammar(this.parseStatement.bind(this)));return e===u.ForInStatement||e===u.ForOfStatement?this.finalize({type:e,left:s,right:a,body:l,...this.getItemLocation(c)}):this.finalize({type:e,init:t,test:n,update:r,body:l,...this.getItemLocation(c)})}parseContinueStatement(){let e=this.captureStartMarker();return this.expectKeyword(m.Continue),this.consumeSemicolon(),this.finalize({type:u.ContinueStatement,...this.getItemLocation(e)})}parseBreakStatement(){let e=this.captureStartMarker();return this.expectKeyword(m.Break),this.consumeSemicolon(),this.finalize({type:u.BreakStatement,...this.getItemLocation(e)})}parseReturnStatement(){let e=this.captureStartMarker();this.expectKeyword(m.Return);let t=!this.matchPunctuator(";")&&!this.matchPunctuator("}")&&!this.hasLineTerminator&&this.rawToken.type!==h.EOF||this.rawToken.type===h.StringLiteral||this.rawToken.type===h.Template?this.parseExpression():null;return this.consumeSemicolon(),this.finalize({type:u.ReturnStatement,argument:t,...this.getItemLocation(e)})}parseStatement(){switch(this.rawToken.type){case h.BooleanLiteral:case h.NullLiteral:case h.NumericLiteral:case h.StringLiteral:case h.Template:case h.Identifier:return this.parseExpressionStatement();case h.Punctuator:return this.rawToken.value==="{"?this.parseBlockOrObjectStatement():this.rawToken.value==="("?this.parseExpressionStatement():this.rawToken.value===";"?this.parseEmptyStatement():this.parseExpressionStatement();case h.Keyword:switch(this.rawToken.value.toLowerCase()){case m.Break:return this.parseBreakStatement();case m.Continue:return this.parseContinueStatement();case m.For:return this.parseForStatement();case m.Function:return this.parseFunctionDeclaration();case m.If:return this.parseIfStatement();case m.Return:return this.parseReturnStatement();case m.Var:return this.parseVariableDeclaration();case m.While:return this.parseWhileStatement();default:return this.parseExpressionStatement()}default:return this.throwUnexpectedToken({rawToken:this.rawToken})}}parseFormalParameters(){let e=[];if(this.expectPunctuator("("),!this.matchPunctuator(")"))for(;this.rawToken.type!==h.EOF;){let t=this.parseIdentifier();if(t||this.throwUnexpectedToken({rawToken:this.rawToken,code:d.IdentifierExpected}),e.push(t),this.matchPunctuator(")")||(this.expectPunctuator(","),this.matchPunctuator(")")))break}return this.expectPunctuator(")"),e}parseFunctionDeclaration(){(this.context.blockContext&w.Function)===w.Function&&this.throwUnexpectedToken({code:d.NoFunctionInsideFunction}),((this.context.blockContext&w.WhileLoop)===w.WhileLoop||(this.context.blockContext&w.ForOfLoop)===w.ForOfLoop||(this.context.blockContext&w.IfClause)===w.IfClause)&&this.throwUnexpectedToken({code:d.NoFunctionInsideBlock});let e=this.captureStartMarker();this.expectKeyword(m.Function);let t=this.parseIdentifier();t||this.throwUnexpectedToken({code:d.InvalidFunctionIdentifier});let n=this.parseFormalParameters(),r=this.context.blockContext;this.context.blockContext|=w.Function;let s=this.parseBlock();return this.context.blockContext=r,this.finalize({type:u.FunctionDeclaration,id:t,params:n,body:s,...this.getItemLocation(e)})}parseScript(){let e=this.captureStartMarker(),t=this.parseStatements(),n=this.finalize({type:u.Program,body:t,...this.getItemLocation(e)});return this.options.tokens&&(n.tokens=this.tokens),this.options.tolerant&&(n.errors=this.errorHandler.errors),n}parseExportDeclaration(){this.context.blockContext!==w.None&&this.throwUnexpectedToken({code:d.ModuleExportRootOnly});let e=null,t=this.captureStartMarker();return this.expectKeyword(m.Export),this.matchKeyword(m.Var)?e=this.parseVariableDeclaration():this.matchKeyword("function")?e=this.parseFunctionDeclaration():this.throwUnexpectedToken({code:d.InvalidExpression}),this.finalize({type:u.ExportNamedDeclaration,declaration:e,specifiers:[],source:null,...this.getItemLocation(t)})}parseModuleSpecifier(){let e=this.captureStartMarker(),t=this.rawToken;if(t.type===h.StringLiteral)return this.readNextRawToken(),this.finalize({type:u.Literal,value:t.value,raw:this.getSourceValue(t),isString:!0,...this.getItemLocation(e)});this.throwError(d.InvalidModuleUri,e)}parseDefaultSpecifier(){let e=this.captureStartMarker(),t=this.parseIdentifier();return t||this.throwUnexpectedToken({code:d.IdentifierExpected}),this.finalize({type:u.ImportDefaultSpecifier,local:t,...this.getItemLocation(e)})}parseImportDeclaration(){this.context.blockContext!==w.None&&this.throwUnexpectedToken({code:d.ModuleImportRootOnly});let e=this.captureStartMarker();this.expectKeyword(m.Import);let t=this.parseDefaultSpecifier();this.expectContextualKeyword(Le.From);let n=this.parseModuleSpecifier();return this.finalize({type:u.ImportDeclaration,specifiers:[t],source:n,...this.getItemLocation(e)})}};function Ci(i,e,t){return new Oe(i,e,t).parseScript()}async function Zi(i,e){try{let t=await i,n=new Map,r=new Map,s=[],a=vi(e);return t.forEach(c=>{let l=[];c.items.forEach(f=>Ti(l,r,n,a,f)),l.length&&s.push({...c,items:l})}),{categories:s,functionDefinitions:n,constantDefinitions:r}}catch(t){return console.error(t),{categories:[],functionDefinitions:new Map,constantDefinitions:new Map}}}function vi(i){let{profile:{apiVersion:e,bundles:t,hiddenApiItems:n=[]}={}}=i,r=Ai(e),s=Array.isArray(t)&&t.length>0?new Set(["core",...t]):void 0;return a=>Pi(r,a.sinceVersion)&&(!s||s.has(a.bundle))&&!n.includes(a.name)}function Ti(i,e,t,n,r){if(Array.isArray(r)){r.forEach(s=>Fi(i,t,n,s));return}r.type==="constant"?Ni(i,e,n,r):Fi(i,t,n,r)}function Fi(i,e,t,n){if(!t(n))return;n.disableDocumentation||i.push(n);let{completion:{label:r}}=n,s=r.toLowerCase(),a=e.get(s);a||(a={type:"functionDefinition",key:s,overloads:[]},e.set(s,a)),a.overloads.push(n)}function Ni(i,e,t,n){if(!t(n))return;i.push(n);let{completion:{label:r}}=n,s=r.toLowerCase();e.set(s,n);let[a,c]=n.completion.label.split(".");if(!c)return;let l=a.toLowerCase(),f=e.get(l);f||(f={type:"namespace",key:l,members:[],completion:{label:a,detail:a,insertText:a,insertTextMode:B.adjustIndentation,insertTextFormat:S.PlainText,kind:b.Enum}},e.set(l,f));let x=structuredClone(n);x.name=c,x.completion.label=c,x.completion.insertText=c,x.completion.kind=b.Constant,f.members.push(x),f.completion.documentation=f.members.reduce((E,F)=>(E.value=`${E.value}${E.value?`
|
|
11
|
+
|
|
12
|
+
`:""}**${F.completion.label}**: ${F.description}`,E),{kind:H.Markdown,value:""})}function Ai(i){if(!i||typeof i!="string")return null;let e=i.split(".").map(r=>Number.parseInt(r));if(e.some(Number.isNaN))return console.error("Invalid API version string",i),null;let[t,n]=e.slice(0,2);return{major:t,minor:n}}function Pi(i,e){if(!i)return!0;let t=Ai(e);return t?i.major>t.major?!1:i.minor===void 0||t.minor===void 0?!0:t.minor<=i.minor:!0}var y={AlreadyDefined:"AlreadyDefined",ApiConflict:"ApiConflict",AssignedNeverUsed:"AssignedNeverUsed",DefinedNeverAssigned:"DefinedNeverAssigned",DefinedNeverUsed:"DefinedNeverUsed",EmptyBlockStatement:"EmptyBlockStatement",ExecutionError:"ExecutionError",InvalidApiFunctionUsage:"InvalidApiFunctionUsage",InvalidConstantIdentifier:"InvalidConstantIdentifier",InvalidPropertyIdentifier:"InvalidPropertyIdentifier",NoArgumentExpected:"NoArgumentExpected",NotADictionary:"NotADictionary",NotDefined:"NotDefined",NotEnoughArguments:"NotEnoughArguments",ProfileVariablesAreImmutable:"ProfileVariablesAreImmutable",ProfileVariablesConflict:"ProfileVariablesConflict",ReservedKeyword:"ReservedKeyword",TooManyArguments:"TooManyArguments",UnexpectedEmptyFunction:"UnexpectedEmptyFunction",UnexpectedPropertyIdentifier:"UnexpectedPropertyIdentifier",UnknownPropertyIdentifier:"UnknownPropertyIdentifier"},on={[y.AlreadyDefined]:"'${identifier}' is already defined.",[y.ApiConflict]:"'${identifier}' is already defined as an Arcade constant or function.",[y.AssignedNeverUsed]:"'${identifier}' is assigned but never used.",[y.DefinedNeverAssigned]:"'${identifier}' is defined but never assigned.",[y.DefinedNeverUsed]:"'${identifier}' is defined but never used.",[y.EmptyBlockStatement]:"Empty block statement.",[y.ExecutionError]:"Execution Error: '${stack}'",[y.InvalidApiFunctionUsage]:"Arcade function '${identifier}' not used in a call expression.",[y.InvalidConstantIdentifier]:"Invalid constant identifier, expecting ${list}.",[y.InvalidPropertyIdentifier]:"Invalid property identifier, expecting ${list}.",[y.NoArgumentExpected]:"Expecting no argument.",[y.NotADictionary]:"'${identifier}' doesn't have properties.",[y.NotDefined]:"'${identifier}' is not defined.",[y.NotEnoughArguments]:"Expecting at least ${min} argument(s).",[y.ProfileVariablesAreImmutable]:"Profile variables cannot be modified.",[y.ProfileVariablesConflict]:"'${identifier}' is already defined as a profile variable.",[y.ReservedKeyword]:"'${identifier}' is a reserved keyword.",[y.TooManyArguments]:"Too many arguments, expecting ${max}.",[y.UnexpectedEmptyFunction]:"Unexpected empty function '${identifier}'.",[y.UnexpectedPropertyIdentifier]:"Unexpected property identifier.",[y.UnknownPropertyIdentifier]:"Unknown property identifier '${identifier}'.",...ze};function de(i,e){return i.line-e.line||i.column-e.column}function Mi(i,e){let t={start:i.loc.start,end:i.loc.end},n=r=>Ui(t,r.loc);return de(t.start,t.end)<0&&(t.start={...t.start},e.skipSpaces(t.start),de(t.start,t.end)<0&&(t.end={...t.end},e.skipSpaces(t.end,!0))),i.leadingComments?.forEach(n),i.trailingComments?.forEach(n),t}function Ui(i,e){de(e.start,i.start)<0&&(i.start=e.start),de(i.end,e.end)<0&&(i.end=e.end)}var _i=/\S/u;function ce(i=""){return!_i.test(i)}var Ge={indentWidth:2,wrapColumn:80,quote:null};function st(i){return{indentWidth:i?.indentWidth??Ge.indentWidth,wrapColumn:i?.wrapColumn??Ge.wrapColumn,quote:i?.quote??Ge.quote}}var ji=/^\s*/u,Oi=/\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u,Ke=class i{constructor(e){this.lineRecords=e,this.length=e.length}static fromString(e,t){if(typeof e!="string")return e;let n=t?.indentWidth;return new i(e.split(Oi).map(r=>{let s=ji.exec(r)?.[0]??"";return{line:r,indentation:zi(s,n),locked:!1,sliceStart:s.length,sliceEnd:r.length}}))}toString(){return this.sliceString(this.firstPos(),this.lastPos())}charAt(e){let{line:t,column:n}=e,r=this.lineRecords[t-1];if(typeof r>"u"||n<0)return"";let s=this.getIndentationAt(t);if(n<s)return" ";let a=n+r.sliceStart-s;return a===r.sliceEnd&&t<this.length?`
|
|
13
|
+
`:a>=r.sliceEnd?"":r.line.charAt(a)}getIndentationAt(e){return Math.max(this.lineRecords[e-1].indentation,0)}getLineLength(e){let t=this.lineRecords[e-1];return this.getIndentationAt(e)+t.sliceEnd-t.sliceStart}getStatementLineSeparators(e){let t=this.slice(e,this.skipSpaces({...e})??this.lastPos());return t.length===1||!ce(t.lineRecords[1].line)?[`
|
|
14
|
+
`]:[`
|
|
15
|
+
`,`
|
|
16
|
+
`]}getLeadingCommentSeparators(e){let t=this.slice(e,this.skipSpaces({...e})??this.lastPos());return t.length===1?[" "]:ce(t.lineRecords[1].line)?[`
|
|
17
|
+
`,`
|
|
18
|
+
`]:[`
|
|
19
|
+
`]}nextPos(e,t=!1){let n=Math.max(e.line,0);return Math.max(e.column,0)<this.getLineLength(n)?(e.column+=1,t?!!this.skipSpaces(e):!0):n<this.length?(e.line+=1,e.column=0,t?!!this.skipSpaces(e):!0):!1}prevPos(e,t=!1){let n=e.line,r=e.column;if(r<1){if(n-=1,n<1)return!1;r=this.getLineLength(n)}else r=Math.min(r-1,this.getLineLength(n));return e.line=n,e.column=r,t?!!this.skipSpaces(e,!0):!0}firstPos(){return{line:1,column:0}}lastPos(){return{line:this.length,column:this.getLineLength(this.length)}}skipSpaces(e,t=!1){if(t){for(;this.prevPos(e);)if(!ce(this.charAt(e))&&this.nextPos(e))return e;return null}else{for(;ce(this.charAt(e));)if(!this.nextPos(e))return null;return e}}slice(e,t){if(!t&&!e)return this;if(t??=this.lastPos(),!e)throw new Error("cannot slice with end but not start");let n=this.lineRecords.slice(e.line-1,t.line);return e.line===t.line?n[0]=R(n[0],e.column,t.column):(n[0]=R(n[0],e.column),n.push(R(n.pop()??n[0],0,t.column))),new i(n)}sliceString(e=this.firstPos(),t=this.lastPos()){let n=[];for(let r=e.line;r<=t.line;r++){let s=this.lineRecords[r-1];r===e.line?r===t.line?s=R(s,e.column,t.column):s=R(s,e.column):r===t.line&&(s=R(s,0,t.column));let a="",c=Math.max(s.indentation,0);c>0&&(a+=new Array(c+1).join(" ")),a+=s.line.slice(s.sliceStart,s.sliceEnd),n.push(a)}return n.join(`
|
|
20
|
+
`)}};function zi(i,e=2){let t=0,n=i.length;for(let r=0;r<n;r++)switch(i.charCodeAt(r)){case 9:{let s=Math.ceil(t/e)*e;s===t?t+=e:t=s;break}case 11:case 12:case 13:case 65279:break;default:t+=1;break}return t}function R(i,e,t){let n=i.sliceStart,r=i.sliceEnd,s=Math.max(i.indentation,0),a=s+r-n;return t??=a,e=Math.max(e,0),t=Math.min(t,a),t=Math.max(t,e),t<s?(s=t,r=n):r-=a-t,e<s?s-=e:(e-=s,s=0,n+=e),i.indentation===s&&i.sliceStart===n&&i.sliceEnd===r?i:{line:i.line,indentation:s,sliceStart:n,sliceEnd:r}}function yi(i,e,t){return!i&&!t?"":i?t?`${i}${e}${t}`:i:t}var Vi=/\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u,p=class i{constructor(e=[]){this.lines=e}static fromString(e){return new i(e.split(Vi))}static appendLines(e=[]){let t=new i;return e.forEach(n=>{n!=null&&(typeof n=="string"?t.lines.push(n):t.lines.push(...n.lines))}),t}static joinLines(e=[],t=""){let n=new i;return e.forEach(r=>{if(r==null)return;let s=n.lines.pop()??"";typeof r=="string"?n.lines.push(yi(s,t,r)):(n.lines.push(yi(s,t,r.lines.slice(0)[0])),n.lines.push(...r.lines.slice(1)))}),n}static aggregateLines(e,t,n,r,s){if(n.isEmpty)return e;if(!t||e.isEmpty)return n.indentFirstLine(s);let a=r.start.line-t.end.line;if(a===0)return i.joinLines([e," ",n]);let c=a===1?void 0:"";return i.appendLines([e,c,n.indentFirstLine(s)])}get isEmpty(){return this.lines.length===0||this.lines.length===1&&this.lines[0].length===0}get maxLineLength(){return this.lines.reduce((e,t)=>Math.max(e,t.length),0)}get firstLineLength(){return(this.lines[0]??"").length}get lastLineLength(){return(this.lines[this.lines.length-1]??"").length}surroundWith(e="",t=""){return!e&&!t?this:this.isEmpty?new i([e+t]):this.lines.length===1?new i([e+this.lines[0]+t]):i.joinLines([e,this,t])}indentFirstLine(e=""){return this.isEmpty?this:(this.lines[0]=e+this.lines[0],this)}suffixWith(e){return this.surroundWith("",e)}toString(e=`
|
|
21
|
+
`){return this.lines.join(e)}};function at(i,e){return i*(e.indentWidth??2)}function M(i=0,e){let{indentWidth:t=2}=st(e);return new Array(i*t+1).join(" ")}function le(i){return i.replace(/['"]/gu,e=>e==='"'?"'":'"')}function $i(i,e){switch(i.type){case u.UnaryExpression:return(He(e)||Di(e))&&e.object===i;case u.BinaryExpression:case u.LogicalExpression:switch(e.type){case u.UnaryExpression:return!0;case u.MemberExpression:case u.SafeMemberExpression:return e.object===i;case u.BinaryExpression:case u.LogicalExpression:return G[e.operator]>G[i.operator];default:return!1}case u.Literal:return He(e)&&typeof i.value=="number"&&e.object===i;case u.AssignmentExpression:switch(e.type){case u.UnaryExpression:case u.BinaryExpression:case u.LogicalExpression:case u.ReturnStatement:return!0;case u.MemberExpression:case u.SafeMemberExpression:return e.object===i;default:return!1}case u.MemberAccessChainExpression:switch(e.type){case u.MemberExpression:case u.SafeMemberExpression:return e.object===i;default:return!1}default:return!1}}function C(i,e,t){switch(i?.type){case u.BinaryExpression:case u.LogicalExpression:return Ri(i,e,t);case u.AssignmentExpression:return new Z(i,e,t);case u.MemberExpression:case u.SafeMemberExpression:return new Xe(i,e,t);case u.Identifier:return new J(i,e,t);case u.CallExpression:return new Je(i,e,t);case u.ObjectExpression:return U(i,e,t);case u.ArrayExpression:return U(i,e,t);case u.Literal:return new J(i,e,t);case u.UpdateExpression:case u.UnaryExpression:case u.MemberAccessChainExpression:return new pe(i,e,t);case u.TemplateLiteral:return new Ye(i,e,t);case u.VariableDeclaration:return new X(i,e,t);default:throw new Error(`unknown type: ${JSON.stringify(i)}`)}}function U(i,e,t){let n=new W(i,e,t);switch(i.type){case u.ArrayExpression:return n.setupCollection(i.elements.map(r=>C(r,i,t)),"SquareBrackets"),n;case u.ObjectExpression:return n.setupCollection(i.properties.map(r=>new Ze(r,i,t)),"CurlyBrackets"),n;case u.VariableDeclaration:return n.prefix="var ",n.setupCollection(i.declarations.map(r=>bi(r,i,t)),"None"),n;case u.FunctionDeclaration:return n.prefix=`function ${i.id.name}`,n.setupCollection(i.params.map(r=>C(r,i,t)),"Parentheses"),n;case u.ForStatement:return n.prefix="for ",n.setupCollection([C(i.init,i,t),C(i.test,i,t),C(i.update,i,t)],"Parentheses",";"),n;case u.ForInStatement:case u.ForOfStatement:return n.prefix="for ",n.setupCollection([new Z(i,e,t)],"Parentheses",""),n;case u.IfStatement:return n.prefix="if ",n.setupCollection([C(i.test,i,t)],"Parentheses",""),n;case u.WhileStatement:return n.prefix="while ",n.setupCollection([C(i.test,i,t)],"Parentheses",""),n;default:return n}}function bi(i,e,t){return i.init?new Z(i,e,t):new J(i.id,e,t)}function Ri(i,e,t){let n=[...he(i.left,i.operator),...he(i.right,i.operator)].map(s=>C(s,i,t)),r=new W(i,e,t);return r.setupCollection(n,"None",` ${i.operator}`),r}function he(i,e){return i.type!==u.BinaryExpression&&i.type!==u.LogicalExpression?[i]:i.operator!==e?[i]:[...he(i.left,e),...he(i.right,e)]}var k=class{constructor(e,t,n){this.node=e,this.parent=t,this.options=n,this.prefix="",this.suffix="",this.groupingParentheses=!1,this.groupingParentheses=$i(e,t)}get openingParenthesis(){return this.groupingParentheses?"(":""}get closingParenthesis(){return this.groupingParentheses?")":""}get leadingString(){return[this.prefix,this.openingParenthesis].join("")}get trailingString(){return[this.closingParenthesis,this.suffix].join("")}finalize(e){return typeof e=="string"&&(e=p.fromString(e)),e.surroundWith(this.leadingString,this.trailingString)}},W=class extends k{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="CollectionPrinter",this.bracketsType="None",this.separator=",",this.printers=[]}setupCollection(e=[],t="None",n){return this.bracketsType=t,this.separator=n??this.separator,this.printers=e,this}getOpeningBracket(e=!1,t="singleLine"){if(this.bracketsType==="None")return"";if(this.bracketsType==="CurlyBrackets")return`{${e||t==="multiline"?"":" "}`;switch(this.bracketsType){case"Parentheses":return"(";case"SquareBrackets":return"[";default:return""}}getClosingBracket(e=!1,t="singleLine"){if(this.bracketsType==="None")return"";if(this.bracketsType==="CurlyBrackets")return`${e||t==="multiline"?"":" "}}`;switch(this.bracketsType){case"Parentheses":return")";case"SquareBrackets":return"]";default:return""}}getLinesLevel(e=0){return this.bracketsType!=="None"||fi(this.parent)||qe(this.parent)||(oe(this.node)||ae(this.node))&&(oe(this.parent)||ae(this.parent))?e+1:e}finalize(e,t="singleLine",n=0){if(this.bracketsType==="None")return super.finalize(e);let r=this.getOpeningBracket(e.isEmpty,t),s=this.getClosingBracket(e.isEmpty,t);if(t==="singleLine")return super.finalize(e.surroundWith(r,s));let a=M(n,this.options);return super.finalize(p.appendLines([r,e,a+s]))}singleLineFormat(e=0){let t=this.printers.length-1;return p.joinLines(this.printers.map((n,r)=>n.format("singleLine",e).suffixWith(r<t?this.separator:""))," ")}optimizedPrinterFormat(e,t,n=0){let r=this.getLinesLevel(n),s=M(r,this.options),a=this.bracketsType==="None"&&t===0?"":s,c=t<this.printers.length-1?this.separator:"",l=e.format("singleLine",r).suffixWith(c);return l.maxLineLength+s.length<=this.options.wrapColumn?l.indentFirstLine(a):e.format("multiline",r).suffixWith(c).indentFirstLine(a)}multilineFormat(e=0){return p.appendLines(this.printers.map((t,n)=>this.optimizedPrinterFormat(t,n,e)))}format(e="singleLine",t=0){if(this.printers.length===0){let r=this.getOpeningBracket(!0,e),s=this.getClosingBracket(!0,e);return super.finalize(p.fromString(r+s))}if(e==="singleLine"){let r=this.singleLineFormat(t);return this.finalize(r,e,t)}let n=this.multilineFormat(t);return this.finalize(n,e,t)}},Wi=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/u,J=class extends k{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="StringPrinter"}format(){if(ue(this.node))return this.finalize(this.node.name);if(typeof this.node.value!="string")return this.finalize(this.node.raw);if(Ei(this.parent)&&this.parent.key===this.node&&Re(this.node)&&typeof this.node.value=="string"&&Wi.test(this.node.value))return this.finalize(this.node.value);switch(this.options.quote){case"auto":{let e=JSON.stringify(this.node.value),t=le(JSON.stringify(le(this.node.value)));return this.finalize(e.length>t.length?t:e)}case"single":return this.finalize(le(JSON.stringify(le(this.node.value))));default:return this.finalize(JSON.stringify(this.node.value))}}},pe=class extends k{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="SingleExpressionPrinter";let r=gi(e),s=xi(e);if(r||s){this.prefix=r?e.operator:"",this.suffix=s&&!e.prefix?e.operator:"",this.printer=C(e.argument,e,this.options);return}if(mi(e)){this.printer=C(e.expression,e,this.options);return}this.printer=C(e,t,this.options)}format(e="singleLine",t=0){return this.finalize(this.printer.format(e,t))}},X=class extends k{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="VariableDeclaratorsPrinter",e.declarations.length===1?(this.printer=bi(e.declarations[0],e,this.options),this.printer.prefix="var "):this.printer=U(e,t,this.options)}format(e="singleLine",t=0){return this.finalize(this.printer.format(e,t))}},Je=class extends k{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="CallExpressionPrinter",this.argumentsPrinter=new W(e,t,n),this.argumentsPrinter.setupCollection(e.arguments.map(r=>C(r,e,n)),"Parentheses"),ue(e.callee)?this.argumentsPrinter.prefix=e.callee.name:this.calleePrinter=C(e.callee,t,n)}format(e="singleLine",t=0){if(!this.calleePrinter)return this.finalize(this.argumentsPrinter.format(e,t));let n=this.calleePrinter.format("singleLine",t),r=this.argumentsPrinter.format("singleLine",t);if(e==="singleLine")return this.finalize(p.joinLines([n,r]));let s=at(t,this.options)+this.leadingString.length+n.firstLineLength;return s+1<this.options.wrapColumn?(r=this.argumentsPrinter.format("multiline",t),this.finalize(p.joinLines([n,r]))):(n=this.calleePrinter.format("multiline",t),s=n.lastLineLength,s+r.maxLineLength>this.options.wrapColumn&&(r=this.argumentsPrinter.format("multiline",t+1)),this.finalize(p.joinLines([n,r])))}},Xe=class extends k{constructor(e,t,n){if(super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="MemberExpressionPrinter",this.objectPrinter=C(e.object,e,this.options),e.computed){let r=new W(e.property,e,this.options);r.setupCollection([C(e.property,e,this.options)],"SquareBrackets"),r.prefix=e.type==="SafeMemberExpression"?T:"",this.propertyPrinter=r}else{let r=new pe(e.property,e,this.options);r.prefix=e.type==="SafeMemberExpression"?T:".",this.propertyPrinter=r}}format(e="singleLine",t=0){let n=this.objectPrinter.format("singleLine",t),r=this.propertyPrinter.format("singleLine",t);if(e==="singleLine")return this.finalize(p.joinLines([n,r]));let s=at(t,this.options)+this.leadingString.length+n.firstLineLength;s>this.options.wrapColumn&&(n=this.objectPrinter.format("multiline",t),s=n.lastLineLength);let a=r.firstLineLength+this.trailingString.length;if(s+a<this.options.wrapColumn)return this.finalize(p.joinLines([n,r]));if(this.node.computed)return this.finalize(p.joinLines([n,this.propertyPrinter.format("multiline",t)]));let c=t+1,l=M(c,this.options);return r=this.propertyPrinter.format("singleLine",t),a=l.length+r.lastLineLength+this.trailingString.length,a>this.options.wrapColumn&&(r=this.propertyPrinter.format("multiline",c)),this.finalize(p.appendLines([n,r.indentFirstLine(l)]))}},Ze=class extends k{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="PropertyPrinter",this.key=C(e.key,e,this.options),e.shorthand||(this.key.suffix=":",this.value=C(e.value,e,this.options))}format(e="singleLine",t=0){if(this.node.shorthand||!this.value)return this.finalize(this.key.format(e,t));let n=this.key.format("singleLine",t);if(e==="singleLine"){let a=this.value.format("singleLine",t);return this.finalize(p.joinLines([n,a]," "))}if(K(this.node.value)||K(this.node.value)){let a=this.value.format("multiline",t);return this.finalize(p.joinLines([n,a]," "))}let r=M(t+1,this.options),s=this.value.format("singleLine",t+1).indentFirstLine(r);return s.maxLineLength+this.trailingString.length+1<=this.options.wrapColumn?this.finalize(p.appendLines([n,s])):(s=this.value.format("multiline",t+1).indentFirstLine(r),this.finalize(p.appendLines([n,s])))}},Z=class extends k{constructor(e,t,n){switch(super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="OperationPrinter",this.operator="",this.noNewLineWrapping=!1,e.type){case u.AssignmentExpression:this.leftPrinter=C(e.left,e,this.options),this.operator=` ${e.operator}`,this.rightPrinter=C(e.right,e,this.options),this.noNewLineWrapping=(ue(e.left)||Re(e.left))&&(K(e.right)||We(e.right));return;case u.VariableDeclarator:this.leftPrinter=C(e.id,e,this.options),e.init&&(this.operator=" =",this.rightPrinter=C(e.init,e,this.options)),this.noNewLineWrapping=K(e.init)||We(e.init);return;case u.ForInStatement:case u.ForOfStatement:this.leftPrinter=C(e.left,e,this.options),this.operator=e.type==="ForInStatement"?" in":" of",this.rightPrinter=C(e.right,e,this.options);return;case u.BinaryExpression:case u.LogicalExpression:this.leftPrinter=C(e.left,e,this.options),this.operator=` ${e.operator}`,this.rightPrinter=C(e.right,e,this.options);return}}format(e="singleLine",t=0){if(!this.rightPrinter)return this.finalize(this.leftPrinter.format(e,t));let n=this.leftPrinter.format("singleLine",t).suffixWith(this.operator),r=this.rightPrinter.format("singleLine",t);if(e==="singleLine")return this.finalize(p.joinLines([n,r]," "));let s=at(t,this.options)+this.leadingString.length+n.maxLineLength+1;s>this.options.wrapColumn&&(n=this.leftPrinter.format("multiline",t).suffixWith(this.operator),s=n.lastLineLength+1);let a=r.firstLineLength+this.trailingString.length+1;if(s+a<this.options.wrapColumn)return this.finalize(p.joinLines([n,r]," "));let c=this.rightPrinter.format("multiline",t);return c.firstLineLength+this.trailingString.length+1+s<this.options.wrapColumn||this.noNewLineWrapping?this.finalize(p.joinLines([n,c]," ")):(a>this.options.wrapColumn&&(r=this.rightPrinter.format("multiline",t+1)),r=r.indentFirstLine(M(t+1)),this.finalize(p.appendLines([n,r])))}},Ye=class extends k{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="TemplateLiteralPrinter",this.parts=[];let r=e.expressions.map(s=>C(s,e,this.options));this.parts.push("`"),e.quasis.forEach((s,a)=>{this.parts.push(s.value.raw),a<r.length&&(this.parts.push("${"),this.parts.push(r[a]),this.parts.push("}"))}),this.parts.push("`")}format(e="singleLine",t=0){return this.finalize(p.joinLines(this.parts.map(n=>typeof n=="string"?n:n.format(e,t))))}};function Hi(i){let e={...i.leadingComments?.slice(0,1)[0]?.loc.start??i.loc.start},t={...i.trailingComments?.slice(-1)[0]?.loc.end??i.loc.end};return{start:e,end:t}}function qi(i){return i.trailingComments?.slice(-1)[0]?.type===u.LineComment}var L=class{constructor(e,t,n){this.node=e,this.parent=t,this.options=n,this.indentStatementFirstLine=!0,this.externalOffset=0,this.options=st(this.options)}createStatementPrinter(e){switch(e.type){case u.Program:return new _(e,this.node,this.options);case u.ImportDeclaration:return new rt(e,this.node,this.options);case u.ExpressionStatement:return new it(e,this.node,this.options);case u.FunctionDeclaration:return new De(e,this.node,this.options);case u.ExportNamedDeclaration:return se(e)?new fe(e,this.node,this.options):new De(e,this.node,this.options);case u.BlockStatement:return new _(e,this.node,this.options);case u.ReturnStatement:return new nt(e,this.node,this.options);case u.VariableDeclaration:return new fe(e,this.node,this.options);case u.IfStatement:return new et(e,this.node,this.options);case u.ForStatement:case u.ForInStatement:case u.ForOfStatement:case u.WhileStatement:return new tt(e,this.node,this.options);case u.EmptyStatement:case u.BreakStatement:case u.ContinueStatement:return new Qe(e,this.node,this.options);default:throw new Error(`unknown type: ${JSON.stringify(e)}`)}}getFormattedBody(e,t=0){if(this.cachedBody?.level===t)return this.cachedBody.body;let n=e.format(t);return this.cachedBody={body:n,level:t},n}getStatementIndentation(e=0){return this.indentStatementFirstLine?M(e,this.options):""}getStatementIndentationLength(e=0){return this.indentStatementFirstLine?e*this.options.indentWidth:0}getIndentation(e=0){return M(e,this.options)}addComments(e,t=0){let n=this.getStatementIndentation(t);if(!this.node.leadingComments?.length&&!this.node.trailingComments?.length)return e.indentFirstLine(n);let r=(this.node.leadingComments??[]).reduce((a,c)=>{let l=this.formatComment(c);return{formattedLines:p.aggregateLines(a.formattedLines,a.location,l,c.loc,n),location:c.loc}},{formattedLines:new p}),s=p.aggregateLines(r.formattedLines,r.location,e,this.node.loc,n);return(this.node.trailingComments?.reduce((a,c)=>{let l=this.formatComment(c);return{formattedLines:p.aggregateLines(a.formattedLines,a.location,l,c.loc,n),location:c.loc}},{formattedLines:s,location:this.node.loc})??{formattedLines:s}).formattedLines}formatInnerComments(e=0){if(!v(this.node)||!Array.isArray(this.node.innerComments)||!this.node.innerComments.length)return new p;let t=this.getIndentation(e);return this.node.innerComments.reduce((n,r)=>{let s=this.formatComment(r);return{formattedLines:p.aggregateLines(n.formattedLines,n.location,s,r.loc,t),location:r.loc}},{formattedLines:new p}).formattedLines}formatComment(e){return e.type===u.BlockComment?p.fromString(e.value).surroundWith("/*","*/"):p.fromString(e.value.trimEnd()).surroundWith("//")}canFitSingleLine(e,t=0,n=0){return this.externalOffset+n+this.getStatementIndentationLength(t)+e.lastLineLength<=this.options.wrapColumn}},_=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.printers=[],this.printers=e.body.map(r=>this.createStatementPrinter(r))}format(e=0){if(this.printers.length===0)return this.formatEmptyBlock(e);let t=[],n=v(this.node);n&&t.push("{");let r=n?e+1:e,s;return this.printers.forEach(a=>{if(Ve(a.node))return;let c=Hi(a.node);s&&c.start.line-s.end.line>1&&t.push(""),s=c,t.push(a.format(r))}),n&&t.push(`${this.getIndentation(e)}}`),this.addComments(p.appendLines(t),e)}formatEmptyBlock(e=0){if(!v(this.node))return this.addComments(p.fromString(""),e);let t=this.formatInnerComments(e+1),n="{",r=`${this.getIndentation(e)}}`;return t.isEmpty?re(this.parent)?this.addComments(p.appendLines([n,r]),e):this.addComments(p.fromString("{}"),e):this.addComments(p.appendLines([n,t,r]),e)}},Qe=class extends L{constructor(e,t,n){switch(super(e,t,n),this.node=e,this.keyword="",this.node.type){case u.ContinueStatement:this.keyword="continue;";break;case u.BreakStatement:this.keyword="break;";break;default:this.keyword=";"}}format(e=0){return this.addComments(p.fromString(this.keyword),e)}},fe=class extends L{constructor(e,t,n){if(super(e,t,n),this.node=e,se(e))this.printer=new X(e,t,n);else if(se(e.declaration))this.printer=new X(e.declaration,t,n),this.printer.prefix="export ";else throw new Error(`invalid type: ${JSON.stringify(e)}`)}format(e=0,t="optimized"){if(t==="singleLine"||t==="optimized"){let n=this.printer.format("singleLine",e).suffixWith(";");if(t==="singleLine"||this.canFitSingleLine(n,e))return this.addComments(n,e)}return this.addComments(this.printer.format("multiline",e).suffixWith(";"),e)}},De=class extends L{constructor(e,t,n){if(super(e,t,n),this.node=e,$e(e))this.header=U(e,t,n),this.body=new _(e.body,e,n);else if($e(e.declaration))this.header=U(e.declaration,t,n),this.header.prefix="export ",this.body=new _(e.declaration.body,e,n);else throw new Error(`invalid type: ${JSON.stringify(e)}`)}format(e=0,t="optimized"){this.body.indentStatementFirstLine=!1;let n=this.getFormattedBody(this.body,e);if(t==="singleLine"||t==="optimized"){let s=this.header.format("singleLine",e);if(t==="singleLine"||this.canFitSingleLine(s,e,n.firstLineLength+1))return this.addComments(p.joinLines([s,n]," "),e)}let r=this.header.format("multiline",e);return this.addComments(p.joinLines([r,n]," "),e)}},et=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.header=U(e,t,n),this.consequent=this.createStatementPrinter(e.consequent),this.consequent.indentStatementFirstLine=!1,e.alternate&&(this.alternate=this.createStatementPrinter(e.alternate),this.alternate.indentStatementFirstLine=!1)}format(e=0,t="optimized"){let n=!1,r;if(t==="singleLine"||t==="optimized"){let l=this.header.format("singleLine",e),f=v(this.node.consequent)?2:0;(t==="singleLine"||this.canFitSingleLine(l,e,f))&&(r=l)}r||(n=!0,r=this.header.format("multiline",e));let s;if(v(this.node.consequent)){let l=this.consequent.format(e,"optimized");s=p.joinLines([r," ",l])}else if(n||re(this.node.consequent)){this.consequent.indentStatementFirstLine=!0;let l=this.consequent.format(e+1,"singleLine");this.canFitSingleLine(l,e+1)||(l=this.consequent.format(e+1,"multiline")),s=p.appendLines([r,l])}else{this.consequent.indentStatementFirstLine=!1;let l=this.consequent.format(e,"singleLine");this.canFitSingleLine(l,0,r.lastLineLength+1)?s=p.joinLines([r," ",l]):(this.consequent.indentStatementFirstLine=!0,l=this.consequent.format(e+1,"optimized"),s=p.appendLines([r,l]))}if(!this.alternate)return this.addComments(s,e);let a=qi(this.node.consequent)||!v(this.node.consequent),c;if(this.alternate.externalOffset=0,v(this.node.alternate)||re(this.node.alternate))this.alternate.indentStatementFirstLine=!1,this.alternate.externalOffset=a?5:s.lastLineLength+6,c=this.alternate.format(e,"optimized"),c=p.joinLines(["else ",c]);else{let l=a?4:s.lastLineLength+4;this.alternate.indentStatementFirstLine=!1,c=this.alternate.format(e,"singleLine"),this.canFitSingleLine(c,e,l+1)?c=p.joinLines(["else ",c]):(this.alternate.indentStatementFirstLine=!0,c=this.alternate.format(e+1,"optimized"),c=p.appendLines(["else",c]))}return a?s=p.appendLines([s,c.indentFirstLine(this.getIndentation(e))]):s=p.joinLines([s,c]," "),this.addComments(s,e)}},tt=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.header=U(e,t,n),this.body=this.createStatementPrinter(e.body)}format(e=0,t="optimized"){this.body.indentStatementFirstLine=!1;let n=this.getFormattedBody(this.body,e);if(t==="singleLine"||t==="optimized"){let s=this.header.format("singleLine",e);if(t==="singleLine"||this.canFitSingleLine(s,e,n.firstLineLength+1))return this.addComments(p.joinLines([s,n]," "),e)}let r=this.header.format("multiline",e);return this.addComments(p.joinLines([r,n]," "),e)}},it=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.expression=C(e.expression,e,n)}format(e=0,t="optimized"){if(t==="singleLine"||t==="optimized"){let n=this.expression.format("singleLine",e).suffixWith(";");if(t==="singleLine"||this.canFitSingleLine(n,e))return this.addComments(n,e)}return this.addComments(this.expression.format("multiline",e).suffixWith(";"),e)}},nt=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.argument=C(e.argument,e,n)}format(e=0,t="optimized"){if(t==="singleLine"||t==="optimized"){let a=this.argument.format("singleLine",e).surroundWith("return ",";");if(t==="singleLine"||this.canFitSingleLine(a,e))return this.addComments(a,e)}if(!oe(this.node.argument)&&!ae(this.node.argument)){let a=this.argument.format("multiline",e).surroundWith("return ",";");return this.addComments(a,e)}let n=this.getIndentation(e+1),r=this.argument.format("multiline",e+1).indentFirstLine(n),s=this.getIndentation(e);return this.addComments(p.appendLines(["return (",r,`${s});`]),e)}},rt=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.libraryNamePrinter=C(e.specifiers[0].local,e,n),this.librarySourcePrinter=C(e.source,e,n)}format(e=0){return this.addComments(p.joinLines(["import"," ",this.libraryNamePrinter.format("singleLine",e)," from ",this.librarySourcePrinter.format("singleLine")]).suffixWith(";"),e)}};function cn(i,e){if(!i)return"";let t=st(e),n=Ke.fromString(i,t),r=n.toString(),s=Ci(r,{tolerant:!0,comments:!0}),a=Mi(s,n);return s.loc.start=a.start,s.loc.end=a.end,new _(s,null,t).format().toString()}var Gi=Object.values(m),Ki=Object.values(V);var ln=Ki.map(i=>({label:i,kind:b.Constant})),dn=Gi.map(i=>({label:i,kind:b.Keyword})),hn=[{label:"exportfunction",kind:b.Snippet,detail:"Export Function Statement",insertText:`export function \${1:functionName} ($2) {
|
|
22
|
+
$0
|
|
23
|
+
}`,insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"exportvar",kind:b.Snippet,detail:"Export Variable Statement",insertText:"export var ${0:variableName}\n",insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"for",kind:b.Snippet,detail:"For Loop Statement",insertText:"for (var ${1:i} = 0; ${1:i} < ${2:Count(arr)}; ${1:i}++) {\n $0\n}",insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"forin",kind:b.Snippet,detail:"For-In Loop Statement",insertText:"for (var ${1:i} in ${2:arrayOrObject}) {\n $0\n}",insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"forof",kind:b.Snippet,detail:"For-Of Loop Statement",insertText:"for (var ${1:i} of ${2:arrayOrObject}) {\n $0\n}",insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"function",kind:b.Snippet,detail:"Function Statement",insertText:`function \${1:functionName} ($2) {
|
|
24
|
+
$0
|
|
25
|
+
}`,insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"if",kind:b.Snippet,detail:"If Statement",insertText:`if (\${1:1==1}) {
|
|
26
|
+
$0
|
|
27
|
+
}`,insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"ifelse",kind:b.Snippet,detail:"If-Else Statement",insertText:`if (\${1:1==1}) {
|
|
28
|
+
$0
|
|
29
|
+
} else {
|
|
30
|
+
|
|
31
|
+
}`,insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"else",kind:b.Snippet,detail:"Else Statement",insertText:`else {
|
|
32
|
+
$0
|
|
33
|
+
}`,insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"import",kind:b.Snippet,detail:"Import Statement",insertText:'import ${1:namespace} from "${0:uri}"',insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet},{label:"while",kind:b.Snippet,detail:"While Loop Statement",insertText:`while (\${1:false}) {
|
|
34
|
+
$0
|
|
35
|
+
}`,insertTextMode:B.adjustIndentation,insertTextFormat:S.Snippet}];export{ee as a,b,S as c,B as d,Zi as e,cn as f,Gi as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./EUV7H33D.js";import a from"./STN3LSQR.js";import{j as f}from"./BHSILWSL.js";import{b as y,c as h,d as b}from"./LEFE3FVL.js";import{M as u}from"./PM4JFKBG.js";export default $arcgis.t(([{i:m,n:l},{l:g,o:F,p:w}])=>{var T={allowAllRootBinaryOperators:!1,requiresPredicateRootNode:!1},M={"field-calculation":T,"where-clause":{allowAllRootBinaryOperators:!0,requiresPredicateRootNode:!0,allowGeometryFields:!0}};function I(i){return i&&i in M?M[i]:void 0}var L=i=>{let r=i.variables[0],t=r?.type==="featureSet"?_(r):void 0,{apiVersion:e,bundles:a,hiddenApiItems:o}=i.toEditorProfileDefinition();return{apiVersion:e,bundles:a,variables:t?[t]:[],hiddenApiItems:o?.map(s=>s.toLowerCase())}};function _(i){let{name:r}=i,t=i.getDescription(),{definition:e}=i.toProfileVariableDefinition(),a={label:r,detail:r,insertText:r,insertTextMode:b.asIs,insertTextFormat:h.PlainText,kind:y.Field},o={name:r,description:t,type:"dictionary",properties:[],completion:a};if(!e||!("fields"in e))return o;let[s,n]=g(e.fields,t,{includeAliases:!1,supportGeometryFields:!0});return o.properties=s,a.documentation={kind:"markdown",value:n},o}var v=[{name:"$layer",type:"featureSet",description:"The layer being calculated."}],q={"field-calculation":{id:"field-calculation",variables:v},"where-clause":{id:"where-clause",variables:v}};function E(i){return q[i]??null}function S(i){if(!l(i))return;let r=E(i.id);if(!r)return;let t={variables:[],hiddenApiItems:i.hiddenApiItems?.map(e=>e.toLowerCase())};return r.variables.forEach(e=>{if(i.disabledVariables?.includes(e.name))return;let a=i.definitions[e.name];if(e.type==="featureSet")return m(a)?t.variables.push({...e,type:e.type,definition:a}):void 0;throw Error(`sdkVariable type not supported (yet) type: ${e.type}`)}),t}var A="arcgis-sql-expression",p=class extends w{constructor(){super(A,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=A,this._layerMap=new Map}updateFeatureLayerForModel(r,t){let e=this._getApiKey(r);this._layerMap.set(e,t)}getFeatureLayerForModel(r){let t=this._getApiKey(r);return this._layerMap.get(t)}async setProfileForModel(r,t,e={locale:"en"}){let a=l(t)?I(t.id):void 0;l(t)&&(t=S(t));let o=await f(e.locale,u("./assets/editor-profile/t9n"),"messages.");if(!o)throw new Error(`Failed to load the language bundle for ${e.locale}`);this.disposeForModel(r);let s=this._getApiKey(r),n=new F(t,o,e.locale,a);this._modelToProfileMap.set(s,n);let x=L(n);this.updateApiContextForModel(r,{locale:e.locale,profile:x,...a?{profilePolicy:a}:{}});let c=t?.variables?.find(P=>P.name==="$layer");c&&this.updateFeatureLayerForModel(r,c.definition)}},d=new p,K={setProfileForModel:d.setProfileForModel.bind(d),getApiLibraryForModel:d.getApiLibraryForModel.bind(d)};async function B(){return await import("./J6FJWQ6O.js").then(m=>m.default)}return{a:d,b:B}},a,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a,b,c,d,e,f}from"./
|
|
2
|
+
import{a,b,c,d,e,f}from"./CLPF64WZ.js";import"./LEFE3FVL.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export{b as arcadeAskAiCommandId,a as arcadeQuickFixKind,e as getArcadeDiagnosticService,d as getArcadeWorker,c as setArcadeAskAiBinding,f as setupMode};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./EUV7H33D.js";import a from"./STN3LSQR.js";import{i as v,j as T}from"./BHSILWSL.js";import{b as f,c as p,d as c}from"./LEFE3FVL.js";import{M as m}from"./PM4JFKBG.js";export default $arcgis.t(([{getDeclaredPixelMembers:$},{G:w,f:M,g:F,h:k,i:A,j:P,n:b},{k:I,l:L,m:V,o:C,p:D}])=>{async function K(e){let{apiVersion:i,bundles:t,hiddenApiItems:n}=e.toEditorProfileDefinition(),s=await E(e.dictionaryVariables.filter(w));return{apiVersion:i,bundles:t,variables:s,hiddenApiItems:n?.map(o=>o.toLowerCase())}}async function E(e,i=f.Variable){return await Promise.all(e.map(async t=>{switch(t.type){case"dictionary":return await B(t,i);case"pixel":return await q(t,i);case"voxel":case"feature":return await _(t,i);default:return U(t,i)}}))}function U(e,i){let{name:t,type:n}=e,s=e.getDescription(),o=i===f.Field?I(t,!1):t;return{name:t,description:s,type:n,completion:{label:t,detail:t,insertText:o,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i,documentation:{kind:"markdown",value:s}}}}async function _(e,i){let t=await e.loadSource(),{name:n}=e,s=e.getDescription(),o={label:n,detail:n,insertText:n,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},a={name:n,description:s,type:"dictionary",properties:[],completion:o};if(!t)return a;let[r,l]=L(t.fields,s,{includeAliases:!0});return a.properties=r,o.documentation={kind:"markdown",value:l},a}async function q(e,i){let t=await e.loadSource(),n=e.toProfileVariableDefinition();if(n.type!=="pixel")throw new Error("Incorrect definition passed to pixel variable");let{name:s}=e,o=e.getDescription(),a={label:s,detail:s,insertText:s,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},r={name:s,description:o,type:"dictionary",properties:[],completion:a};if(!t||!n.definition)return r;let l=await $(t),[d,u]=V(l,o);return r.properties=d,a.documentation={kind:"markdown",value:u},r}async function B(e,i){let{name:t,dictionaryVariables:n}=e,s=e.getDescription(),o=n.reduce((a,r)=>{a!==""&&(a+=`
|
|
3
3
|
|
|
4
4
|
`),a+=`**${r.name}**
|
|
5
5
|
${r.type}`;let l=r.getDescription();return l&&(a+=`
|